mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-30 15:17:00 +00:00
Compare commits
2 Commits
1c51d10da7
...
7584078f6d
Author | SHA1 | Date | |
---|---|---|---|
|
7584078f6d | ||
|
87c03657e5 |
Binary file not shown.
@ -28,13 +28,14 @@ def remove_unwanted_custom_properties(object):
|
|||||||
def duplicate_object(object):
|
def duplicate_object(object):
|
||||||
obj_copy = object.copy()
|
obj_copy = object.copy()
|
||||||
# FIXME: orphan data comes from this one
|
# FIXME: orphan data comes from this one
|
||||||
if object.data:
|
"""if object.data:
|
||||||
data = object.data.copy()
|
data = object.data.copy()
|
||||||
obj_copy.data = data
|
obj_copy.data = data"""
|
||||||
if object.animation_data and object.animation_data.action:
|
copy_animation_data(object, obj_copy)
|
||||||
|
"""if object.animation_data and object.animation_data.action:
|
||||||
if obj_copy.animation_data == None:
|
if obj_copy.animation_data == None:
|
||||||
obj_copy.animation_data_create()
|
obj_copy.animation_data_create()
|
||||||
obj_copy.animation_data.action = object.animation_data.action.copy()
|
obj_copy.animation_data.action = object.animation_data.action.copy()"""
|
||||||
return obj_copy
|
return obj_copy
|
||||||
|
|
||||||
# TODO: rename actions
|
# TODO: rename actions
|
||||||
@ -43,13 +44,13 @@ def copy_animation_data(source, target):
|
|||||||
data = source.data.copy()
|
data = source.data.copy()
|
||||||
target.data = data"""
|
target.data = data"""
|
||||||
if source.animation_data and source.animation_data.action:
|
if source.animation_data and source.animation_data.action:
|
||||||
print("source", source.animation_data.action.name)
|
print("current action name", source.animation_data.action.name)
|
||||||
print("copying animation data for", source.name, target.animation_data)
|
print("copying animation data from", source.name, "to", target.name)
|
||||||
|
|
||||||
|
|
||||||
if target.animation_data == None:
|
"""if target.animation_data == None:
|
||||||
target.animation_data_create()
|
target.animation_data_create()
|
||||||
target.animation_data.action = source.animation_data.action.copy()
|
target.animation_data.action = source.animation_data.action.copy()"""
|
||||||
# alternative method, using the build in link animation operator
|
# alternative method, using the build in link animation operator
|
||||||
with bpy.context.temp_override(active_object=source, selected_editable_objects=[target]):
|
with bpy.context.temp_override(active_object=source, selected_editable_objects=[target]):
|
||||||
bpy.ops.object.make_links_data(type='ANIMATION')
|
bpy.ops.object.make_links_data(type='ANIMATION')
|
||||||
|
Loading…
Reference in New Issue
Block a user