[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34457] trunk/blender: "Fix" for [#25766] Fluid Particle Bugs

Janne Karhu jhkarh at gmail.com
Sat Jan 22 21:38:28 CET 2011


Revision: 34457
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34457
Author:   jhk
Date:     2011-01-22 20:38:27 +0000 (Sat, 22 Jan 2011)
Log Message:
-----------
"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.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_particle.py
    trunk/blender/source/blender/makesrna/intern/rna_particle.c

Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py	2011-01-22 18:15:42 UTC (rev 34456)
+++ trunk/blender/release/scripts/ui/properties_particle.py	2011-01-22 20:38:27 UTC (rev 34457)
@@ -41,7 +41,7 @@
         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 @@
             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 @@
             #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 @@
 
     @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 @@
             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 @@
     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 @@
     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

Modified: trunk/blender/source/blender/makesrna/intern/rna_particle.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_particle.c	2011-01-22 18:15:42 UTC (rev 34456)
+++ trunk/blender/source/blender/makesrna/intern/rna_particle.c	2011-01-22 20:38:27 UTC (rev 34457)
@@ -423,6 +423,14 @@
 	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 @@
 	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);




More information about the Bf-blender-cvs mailing list