1 # SPDX-License-Identifier: GPL-2.0-or-later
4 "name": "Hotkey: 'Ctrl A'",
5 "description": "Apply Transform Menu",
6 "author": "pitiwazou, meta-androcto",
12 "category": "Apply Transform Pie"
16 from bpy
.types
import (
20 from bpy
.props
import EnumProperty
23 # Pie Apply Transforms - Ctrl + A
24 class PIE_MT_PieApplyTransforms(Menu
):
25 bl_idname
= "PIE_MT_applytransforms"
26 bl_label
= "Pie Apply Transforms"
28 def draw(self
, context
):
30 pie
= layout
.menu_pie()
32 pie
.operator("object.visual_transform_apply", text
="Apply Visual")
34 props
= pie
.operator("object.transform_apply", text
="Apply All")
35 props
.location
, props
.rotation
, props
.scale
= (True, True, True)
37 props
= pie
.operator("object.transform_apply", text
="Rotation/Scale")
38 props
.location
, props
.rotation
, props
.scale
= (False, True, True)
40 props
= pie
.operator("object.transform_apply", text
="Rotation")
41 props
.location
, props
.rotation
, props
.scale
= (False, True, False)
43 props
= pie
.operator("object.transform_apply", text
="Location")
44 props
.location
, props
.rotation
, props
.scale
= (True, False, False)
46 props
= pie
.operator("object.transform_apply", text
="Scale")
47 props
.location
, props
.rotation
, props
.scale
= (False, False, True)
49 pie
.operator("object.duplicates_make_real", text
="Make Instances Real")
51 pie
.menu("PIE_MT_clear_menu", text
="Clear Transform Menu")
55 class PIE_MT_ClearMenu(Menu
):
56 bl_idname
= "PIE_MT_clear_menu"
57 bl_label
= "Clear Menu"
59 def draw(self
, context
):
61 layout
.operator("clear.all", text
="Clear All", icon
='NONE')
62 layout
.operator("object.location_clear", text
="Clear Location", icon
='NONE')
63 layout
.operator("object.rotation_clear", text
="Clear Rotation", icon
='NONE')
64 layout
.operator("object.scale_clear", text
="Clear Scale", icon
='NONE')
65 layout
.operator("object.origin_clear", text
="Clear Origin", icon
='NONE')
69 class PIE_OT_ClearAll(Operator
):
70 bl_idname
= "clear.all"
71 bl_label
= "Clear All"
72 bl_description
= "Clear All Transforms"
73 bl_options
= {'REGISTER', 'UNDO'}
75 def execute(self
, context
):
76 bpy
.ops
.object.location_clear()
77 bpy
.ops
.object.rotation_clear()
78 bpy
.ops
.object.scale_clear()
83 PIE_MT_PieApplyTransforms
,
93 bpy
.utils
.register_class(cls
)
94 wm
= bpy
.context
.window_manager
96 if wm
.keyconfigs
.addon
:
98 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Object Mode')
99 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'A', 'PRESS', ctrl
=True)
100 kmi
.properties
.name
= "PIE_MT_applytransforms"
101 addon_keymaps
.append((km
, kmi
))
106 bpy
.utils
.unregister_class(cls
)
108 wm
= bpy
.context
.window_manager
109 kc
= wm
.keyconfigs
.addon
111 for km
, kmi
in addon_keymaps
:
112 km
.keymap_items
.remove(kmi
)
113 addon_keymaps
.clear()
116 if __name__
== "__main__":