Add support for fluid simulation caches

Add `eModifierType_Fluid` support, with non-pointcache caches. The entire
cache directory is considered a dependency to list/pack.
This commit is contained in:
Sybren A. Stüvel 2022-12-16 14:49:36 +01:00
parent 1541c52520
commit 1e8c924990
3 changed files with 33 additions and 0 deletions

View File

@ -3,6 +3,10 @@
This file logs the changes that are actually interesting to users (new features, This file logs the changes that are actually interesting to users (new features,
changed functionality, fixed bugs). changed functionality, fixed bugs).
# Version 1.15 (in development)
- Add support for fluid simulation caches.
# Version 1.14 (2022-09-12) # Version 1.14 (2022-09-12)
- While tracing dependencies, call the progress callback function before opening a blend file, instead of before iterating over its contents. The opening (and loading of SDNA) takes a significant amount of time, so this will make any UI (like the Flamenco add-on) report the right filename when waiting for big files. - While tracing dependencies, call the progress callback function before opening a blend file, instead of before iterating over its contents. The opening (and loading of SDNA) takes a significant amount of time, so this will make any UI (like the Flamenco add-on) report the right filename when waiting for big files.

View File

@ -48,6 +48,7 @@ eModifierType_WeightVGProximity = 38
eModifierType_Ocean = 39 eModifierType_Ocean = 39
eModifierType_MeshCache = 46 eModifierType_MeshCache = 46
eModifierType_MeshSequenceCache = 52 eModifierType_MeshSequenceCache = 52
eModifierType_Fluid = 56
eModifierType_Nodes = 57 eModifierType_Nodes = 57
# DNA_particle_types.h # DNA_particle_types.h

View File

@ -278,6 +278,34 @@ def modifier_smoke_sim(
) )
@mod_handler(cdefs.eModifierType_Fluid)
def modifier_fluid(
ctx: ModifierContext, modifier: blendfile.BlendFileBlock, block_name: bytes
) -> typing.Iterator[result.BlockUsage]:
my_log = log.getChild("modifier_fluid")
domain = modifier.get_pointer(b"domain")
if domain is None:
my_log.debug(
"Modifier %r (%r) has no domain", modifier[b"modifier", b"name"], block_name
)
return
# See fluid_bake_startjob() in physics_fluid.c
path = domain[b"cache_directory"]
path, field = domain.get(b"cache_directory", return_field=True)
log.info(" fluid cache at %s", path)
bpath = bpathlib.BlendPath(path)
yield result.BlockUsage(
domain,
bpath,
path_full_field=field,
is_sequence=True,
block_name=block_name,
)
@mod_handler(cdefs.eModifierType_Cloth) @mod_handler(cdefs.eModifierType_Cloth)
def modifier_cloth( def modifier_cloth(
ctx: ModifierContext, modifier: blendfile.BlendFileBlock, block_name: bytes ctx: ModifierContext, modifier: blendfile.BlendFileBlock, block_name: bytes