Fix T94559: Copying geometry node group does not copy animation data
Reimplement copy geometry node groups in C. The version implemented in Python could also manually copy the animation data, but it's more standard to do this with `BKE_id_copy_ex` and `LIB_ID_COPY_ACTIONS`. Differential Revision: https://developer.blender.org/D14615
This commit is contained in:
committed by
Hans Goudey
parent
ef2b8c1c3a
commit
ccd2e89d37
@@ -83,32 +83,7 @@ class NewGeometryNodeTreeAssign(Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CopyGeometryNodeTreeAssign(Operator):
|
||||
"""Copy the active geometry node group and assign it to the active modifier"""
|
||||
|
||||
bl_idname = "node.copy_geometry_node_group_assign"
|
||||
bl_label = "Copy Geometry Node Group"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return geometry_modifier_poll(context)
|
||||
|
||||
def execute(self, context):
|
||||
modifier = context.object.modifiers.active
|
||||
if modifier is None:
|
||||
return {'CANCELLED'}
|
||||
|
||||
group = modifier.node_group
|
||||
if group is None:
|
||||
return {'CANCELLED'}
|
||||
|
||||
modifier.node_group = group.copy()
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
classes = (
|
||||
NewGeometryNodesModifier,
|
||||
NewGeometryNodeTreeAssign,
|
||||
CopyGeometryNodeTreeAssign,
|
||||
)
|
||||
|
||||
@@ -149,7 +149,7 @@ class NODE_HT_header(Header):
|
||||
active_modifier = ob.modifiers.active
|
||||
if active_modifier and active_modifier.type == 'NODES':
|
||||
if active_modifier.node_group:
|
||||
row.template_ID(active_modifier, "node_group", new="node.copy_geometry_node_group_assign")
|
||||
row.template_ID(active_modifier, "node_group", new="object.geometry_node_tree_copy_assign")
|
||||
else:
|
||||
row.template_ID(active_modifier, "node_group", new="node.new_geometry_node_group_assign")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user