1 # SPDX-FileCopyrightText: 2016-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 "name": "Hotkey: 'Ctrl A'",
7 "description": "Apply Transform Menu",
8 "author": "pitiwazou, meta-androcto",
10 "blender": (2, 80, 0),
11 "location": "3D View",
14 "category": "Apply Transform Pie"
18 from bpy
.types
import (
22 from bpy
.props
import EnumProperty
25 # Pie Apply Transforms - Ctrl + A
26 class PIE_MT_PieApplyTransforms(Menu
):
27 bl_idname
= "PIE_MT_applytransforms"
28 bl_label
= "Pie Apply Transforms"
30 def draw(self
, context
):
32 pie
= layout
.menu_pie()
34 pie
.operator("object.visual_transform_apply", text
="Apply Visual")
36 props
= pie
.operator("object.transform_apply", text
="Apply All")
37 props
.location
, props
.rotation
, props
.scale
= (True, True, True)
39 props
= pie
.operator("object.transform_apply", text
="Rotation/Scale")
40 props
.location
, props
.rotation
, props
.scale
= (False, True, True)
42 props
= pie
.operator("object.transform_apply", text
="Rotation")
43 props
.location
, props
.rotation
, props
.scale
= (False, True, False)
45 props
= pie
.operator("object.transform_apply", text
="Location")
46 props
.location
, props
.rotation
, props
.scale
= (True, False, False)
48 props
= pie
.operator("object.transform_apply", text
="Scale")
49 props
.location
, props
.rotation
, props
.scale
= (False, False, True)
51 pie
.operator("object.duplicates_make_real", text
="Make Instances Real")
53 pie
.menu("PIE_MT_clear_menu", text
="Clear Transform Menu")
57 class PIE_MT_ClearMenu(Menu
):
58 bl_idname
= "PIE_MT_clear_menu"
59 bl_label
= "Clear Menu"
61 def draw(self
, context
):
63 layout
.operator("clear.all", text
="Clear All", icon
='NONE')
64 layout
.operator("object.location_clear", text
="Clear Location", icon
='NONE')
65 layout
.operator("object.rotation_clear", text
="Clear Rotation", icon
='NONE')
66 layout
.operator("object.scale_clear", text
="Clear Scale", icon
='NONE')
67 layout
.operator("object.origin_clear", text
="Clear Origin", icon
='NONE')
71 class PIE_OT_ClearAll(Operator
):
72 bl_idname
= "clear.all"
73 bl_label
= "Clear All"
74 bl_description
= "Clear All Transforms"
75 bl_options
= {'REGISTER', 'UNDO'}
77 def execute(self
, context
):
78 bpy
.ops
.object.location_clear()
79 bpy
.ops
.object.rotation_clear()
80 bpy
.ops
.object.scale_clear()
85 PIE_MT_PieApplyTransforms
,
95 bpy
.utils
.register_class(cls
)
96 wm
= bpy
.context
.window_manager
98 if wm
.keyconfigs
.addon
:
100 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Object Mode')
101 kmi
= km
.keymap_items
.new('wm.call_menu_pie', 'A', 'PRESS', ctrl
=True)
102 kmi
.properties
.name
= "PIE_MT_applytransforms"
103 addon_keymaps
.append((km
, kmi
))
108 bpy
.utils
.unregister_class(cls
)
110 wm
= bpy
.context
.window_manager
111 kc
= wm
.keyconfigs
.addon
113 for km
, kmi
in addon_keymaps
:
114 km
.keymap_items
.remove(kmi
)
115 addon_keymaps
.clear()
118 if __name__
== "__main__":