Merge branch 'blender-v2.82-release'
This commit is contained in:
commit
f780057d52
|
@ -954,6 +954,79 @@ template<class T> void readGridVDB(const string &name, Grid<T> *grid)
|
|||
1);
|
||||
}
|
||||
|
||||
template<> void writeGridVDB(const string &name, Grid<int> *grid)
|
||||
{
|
||||
debMsg("Writing int grid " << grid->getName() << " to vdb file " << name, 1);
|
||||
|
||||
// Create an empty int32-point grid with background value 0.
|
||||
openvdb::initialize();
|
||||
openvdb::Int32Grid::Ptr gridVDB = openvdb::Int32Grid::create();
|
||||
gridVDB->setTransform(
|
||||
openvdb::math::Transform::createLinearTransform(1. / grid->getSizeX())); // voxel size
|
||||
|
||||
// Get an accessor for coordinate-based access to voxels.
|
||||
openvdb::Int32Grid::Accessor accessor = gridVDB->getAccessor();
|
||||
|
||||
gridVDB->setGridClass(openvdb::GRID_UNKNOWN);
|
||||
|
||||
// Name the grid "density".
|
||||
gridVDB->setName(grid->getName());
|
||||
|
||||
openvdb::io::File file(name);
|
||||
|
||||
FOR_IJK(*grid)
|
||||
{
|
||||
openvdb::Coord xyz(i, j, k);
|
||||
accessor.setValue(xyz, (*grid)(i, j, k));
|
||||
}
|
||||
|
||||
// Add the grid pointer to a container.
|
||||
openvdb::GridPtrVec gridsVDB;
|
||||
gridsVDB.push_back(gridVDB);
|
||||
|
||||
// Write out the contents of the container.
|
||||
file.write(gridsVDB);
|
||||
file.close();
|
||||
}
|
||||
|
||||
template<> void readGridVDB(const string &name, Grid<int> *grid)
|
||||
{
|
||||
debMsg("Reading int grid " << grid->getName() << " from vdb file " << name, 1);
|
||||
|
||||
openvdb::initialize();
|
||||
openvdb::io::File file(name);
|
||||
file.open();
|
||||
|
||||
openvdb::GridBase::Ptr baseGrid;
|
||||
for (openvdb::io::File::NameIterator nameIter = file.beginName(); nameIter != file.endName();
|
||||
++nameIter) {
|
||||
# ifndef BLENDER
|
||||
// Read in only the grid we are interested in.
|
||||
if (nameIter.gridName() == grid->getName()) {
|
||||
baseGrid = file.readGrid(nameIter.gridName());
|
||||
}
|
||||
else {
|
||||
debMsg("skipping grid " << nameIter.gridName(), 1);
|
||||
}
|
||||
# else
|
||||
// For Blender, skip name check and pick first grid from loop
|
||||
baseGrid = file.readGrid(nameIter.gridName());
|
||||
break;
|
||||
# endif
|
||||
}
|
||||
file.close();
|
||||
openvdb::Int32Grid::Ptr gridVDB = openvdb::gridPtrCast<openvdb::Int32Grid>(baseGrid);
|
||||
|
||||
openvdb::Int32Grid::Accessor accessor = gridVDB->getAccessor();
|
||||
|
||||
FOR_IJK(*grid)
|
||||
{
|
||||
openvdb::Coord xyz(i, j, k);
|
||||
int v = accessor.getValue(xyz);
|
||||
(*grid)(i, j, k) = v;
|
||||
}
|
||||
}
|
||||
|
||||
template<> void writeGridVDB(const string &name, Grid<Real> *grid)
|
||||
{
|
||||
debMsg("Writing real grid " << grid->getName() << " to vdb file " << name, 1);
|
||||
|
|
|
@ -310,6 +310,8 @@ template<class T> void readPdataUni(const std::string &name, ParticleDataImpl<T>
|
|||
UniPartHeader head;
|
||||
assertMsg(gzread(gzf, &head, sizeof(UniPartHeader)) == sizeof(UniPartHeader),
|
||||
"can't read file, no header present");
|
||||
pdata->resize(head.dim);
|
||||
|
||||
assertMsg(head.dim == pdata->size(), "pdata size doesn't match");
|
||||
# if FLOATINGPOINT_PRECISION != 1
|
||||
ParticleDataImpl<T> temp(pdata->getParent());
|
||||
|
|
|
@ -136,9 +136,9 @@ FluidSolver::FluidSolver(Vec3i gridsize, int dim, int fourthDim)
|
|||
mDtMin(1.),
|
||||
mDtMax(1.),
|
||||
mFrameLength(1.),
|
||||
mTimePerFrame(0.),
|
||||
mGridSize(gridsize),
|
||||
mDim(dim),
|
||||
mTimePerFrame(0.),
|
||||
mLockDt(false),
|
||||
mFourthDim(fourthDim)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
|
||||
|
||||
#define MANTA_GIT_VERSION "commit 3f5c7989fd82920f0c509844a06e97dd1069191c"
|
||||
#define MANTA_GIT_VERSION "commit abfff159b5ea8cee93d858f4b8be2a308b58b51d"
|
||||
|
|
|
@ -1407,7 +1407,6 @@ struct correctLevelset : public KernelBase {
|
|||
{
|
||||
if (rAcc(i, j, k) <= VECTOR_EPSILON)
|
||||
return; // outside nothing happens
|
||||
Real x = pAcc(i, j, k).x;
|
||||
|
||||
// create jacobian of pAcc via central differences
|
||||
Matrix3x3f jacobian = Matrix3x3f(0.5 * (pAcc(i + 1, j, k).x - pAcc(i - 1, j, k).x),
|
||||
|
|
|
@ -381,7 +381,6 @@ void getSpiralVelocity(const FlagGrid &flags,
|
|||
nz = flags.getSizeZ();
|
||||
Real midX = 0.5 * (Real)(nx - 1);
|
||||
Real midY = 0.5 * (Real)(ny - 1);
|
||||
Real midZ = 0.5 * (Real)(nz - 1);
|
||||
for (int i = 0; i < nx; i++) {
|
||||
for (int j = 0; j < ny; j++) {
|
||||
for (int k = 0; k < nz; k++) {
|
||||
|
|
|
@ -1099,7 +1099,7 @@ void PbRegister_flipSampleSecondaryParticles()
|
|||
// evaluates cubic spline with radius h and distance l in dim dimensions
|
||||
Real cubicSpline(const Real h, const Real l, const int dim)
|
||||
{
|
||||
const Real h2 = square(h), h3 = h2 * h, h4 = h3 * h, h5 = h4 * h;
|
||||
const Real h2 = square(h), h3 = h2 * h;
|
||||
const Real c[] = {
|
||||
Real(2e0 / (3e0 * h)), Real(10e0 / (7e0 * M_PI * h2)), Real(1e0 / (M_PI * h3))};
|
||||
const Real q = l / h;
|
||||
|
@ -1175,9 +1175,6 @@ struct knFlipUpdateSecondaryParticlesLinear : public KernelBase {
|
|||
}
|
||||
|
||||
Vec3i gridpos = toVec3i(pts_sec[idx].pos);
|
||||
int i = gridpos.x;
|
||||
int j = gridpos.y;
|
||||
int k = gridpos.z;
|
||||
|
||||
// spray particle
|
||||
if (neighborRatio(gridpos) < c_s) {
|
||||
|
|
|
@ -572,6 +572,29 @@ void MANTA::terminateMantaflow()
|
|||
mantaInitialized = false;
|
||||
}
|
||||
|
||||
static std::string getCacheFileEnding(char cache_format)
|
||||
{
|
||||
if (MANTA::with_debug)
|
||||
std::cout << "MANTA::getCacheFileEnding()" << std::endl;
|
||||
|
||||
switch (cache_format) {
|
||||
case FLUID_DOMAIN_FILE_UNI:
|
||||
return ".uni";
|
||||
case FLUID_DOMAIN_FILE_OPENVDB:
|
||||
return ".vdb";
|
||||
case FLUID_DOMAIN_FILE_RAW:
|
||||
return ".raw";
|
||||
case FLUID_DOMAIN_FILE_BIN_OBJECT:
|
||||
return ".bobj.gz";
|
||||
case FLUID_DOMAIN_FILE_OBJECT:
|
||||
return ".obj";
|
||||
default:
|
||||
if (MANTA::with_debug)
|
||||
std::cout << "Error: Could not find file extension" << std::endl;
|
||||
return ".uni";
|
||||
}
|
||||
}
|
||||
|
||||
std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *mmd)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
|
@ -815,6 +838,14 @@ std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *m
|
|||
ss << mmd->time;
|
||||
else if (varName == "END_FRAME")
|
||||
ss << mmd->domain->cache_frame_end;
|
||||
else if (varName == "CACHE_DATA_FORMAT")
|
||||
ss << getCacheFileEnding(mmd->domain->cache_data_format);
|
||||
else if (varName == "CACHE_MESH_FORMAT")
|
||||
ss << getCacheFileEnding(mmd->domain->cache_mesh_format);
|
||||
else if (varName == "CACHE_NOISE_FORMAT")
|
||||
ss << getCacheFileEnding(mmd->domain->cache_noise_format);
|
||||
else if (varName == "CACHE_PARTICLE_FORMAT")
|
||||
ss << getCacheFileEnding(mmd->domain->cache_particle_format);
|
||||
else if (varName == "SIMULATION_METHOD") {
|
||||
if (mmd->domain->simulation_method & FLUID_DOMAIN_METHOD_FLIP) {
|
||||
ss << "'FLIP'";
|
||||
|
@ -987,29 +1018,6 @@ std::string MANTA::parseScript(const std::string &setup_string, FluidModifierDat
|
|||
return res.str();
|
||||
}
|
||||
|
||||
static std::string getCacheFileEnding(char cache_format)
|
||||
{
|
||||
if (MANTA::with_debug)
|
||||
std::cout << "MANTA::getCacheFileEnding()" << std::endl;
|
||||
|
||||
switch (cache_format) {
|
||||
case FLUID_DOMAIN_FILE_UNI:
|
||||
return ".uni";
|
||||
case FLUID_DOMAIN_FILE_OPENVDB:
|
||||
return ".vdb";
|
||||
case FLUID_DOMAIN_FILE_RAW:
|
||||
return ".raw";
|
||||
case FLUID_DOMAIN_FILE_BIN_OBJECT:
|
||||
return ".bobj.gz";
|
||||
case FLUID_DOMAIN_FILE_OBJECT:
|
||||
return ".obj";
|
||||
default:
|
||||
if (MANTA::with_debug)
|
||||
std::cout << "Error: Could not find file extension" << std::endl;
|
||||
return ".uni";
|
||||
}
|
||||
}
|
||||
|
||||
int MANTA::updateFlipStructures(FluidModifierData *mmd, int framenr)
|
||||
{
|
||||
if (MANTA::with_debug)
|
||||
|
@ -2001,6 +2009,9 @@ int MANTA::bakeGuiding(FluidModifierData *mmd, int framenr)
|
|||
|
||||
std::string gformat = getCacheFileEnding(mmd->domain->cache_data_format);
|
||||
|
||||
bool final_cache = (mmd->domain->cache_type == FLUID_DOMAIN_CACHE_FINAL);
|
||||
std::string resumable_cache = (final_cache) ? "False" : "True";
|
||||
|
||||
BLI_path_join(cacheDirGuiding,
|
||||
sizeof(cacheDirGuiding),
|
||||
mmd->domain->cache_directory,
|
||||
|
@ -2010,7 +2021,7 @@ int MANTA::bakeGuiding(FluidModifierData *mmd, int framenr)
|
|||
|
||||
ss.str("");
|
||||
ss << "bake_guiding_" << mCurrentID << "('" << escapeSlashes(cacheDirGuiding) << "', " << framenr
|
||||
<< ", '" << gformat << "')";
|
||||
<< ", '" << gformat << "', " << resumable_cache << ")";
|
||||
pythonCommands.push_back(ss.str());
|
||||
|
||||
runPythonString(pythonCommands);
|
||||
|
|
|
@ -559,12 +559,9 @@ def bake_particles_$ID$(path_data, path_particles, framenr, format_data, format_
|
|||
|
||||
const std::string fluid_bake_guiding =
|
||||
"\n\
|
||||
def bake_guiding_process_$ID$(framenr, format_guiding, path_guiding):\n\
|
||||
def bake_guiding_process_$ID$(framenr, format_guiding, path_guiding, resumable):\n\
|
||||
mantaMsg('Bake fluid guiding')\n\
|
||||
\n\
|
||||
if framenr>1:\n\
|
||||
fluid_load_guiding_$ID$(path_guiding, framenr-1, format_guiding)\n\
|
||||
\n\
|
||||
# Average out velocities from multiple guiding objects at one cell\n\
|
||||
x_guidevel_s$ID$.safeDivide(numGuides_s$ID$)\n\
|
||||
y_guidevel_s$ID$.safeDivide(numGuides_s$ID$)\n\
|
||||
|
@ -582,13 +579,13 @@ def bake_guiding_process_$ID$(framenr, format_guiding, path_guiding):\n\
|
|||
extrapolateVec3Simple(vel=guidevelC_s$ID$, phi=phiGuideIn_s$ID$, distance=4, inside=False)\n\
|
||||
resampleVec3ToMac(source=guidevelC_s$ID$, target=guidevel_sg$ID$)\n\
|
||||
\n\
|
||||
fluid_save_guiding_$ID$(path_guiding, framenr, format_guiding)\n\
|
||||
fluid_save_guiding_$ID$(path_guiding, framenr, format_guiding, resumable)\n\
|
||||
\n\
|
||||
def bake_guiding_$ID$(path_guiding, framenr, format_guiding):\n\
|
||||
def bake_guiding_$ID$(path_guiding, framenr, format_guiding, resumable):\n\
|
||||
if not withMPBake or isWindows:\n\
|
||||
bake_guiding_process_$ID$(framenr, format_guiding, path_guiding)\n\
|
||||
bake_guiding_process_$ID$(framenr, format_guiding, path_guiding, resumable)\n\
|
||||
else:\n\
|
||||
fluid_cache_multiprocessing_start_$ID$(function=bake_guiding_process_$ID$, framenr=framenr, format_guiding=format_guiding, path_guiding=path_guiding)\n";
|
||||
fluid_cache_multiprocessing_start_$ID$(function=bake_guiding_process_$ID$, framenr=framenr, format_guiding=format_guiding, path_guiding=path_guiding, resumable=resumable)\n";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// IMPORT
|
||||
|
@ -692,12 +689,12 @@ if (GUI):\n\
|
|||
gui.show()\n\
|
||||
gui.pause()\n\
|
||||
\n\
|
||||
cache_dir = '$CACHE_DIR$'\n\
|
||||
cache_resumable = $CACHE_RESUMABLE$\n\
|
||||
file_format_data = '.uni'\n\
|
||||
file_format_noise = '.uni'\n\
|
||||
file_format_particles = '.uni'\n\
|
||||
file_format_mesh = '.bobj.gz'\n\
|
||||
cache_resumable = $CACHE_RESUMABLE$\n\
|
||||
cache_dir = '$CACHE_DIR$'\n\
|
||||
file_format_data = '$CACHE_DATA_FORMAT$'\n\
|
||||
file_format_noise = '$CACHE_NOISE_FORMAT$'\n\
|
||||
file_format_particles = '$CACHE_PARTICLE_FORMAT$'\n\
|
||||
file_format_mesh = '$CACHE_MESH_FORMAT$'\n\
|
||||
\n\
|
||||
# Start and stop for simulation\n\
|
||||
current_frame = $CURRENT_FRAME$\n\
|
||||
|
|
|
@ -162,9 +162,6 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
|
|||
if md.fluid_type == 'DOMAIN':
|
||||
domain = md.domain_settings
|
||||
|
||||
# Deactivate UI if guides are enabled but not baked yet.
|
||||
layout.active = not self.check_domain_has_unbaked_guide(domain)
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
has_baked_data = domain.has_cache_baked_data
|
||||
|
||||
|
@ -176,7 +173,9 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
|
|||
flow.enabled = not is_baking_any and not has_baked_data
|
||||
|
||||
col = flow.column()
|
||||
col.enabled = not domain.has_cache_baked_guide
|
||||
col.prop(domain, "resolution_max", text="Resolution Divisions")
|
||||
col = flow.column()
|
||||
col.prop(domain, "time_scale", text="Time Scale")
|
||||
col.prop(domain, "cfl_condition", text="CFL Number")
|
||||
|
||||
|
@ -201,7 +200,17 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel):
|
|||
|
||||
if domain.cache_type == 'MODULAR':
|
||||
col.separator()
|
||||
|
||||
# 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()
|
||||
note_flag = False
|
||||
note.enabled = note_flag
|
||||
note.label(icon='INFO', text="Unbaked Guides: Bake Guides or disable them.")
|
||||
|
||||
split = layout.split()
|
||||
split.enabled = note_flag
|
||||
|
||||
bake_incomplete = (domain.cache_frame_pause_data < domain.cache_frame_end)
|
||||
if domain.has_cache_baked_data and not domain.is_cache_baking_data and bake_incomplete:
|
||||
|
@ -354,10 +363,13 @@ class PHYSICS_PT_smoke_dissolve(PhysicButtonsPanel, Panel):
|
|||
return (context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
md = context.fluid
|
||||
domain = md.domain_settings
|
||||
md = context.fluid.domain_settings
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
self.layout.prop(domain, "use_dissolve_smoke", text="")
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
|
||||
self.layout.enabled = not is_baking_any
|
||||
self.layout.prop(md, "use_dissolve_smoke", text="")
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -433,6 +445,11 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel):
|
|||
|
||||
def draw_header(self, context):
|
||||
md = context.fluid.domain_settings
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
|
||||
self.layout.enabled = not is_baking_any
|
||||
self.layout.prop(md, "use_flip_particles", text="")
|
||||
|
||||
def draw(self, context):
|
||||
|
@ -613,6 +630,12 @@ class PHYSICS_PT_adaptive_domain(PhysicButtonsPanel, Panel):
|
|||
if not PhysicButtonsPanel.poll_gas_domain(context):
|
||||
return False
|
||||
|
||||
md = context.fluid
|
||||
domain = md.domain_settings
|
||||
# Effector guides require a fixed domain size
|
||||
if domain.use_guide and domain.guide_source == 'EFFECTOR':
|
||||
return False
|
||||
|
||||
return (context.engine in cls.COMPAT_ENGINES)
|
||||
|
||||
def draw_header(self, context):
|
||||
|
@ -673,9 +696,7 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel):
|
|||
layout.use_property_split = True
|
||||
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
# Deactivate UI if guides are enabled but not baked yet.
|
||||
layout.enabled = domain.use_noise and not self.check_domain_has_unbaked_guide(domain)
|
||||
layout.enabled = domain.use_noise
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
has_baked_noise = domain.has_cache_baked_noise
|
||||
|
@ -696,8 +717,16 @@ class PHYSICS_PT_noise(PhysicButtonsPanel, Panel):
|
|||
if domain.cache_type == 'MODULAR':
|
||||
col.separator()
|
||||
|
||||
# Deactivate bake operator if data has not been baked yet.
|
||||
note_flag = True
|
||||
if domain.use_noise and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR':
|
||||
note = layout.split()
|
||||
note_flag = False
|
||||
note.enabled = note_flag
|
||||
note.label(icon='INFO', text="Unbaked Data: Bake Data first.")
|
||||
|
||||
split = layout.split()
|
||||
split.enabled = domain.has_cache_baked_data
|
||||
split.enabled = domain.has_cache_baked_data and note_flag
|
||||
|
||||
bake_incomplete = (domain.cache_frame_pause_noise < domain.cache_frame_end)
|
||||
if domain.has_cache_baked_noise and not domain.is_cache_baking_noise and bake_incomplete:
|
||||
|
@ -739,9 +768,7 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel):
|
|||
layout.use_property_split = True
|
||||
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
# Deactivate UI if guides are enabled but not baked yet.
|
||||
layout.enabled = domain.use_mesh and not self.check_domain_has_unbaked_guide(domain)
|
||||
layout.enabled = domain.use_mesh
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
has_baked_mesh = domain.has_cache_baked_mesh
|
||||
|
@ -775,8 +802,16 @@ class PHYSICS_PT_mesh(PhysicButtonsPanel, Panel):
|
|||
if domain.cache_type == 'MODULAR':
|
||||
col.separator()
|
||||
|
||||
# Deactivate bake operator if data has not been baked yet.
|
||||
note_flag = True
|
||||
if domain.use_mesh and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR':
|
||||
note = layout.split()
|
||||
note_flag = False
|
||||
note.enabled = note_flag
|
||||
note.label(icon='INFO', text="Unbaked Data: Bake Data first.")
|
||||
|
||||
split = layout.split()
|
||||
split.enabled = domain.has_cache_baked_data
|
||||
split.enabled = domain.has_cache_baked_data and note_flag
|
||||
|
||||
bake_incomplete = (domain.cache_frame_pause_mesh < domain.cache_frame_end)
|
||||
if domain.has_cache_baked_mesh and not domain.is_cache_baking_mesh and bake_incomplete:
|
||||
|
@ -812,9 +847,6 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel):
|
|||
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
# Deactivate UI if guides are enabled but not baked yet.
|
||||
layout.enabled = not self.check_domain_has_unbaked_guide(domain)
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
has_baked_particles = domain.has_cache_baked_particles
|
||||
using_particles = domain.use_spray_particles or domain.use_foam_particles or domain.use_bubble_particles
|
||||
|
@ -882,8 +914,17 @@ class PHYSICS_PT_particles(PhysicButtonsPanel, Panel):
|
|||
if domain.cache_type == 'MODULAR':
|
||||
col.separator()
|
||||
|
||||
# Deactivate bake operator if data has not been baked yet.
|
||||
note_flag = True
|
||||
if using_particles and not domain.has_cache_baked_data and domain.cache_type == 'MODULAR':
|
||||
note = layout.split()
|
||||
note_flag = False
|
||||
note.enabled = note_flag
|
||||
note.label(icon='INFO', text="Unbaked Data: Bake Data first.")
|
||||
|
||||
split = layout.split()
|
||||
split.enabled = (
|
||||
note_flag and
|
||||
domain.has_cache_baked_data and
|
||||
(domain.use_spray_particles or
|
||||
domain.use_bubble_particles or
|
||||
|
@ -926,9 +967,6 @@ class PHYSICS_PT_diffusion(PhysicButtonsPanel, Panel):
|
|||
|
||||
domain = context.fluid.domain_settings
|
||||
|
||||
# Deactivate UI if guides are enabled but not baked yet.
|
||||
layout.active = not self.check_domain_has_unbaked_guide(domain)
|
||||
|
||||
is_baking_any = domain.is_cache_baking_any
|
||||
has_baked_any = domain.has_cache_baked_any
|
||||
has_baked_data = domain.has_cache_baked_data
|
||||
|
@ -1013,7 +1051,8 @@ class PHYSICS_PT_guide(PhysicButtonsPanel, Panel):
|
|||
col = split.column()
|
||||
col.operator("fluid.free_guides", text="Free")
|
||||
elif not domain.has_cache_baked_guide and domain.is_cache_baking_guide:
|
||||
split.operator("fluid.pause_bake", text="Pause Guides")
|
||||
split.enabled = False
|
||||
split.operator("fluid.pause_bake", text="Baking Guides - ESC to pause")
|
||||
elif not domain.has_cache_baked_guide and not domain.is_cache_baking_guide:
|
||||
split.operator("fluid.bake_guides", text="Bake Guides")
|
||||
else:
|
||||
|
|
|
@ -3239,7 +3239,6 @@ static void manta_guiding(
|
|||
FluidDomainSettings *mds = mmd->domain;
|
||||
float fps = scene->r.frs_sec / scene->r.frs_sec_base;
|
||||
float dt = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
|
||||
;
|
||||
|
||||
BLI_mutex_lock(&object_update_lock);
|
||||
|
||||
|
@ -3325,15 +3324,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
|
|||
BKE_fluid_modifier_reset_ex(mmd, false);
|
||||
}
|
||||
|
||||
BKE_fluid_modifier_init(mmd, depsgraph, ob, scene, me);
|
||||
|
||||
/* ensure that time parameters are initialized correctly before every step */
|
||||
float fps = scene->r.frs_sec / scene->r.frs_sec_base;
|
||||
mds->frame_length = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
|
||||
mds->dt = mds->frame_length;
|
||||
mds->time_per_frame = 0;
|
||||
mds->time_total = (scene_framenr - 1) * mds->frame_length;
|
||||
|
||||
/* Guiding parent res pointer needs initialization */
|
||||
guide_parent = mds->guide_parent;
|
||||
if (guide_parent) {
|
||||
|
@ -3343,6 +3333,15 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
|
|||
}
|
||||
}
|
||||
|
||||
BKE_fluid_modifier_init(mmd, depsgraph, ob, scene, me);
|
||||
|
||||
/* ensure that time parameters are initialized correctly before every step */
|
||||
float fps = scene->r.frs_sec / scene->r.frs_sec_base;
|
||||
mds->frame_length = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
|
||||
mds->dt = mds->frame_length;
|
||||
mds->time_per_frame = 0;
|
||||
mds->time_total = (scene_framenr - 1) * mds->frame_length;
|
||||
|
||||
objs = BKE_collision_objects_create(
|
||||
depsgraph, ob, mds->fluid_group, &numobj, eModifierType_Fluid);
|
||||
update_flowsflags(mds, objs, numobj);
|
||||
|
@ -3403,7 +3402,7 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
|
|||
resume_guide = (!is_startframe) && (mds->cache_frame_pause_guide == scene_framenr);
|
||||
|
||||
bool read_cache, bake_cache;
|
||||
read_cache = false, bake_cache = baking_data || baking_noise || baking_mesh || baking_particles;
|
||||
read_cache = false, bake_cache = baking_data || baking_noise || baking_mesh || baking_particles || baking_guide;
|
||||
|
||||
bool with_gdomain;
|
||||
with_gdomain = (mds->guide_source == FLUID_DOMAIN_GUIDE_SRC_DOMAIN);
|
||||
|
@ -3419,14 +3418,14 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
|
|||
switch (mode) {
|
||||
case FLUID_DOMAIN_CACHE_FINAL:
|
||||
/* Just load the data that has already been baked */
|
||||
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
|
||||
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles && !baking_guide) {
|
||||
read_cache = true;
|
||||
bake_cache = false;
|
||||
}
|
||||
break;
|
||||
case FLUID_DOMAIN_CACHE_MODULAR:
|
||||
/* Just load the data that has already been baked */
|
||||
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
|
||||
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles && !baking_guide) {
|
||||
read_cache = true;
|
||||
bake_cache = false;
|
||||
break;
|
||||
|
@ -4561,7 +4560,7 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *mmd)
|
|||
mmd->effector->flags = 0;
|
||||
|
||||
/* guide options */
|
||||
mmd->effector->guide_mode = FLUID_EFFECTOR_GUIDE_MAX;
|
||||
mmd->effector->guide_mode = FLUID_EFFECTOR_GUIDE_OVERRIDE;
|
||||
mmd->effector->vel_multi = 1.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -505,7 +505,9 @@ static void fluid_free_startjob(void *customdata, short *stop, short *do_update,
|
|||
cache_map |= FLUID_DOMAIN_OUTDATED_PARTICLES;
|
||||
}
|
||||
if (fluid_is_free_guiding(job) || fluid_is_free_all(job)) {
|
||||
cache_map |= FLUID_DOMAIN_OUTDATED_GUIDE;
|
||||
cache_map |= (FLUID_DOMAIN_OUTDATED_DATA | FLUID_DOMAIN_OUTDATED_NOISE |
|
||||
FLUID_DOMAIN_OUTDATED_MESH | FLUID_DOMAIN_OUTDATED_PARTICLES |
|
||||
FLUID_DOMAIN_OUTDATED_GUIDE);
|
||||
}
|
||||
#ifdef WITH_FLUID
|
||||
BKE_fluid_cache_free(mds, job->ob, cache_map);
|
||||
|
|
Loading…
Reference in New Issue