diff options
author | Angus Stanton <abstanton> | 2021-03-19 13:20:57 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-03-19 13:24:27 +0300 |
commit | ae650b016f760b103670b3d2f3a18d150cd05ce5 (patch) | |
tree | dd4d50493e9457bf12651191c2141501315aded1 /release/scripts/startup/bl_operators | |
parent | de296e842932a1d746bfa4bc4f3e7e9cbf7fbf4b (diff) |
Fix T86208: copy node group button is inconsistent in geometry nodes
Differential Revision: https://developer.blender.org/D10740
Diffstat (limited to 'release/scripts/startup/bl_operators')
-rw-r--r-- | release/scripts/startup/bl_operators/geometry_nodes.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/geometry_nodes.py b/release/scripts/startup/bl_operators/geometry_nodes.py index 4ced3cb5957..0e7f8b7b1e7 100644 --- a/release/scripts/startup/bl_operators/geometry_nodes.py +++ b/release/scripts/startup/bl_operators/geometry_nodes.py @@ -91,7 +91,32 @@ class NewGeometryNodeTreeAssign(bpy.types.Operator): return {'FINISHED'} +class CopyGeometryNodeTreeAssign(bpy.types.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, ) |