Toolbar
[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.itemL(text="Transform:")
19                 
20                 split = layout.split()
21                 col = split.column(align=True)
22                 col.itemO("tfm.translate")
23                 col.itemO("tfm.rotate")
24                 col.itemO("tfm.resize", text="Scale")
25                 
26                 layout.itemL(text="Object:")
27                 
28                 split = layout.split()
29                 col = split.column(align=True)
30                 col.itemO("object.duplicate")
31                 col.itemO("object.delete")
32                 
33                 layout.itemL(text="Keyframes:")
34                 
35                 split = layout.split()
36                 col = split.column(align=True)
37                 col.itemO("anim.insert_keyframe_menu", text="Insert")
38                 col.itemO("anim.delete_keyframe_v3d", text="Remove")
39
40 # ********** default tools for editmode_mesh ****************
41
42 class View3DPanel(bpy.types.Panel):
43         __space_type__ = "VIEW_3D"
44         __region_type__ = "TOOLS"
45         __context__ = "editmode_mesh"
46
47 class VIEW3D_PT_tools_editmode_mesh(View3DPanel):
48         __idname__ = "VIEW3D_PT_tools_editmode_mesh"
49         __label__ = "Mesh Tools"
50
51         def draw(self, context):
52                 layout = self.layout
53                 layout.itemL(text="Transform:")
54                 
55                 split = layout.split()
56                 col = split.column(align=True)
57                 col.itemO("tfm.translate")
58                 col.itemO("tfm.rotate")
59                 col.itemO("tfm.resize", text="Scale")
60                 
61                 layout.itemL(text="Mesh:")
62                 split = layout.split()
63                 col = split.column(align=True)
64                 col.itemO("mesh.duplicate")
65                 col.itemO("mesh.delete")
66                 
67                 layout.itemL(text="Modeling:")
68                 split = layout.split()
69                 col = split.column(align=True)
70                 col.itemO("mesh.extrude")
71                 col.itemO("mesh.subdivide")
72                 col.itemO("mesh.spin")
73                 col.itemO("mesh.screw")
74                 
75                 layout.itemL(text="Shading:")
76                 
77                 split = layout.split()
78                 col = split.column(align=True)
79                 col.itemO("mesh.faces_shade_smooth", text="Smooth")
80                 col.itemO("mesh.faces_shade_flat", text="Flat")
81                 
82                 layout.itemL(text="UV Mapping:")
83                 
84                 split = layout.split()
85                 col = split.column(align=True)
86                 col.itemO("uv.mapping_menu", text="Unwrap")
87                 col.itemO("mesh.uvs_rotate")
88                 col.itemO("mesh.uvs_mirror")
89
90 # ********** default tools for editmode_curve ****************
91
92 class View3DPanel(bpy.types.Panel):
93         __space_type__ = "VIEW_3D"
94         __region_type__ = "TOOLS"
95         __context__ = "editmode_curve"
96
97 class VIEW3D_PT_tools_editmode_curve(View3DPanel):
98         __idname__ = "VIEW3D_PT_tools_editmode_curve"
99         __label__ = "Curve Tools"
100
101         def draw(self, context):
102                 layout = self.layout
103                 layout.itemL(text="Transform:")
104                 
105                 split = layout.split()
106                 col = split.column(align=True)
107                 col.itemO("tfm.translate")
108                 col.itemO("tfm.rotate")
109                 col.itemO("tfm.resize", text="Scale")
110                 
111                 layout.itemL(text="Curve:")
112                 split = layout.split()
113                 col = split.column(align=True)
114                 col.itemO("curve.duplicate")
115                 col.itemO("curve.delete")
116                 col.itemO("curve.cyclic_toggle")
117                 col.itemO("curve.switch_direction")
118                 
119                 layout.itemL(text="Modeling:")
120                 split = layout.split()
121                 col = split.column(align=True)
122                 col.itemO("curve.extrude")
123                 col.itemO("curve.subdivide")
124
125 # ********** default tools for editmode_surface ****************
126
127 class View3DPanel(bpy.types.Panel):
128         __space_type__ = "VIEW_3D"
129         __region_type__ = "TOOLS"
130         __context__ = "editmode_surface"
131
132 class VIEW3D_PT_tools_editmode_surface(View3DPanel):
133         __idname__ = "VIEW3D_PT_tools_editmode_surface"
134         __label__ = "Surface Tools"
135
136         def draw(self, context):
137                 layout = self.layout
138                 layout.itemL(text="Transform:")
139                 split = layout.split()
140                 col = split.column(align=True)
141                 col.itemO("tfm.translate")
142                 col.itemO("tfm.rotate")
143                 col.itemO("tfm.resize", text="Scale")
144                 
145                 layout.itemL(text="Curve:")
146                 split = layout.split()
147                 col = split.column(align=True)
148                 col.itemO("curve.duplicate")
149                 col.itemO("curve.delete")
150                 col.itemO("curve.cyclic_toggle")
151                 col.itemO("curve.switch_direction")
152                 
153                 layout.itemL(text="Modeling:")
154                 split = layout.split()
155                 col = split.column(align=True)
156                 col.itemO("curve.extrude")
157                 col.itemO("curve.subdivide")
158
159 # ********** default tools for editmode_text ****************
160
161 class View3DPanel(bpy.types.Panel):
162         __space_type__ = "VIEW_3D"
163         __region_type__ = "TOOLS"
164         __context__ = "editmode_text"
165
166 class VIEW3D_PT_tools_editmode_text(View3DPanel):
167         __idname__ = "VIEW3D_PT_tools_editmode_text"
168         __label__ = "Text Tools"
169
170         def draw(self, context):
171                 layout = self.layout
172
173                 layout.row().itemO("font.text_copy")
174                 layout.row().itemO("font.text_paste")
175                 layout.row().itemO("font.case_set")
176                 layout.row().itemO("font.style_toggle")
177
178 # ********** default tools for editmode_armature ****************
179
180 class View3DPanel(bpy.types.Panel):
181         __space_type__ = "VIEW_3D"
182         __region_type__ = "TOOLS"
183         __context__ = "editmode_armature"
184
185 class VIEW3D_PT_tools_editmode_armature(View3DPanel):
186         __idname__ = "VIEW3D_PT_tools_editmode_armature"
187         __label__ = "Armature Tools"
188
189         def draw(self, context):
190                 layout = self.layout
191                 layout.itemL(text="Transform:")
192                 split = layout.split()
193                 col = split.column(align=True)
194                 col.itemO("tfm.translate")
195                 col.itemO("tfm.rotate")
196                 col.itemO("tfm.resize", text="Scale")
197                 
198                 layout.itemL(text="Bones:")
199                 split = layout.split()
200                 col = split.column(align=True)
201                 col.itemO("armature.bone_primitive_add", text="Add")
202                 col.itemO("armature.duplicate_selected", text="Duplicate")
203                 col.itemO("armature.delete", text="Delete")
204                 
205                 layout.itemL(text="Modeling:")
206                 split = layout.split()
207                 col = split.column(align=True)
208                 col.itemO("armature.extrude")
209                 
210                 
211 # ********** default tools for editmode_mball ****************
212
213 class View3DPanel(bpy.types.Panel):
214         __space_type__ = "VIEW_3D"
215         __region_type__ = "TOOLS"
216         __context__ = "editmode_mball"
217
218 class VIEW3D_PT_tools_editmode_mball(View3DPanel):
219         __idname__ = "VIEW3D_PT_tools_editmode_mball"
220         __label__ = "Meta Tools"
221
222         def draw(self, context):
223                 layout = self.layout
224                 layout.itemL(text="Transform:")
225                 split = layout.split()
226                 col = split.column(align=True)
227                 col.itemO("tfm.translate")
228                 col.itemO("tfm.rotate")
229                 col.itemO("tfm.resize", text="Scale")
230
231 # ********** default tools for editmode_lattice ****************
232
233 class View3DPanel(bpy.types.Panel):
234         __space_type__ = "VIEW_3D"
235         __region_type__ = "TOOLS"
236         __context__ = "editmode_lattice"
237
238 class VIEW3D_PT_tools_editmode_lattice(View3DPanel):
239         __idname__ = "VIEW3D_PT_tools_editmode_lattice"
240         __label__ = "Lattice Tools"
241
242         def draw(self, context):
243                 layout = self.layout
244                 layout.itemL(text="Transform:")
245                 split = layout.split()
246                 col = split.column(align=True)
247                 col.itemO("tfm.translate")
248                 col.itemO("tfm.rotate")
249                 col.itemO("tfm.resize", text="Scale")
250
251 # ********** default tools for posemode ****************
252
253 class View3DPanel(bpy.types.Panel):
254         __space_type__ = "VIEW_3D"
255         __region_type__ = "TOOLS"
256         __context__ = "posemode"
257
258 class VIEW3D_PT_tools_posemode(View3DPanel):
259         __idname__ = "VIEW3D_PT_tools_posemode"
260         __label__ = "Pose Tools"
261
262         def draw(self, context):
263                 layout = self.layout
264                 layout.itemL(text="Transform:")
265                 split = layout.split()
266                 col = split.column(align=True)
267                 col.itemO("tfm.translate")
268                 col.itemO("tfm.rotate")
269                 col.itemO("tfm.resize", text="Scale")
270                 
271                 layout.itemL(text="Bones:")
272                 split = layout.split()
273                 col = split.column(align=True)
274                 col.itemO("pose.hide", text="Hide")
275                 col.itemO("pose.reveal", text="Reveal")
276                 
277                 layout.itemL(text="Keyframes:")
278                 
279                 split = layout.split()
280                 col = split.column(align=True)
281                 col.itemO("anim.insert_keyframe_menu", text="Insert")
282                 col.itemO("anim.delete_keyframe_v3d", text="Remove")
283                 
284                 layout.itemL(text="Pose:")
285                 
286                 split = layout.split()
287                 col = split.column(align=True)
288                 col.itemO("pose.copy", text="Copy")
289                 col.itemO("pose.paste", text="Paste")
290                 col.itemO("poselib.pose_add", text="Add to Library")
291                 col.itemO("poselib.pose_remove", text="Remove From Library")
292
293 # ********** default tools for paint modes ****************
294
295
296 class VIEW3D_PT_tools_brush(bpy.types.Panel):
297         __space_type__ = "VIEW_3D"
298         __region_type__ = "TOOLS"
299         __label__ = "Brush"
300
301         def brush_src(self, context):
302                 ts = context.tool_settings
303                 if context.sculpt_object:
304                         return ts.sculpt
305                 elif context.vpaint_object:
306                         return ts.vpaint
307                 elif context.wpaint_object:
308                         return ts.wpaint
309                 elif context.tpaint_object:
310                         return ts.tpaint
311                 return False
312
313         def poll(self, context):
314                 return self.brush_src(context)
315
316         def draw(self, context):
317                 src = self.brush_src(context)
318                 brush = src.brush
319                 layout = self.layout
320
321                 layout.split().row().template_ID(src, "brush")
322
323                 if context.sculpt_object:
324                         layout.column().itemR(brush, "sculpt_tool", expand=True)
325
326                 split = layout.split()
327                 col = split.column()
328                 row = col.row(align=True)
329                 row.itemR(brush, "size", slider=True)
330                 row.itemR(brush, "size_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
331                 if context.wpaint_object:
332                         col.itemR(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
333                 col.itemR(brush, "strength", slider=True)
334                 row = col.row(align=True)
335                 row.itemR(brush, "falloff", slider=True)
336                 row.itemR(brush, "falloff_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
337                 if context.vpaint_object:
338                         col.itemR(brush, "color", text="")
339                 if context.tpaint_object:
340                         row = col.row(align=True)
341                         row.itemR(brush, "clone_opacity", slider=True, text=Opacity)
342                         row.itemR(brush, "opacity_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
343                 
344                 row = col.row(align=True)
345                 row.itemR(brush, "space", text="")
346                 rowsub = row.row(align=True)
347                 rowsub.active = brush.space
348                 rowsub.itemR(brush, "spacing", text="Spacing", slider=True)
349                 rowsub.itemR(brush, "spacing_pressure", toggle=True, icon='ICON_BRUSH_DATA', text="")
350
351                 split = layout.split()
352                 col = split.column()
353                 col.itemR(brush, "airbrush")
354                 col.itemR(brush, "anchored")
355                 col.itemR(brush, "rake")
356
357
358 class VIEW3D_PT_tools_brush_curve(bpy.types.Panel):
359         __space_type__ = "VIEW_3D"
360         __region_type__ = "TOOLS"
361         __label__ = "Curve"
362
363         def brush_src(self, context):
364                 ts = context.tool_settings
365                 if context.sculpt_object:
366                         return ts.sculpt
367                 elif context.vpaint_object:
368                         return ts.vpaint
369                 elif context.wpaint_object:
370                         return ts.wpaint
371                 elif context.tpaint_object:
372                         return ts.tpaint
373                 return False
374
375         def poll(self, context):
376                 return self.brush_src(context)
377
378         def draw(self, context):
379                 src = self.brush_src(context)
380                 brush = src.brush
381                 layout = self.layout
382
383                 split = layout.split()
384                 split.template_curve_mapping(brush.curve)
385                 
386 class VIEW3D_PT_sculpt_options(bpy.types.Panel):
387         __space_type__ = "VIEW_3D"
388         __region_type__ = "TOOLS"
389         __label__ = "Options"
390
391         def poll(self, context):
392                 return context.sculpt_object
393
394         def draw(self, context):
395                 sculpt = context.tool_settings.sculpt
396
397                 split = self.layout.split()
398                 
399                 col = split.column()
400                 col.itemR(sculpt, "partial_redraw", text="Partial Refresh")
401                 col.itemR(sculpt, "show_brush")
402
403
404                 split = self.layout.split()
405                 
406                 col = split.column()
407                 col.itemL(text="Symmetry:")
408                 col.itemR(sculpt, "symmetry_x", text="X")
409                 col.itemR(sculpt, "symmetry_y", text="Y")
410                 col.itemR(sculpt, "symmetry_z", text="Z")
411                 
412                 col = split.column()
413                 col.itemL(text="Lock:")
414                 col.itemR(sculpt, "lock_x", text="X")
415                 col.itemR(sculpt, "lock_y", text="Y")
416                 col.itemR(sculpt, "lock_z", text="Z")
417                 
418                 
419                 
420                 
421 # ********** default tools for weightpaint ****************
422
423 class View3DPanel(bpy.types.Panel):
424         __space_type__ = "VIEW_3D"
425         __region_type__ = "TOOLS"
426         __context__ = "weightpaint"
427
428 class VIEW3D_PT_weightpaint_options(View3DPanel):
429         __idname__ = "VIEW3D_PT_tools_weightpaint"
430         __label__ = "Options"
431
432         def draw(self, context):
433                 wpaint = context.tool_settings.wpaint
434                 layout = self.layout
435                 split = self.layout.split()
436                 col = split.column()
437                 col.itemL(text="Blend:")
438                 col.itemR(wpaint, "mode", text="")
439                 col.itemR(wpaint, "all_faces")
440                 col.itemR(wpaint, "normals")
441                 col.itemR(wpaint, "spray")
442                 col.itemR(wpaint, "vertex_dist", text="Distance")
443
444 # Commented out because the Apply button isn't an operator yet, making these settings useless
445 #               col.itemL(text="Gamma:")
446 #               col.itemR(wpaint, "gamma", text="")
447 #               col.itemL(text="Multiply:")
448 #               col.itemR(wpaint, "mul", text="")
449
450                 
451         
452
453 # ********** default tools for vertexpaint ****************
454
455 class View3DPanel(bpy.types.Panel):
456         __space_type__ = "VIEW_3D"
457         __region_type__ = "TOOLS"
458         __context__ = "vertexpaint"
459
460 class VIEW3D_PT_vertexpaint_options(View3DPanel):
461         __idname__ = "VIEW3D_PT_vertexpaintoptions"
462         __label__ = "Options"
463
464         def draw(self, context):
465                 vpaint = context.tool_settings.vpaint
466                 layout = self.layout
467                 split = self.layout.split()
468                 col = split.column()
469                 col.itemL(text="Blend:")
470                 col.itemR(vpaint, "mode", text="")
471                 col.itemR(vpaint, "all_faces")
472                 col.itemR(vpaint, "normals")
473                 col.itemR(vpaint, "spray")
474                 col.itemR(vpaint, "vertex_dist", text="Distance")
475 # Commented out because the Apply button isn't an operator yet, making these settings useless
476 #               col.itemL(text="Gamma:")
477 #               col.itemR(vpaint, "gamma", text="")
478 #               col.itemL(text="Multiply:")
479 #               col.itemR(vpaint, "mul", text="")
480                 
481 # ********** default tools for texturepaint ****************
482
483 class View3DPanel(bpy.types.Panel):
484         __space_type__ = "VIEW_3D"
485         __region_type__ = "TOOLS"
486         __context__ = "texturepaint"
487
488 class VIEW3D_PT_tools_texturepaint(View3DPanel):
489         __idname__ = "VIEW3D_PT_tools_texturepaint"
490         __label__ = "Texture Paint Tools"
491
492         def draw(self, context):
493                 layout = self.layout
494
495
496
497 bpy.types.register(VIEW3D_PT_tools_objectmode)
498 bpy.types.register(VIEW3D_PT_tools_editmode_mesh)
499 bpy.types.register(VIEW3D_PT_tools_editmode_curve)
500 bpy.types.register(VIEW3D_PT_tools_editmode_surface)
501 bpy.types.register(VIEW3D_PT_tools_editmode_text)
502 bpy.types.register(VIEW3D_PT_tools_editmode_armature)
503 bpy.types.register(VIEW3D_PT_tools_editmode_mball)
504 bpy.types.register(VIEW3D_PT_tools_editmode_lattice)
505 bpy.types.register(VIEW3D_PT_tools_posemode)
506 bpy.types.register(VIEW3D_PT_tools_brush)
507 bpy.types.register(VIEW3D_PT_tools_brush_curve)
508 bpy.types.register(VIEW3D_PT_sculpt_options)
509 bpy.types.register(VIEW3D_PT_vertexpaint_options)
510 bpy.types.register(VIEW3D_PT_weightpaint_options)
511 bpy.types.register(VIEW3D_PT_tools_texturepaint)
512
513