UI: Clarify Liquid Diffusion/Viscosity Properties #116118

Merged
Aaron Carlisle merged 2 commits from tmp-ui-fluid-diffusion into main 2024-01-12 16:55:14 +01:00
2 changed files with 48 additions and 47 deletions

View File

@ -1055,51 +1055,6 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel):
split.operator("fluid.free_particles", text="Free Particles")
class PHYSICS_PT_viscosity(PhysicButtonsPanel, Panel):
bl_label = "Viscosity"
bl_parent_id = "PHYSICS_PT_liquid"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
# Fluid viscosity only enabled for liquids
if not PhysicButtonsPanel.poll_liquid_domain(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
md = context.fluid.domain_settings
domain = context.fluid.domain_settings
is_baking_any = domain.is_cache_baking_any
has_baked_any = domain.has_cache_baked_any
self.layout.enabled = not is_baking_any and not has_baked_any
self.layout.prop(md, "use_viscosity", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
domain = context.fluid.domain_settings
layout.active = domain.use_viscosity
is_baking_any = domain.is_cache_baking_any
has_baked_any = domain.has_cache_baked_any
has_baked_data = domain.has_cache_baked_data
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
flow.enabled = not is_baking_any and not has_baked_any and not has_baked_data
col = flow.column(align=True)
col.prop(domain, "viscosity_value", text="Strength")
class PHYSICS_PT_diffusion(PhysicButtonsPanel, Panel):
bl_label = "Diffusion"
bl_parent_id = "PHYSICS_PT_liquid"
@ -1152,6 +1107,51 @@ class PHYSICS_PT_diffusion(PhysicButtonsPanel, Panel):
col.prop(domain, "surface_tension", text="Surface Tension")
class PHYSICS_PT_viscosity(PhysicButtonsPanel, Panel):
bl_label = "High Viscosity Solver"
bl_parent_id = "PHYSICS_PT_diffusion"
bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {
'BLENDER_RENDER',
'BLENDER_EEVEE',
'BLENDER_EEVEE_NEXT',
'BLENDER_WORKBENCH',
}
@classmethod
def poll(cls, context):
# Fluid viscosity only enabled for liquids
if not PhysicButtonsPanel.poll_liquid_domain(context):
return False
return (context.engine in cls.COMPAT_ENGINES)
def draw_header(self, context):
md = context.fluid.domain_settings
domain = context.fluid.domain_settings
is_baking_any = domain.is_cache_baking_any
has_baked_any = domain.has_cache_baked_any
self.layout.enabled = not is_baking_any and not has_baked_any
self.layout.prop(md, "use_viscosity", text="")
def draw(self, context):
layout = self.layout
layout.use_property_split = True
domain = context.fluid.domain_settings
layout.active = domain.use_viscosity
is_baking_any = domain.is_cache_baking_any
has_baked_any = domain.has_cache_baked_any
has_baked_data = domain.has_cache_baked_data
flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
flow.enabled = not is_baking_any and not has_baked_any and not has_baked_data
col = flow.column(align=True)
col.prop(domain, "viscosity_value", text="Strength")
class PHYSICS_PT_guide(PhysicButtonsPanel, Panel):
bl_label = "Guides"
bl_parent_id = "PHYSICS_PT_fluid"
@ -1625,8 +1625,8 @@ classes = (
PHYSICS_PT_noise,
PHYSICS_PT_fire,
PHYSICS_PT_liquid,
PHYSICS_PT_viscosity,
PHYSICS_PT_diffusion,
PHYSICS_PT_viscosity,
PHYSICS_PT_particles,
PHYSICS_PT_mesh,
PHYSICS_PT_guide,

View File

@ -1904,7 +1904,8 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_viscosity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flags", FLUID_DOMAIN_USE_VISCOSITY);
RNA_def_property_ui_text(prop, "Use Viscosity", "Enable fluid viscosity settings");
RNA_def_property_ui_text(
prop, "Use Viscosity", "Simulate fluids with high viscosity using a special solver");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
prop = RNA_def_property(srna, "viscosity_value", PROP_FLOAT, PROP_NONE);