Fluid: Diffusion settings now optional
For optimization purposes these settings need to be enabled explicitly from now on.
This commit is contained in:
parent
4d3da4e1d0
commit
cd0a6ff5c4
Notes:
blender-bot
2023-02-14 09:48:25 +01:00
Referenced by issue #74531, File Browser not show image preview when set Display As `thumbnail` untill file browser window is resized
|
@ -981,6 +981,8 @@ std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *m
|
|||
ss << (mmd->domain->flags & FLUID_DOMAIN_USE_FRACTIONS ? "True" : "False");
|
||||
else if (varName == "DELETE_IN_OBSTACLE")
|
||||
ss << (mmd->domain->flags & FLUID_DOMAIN_DELETE_IN_OBSTACLE ? "True" : "False");
|
||||
else if (varName == "USING_DIFFUSION")
|
||||
ss << (mmd->domain->flags & FLUID_DOMAIN_USE_DIFFUSION ? "True" : "False");
|
||||
else
|
||||
std::cout << "ERROR: Unknown option: " << varName << std::endl;
|
||||
return ss.str();
|
||||
|
|
|
@ -112,6 +112,7 @@ using_invel_s$ID$ = $USING_INVEL$\n\
|
|||
using_outflow_s$ID$ = $USING_OUTFLOW$\n\
|
||||
using_sndparts_s$ID$ = $USING_SNDPARTS$\n\
|
||||
using_speedvectors_s$ID$ = $USING_SPEEDVECTORS$\n\
|
||||
using_diffusion_s$ID$ = $USING_DIFFUSION$\n\
|
||||
\n\
|
||||
# Fluid time params\n\
|
||||
timeTotal_s$ID$ = $TIME_TOTAL$\n\
|
||||
|
|
|
@ -266,14 +266,14 @@ def liquid_step_$ID$():\n\
|
|||
if using_obstacle_s$ID$:\n\
|
||||
mantaMsg('Extrapolating object velocity')\n\
|
||||
# ensure velocities inside of obs object, slightly add obvels outside of obs object\n\
|
||||
extrapolateVec3Simple(vel=obvelC_s$ID$, phi=phiObsIn_s$ID$, distance=int(res_s$ID$/2), inside=True)\n\
|
||||
extrapolateVec3Simple(vel=obvelC_s$ID$, phi=phiObsIn_s$ID$, distance=6, inside=True)\n\
|
||||
extrapolateVec3Simple(vel=obvelC_s$ID$, phi=phiObsIn_s$ID$, distance=3, inside=False)\n\
|
||||
resampleVec3ToMac(source=obvelC_s$ID$, target=obvel_s$ID$)\n\
|
||||
\n\
|
||||
extrapolateMACSimple(flags=flags_s$ID$, vel=vel_s$ID$, distance=2, intoObs=True if using_fractions_s$ID$ else False)\n\
|
||||
\n\
|
||||
# vel diffusion / viscosity!\n\
|
||||
if viscosity_s$ID$ > 0.:\n\
|
||||
if using_diffusion_s$ID$:\n\
|
||||
mantaMsg('Viscosity')\n\
|
||||
# diffusion param for solve = const * dt / dx^2\n\
|
||||
alphaV = viscosity_s$ID$ * s$ID$.timestep * float(res_s$ID$*res_s$ID$)\n\
|
||||
|
|
|
@ -957,6 +957,14 @@ class PHYSICS_PT_diffusion(PhysicButtonsPanel, Panel):
|
|||
|
||||
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_diffusion", text="")
|
||||
|
||||
def draw_header_preset(self, _context):
|
||||
FLUID_PT_presets.draw_panel_header(self.layout)
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ enum {
|
|||
FLUID_DOMAIN_EXPORT_MANTA_SCRIPT = (1 << 12), /* Export mantaflow script during bake. */
|
||||
FLUID_DOMAIN_USE_FRACTIONS = (1 << 13), /* Use second order obstacles. */
|
||||
FLUID_DOMAIN_DELETE_IN_OBSTACLE = (1 << 14), /* Delete fluid inside obstacles. */
|
||||
FLUID_DOMAIN_USE_DIFFUSION = (1 << 15), /* Use diffusion (e.g. viscosity, surface tension). */
|
||||
};
|
||||
|
||||
/* Border collisions. */
|
||||
|
|
|
@ -1563,6 +1563,13 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
|
|||
|
||||
/* diffusion options */
|
||||
|
||||
prop = RNA_def_property(srna, "use_diffusion", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_USE_DIFFUSION);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Use Diffusion", "Enable fluid diffusion settings (e.g. viscosity, surface tension)");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset");
|
||||
|
||||
prop = RNA_def_property(srna, "surface_tension", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0, 100.0);
|
||||
RNA_def_property_ui_text(
|
||||
|
|
Loading…
Reference in New Issue