diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_physics_fluid.py')
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_fluid.py | 189 |
1 files changed, 144 insertions, 45 deletions
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 427f8c2c85f..3afe7a47028 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -196,18 +196,32 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel): col = flow.column() if PhysicButtonsPanel.poll_gas_domain(context): col.prop(domain, "clipping", text="Empty Space") - col.prop(domain, "delete_in_obstacle", text="Delete In Obstacle") + col.prop(domain, "delete_in_obstacle", text="Delete in Obstacle") if domain.cache_type == 'MODULAR': col.separator() + label = "" # Deactivate bake operator if guides are enabled but not baked yet. note_flag = True - if self.check_domain_has_unbaked_guide(domain) and domain.cache_type == 'MODULAR': - note = layout.split() + if self.check_domain_has_unbaked_guide(domain): note_flag = False + label = "Unbaked Guides: Bake Guides or disable them" + elif not domain.cache_resumable and not label: + label = "Non Resumable Cache: Baking " + if PhysicButtonsPanel.poll_liquid_domain(context): + label += "mesh or particles will not be possible" + elif PhysicButtonsPanel.poll_gas_domain(context): + label += "noise will not be possible" + else: + label = "" + + if label: + info = layout.split() + note = info.row() note.enabled = note_flag - note.label(icon='INFO', text="Unbaked Guides: Bake Guides or disable them") + note.alignment = 'RIGHT' + note.label(icon='INFO', text=label) split = layout.split() split.enabled = note_flag and ob.mode == 'OBJECT' @@ -472,7 +486,8 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel): col = flow.column() col.prop(domain, "simulation_method", expand=False) - col.prop(domain, "flip_ratio", text="FLIP Ratio") + if domain.simulation_method == 'FLIP': + col.prop(domain, "flip_ratio", text="FLIP Ratio") col.prop(domain, "sys_particle_maximum", text="System Maximum") col = col.column(align=True) col.prop(domain, "particle_radius", text="Particle Radius") @@ -493,7 +508,8 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel): col.prop(domain, "use_fractions", text="Fractional Obstacles") sub = col.column() sub.active = domain.use_fractions - sub.prop(domain, "fractions_threshold", text="Obstacle-Fluid Threshold") + sub.prop(domain, "fractions_distance", text="Obstacle Distance") + sub.prop(domain, "fractions_threshold", text="Threshold") class PHYSICS_PT_flow_source(PhysicButtonsPanel, Panel): @@ -731,17 +747,19 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True - if domain.use_noise and domain.cache_type == 'MODULAR': + if domain.use_noise: label = "" - if not domain.has_cache_baked_data: - label = "Unbaked Data: Bake Data first" if not domain.cache_resumable: label = "Non Resumable Cache: Enable resumable option first" + elif not domain.has_cache_baked_data: + label = "Unbaked Data: Bake Data first" if label: - note = layout.split() + info = layout.split() + note = info.row() note_flag = False note.enabled = note_flag + note.alignment = 'RIGHT' note.label(icon='INFO', text=label) split = layout.split() @@ -824,17 +842,19 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True - if domain.use_mesh and domain.cache_type == 'MODULAR': + if domain.use_mesh: label = "" - if not domain.has_cache_baked_data: - label = "Unbaked Data: Bake Data first" if not domain.cache_resumable: label = "Non Resumable Cache: Enable resumable option first" + elif not domain.has_cache_baked_data: + label = "Unbaked Data: Bake Data first" if label: - note = layout.split() + info = layout.split() + note = info.row() note_flag = False note.enabled = note_flag + note.alignment = 'RIGHT' note.label(icon='INFO', text=label) split = layout.split() @@ -945,17 +965,19 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel): # Deactivate bake operator if data has not been baked yet. note_flag = True - if using_particles and domain.cache_type == 'MODULAR': + if using_particles: label = "" - if not domain.has_cache_baked_data: - label = "Unbaked Data: Bake Data first" if not domain.cache_resumable: label = "Non Resumable Cache: Enable resumable option first" + elif not domain.has_cache_baked_data: + label = "Unbaked Data: Bake Data first" if label: - note = layout.split() + info = layout.split() + note = info.row() note_flag = False note.enabled = note_flag + note.alignment = 'RIGHT' note.label(icon='INFO', text=label) split = layout.split() @@ -1184,7 +1206,6 @@ class PHYSICS_PT_cache(PhysicButtonsPanel, Panel): row.prop(domain, "cache_mesh_format", text="Meshes") if domain.cache_type == 'ALL': - col.separator() split = layout.split() split.enabled = ob.mode == 'OBJECT' @@ -1213,7 +1234,10 @@ class PHYSICS_PT_export(PhysicButtonsPanel, Panel): @classmethod def poll(cls, context): domain = context.fluid.domain_settings - if not PhysicButtonsPanel.poll_fluid_domain(context) or (domain.cache_data_format != 'OPENVDB' and bpy.app.debug_value != 3001): + if ( + not PhysicButtonsPanel.poll_fluid_domain(context) or + (domain.cache_data_format != 'OPENVDB' and bpy.app.debug_value != 3001) + ): return False return (context.engine in cls.COMPAT_ENGINES) @@ -1271,7 +1295,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 @@ -1279,41 +1303,61 @@ 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") - - col = col.column() - col.active = do_axis_slicing - col.prop(domain, "axis_slice_method") + sub = col.column() + sub.prop(domain, "display_interpolation") - if not do_full_slicing and do_axis_slicing: - col.prop(domain, "slice_axis") - col.prop(domain, "slice_depth") + if domain.use_color_ramp and domain.color_ramp_field == 'FLAGS': + sub.enabled = False col = col.column() - col.active = do_full_slicing or not do_axis_slicing + col.active = not domain.use_slice col.prop(domain, "slice_per_voxel") +class PHYSICS_PT_viewport_display_slicing(PhysicButtonsPanel, Panel): + bl_label = "Slice" + bl_parent_id = 'PHYSICS_PT_viewport_display' + bl_options = {'DEFAULT_CLOSED'} + + @classmethod + def poll(cls, context): + return (PhysicButtonsPanel.poll_fluid_domain(context)) + + def draw_header(self, context): + md = context.fluid.domain_settings + + self.layout.prop(md, "use_slice", text="") + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + domain = context.fluid.domain_settings + + layout.active = domain.use_slice + + col = layout.column() + col.prop(domain, "slice_axis") + col.prop(domain, "slice_depth") + + sub = col.column() + sub.prop(domain, "show_gridlines") + + sub.active = domain.display_interpolation == 'CLOSEST' or domain.color_ramp_field == 'FLAGS' + + 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 @@ -1327,22 +1371,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 @@ -1359,9 +1407,58 @@ 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): + domain = context.fluid.domain_settings + return PhysicButtonsPanel.poll_fluid_domain(context) and domain.use_slice and domain.show_gridlines + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + + domain = context.fluid.domain_settings + + layout.active = domain.display_interpolation == 'CLOSEST' or domain.color_ramp_field == 'FLAGS' + + 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, PHYSICS_PT_fluid, @@ -1385,8 +1482,10 @@ classes = ( PHYSICS_PT_flow_initial_velocity, PHYSICS_PT_flow_texture, PHYSICS_PT_viewport_display, + PHYSICS_PT_viewport_display_slicing, PHYSICS_PT_viewport_display_color, PHYSICS_PT_viewport_display_debug, + PHYSICS_PT_viewport_display_advanced, ) |