1 # SPDX-FileCopyrightText: 2019-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.types
import (
10 from bpy
.props
import (
15 from .object_menus
import *
19 class VIEW3D_MT_TransformMenu(Menu
):
20 bl_label
= "Transform"
22 def draw(self
, context
):
24 layout
.operator("transform.translate", text
="Move")
25 layout
.operator("transform.rotate", text
="Rotate")
26 layout
.operator("transform.resize", text
="Scale")
28 layout
.menu("VIEW3D_MT_object_clear")
29 layout
.menu("VIEW3D_MT_object_apply")
31 layout
.operator("transform.translate", text
="Move Texture Space").texture_space
= True
32 layout
.operator("transform.resize", text
="Scale Texture Space").texture_space
= True
34 layout
.operator("object.randomize_transform")
35 layout
.operator("transform.tosphere", text
="To Sphere")
36 layout
.operator("transform.shear", text
="Shear")
37 layout
.operator("transform.bend", text
="Bend")
38 layout
.operator("transform.push_pull", text
="Push/Pull")
40 layout
.operator("object.align")
41 layout
.operator_context
= 'EXEC_REGION_WIN'
42 layout
.operator("transform.transform",
43 text
="Align to Transform Orientation").mode
= 'ALIGN'
46 # ********** Transform Lite/Short **********
47 class VIEW3D_MT_TransformMenuLite(Menu
):
48 bl_label
= "Transform"
50 def draw(self
, context
):
52 layout
.operator("transform.translate", text
="Move")
53 layout
.operator("transform.rotate", text
="Rotate")
54 layout
.operator("transform.resize", text
="Scale")
56 layout
.menu("VIEW3D_MT_object_clear")
57 layout
.menu("VIEW3D_MT_object_apply")
59 layout
.operator("transform.transform",
60 text
="Align to Transform Orientation").mode
= 'ALIGN'
62 layout
.operator("object.align")
63 layout
.operator_context
= 'EXEC_REGION_WIN'
64 layout
.operator("transform.transform",
65 text
="Align to Transform Orientation").mode
= 'ALIGN'
67 # ********** Transform Camera **********
68 class VIEW3D_MT_TransformMenuCamera(Menu
):
69 bl_label
= "Transform"
71 def draw(self
, context
):
73 layout
.menu("VIEW3D_MT_object_clear")
74 layout
.menu("VIEW3D_MT_object_apply")
75 layout
.operator("transform.translate", text
="Move")
76 layout
.operator("transform.rotate", text
="Rotate")
77 layout
.operator("transform.resize", text
="Scale")
78 layout
.operator("object.align")
79 layout
.operator_context
= 'EXEC_REGION_WIN'
81 layout
.operator("transform.transform",
82 text
="Align to Transform Orientation").mode
= 'ALIGN'
85 # ********** Transform Armature **********
86 class VIEW3D_MT_TransformMenuArmature(Menu
):
87 bl_label
= "Transform"
89 def draw(self
, context
):
91 layout
.operator("transform.translate", text
="Move")
92 layout
.operator("transform.rotate", text
="Rotate")
93 layout
.operator("transform.resize", text
="Scale")
95 layout
.operator("armature.align")
96 layout
.operator("object.align")
97 layout
.operator_context
= 'EXEC_AREA'
99 layout
.operator("object.origin_set",
100 text
="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
101 layout
.operator("object.origin_set",
102 text
="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
103 layout
.operator("object.origin_set",
104 text
="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
105 layout
.operator("object.origin_set",
106 text
="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
112 VIEW3D_MT_TransformMenu
,
113 VIEW3D_MT_TransformMenuArmature
,
114 VIEW3D_MT_TransformMenuLite
,
115 VIEW3D_MT_TransformMenuCamera
,
119 # Register Classes & Hotkeys #
122 bpy
.utils
.register_class(cls
)
125 # Unregister Classes & Hotkeys #
128 for cls
in reversed(classes
):
129 bpy
.utils
.unregister_class(cls
)
132 if __name__
== "__main__":