Add Support for Dynamic Paint Modifier #92889

Merged
Sybren A. Stüvel merged 2 commits from JonasDichelle/blender-asset-tracer:dynamicpaint_support into main 2024-09-02 18:19:08 +02:00
2 changed files with 35 additions and 0 deletions
Showing only changes of commit e05316edd4 - Show all commits

View File

@ -46,6 +46,7 @@ eModifierType_WeightVGEdit = 36
eModifierType_WeightVGMix = 37 eModifierType_WeightVGMix = 37
eModifierType_WeightVGProximity = 38 eModifierType_WeightVGProximity = 38
eModifierType_Ocean = 39 eModifierType_Ocean = 39
eModifierType_DynamicPaint = 40
eModifierType_MeshCache = 46 eModifierType_MeshCache = 46
eModifierType_MeshSequenceCache = 52 eModifierType_MeshSequenceCache = 52
eModifierType_Fluid = 56 eModifierType_Fluid = 56

View File

@ -22,6 +22,7 @@
The modifier_xxx() functions all yield result.BlockUsage objects for external The modifier_xxx() functions all yield result.BlockUsage objects for external
files used by the modifiers. files used by the modifiers.
""" """
import logging import logging
import typing import typing
@ -317,3 +318,36 @@ def modifier_cloth(
yield from _walk_point_cache( yield from _walk_point_cache(
ctx, block_name, modifier.bfile, pointcache, cdefs.PTCACHE_EXT ctx, block_name, modifier.bfile, pointcache, cdefs.PTCACHE_EXT
) )
@mod_handler(cdefs.eModifierType_DynamicPaint)
def modifier_dynamic_paint(
ctx: ModifierContext, modifier: blendfile.BlendFileBlock, block_name: bytes
) -> typing.Iterator[result.BlockUsage]:
my_log = log.getChild("modifier_dynamic_paint")
canvas_settings = modifier.get_pointer(b"canvas")
if canvas_settings is None:
my_log.debug(
"Modifier %r (%r) has no canvas_settings",
modifier[b"modifier", b"name"],
block_name,
)
return
surfaces = canvas_settings.get_pointer((b"surfaces", b"first"))
for surface in blendfile.iterators.listbase(surfaces):
surface_block_name = block_name + b"%s.canvas_settings.surfaces[%d]"
point_cache = surface.get_pointer(b"pointcache")
if point_cache is None:
my_log.debug(
"Surface %r (%r) has no pointcache",
surface[b"surface", b"name"],
surface_block_name,
)
continue
yield from _walk_point_cache(
ctx, surface_block_name, modifier.bfile, point_cache, cdefs.PTCACHE_EXT
)