Cleanup: trailing space
[blender-addons.git] / space_view3d_spacebar_menu / transform_menus.py
bloba6438bd9251f799c84dadb31334730f5d976d294
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
18 # Contributed to by: meta-androcto, JayDez, sim88, sam, lijenstina, mkb, wisaac, CoDEmanX #
21 import bpy
22 from bpy.types import (
23 Operator,
24 Menu,
26 from bpy.props import (
27 BoolProperty,
28 StringProperty,
31 from .object_menus import *
34 # Transform Menu's #
35 class VIEW3D_MT_TransformMenu(Menu):
36 bl_label = "Transform"
38 def draw(self, context):
39 layout = self.layout
40 layout.operator("transform.translate", text="Move")
41 layout.operator("transform.rotate", text="Rotate")
42 layout.operator("transform.resize", text="Scale")
43 layout.separator()
44 layout.menu("VIEW3D_MT_object_clear")
45 layout.menu("VIEW3D_MT_object_apply")
46 layout.separator()
47 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
48 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
49 layout.separator()
50 layout.operator("object.randomize_transform")
51 layout.operator("transform.tosphere", text="To Sphere")
52 layout.operator("transform.shear", text="Shear")
53 layout.operator("transform.bend", text="Bend")
54 layout.operator("transform.push_pull", text="Push/Pull")
55 layout.separator()
56 layout.operator("object.align")
57 layout.operator_context = 'EXEC_REGION_WIN'
58 layout.operator("transform.transform",
59 text="Align to Transform Orientation").mode = 'ALIGN'
62 # ********** Transform Lite/Short **********
63 class VIEW3D_MT_TransformMenuLite(Menu):
64 bl_label = "Transform"
66 def draw(self, context):
67 layout = self.layout
68 layout.operator("transform.translate", text="Move")
69 layout.operator("transform.rotate", text="Rotate")
70 layout.operator("transform.resize", text="Scale")
71 layout.separator()
72 layout.menu("VIEW3D_MT_object_clear")
73 layout.menu("VIEW3D_MT_object_apply")
74 layout.separator()
75 layout.operator("transform.transform",
76 text="Align to Transform Orientation").mode = 'ALIGN'
77 layout.separator()
78 layout.operator("object.align")
79 layout.operator_context = 'EXEC_REGION_WIN'
80 layout.operator("transform.transform",
81 text="Align to Transform Orientation").mode = 'ALIGN'
83 # ********** Transform Camera **********
84 class VIEW3D_MT_TransformMenuCamera(Menu):
85 bl_label = "Transform"
87 def draw(self, context):
88 layout = self.layout
89 layout.menu("VIEW3D_MT_object_clear")
90 layout.menu("VIEW3D_MT_object_apply")
91 layout.operator("transform.translate", text="Move")
92 layout.operator("transform.rotate", text="Rotate")
93 layout.operator("transform.resize", text="Scale")
94 layout.operator("object.align")
95 layout.operator_context = 'EXEC_REGION_WIN'
96 layout.separator()
97 layout.operator("transform.transform",
98 text="Align to Transform Orientation").mode = 'ALIGN'
101 # ********** Transform Armature **********
102 class VIEW3D_MT_TransformMenuArmature(Menu):
103 bl_label = "Transform"
105 def draw(self, context):
106 layout = self.layout
107 layout.operator("transform.translate", text="Move")
108 layout.operator("transform.rotate", text="Rotate")
109 layout.operator("transform.resize", text="Scale")
110 layout.separator()
111 layout.operator("armature.align")
112 layout.operator("object.align")
113 layout.operator_context = 'EXEC_AREA'
114 layout.separator()
115 layout.operator("object.origin_set",
116 text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
117 layout.operator("object.origin_set",
118 text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
119 layout.operator("object.origin_set",
120 text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
121 layout.operator("object.origin_set",
122 text="Origin to Center of Mass").type = 'ORIGIN_CENTER_OF_MASS'
125 # List The Classes #
127 classes = (
128 VIEW3D_MT_TransformMenu,
129 VIEW3D_MT_TransformMenuArmature,
130 VIEW3D_MT_TransformMenuLite,
131 VIEW3D_MT_TransformMenuCamera,
135 # Register Classes & Hotkeys #
136 def register():
137 for cls in classes:
138 bpy.utils.register_class(cls)
141 # Unregister Classes & Hotkeys #
142 def unregister():
144 for cls in reversed(classes):
145 bpy.utils.unregister_class(cls)
148 if __name__ == "__main__":
149 register()