Skip to content

Commit

Permalink
fix strange key collision where two different evaluated objects in th…
Browse files Browse the repository at this point in the history
…e depsgraph would have the same memory address
  • Loading branch information
Theverat committed Mar 13, 2020
1 parent 20a80ee commit 67a8a70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions export/caches/object_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def first_run(self, exporter, depsgraph, view_layer, engine, luxcore_scene, scen
try:
# The code in this try block is performance-critical, as it is
# executed most often when exporting millions of instances.
duplis = instances[obj]
duplis = instances[obj.original.as_pointer()]
# If duplis is None, then a non-exportable object like a curve with zero faces is being duplicated
if duplis:
obj_id = dg_obj_instance.object.original.luxcore.id
Expand All @@ -162,10 +162,10 @@ def first_run(self, exporter, depsgraph, view_layer, engine, luxcore_scene, scen
if exported_obj:
# Note, the transformation matrix and object ID of this first instance is not added
# to the duplication list, since it already exists in the scene
instances[obj] = Duplis(exported_obj)
instances[obj.original.as_pointer()] = Duplis(exported_obj)
else:
# Could not export the object, happens e.g. with curve objects with zero faces
instances[obj] = None
instances[obj.original.as_pointer()] = None
else:
# This code is for singular objects and for duplis that should be movable later in a viewport render
if not utils.is_instance_visible(dg_obj_instance, obj):
Expand All @@ -189,7 +189,7 @@ def duplicate_instances(self, instances, luxcore_scene):
We can only duplicate the instances *after* the scene_props were parsed so the base
objects are available for luxcore_scene. Needs to happen before this method is called.
"""
for obj, duplis in instances.items():
for duplis in instances.values():
if duplis is None:
# If duplis is None, then a non-exportable object like a curve with zero faces is being duplicated
continue
Expand Down

0 comments on commit 67a8a70

Please sign in to comment.