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