diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-04 20:44:23 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-04 20:46:48 +0300 |
commit | a5c4a44df67ed69844a433179629d861cf10f438 (patch) | |
tree | edcf5c0ac33cc684a3798b8eca62a013aad48fb3 /source/blender/makesrna | |
parent | 3c74d45c9e90b72184c2af810684dcf21bf72713 (diff) |
Fluid: Bounding boxes for effector objects
This commit adds bounding box support for emission objects - similarly to flow objects. Before, each effector object had to iterate over the entire domain. Bake times of scenes with multiple obstacles improved significantly with this optimization.
Other improvements that were implemented alongside the bbox feature:
- Option for subframe sampling for effector objects
- Option to enable / disable effectors (can be animated)
- Optimization for static objects. If a flow or effector object does not move and the adaptive domain is not in use, the bake time will be optimized further by reusing the flow / effector grids from the previous frame (no recalculation).
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_fluid.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 7edb1cfaa81..7b6ca8b2273 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -2243,7 +2243,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static const EnumPropertyItem flow_types[] = { + static const EnumPropertyItem flow_type_items[] = { {FLUID_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"}, {FLUID_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"}, {FLUID_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"}, @@ -2251,7 +2251,7 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static EnumPropertyItem flow_behaviors[] = { + static EnumPropertyItem flow_behavior_items[] = { {FLUID_FLOW_BEHAVIOR_INFLOW, "INFLOW", 0, "Inflow", "Add fluid to simulation"}, {FLUID_FLOW_BEHAVIOR_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete fluid from simulation"}, {FLUID_FLOW_BEHAVIOR_GEOMETRY, @@ -2318,14 +2318,14 @@ static void rna_def_fluid_flow_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "flow_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, flow_types); + RNA_def_property_enum_items(prop, flow_type_items); RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_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_Fluid_reset"); prop = RNA_def_property(srna, "flow_behavior", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "behavior"); - RNA_def_property_enum_items(prop, flow_behaviors); + RNA_def_property_enum_items(prop, flow_behavior_items); RNA_def_property_ui_text(prop, "Flow Behavior", "Change flow behavior in the simulation"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); @@ -2535,7 +2535,7 @@ static void rna_def_fluid_effector_settings(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_FLOW_USE_PLANE_INIT); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_EFFECTOR_USE_PLANE_INIT); RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); @@ -2555,6 +2555,20 @@ static void rna_def_fluid_effector_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, fluid_guide_mode_items); RNA_def_property_ui_text(prop, "Guiding mode", "How to create guiding velocities"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update"); + + prop = RNA_def_property(srna, "use_effector", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_EFFECTOR_USE_EFFEC); + RNA_def_property_ui_text(prop, "Enabled", "Control when to apply the effector"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); + + prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 200); + RNA_def_property_ui_range(prop, 0, 10, 1, -1); + RNA_def_property_ui_text(prop, + "Subframes", + "Number of additional samples to take between frames to improve " + "quality of fast moving effector objects"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); } void RNA_def_fluid(BlenderRNA *brna) |