"Fix" for [#25766] Fluid Particle Bugs

* Argh, particles tab was showing the whole "non applicable settings for fluid particles"-galore as the particle type "fluid" can't be checked from rna using the settings type value. Now the ui is a lot cleaner and only settings that actually effect the fluid particles are shown.
This commit is contained in:
Janne Karhu 2011-01-22 20:38:27 +00:00
parent 29bee35112
commit f4598728c4
2 changed files with 32 additions and 7 deletions

@ -41,7 +41,7 @@ def particle_panel_poll(cls, context):
return False
if psys.settings is None:
return False
return psys.settings.type in ('EMITTER', 'REACTOR', 'HAIR') and (engine in cls.COMPAT_ENGINES)
return psys.settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
class ParticleButtonsPanel():
@ -95,13 +95,13 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
split = layout.split(percentage=0.32)
col = split.column()
col.label(text="Name:")
if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
if part.is_fluid == False:
col.label(text="Settings:")
col.label(text="Type:")
col = split.column()
col.prop(psys, "name", text="")
if part.type in ('EMITTER', 'REACTOR', 'HAIR'):
if part.is_fluid == False:
row = col.row()
row.enabled = particle_panel_enabled(context, psys)
row.template_ID(psys, "settings", new="particle.new")
@ -111,8 +111,8 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
#row.label(text="Render")
if part:
if part.type not in ('EMITTER', 'REACTOR', 'HAIR'):
layout.label(text="No settings for fluid particles")
if part.is_fluid:
layout.label(text=str(part.count) + " fluid particles for this frame.")
return
row = col.row()
@ -150,10 +150,11 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
@classmethod
def poll(cls, context):
if context.particle_system.settings.is_fluid:
return False
if particle_panel_poll(PARTICLE_PT_emission, context):
return not context.particle_system.point_cache.use_external
else:
return False
return False
def draw(self, context):
layout = self.layout
@ -273,6 +274,8 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
return False
if psys.settings is None:
return False
if psys.settings.is_fluid:
return False
phystype = psys.settings.physics_type
if phystype == 'NO' or phystype == 'KEYED':
return False
@ -1011,6 +1014,10 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Field Weights"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
return particle_panel_poll(cls, context)
def draw(self, context):
part = context.particle_system.settings
@ -1052,6 +1059,10 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
bl_label = "Vertexgroups"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@classmethod
def poll(cls, context):
return particle_panel_poll(cls, context)
def draw(self, context):
layout = self.layout

@ -423,6 +423,14 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
return settings->draw_line[1];
}
static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
{
ParticleSettings *part= (ParticleSettings*)ptr->data;
return part->type == PART_FLUID;
}
static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
{
ParticleSystem *psys= (ParticleSystem*)ptr->data;
@ -1199,6 +1207,12 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
/* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
/* flag */
prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);