Page MenuHome
Paste P732

T55542 snippet
ActivePublic

Authored by Philipp Oeser (lichtwerk) on Jun 20 2018, 3:06 PM.
diff --git a/blender_asset_tracer/cdefs.py b/blender_asset_tracer/cdefs.py
index 3fc9948..0d8cafe 100644
--- a/blender_asset_tracer/cdefs.py
+++ b/blender_asset_tracer/cdefs.py
@@ -39,6 +39,7 @@ eModifierType_Displace = 14
eModifierType_UVProject = 15
eModifierType_ParticleSystem = 19
eModifierType_Fluidsim = 26
+eModifierType_Smokesim = 31
eModifierType_WeightVGEdit = 36
eModifierType_WeightVGMix = 37
eModifierType_WeightVGProximity = 38
diff --git a/blender_asset_tracer/trace/modifier_walkers.py b/blender_asset_tracer/trace/modifier_walkers.py
index 9273ff8..877b5bb 100644
--- a/blender_asset_tracer/trace/modifier_walkers.py
+++ b/blender_asset_tracer/trace/modifier_walkers.py
@@ -175,3 +175,21 @@ def modifier_fluid_sim(modifier: blendfile.BlendFileBlock, block_name: bytes) \
pointcache = modifier.get_pointer(b'point_cache')
if pointcache:
yield from _walk_point_cache(block_name, modifier.bfile, pointcache)
+
+@mod_handler(cdefs.eModifierType_Smokesim)
+def modifier_smoke_sim(modifier: blendfile.BlendFileBlock, block_name: bytes) \
+ -> typing.Iterator[result.BlockUsage]:
+ my_log = log.getChild('modifier_smoke_sim')
+
+ 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 []
+ else:
+ pointcache = domain.get_pointer(b'point_cache')
+ if pointcache is None:
+ return []
+ else:
+ if pointcache:
+ yield from _walk_point_cache(block_name, modifier.bfile, pointcache)

Event Timeline

Here are some review remarks:

  • Don't use else after a return in the if body. It just unnecessarily indents your code.
  • if pointcache also covers if pointcache is None, so doing the former in the else clause of the latter is unnecessarily complex.
  • Don't return []. The function is a generator, not a regular function, so just return nothing.