Skip to content

Commit

Permalink
feat: add a hard apply & duplicate mesh alternative mode to the apply…
Browse files Browse the repository at this point in the history
… modifiers operator
  • Loading branch information
tristan-hm committed May 18, 2024
1 parent 81429e2 commit 7132c12
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/apply_modifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class ND_OT_apply_modifiers(bpy.types.Operator):
bl_idname = "nd.apply_modifiers"
bl_label = "Apply Modifiers"
bl_description = """Prepare the selected object(s) for destructive operations by applying applicable modifiers
SHIFT — Hard apply (apply all modifiers)"""
SHIFT — Hard apply (apply all modifiers)
ALT — Hard apply (duplicate mesh)"""
bl_options = {'UNDO'}


Expand All @@ -44,6 +45,9 @@ def poll(cls, context):


def execute(self, context):
if self.duplicate:
bpy.ops.object.duplicate()

bpy.ops.object.make_single_user(object=True, obdata=True, material=False, animation=False, obdata_animation=False)

for obj in context.selected_objects:
Expand All @@ -56,6 +60,7 @@ def execute(self, context):

def invoke(self, context, event):
self.hard_apply = event.shift
self.duplicate = event.alt

return self.execute(context)

Expand Down

0 comments on commit 7132c12

Please sign in to comment.