patch from William
[blender-staging.git] / release / ui / space_view3d_toolbar.py
1
2 import bpy
3
4 # ********** default tools for objectmode ****************
5
6 class View3DPanel(bpy.types.Panel):
7         __space_type__ = "VIEW_3D"
8         __region_type__ = "TOOLS"
9         __context__ = "objectmode"
10
11 class VIEW3D_PT_tools_objectmode(View3DPanel):
12         __idname__ = "VIEW3D_PT_tools_objectmode"
13         __label__ = "Object Tools"
14
15         def draw(self, context):
16                 layout = self.layout
17
18                 layout.row().itemO("object.duplicate")
19                 layout.row().itemO("object.delete")
20                 layout.row().itemO("object.mesh_add")
21                 layout.row().itemO("object.curve_add")
22                 layout.row().itemO("object.text_add")
23                 layout.row().itemO("object.surface_add")
24
25 # ********** default tools for editmode_mesh ****************
26
27 class View3DPanel(bpy.types.Panel):
28         __space_type__ = "VIEW_3D"
29         __region_type__ = "TOOLS"
30         __context__ = "editmode_mesh"
31
32 class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
33         __idname__ = "VIEW3D_PT_tools_editmode_mesh"
34         __label__ = "Mesh Tools"
35
36         def draw(self, context):
37                 layout = self.layout
38
39                 layout.row().itemO("mesh.duplicate")
40                 layout.row().itemO("mesh.delete")
41                 layout.row().itemO("mesh.spin")
42                 layout.row().itemO("mesh.screw")
43                 layout.row().itemO("mesh.primitive_plane_add")
44                 layout.row().itemO("mesh.primitive_cube_add")
45                 layout.row().itemO("mesh.primitive_circle_add")
46                 layout.row().itemO("mesh.primitive_cylinder_add")
47
48 # ********** default tools for editmode_curve ****************
49
50 class View3DPanel(bpy.types.Panel):
51         __space_type__ = "VIEW_3D"
52         __region_type__ = "TOOLS"
53         __context__ = "editmode_curve"
54
55 class VIEW3D_PT_tools_editmode_curve(View3DPanel):
56         __idname__ = "VIEW3D_PT_tools_editmode_curve"
57         __label__ = "Curve Tools"
58
59         def draw(self, context):
60                 layout = self.layout
61
62                 layout.row().itemO("curve.duplicate")
63                 layout.row().itemO("curve.delete")
64                 layout.row().itemO("object.curve_add")
65                 layout.row().itemO("curve.subdivide")
66
67 # ********** default tools for editmode_surface ****************
68
69 class View3DPanel(bpy.types.Panel):
70         __space_type__ = "VIEW_3D"
71         __region_type__ = "TOOLS"
72         __context__ = "editmode_surface"
73
74 class VIEW3D_PT_tools_editmode_surface(View3DPanel):
75         __idname__ = "VIEW3D_PT_tools_editmode_surface"
76         __label__ = "Surface Tools"
77
78         def draw(self, context):
79                 layout = self.layout
80
81                 layout.row().itemO("curve.duplicate")
82                 layout.row().itemO("curve.delete")
83                 layout.row().itemO("object.surface_add")
84                 layout.row().itemO("curve.subdivide")
85
86 # ********** default tools for editmode_text ****************
87
88 class View3DPanel(bpy.types.Panel):
89         __space_type__ = "VIEW_3D"
90         __region_type__ = "TOOLS"
91         __context__ = "editmode_text"
92
93 class VIEW3D_PT_tools_editmode_text(View3DPanel):
94         __idname__ = "VIEW3D_PT_tools_editmode_text"
95         __label__ = "Text Tools"
96
97         def draw(self, context):
98                 layout = self.layout
99
100                 layout.row().itemO("font.text_copy")
101                 layout.row().itemO("font.text_paste")
102                 layout.row().itemO("font.case_set")
103                 layout.row().itemO("font.style_toggle")
104
105 # ********** default tools for editmode_armature ****************
106
107 class View3DPanel(bpy.types.Panel):
108         __space_type__ = "VIEW_3D"
109         __region_type__ = "TOOLS"
110         __context__ = "editmode_armature"
111
112 class VIEW3D_PT_tools_editmode_armature(View3DPanel):
113         __idname__ = "VIEW3D_PT_tools_editmode_armature"
114         __label__ = "Armature Tools"
115
116         def draw(self, context):
117                 layout = self.layout
118
119                 layout.row().itemO("armature.duplicate_selected")
120                 layout.row().itemO("armature.bone_primitive_add")
121                 layout.row().itemO("armature.delete")
122                 layout.row().itemO("armature.parent_clear")
123
124 # ********** default tools for editmode_mball ****************
125
126 class View3DPanel(bpy.types.Panel):
127         __space_type__ = "VIEW_3D"
128         __region_type__ = "TOOLS"
129         __context__ = "editmode_mball"
130
131 class VIEW3D_PT_tools_editmode_mball(View3DPanel):
132         __idname__ = "VIEW3D_PT_tools_editmode_mball"
133         __label__ = "Meta Tools"
134
135         def draw(self, context):
136                 layout = self.layout
137
138                 row = layout.row()
139
140 # ********** default tools for editmode_lattice ****************
141
142 class View3DPanel(bpy.types.Panel):
143         __space_type__ = "VIEW_3D"
144         __region_type__ = "TOOLS"
145         __context__ = "editmode_lattice"
146
147 class VIEW3D_PT_tools_editmode_lattice(View3DPanel):
148         __idname__ = "VIEW3D_PT_tools_editmode_lattice"
149         __label__ = "Lattice Tools"
150
151         def draw(self, context):
152                 layout = self.layout
153
154                 row = layout.row()
155
156 # ********** default tools for posemode ****************
157
158 class View3DPanel(bpy.types.Panel):
159         __space_type__ = "VIEW_3D"
160         __region_type__ = "TOOLS"
161         __context__ = "posemode"
162
163 class VIEW3D_PT_tools_posemode(View3DPanel):
164         __idname__ = "VIEW3D_PT_tools_posemode"
165         __label__ = "Pose Tools"
166
167         def draw(self, context):
168                 layout = self.layout
169
170                 layout.row().itemO("pose.hide")
171                 layout.row().itemO("pose.reveal")
172                 layout.row().itemO("pose.rot_clear")
173                 layout.row().itemO("pose.loc_clear")
174
175 # ********** default tools for sculptmode ****************
176
177 class View3DPanel(bpy.types.Panel):
178         __space_type__ = "VIEW_3D"
179         __region_type__ = "TOOLS"
180         __context__ = "sculptmode"
181
182 #class VIEW3D_PT_tools_sculptmode(View3DPanel):
183 #       __idname__ = "VIEW3D_PT_tools_sculptmode"
184 #       __label__ = "Sculpt Tools"
185 #
186 #       def draw(self, context):
187 #               layout = self.layout
188 #
189 #               layout.row().itemO("sculpt.radial_control")
190
191 class VIEW3D_PT_tools_brush(bpy.types.Panel):
192         __space_type__ = "VIEW_3D"
193         __region_type__ = "TOOLS"
194         __label__ = "Brush"
195
196         def brush_src(self, context):
197                 ts = context.scene.tool_settings
198                 if context.sculpt_object:
199                         return ts.sculpt
200                 elif context.vpaint_object:
201                         return ts.vpaint
202                 elif context.wpaint_object:
203                         return ts.wpaint
204                 return False
205
206         def poll(self, context):
207                 return self.brush_src(context)
208
209         def draw(self, context):
210                 src = self.brush_src(context)
211                 brush = src.brush
212                 layout = self.layout
213
214                 layout.split().row().template_ID(src, "brush")
215
216                 if context.sculpt_object:
217                         layout.column().itemR(brush, "sculpt_tool", expand=True)
218
219                 split = layout.split()
220                 col = split.column()
221                 col.itemR(brush, "size", slider=True)
222                 if context.wpaint_object:
223                         col.itemR(context.scene.tool_settings, "vertex_group_weight", text="Weight", slider=True)
224                 col.itemR(brush, "strength", slider=True)
225
226
227
228                 split = layout.split()
229                 col = split.column()
230                 col.itemR(brush, "airbrush")
231                 col.itemR(brush, "anchored")
232                 col.itemR(brush, "rake")
233                 col.itemR(brush, "space", text="Spacing")
234                 colsub = col.column()
235                 colsub.active = brush.space
236                 colsub.itemR(brush, "spacing", text="")
237
238                 split = layout.split()
239                 split.template_curve_mapping(brush.curve)
240                 
241 class VIEW3D_PT_sculptoptions(bpy.types.Panel):
242         __space_type__ = "VIEW_3D"
243         __region_type__ = "TOOLS"
244         __label__ = "Options"
245
246         def poll(self, context):
247                 return context.sculpt_object
248
249         def draw(self, context):
250                 sculpt = context.scene.tool_settings.sculpt
251
252                 split = self.layout.split()
253                 
254                 col = split.column()
255                 col.itemL(text="Symmetry:")
256                 row = col.row(align=True)
257                 row.itemR(sculpt, "symmetry_x", text="X", toggle=True)
258                 row.itemR(sculpt, "symmetry_y", text="Y", toggle=True)
259                 row.itemR(sculpt, "symmetry_z", text="Z", toggle=True)
260
261                 split = self.layout.split()
262                 
263                 col = split.column()
264                 col.itemL(text="Lock Axis:")
265                 row = col.row(align=True)
266                 row.itemR(sculpt, "lock_x", text="X", toggle=True)
267                 row.itemR(sculpt, "lock_y", text="Y", toggle=True)
268                 row.itemR(sculpt, "lock_z", text="Z", toggle=True)
269
270
271 # ********** default tools for weightpaint ****************
272
273 class View3DPanel(bpy.types.Panel):
274         __space_type__ = "VIEW_3D"
275         __region_type__ = "TOOLS"
276         __context__ = "weightpaint"
277
278 class VIEW3D_PT_tools_weightpaint(View3DPanel):
279         __idname__ = "VIEW3D_PT_tools_weightpaint"
280         __label__ = "Weight Paint Tools"
281
282         def draw(self, context):
283                 layout = self.layout
284
285                 layout.row().itemO("paint.weight_paint_radial_control")
286
287 # ********** default tools for vertexpaint ****************
288
289 class View3DPanel(bpy.types.Panel):
290         __space_type__ = "VIEW_3D"
291         __region_type__ = "TOOLS"
292         __context__ = "vertexpaint"
293
294 class VIEW3D_PT_tools_vertexpaint(View3DPanel):
295         __idname__ = "VIEW3D_PT_tools_vertexpaint"
296         __label__ = "Vertex Paint Tools"
297
298         def draw(self, context):
299                 layout = self.layout
300
301                 layout.row().itemO("paint.vertex_paint_radial_control")
302
303 # ********** default tools for texturepaint ****************
304
305 class View3DPanel(bpy.types.Panel):
306         __space_type__ = "VIEW_3D"
307         __region_type__ = "TOOLS"
308         __context__ = "texturepaint"
309
310 class VIEW3D_PT_tools_texturepaint(View3DPanel):
311         __idname__ = "VIEW3D_PT_tools_texturepaint"
312         __label__ = "Texture Paint Tools"
313
314         def draw(self, context):
315                 layout = self.layout
316
317                 layout.row().itemO("paint.texture_paint_radial_control")
318
319
320 bpy.types.register(VIEW3D_PT_tools_objectmode)
321 bpy.types.register(VIEW3D_PT_tools_editmode_mesh)
322 bpy.types.register(VIEW3D_PT_tools_editmode_curve)
323 bpy.types.register(VIEW3D_PT_tools_editmode_surface)
324 bpy.types.register(VIEW3D_PT_tools_editmode_text)
325 bpy.types.register(VIEW3D_PT_tools_editmode_armature)
326 bpy.types.register(VIEW3D_PT_tools_editmode_mball)
327 bpy.types.register(VIEW3D_PT_tools_editmode_lattice)
328 bpy.types.register(VIEW3D_PT_tools_posemode)
329 bpy.types.register(VIEW3D_PT_tools_brush)
330 bpy.types.register(VIEW3D_PT_sculptoptions)
331 bpy.types.register(VIEW3D_PT_tools_weightpaint)
332 bpy.types.register(VIEW3D_PT_tools_vertexpaint)
333 bpy.types.register(VIEW3D_PT_tools_texturepaint)
334
335