Skip to content

Commit

Permalink
handle proxies on mesh dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
ILoveAGoodCrisp committed Jan 17, 2025
1 parent 94f1727 commit ef6c3b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions blender/addons/io_scene_foundry/tools/instance_proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,26 @@ def execute(self, context):
self.parent = context.object
self.proxy_ob = bpy.data.objects[self.proxy]
self.scene_coll = context.scene.collection.objects
old_ob = None
if self.proxy_ob.nwo.proxy_parent != self.parent.data:
old_ob = self.proxy_ob
self.proxy_ob = self.proxy_ob.copy()
self.proxy_ob.data = self.proxy_ob.data.copy()
self.proxy_ob.nwo.proxy_parent = self.parent.data
for collection in old_ob.users_collection:
collection.objects.link(self.proxy_ob)
data_nwo = self.parent.data.nwo
if data_nwo.proxy_collision is not None:
if data_nwo.proxy_collision == old_ob:
data_nwo.proxy_collision = self.proxy_ob
self.linked_objects.append(data_nwo.proxy_collision)
self.scene_coll.link(data_nwo.proxy_collision)
data_nwo.proxy_collision.hide_set(False)
data_nwo.proxy_collision.select_set(True)
data_nwo.proxy_collision.matrix_world = self.parent.matrix_world
if data_nwo.proxy_cookie_cutter is not None:
if data_nwo.proxy_cookie_cutter == old_ob:
data_nwo.proxy_cookie_cutter = self.proxy_ob
self.linked_objects.append(data_nwo.proxy_cookie_cutter)
self.scene_coll.link(data_nwo.proxy_cookie_cutter)
data_nwo.proxy_cookie_cutter.hide_set(False)
Expand All @@ -60,6 +72,9 @@ def execute(self, context):
for i in range(10):
phys = getattr(data_nwo, f"proxy_physics{i}", None)
if phys is not None:
if phys == old_ob:
setattr(data_nwo, f"proxy_physics{i}", self.proxy_ob)
phys = self.proxy_ob
self.linked_objects.append(phys)
self.scene_coll.link(phys)
phys.hide_set(False)
Expand Down

0 comments on commit ef6c3b0

Please sign in to comment.