Asset Pipeline v2 #145
@ -159,6 +159,7 @@ def init_modifiers(scene, obj):
|
|||||||
|
|
||||||
def transfer_modifier(modifier_name, target_obj, source_obj):
|
def transfer_modifier(modifier_name, target_obj, source_obj):
|
||||||
# remove old and sync existing modifiers
|
# remove old and sync existing modifiers
|
||||||
|
context = bpy.context # TODO PASS CONTEXT
|
||||||
old_mod = target_obj.modifiers.get(modifier_name)
|
old_mod = target_obj.modifiers.get(modifier_name)
|
||||||
if old_mod:
|
if old_mod:
|
||||||
target_obj.modifiers.remove(old_mod)
|
target_obj.modifiers.remove(old_mod)
|
||||||
@ -174,9 +175,8 @@ def transfer_modifier(modifier_name, target_obj, source_obj):
|
|||||||
for target_mod_i, target_mod in enumerate(target_obj.modifiers):
|
for target_mod_i, target_mod in enumerate(target_obj.modifiers):
|
||||||
if target_mod.name == name_prev:
|
if target_mod.name == name_prev:
|
||||||
idx = target_mod_i + 1
|
idx = target_mod_i + 1
|
||||||
bpy.ops.object.modifier_move_to_index(
|
with context.temp_override(object=target_obj):
|
||||||
{'object': target_obj}, modifier=mod_new.name, index=idx
|
bpy.ops.object.modifier_move_to_index(modifier=mod_new.name, index=idx)
|
||||||
)
|
|
||||||
mod_target = target_obj.modifiers.get(mod.name)
|
mod_target = target_obj.modifiers.get(mod.name)
|
||||||
props = [p.identifier for p in mod.bl_rna.properties if not p.is_readonly]
|
props = [p.identifier for p in mod.bl_rna.properties if not p.is_readonly]
|
||||||
for prop in props:
|
for prop in props:
|
||||||
|
Loading…
Reference in New Issue
Block a user