[Bf-blender-cvs] [613cc715fa0] fluid-mantaflow: flow source UI updates
Sebastián Barschkis
noreply at git.blender.org
Sun Sep 3 02:24:22 CEST 2017
Commit: 613cc715fa02eb8450481c00b21468acf8ea512d
Author: Sebastián Barschkis
Date: Sat Sep 2 22:59:33 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB613cc715fa02eb8450481c00b21468acf8ea512d
flow source UI updates
===================================================================
M release/scripts/startup/bl_ui/properties_physics_smoke.py
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 6bb8ccc48e1..79344171d84 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -171,7 +171,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
col = split.column()
- if flow.smoke_flow_behavior in {'INFLOW', 'GEOMETRY'}:
+ if flow.smoke_flow_behavior in {'INFLOW'}:
col.prop(flow, "use_inflow")
if flow.smoke_flow_type in {'SMOKE', 'BOTH', 'FIRE'}:
col.prop(flow, "use_absolute")
@@ -191,7 +191,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
col.prop(effec, "surface_distance")
-class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
+class PHYSICS_PT_smoke_flow_source(PhysicButtonsPanel, Panel):
bl_label = "Fluid Source"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER'}
@@ -209,45 +209,63 @@ class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
split = layout.split()
col = split.column()
- col.label(text="Flow Source:")
+ col.label(text="Flow source:")
col.prop(flow, "smoke_flow_source", expand=False, text="")
if flow.smoke_flow_source == 'MESH':
col.prop(flow, "surface_distance")
- col.prop(flow, "volume_density")
+ if flow.smoke_flow_type in {'SMOKE', 'BOTH', 'FIRE'}:
+ col.prop(flow, "volume_density")
+ if flow.smoke_flow_source == 'PARTICLES':
+ col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
+ col.prop(flow, "use_particle_size", text="Set Size")
+ sub = col.column()
+ sub.active = flow.use_particle_size
+ sub.prop(flow, "particle_size")
- sub = col.column(align=True)
- sub.prop(flow, "use_initial_velocity")
+ col = split.column()
+ col.label(text="Flow velocity:")
+ col.prop(flow, "use_initial_velocity")
- sub = sub.column()
+ sub = col.column()
sub.active = flow.use_initial_velocity
sub.prop(flow, "velocity_factor")
if flow.smoke_flow_source == 'MESH':
sub.prop(flow, "velocity_normal")
#sub.prop(flow, "velocity_random")
+class PHYSICS_PT_smoke_flow_advanced(PhysicButtonsPanel, Panel):
+ bl_label = "Fluid Flow Advanced"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.smoke
+ return md and (md.smoke_type == 'FLOW') and (md.flow_settings.smoke_flow_type in {'SMOKE', 'BOTH', 'FIRE'}) and (md.flow_settings.smoke_flow_source in {'MESH'})
+
+ def draw(self, context):
+ layout = self.layout
+ ob = context.object
+ flow = context.smoke.flow_settings
+
+ split = layout.split()
+
col = split.column()
- if flow.smoke_flow_source == 'PARTICLES':
- col.label(text="Particle System:")
- col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
- col.prop(flow, "use_particle_size", text="Set Size")
- sub = col.column()
- sub.active = flow.use_particle_size
- sub.prop(flow, "particle_size")
- else:
- col.label(text="Vertex Group:")
- col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
-
- col.prop(flow, "use_texture")
- sub = col.column()
- sub.active = flow.use_texture
- sub.prop(flow, "noise_texture", text="")
- sub.label(text="Mapping:")
- sub.prop(flow, "texture_map_type", expand=False, text="")
- if flow.texture_map_type == 'UV':
- sub.prop_search(flow, "uv_layer", ob.data, "uv_textures", text="")
- if flow.texture_map_type == 'AUTO':
- sub.prop(flow, "texture_size")
- sub.prop(flow, "texture_offset")
+ col.prop(flow, "use_texture")
+ sub = col.column()
+ sub.active = flow.use_texture
+ sub.prop(flow, "noise_texture", text="")
+ sub.label(text="Mapping:")
+ sub.prop(flow, "texture_map_type", expand=False, text="")
+ if flow.texture_map_type == 'UV':
+ sub.prop_search(flow, "uv_layer", ob.data, "uv_textures", text="")
+ if flow.texture_map_type == 'AUTO':
+ sub.prop(flow, "texture_size")
+ sub.prop(flow, "texture_offset")
+
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
class PHYSICS_PT_smoke_adaptive_domain(PhysicButtonsPanel, Panel):
bl_label = "Smoke Adaptive Domain"
@@ -596,6 +614,7 @@ class PHYSICS_PT_smoke_display_settings(PhysicButtonsPanel, Panel):
classes = (
PHYSICS_PT_smoke,
+ PHYSICS_PT_smoke_flow_source,
PHYSICS_PT_smoke_flow_advanced,
PHYSICS_PT_smoke_adaptive_domain,
PHYSICS_PT_smoke_quality,
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 6a1c713f15e..188815a410a 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -769,6 +769,60 @@ static void rna_Smoke_use_color_ramp_set(PointerRNA *ptr, int value)
}
}
+static void rna_Smoke_flowsource_set(struct PointerRNA *ptr, int value)
+{
+ SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
+
+ if (value != settings->source) {
+ settings->source = value;
+ }
+}
+
+static EnumPropertyItem *rna_Smoke_flowsource_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+{
+ SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
+
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+
+ tmp.value = MOD_SMOKE_FLOW_SOURCE_MESH;
+ tmp.identifier = "MESH";
+ tmp.icon = ICON_META_CUBE;
+ tmp.name = "Mesh";
+ tmp.description = "Emit fluid from mesh surface or volume";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ if (settings->type != MOD_SMOKE_FLOW_TYPE_LIQUID)
+ {
+ tmp.value = MOD_SMOKE_FLOW_SOURCE_PARTICLES;
+ tmp.identifier = "PARTICLES";
+ tmp.icon = ICON_PARTICLES;
+ tmp.name = "Particle System";
+ tmp.description = "Emit smoke from particles";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
+static void rna_Smoke_flowtype_set(struct PointerRNA *ptr, int value)
+{
+ SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
+
+ if (value != settings->type) {
+ settings->type = value;
+
+ /* Force flow source to mesh */
+ if (value == MOD_SMOKE_FLOW_TYPE_LIQUID) {
+ rna_Smoke_flowsource_set(ptr, MOD_SMOKE_FLOW_SOURCE_MESH);
+ }
+ }
+}
+
#else
static void rna_def_smoke_domain_settings(BlenderRNA *brna)
@@ -1457,9 +1511,9 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ /* Flow source - generated dynamically based on flow type */
static EnumPropertyItem smoke_flow_sources[] = {
- {MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"},
- {MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"},
+ {0, "NONE", 0, "", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -1510,6 +1564,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, smoke_flow_types);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_flowtype_set", NULL);
RNA_def_property_ui_text(prop, "Flow Type", "Change type of fluid in the simulation");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
@@ -1522,7 +1577,8 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "source");
RNA_def_property_enum_items(prop, smoke_flow_sources);
- RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_flowsource_set", "rna_Smoke_flowsource_itemf");
+ RNA_def_property_ui_text(prop, "Source", "Change how fluid is emitted");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
@@ -1565,7 +1621,7 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
+ RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit fluid");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
More information about the Bf-blender-cvs
mailing list