Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSriharsha Kotcharlakot <k.venkatsriharsha@gmail.com>2020-09-15 18:51:14 +0300
committerSriharsha Kotcharlakot <k.venkatsriharsha@gmail.com>2020-09-15 20:43:01 +0300
commitf137022f9919f4dd315ec6b325a08e1bf5aec6fb (patch)
tree4b15aa230eb100e77b41dfffb8ef5e7501c55db5 /release/scripts/startup
parentbedbd8655ed1d331aeaf756874c46dbed93168a1 (diff)
Liquid Simulation Display Options (GSoC 2020)
All the changes made in the branch `soc-2020-fluid-tools` are included in this patch. **Major changes:** === Viewport Display === - //Raw voxel display// or //closest (nearest-neighbor)// interpolation for displaying the underlying voxel data of the simulation grids more clearly. - An option to display //gridlines// when the slicing method is //single//. ==== Grid Display ==== - Visualization for flags, pressure and level-set representation grids with a fixed color coding based on Manta GUI. ==== Vector Display ==== - //**M**arker **A**nd **C**ell// grid visualization options for vector grids like velocity or external forces. - Made vector display options available for external forces. ==== Coloring options for //gridlines// ==== - Range highlighting and cell filtering options for displaying the simulation grid data more precisely. - Color gridlines with flags. - Also, made slicing and interpolation options available for Volume Object. Reviewed By: JacquesLucke, sebbas Differential Revision: https://developer.blender.org/D8705
Diffstat (limited to 'release/scripts/startup')
-rw-r--r--release/scripts/startup/bl_operators/object_quick_effects.py11
-rw-r--r--release/scripts/startup/bl_ui/properties_data_volume.py12
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_fluid.py84
3 files changed, 88 insertions, 19 deletions
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index 46127f34bcd..5b9764eabfb 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -523,6 +523,17 @@ class QuickLiquid(Operator):
# change domain type, will also allocate and show particle system for FLIP
obj.modifiers[-1].domain_settings.domain_type = 'LIQUID'
+ liquid_domain = obj.modifiers[-2]
+
+ # set color mapping field to show phi grid for liquid
+ liquid_domain.domain_settings.color_ramp_field = 'PHI'
+
+ # set slicing method to single
+ liquid_domain.domain_settings.axis_slice_method = 'SINGLE'
+
+ # set display thickness to a lower value for more detailed display of phi grids
+ liquid_domain.domain_settings.display_thickness = 0.02
+
# make the domain smooth so it renders nicely
bpy.ops.object.shade_smooth()
diff --git a/release/scripts/startup/bl_ui/properties_data_volume.py b/release/scripts/startup/bl_ui/properties_data_volume.py
index b10bb808edd..cb8c90c0ede 100644
--- a/release/scripts/startup/bl_ui/properties_data_volume.py
+++ b/release/scripts/startup/bl_ui/properties_data_volume.py
@@ -142,6 +142,9 @@ class DATA_PT_volume_viewport_display(DataButtonsPanel, Panel):
volume = context.volume
display = volume.display
+ axis_slice_method = display.axis_slice_method
+
+ do_full_slicing = (axis_slice_method == 'FULL')
col = layout.column(align=True)
col.prop(display, "wireframe_type")
@@ -149,7 +152,14 @@ class DATA_PT_volume_viewport_display(DataButtonsPanel, Panel):
sub.active = display.wireframe_type in {'BOXES', 'POINTS'}
sub.prop(display, "wireframe_detail", text="Detail")
- layout.prop(display, "density")
+ col = layout.column(align=True)
+ col.prop(display, "density")
+ col.prop(display, "interpolation_method")
+ col.prop(display, "axis_slice_method")
+
+ if not do_full_slicing:
+ col.prop(display, "slice_axis")
+ col.prop(display, "slice_depth")
class DATA_PT_custom_props_volume(DataButtonsPanel, PropertyPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index f959d10a809..a8185a3e66f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -1290,7 +1290,7 @@ class PHYSICS_PT_viewport_display(PhysicButtonsPanel, Panel):
@classmethod
def poll(cls, context):
- return (PhysicButtonsPanel.poll_gas_domain(context))
+ return (PhysicButtonsPanel.poll_fluid_domain(context))
def draw(self, context):
layout = self.layout
@@ -1298,41 +1298,40 @@ class PHYSICS_PT_viewport_display(PhysicButtonsPanel, Panel):
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
domain = context.fluid.domain_settings
- slice_method = domain.slice_method
axis_slice_method = domain.axis_slice_method
- do_axis_slicing = (slice_method == 'AXIS_ALIGNED')
do_full_slicing = (axis_slice_method == 'FULL')
col = flow.column(align=False)
col.prop(domain, "display_thickness")
- col.prop(domain, "display_interpolation")
- col.separator()
- col = flow.column()
- col.prop(domain, "slice_method", text="Slicing")
+ sub = col.column()
+ sub.prop(domain, "display_interpolation")
+
+ if domain.use_color_ramp and domain.color_ramp_field == 'FLAGS':
+ sub.enabled = False
- col = col.column()
- col.active = do_axis_slicing
col.prop(domain, "axis_slice_method")
- if not do_full_slicing and do_axis_slicing:
+ if not do_full_slicing:
col.prop(domain, "slice_axis")
col.prop(domain, "slice_depth")
+ if domain.display_interpolation == 'CLOSEST' or domain.color_ramp_field == 'FLAGS':
+ col.prop(domain, "show_gridlines")
col = col.column()
- col.active = do_full_slicing or not do_axis_slicing
+ col.active = do_full_slicing
col.prop(domain, "slice_per_voxel")
class PHYSICS_PT_viewport_display_color(PhysicButtonsPanel, Panel):
- bl_label = "Color Mapping"
+ bl_label = "Grid Display"
bl_parent_id = 'PHYSICS_PT_viewport_display'
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
- return (PhysicButtonsPanel.poll_gas_domain(context))
+ return (PhysicButtonsPanel.poll_fluid_domain(context))
def draw_header(self, context):
md = context.fluid.domain_settings
@@ -1346,22 +1345,26 @@ class PHYSICS_PT_viewport_display_color(PhysicButtonsPanel, Panel):
domain = context.fluid.domain_settings
col = layout.column()
col.active = domain.use_color_ramp
- col.prop(domain, "coba_field")
+ col.prop(domain, "color_ramp_field")
+
+ if not domain.color_ramp_field == 'FLAGS':
+ col.prop(domain, "color_ramp_field_scale")
col.use_property_split = False
- col = col.column()
- col.template_color_ramp(domain, "color_ramp", expand=True)
+ if domain.color_ramp_field[:3] != 'PHI' and domain.color_ramp_field not in {'FLAGS', 'PRESSURE'}:
+ col = col.column()
+ col.template_color_ramp(domain, "color_ramp", expand=True)
class PHYSICS_PT_viewport_display_debug(PhysicButtonsPanel, Panel):
- bl_label = "Debug Velocity"
+ bl_label = "Vector Display"
bl_parent_id = 'PHYSICS_PT_viewport_display'
bl_options = {'DEFAULT_CLOSED'}
@classmethod
def poll(cls, context):
- return (PhysicButtonsPanel.poll_gas_domain(context))
+ return (PhysicButtonsPanel.poll_fluid_domain(context))
def draw_header(self, context):
md = context.fluid.domain_settings
@@ -1378,8 +1381,52 @@ class PHYSICS_PT_viewport_display_debug(PhysicButtonsPanel, Panel):
col = flow.column()
col.active = domain.show_velocity
col.prop(domain, "vector_display_type", text="Display As")
+
+ if not domain.use_guide and domain.vector_field == 'GUIDE_VELOCITY':
+ note = layout.split()
+ note.label(icon='INFO', text="Enable Guides first! Defaulting to Fluid Velocity.")
+
+ if domain.vector_display_type == 'MAC':
+ sub = col.column(heading="MAC Grid")
+ sub.prop(domain, "vector_show_mac_x")
+ sub.prop(domain, "vector_show_mac_y")
+ sub.prop(domain, "vector_show_mac_z")
+ else:
+ col.prop(domain, "vector_scale_with_magnitude")
+
+ col.prop(domain, "vector_field")
col.prop(domain, "vector_scale")
+class PHYSICS_PT_viewport_display_advanced(PhysicButtonsPanel, Panel):
+ bl_label = "Advanced"
+ bl_parent_id = 'PHYSICS_PT_viewport_display'
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return PhysicButtonsPanel.poll_fluid_domain(context) and context.fluid.domain_settings.show_gridlines
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ domain = context.fluid.domain_settings
+
+ col = layout.column()
+ col.prop(domain, "gridlines_color_field", text="Color Gridlines")
+
+ if domain.gridlines_color_field == 'RANGE':
+ if domain.use_color_ramp and domain.color_ramp_field != 'FLAGS':
+ col.prop(domain, "gridlines_lower_bound")
+ col.prop(domain, "gridlines_upper_bound")
+ col.prop(domain, "gridlines_range_color")
+ col.prop(domain, "gridlines_cell_filter")
+ else:
+ note = layout.split()
+ if not domain.use_color_ramp:
+ note.label(icon='INFO', text="Enable Grid Display to use range highlighting!")
+ else:
+ note.label(icon='INFO', text="Range highlighting for flags is not available!")
classes = (
FLUID_PT_presets,
@@ -1406,6 +1453,7 @@ classes = (
PHYSICS_PT_viewport_display,
PHYSICS_PT_viewport_display_color,
PHYSICS_PT_viewport_display_debug,
+ PHYSICS_PT_viewport_display_advanced,
)