[Bf-blender-cvs] [ce69ec3] fluid-mantaflow: more UI changes: clean up layout for smoke, fire and liquids

Sebastián Barschkis noreply at git.blender.org
Mon Jul 11 00:04:53 CEST 2016


Commit: ce69ec37cf540dad1c9825e743a110805b52670e
Author: Sebastián Barschkis
Date:   Fri Jul 8 19:47:13 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBce69ec37cf540dad1c9825e743a110805b52670e

more UI changes: clean up layout for smoke, fire and liquids

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/makesdna/DNA_smoke_types.h
M	source/blender/makesrna/intern/rna_smoke.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index d79bd28..e889350 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -40,8 +40,8 @@ class PhysicButtonsPanel:
         return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke)
 
 
-class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
-    bl_label = "Smoke"
+class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
+    bl_label = "Fluid"
 
     def draw(self, context):
         layout = self.layout
@@ -65,19 +65,12 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
             col.prop(domain, "resolution_max", text="Divisions")
             col.label(text="Time:")
             col.prop(domain, "time_scale", text="Scale")
-            col.label(text="Border Collisions:")
-            col.prop(domain, "collision_extents", text="")
 
             col = split.column()
-            col.label(text="Behavior:")
-            col.prop(domain, "alpha")
-            col.prop(domain, "beta", text="Temp. Diff.")
-            col.prop(domain, "vorticity")
-            col.prop(domain, "use_dissolve_smoke", text="Dissolve")
-            sub = col.column()
-            sub.active = domain.use_dissolve_smoke
-            sub.prop(domain, "dissolve_speed", text="Time")
-            sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
+            col.label(text="Border Collisions:")
+            col.prop(domain, "collision_extents", text="")
+            col.label(text="Viewport Display:")
+            col.prop(domain, "viewport_display", text="")
 
         elif md.smoke_type == 'FLOW':
             flow = md.flow_settings
@@ -134,6 +127,34 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
             col = split.column()
             col.prop(coll, "collision_type")
 
+class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
+    bl_label = "Smoke"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        md = context.smoke
+        return md and (md.smoke_type == 'DOMAIN')
+
+    def draw(self, context):
+        layout = self.layout
+        domain = context.smoke.domain_settings
+
+        split = layout.split()
+        split.enabled = not domain.point_cache.is_baked
+
+        col = split.column(align=True)
+        col.label(text="Behavior:")
+        col.prop(domain, "alpha")
+        col.prop(domain, "beta", text="Temp. Diff.")
+        col.prop(domain, "vorticity")
+
+        col = split.column(align=True)
+        col.prop(domain, "use_dissolve_smoke", text="Dissolve")
+        sub = col.column()
+        sub.active = domain.use_dissolve_smoke
+        sub.prop(domain, "dissolve_speed", text="Time")
+        sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
 
 class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
     bl_label = "Smoke Flow Advanced"
@@ -170,7 +191,7 @@ class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
 
 
 class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
-    bl_label = "Smoke Flames"
+    bl_label = "Fire"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
@@ -197,6 +218,31 @@ class PHYSICS_PT_smoke_fire(PhysicButtonsPanel, Panel):
         col.prop(domain, "flame_max_temp")
         col.prop(domain, "flame_smoke_color")
 
+class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel):
+    bl_label = "Liquid"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        md = context.smoke
+        return md and (md.smoke_type == 'DOMAIN')
+
+    def draw(self, context):
+        layout = self.layout
+        domain = context.smoke.domain_settings
+
+        split = layout.split()
+        split.enabled = not domain.point_cache.is_baked
+
+        col = split.column(align=True)
+        col.label(text="Particles:")
+        col.prop(domain, "particle_randomness")
+
+        col = split.column(align=True)
+        col.prop(domain, "use_narrow_band", text="Narrow Band")
+        sub = col.column()
+        sub.active = domain.use_narrow_band
+        sub.prop(domain, "nb_width", text="Width")
 
 class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
     bl_label = "Smoke Adaptive Domain"
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 9fbb7cc..68fb62d 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -42,6 +42,7 @@ enum {
 	MOD_SMOKE_DISSOLVE = (1 << 2),  /* let smoke dissolve */
 	MOD_SMOKE_DISSOLVE_LOG = (1 << 3),  /* using 1/x for dissolve */
 	MOD_SMOKE_USE_MANTA = (1 << 4),
+	MOD_LIQUID_NARROW_BAND = (1 << 5),
 
 #ifdef DNA_DEPRECATED
 	MOD_SMOKE_HIGH_SMOOTH = (1 << 5),  /* -- Deprecated -- */
@@ -66,6 +67,11 @@ enum {
 #define SM_BORDER_VERTICAL	1
 #define SM_BORDER_CLOSED	2
 
+/* viewport preview types */
+#define SM_VIEWPORT_GEOM  	0
+#define SM_VIEWPORT_PREVIEW	1
+#define SM_VIEWPORT_FINAL	2
+
 /* collision types */
 #define SM_COLL_STATIC		0
 #define SM_COLL_RIGID		1
@@ -162,6 +168,8 @@ typedef struct SmokeDomainSettings {
 	struct ListBase ptcaches[2];
 	struct EffectorWeights *effector_weights;
 	int border_collisions;	/* How domain border collisions are handled */
+	int viewport_display;	/* How to display mesh in viewport */
+	char pad2[4];
 	float time_scale;
 	float vorticity;
 	int active_fields;
@@ -172,6 +180,10 @@ typedef struct SmokeDomainSettings {
 	float burning_rate, flame_smoke, flame_vorticity;
 	float flame_ignition, flame_max_temp;
 	float flame_smoke_color[3];
+	
+	/* liquid parameters */
+	float particle_randomness;
+	float nb_width;
 
 	/* mantaflow settings */
 	struct SMOKE *fluid;
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 825e6b3..a7ccf7a 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -463,6 +463,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 		{SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
 		{0, NULL, 0, NULL, NULL}
 	};
+	
+	static EnumPropertyItem smoke_quality_items[] = {
+		{SM_VIEWPORT_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"},
+		{SM_VIEWPORT_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"},
+		{SM_VIEWPORT_FINAL, "FINAL", 0, "Final", "Display final quality results"},
+		{0, NULL, 0, NULL, NULL}
+	};
 
 	static EnumPropertyItem cache_file_type_items[] = {
 		{PTCACHE_FILE_PTCACHE, "POINTCACHE", 0, "Point Cache", "Blender specific point cache file format"},
@@ -615,6 +622,11 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Border Collisions",
 	                         "Select which domain border will be treated as collision object");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+	
+	prop = RNA_def_property(srna, "viewport_display", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "viewport_display");
+	RNA_def_property_enum_items(prop, smoke_quality_items);
+	RNA_def_property_ui_text(prop, "Viewport Display Mode", "How to display the mesh in the viewport");
 
 	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EffectorWeights");
@@ -779,6 +791,23 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Time", "Animation time of noise");
+	
+	prop = RNA_def_property(srna, "particle_randomness", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Randomness", "Randomness factor for particle sampling");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+	
+	prop = RNA_def_property(srna, "nb_width", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 1.0, 10.0);
+	RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
+	RNA_def_property_ui_text(prop, "Width", "Narrow band width in cells");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+	
+	prop = RNA_def_property(srna, "use_narrow_band", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_LIQUID_NARROW_BAND);
+	RNA_def_property_ui_text(prop, "Use Narrow Band", "Enable narrow band for liquids");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 }
 
 static void rna_def_smoke_flow_settings(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list