LEFT | RIGHT |
1 # ##### BEGIN GPL LICENSE BLOCK ##### | 1 # ##### BEGIN GPL LICENSE BLOCK ##### |
2 # | 2 # |
3 # This program is free software; you can redistribute it and/or | 3 # This program is free software; you can redistribute it and/or |
4 # modify it under the terms of the GNU General Public License | 4 # modify it under the terms of the GNU General Public License |
5 # as published by the Free Software Foundation; either version 2 | 5 # as published by the Free Software Foundation; either version 2 |
6 # of the License, or (at your option) any later version. | 6 # of the License, or (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower()) | 48 sub.menu("VIEW3D_MT_select_%s" % mode_string.lower()) |
49 | 49 |
50 if edit_object: | 50 if edit_object: |
51 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower()) | 51 sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower()) |
52 elif obj: | 52 elif obj: |
53 if mode_string not in {'PAINT_TEXTURE'}: | 53 if mode_string not in {'PAINT_TEXTURE'}: |
54 sub.menu("VIEW3D_MT_%s" % mode_string.lower()) | 54 sub.menu("VIEW3D_MT_%s" % mode_string.lower()) |
55 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PA
INT_TEXTURE'}: | 55 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PA
INT_TEXTURE'}: |
56 sub.menu("VIEW3D_MT_brush") | 56 sub.menu("VIEW3D_MT_brush") |
57 if mode_string == 'SCULPT': | 57 if mode_string == 'SCULPT': |
58 sub.menu("VIEW3D_MT_hide_mask") | 58 sub.menu("VIEW3D_MT_hide") |
59 else: | 59 else: |
60 sub.menu("VIEW3D_MT_object") | 60 sub.menu("VIEW3D_MT_object") |
61 | 61 |
62 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mod
e... | |
63 row = layout | |
64 layout.template_header_3D() | |
65 | |
66 if obj: | |
67 # Particle edit | |
68 if obj.mode == 'PARTICLE_EDIT': | |
69 row.prop(toolsettings.particle_edit, "select_mode", text="", exp
and=True) | |
70 | |
71 # Occlude geometry | |
72 if view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (obj.mod
e == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')): | |
73 row.prop(view, "use_occlude_geometry", text="") | |
74 | |
75 # Proportional editing | |
76 if obj.mode in {'EDIT', 'PARTICLE_EDIT'}: | |
77 row = layout.row(align=True) | |
78 row.prop(toolsettings, "proportional_edit", text="", icon_only=T
rue) | |
79 if toolsettings.proportional_edit != 'DISABLED': | |
80 row.prop(toolsettings, "proportional_edit_falloff", text="",
icon_only=True) | |
81 elif obj.mode == 'OBJECT': | |
82 row = layout.row(align=True) | |
83 row.prop(toolsettings, "use_proportional_edit_objects", text="",
icon_only=True) | |
84 if toolsettings.use_proportional_edit_objects: | |
85 row.prop(toolsettings, "proportional_edit_falloff", text="",
icon_only=True) | |
86 | |
87 # Snap | |
88 if not obj or obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT',
'TEXTURE_PAINT'}: | |
89 snap_element = toolsettings.snap_element | |
90 row = layout.row(align=True) | |
91 row.prop(toolsettings, "use_snap", text="") | |
92 row.prop(toolsettings, "snap_element", text="", icon_only=True) | |
93 if snap_element != 'INCREMENT': | |
94 row.prop(toolsettings, "snap_target", text="") | |
95 if obj: | |
96 if obj.mode == 'OBJECT' and snap_element != 'VOLUME': | |
97 row.prop(toolsettings, "use_snap_align_rotation", text="
") | |
98 elif obj.mode == 'EDIT': | |
99 row.prop(toolsettings, "use_snap_self", text="") | |
100 | |
101 if snap_element == 'VOLUME': | |
102 row.prop(toolsettings, "use_snap_peel_object", text="") | |
103 elif snap_element == 'FACE': | |
104 row.prop(toolsettings, "use_snap_project", text="") | |
105 | |
106 # OpenGL render | |
107 row = layout.row(align=True) | |
108 row.operator("render.opengl", text="", icon='RENDER_STILL') | |
109 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION') | |
110 props.animation = True | |
111 | |
112 # Pose | |
113 if obj and obj.mode == 'POSE': | |
114 row = layout.row(align=True) | |
115 row.operator("pose.copy", text="", icon='COPYDOWN') | |
116 row.operator("pose.paste", text="", icon='PASTEDOWN') | |
117 props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN') | |
118 props.flipped = 1 | |
119 | |
120 | |
121 # ********** Menu ********** | |
122 | |
123 # ********** Utilities ********** | |
124 | |
125 | |
126 class ShowHideMenu(): | |
127 bl_label = "Show/Hide" | |
128 _operator_name = "" | |
129 | |
130 def draw(self, context): | |
131 layout = self.layout | |
132 | |
133 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden") | |
134 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").u
nselected = False | |
135 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected")
.unselected = True | |
136 | |
137 | |
138 class VIEW3D_MT_transform(Menu): | |
139 bl_label = "Transform" | |
140 | |
141 # TODO: get rid of the custom text strings? | |
142 def draw(self, context): | |
143 layout = self.layout | |
144 | |
145 layout.operator("transform.translate", text="Grab/Move") | |
146 # TODO: sub-menu for grab per axis | |
147 layout.operator("transform.rotate", text="Rotate") | |
148 # TODO: sub-menu for rot per axis | |
149 layout.operator("transform.resize", text="Scale") | |
150 # TODO: sub-menu for scale per axis | |
151 | |
152 layout.separator() | |
153 | |
154 layout.operator("transform.tosphere", text="To Sphere") | |
155 layout.operator("transform.shear", text="Shear") | |
156 layout.operator("transform.warp", text="Warp") | |
157 layout.operator("transform.push_pull", text="Push/Pull") | |
158 | |
159 layout.separator() | |
160 | |
161 layout.operator("transform.translate", text="Move Texture Space").textur
e_space = True | |
162 layout.operator("transform.resize", text="Scale Texture Space").texture_
space = True | |
163 | |
164 layout.separator() | |
165 | |
166 obj = context.object | |
167 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.
draw_type in {'BBONE', 'ENVELOPE'}: | |
168 layout.operator("transform.transform", text="Scale Envelope/BBone").
mode = 'BONE_SIZE' | |
169 | |
170 if context.edit_object and context.edit_object.type == 'ARMATURE': | |
171 layout.operator("armature.align") | |
172 else: | |
173 layout.operator_context = 'EXEC_REGION_WIN' | |
174 layout.operator("transform.transform", text="Align to Transform Orie
ntation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this w
orking | |
175 | |
176 layout.separator() | |
177 | |
178 layout.operator_context = 'EXEC_AREA' | |
179 | |
180 layout.operator("object.origin_set", text="Geometry to Origin").type = '
GEOMETRY_ORIGIN' | |
181 layout.operator("object.origin_set", text="Origin to Geometry").type = '
ORIGIN_GEOMETRY' | |
182 layout.operator("object.origin_set", text="Origin to 3D Cursor").type =
'ORIGIN_CURSOR' | |
183 | |
184 layout.separator() | |
185 | |
186 layout.operator("object.randomize_transform") | |
187 layout.operator("object.align") | |
188 | |
189 layout.separator() | |
190 | |
191 layout.operator("object.anim_transforms_to_deltas") | |
192 | |
193 | |
194 class VIEW3D_MT_mirror(Menu): | |
195 bl_label = "Mirror" | |
196 | |
197 def draw(self, context): | |
198 layout = self.layout | |
199 | |
200 layout.operator("transform.mirror", text="Interactive Mirror") | |
201 | |
202 layout.separator() | |
203 | |
204 layout.operator_context = 'INVOKE_REGION_WIN' | |
205 | |
206 props = layout.operator("transform.mirror", text="X Global") | |
207 props.constraint_axis = (True, False, False) | |
208 props.constraint_orientation = 'GLOBAL' | |
209 props = layout.operator("transform.mirror", text="Y Global") | |
210 props.constraint_axis = (False, True, False) | |
211 props.constraint_orientation = 'GLOBAL' | |
212 props = layout.operator("transform.mirror", text="Z Global") | |
213 props.constraint_axis = (False, False, True) | |
214 props.constraint_orientation = 'GLOBAL' | |
215 | |
216 if context.edit_object: | |
217 layout.separator() | |
218 | |
219 props = layout.operator("transform.mirror", text="X Local") | |
220 props.constraint_axis = (True, False, False) | |
221 props.constraint_orientation = 'LOCAL' | |
222 props = layout.operator("transform.mirror", text="Y Local") | |
223 props.constraint_axis = (False, True, False) | |
224 props.constraint_orientation = 'LOCAL' | |
225 props = layout.operator("transform.mirror", text="Z Local") | |
226 props.constraint_axis = (False, False, True) | |
227 props.constraint_orientation = 'LOCAL' | |
228 | |
229 layout.operator("object.vertex_group_mirror") | |
230 | |
231 | |
232 class VIEW3D_MT_snap(Menu): | |
233 bl_label = "Snap" | |
234 | |
235 def draw(self, context): | |
236 layout = self.layout | |
237 | |
238 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid"
) | |
239 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cur
sor") | |
240 | |
241 layout.separator() | |
242 | |
243 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Select
ed") | |
244 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center") | |
245 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid") | |
246 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active") | |
247 | |
248 | |
249 class VIEW3D_MT_uv_map(Menu): | |
250 bl_label = "UV Mapping" | |
251 | |
252 def draw(self, context): | |
253 layout = self.layout | |
254 | |
255 layout.operator("uv.unwrap") | |
256 | |
257 layout.operator_context = 'INVOKE_DEFAULT' | |
258 layout.operator("uv.smart_project") | |
259 layout.operator("uv.lightmap_pack") | |
260 layout.operator("uv.follow_active_quads") | |
261 | |
262 layout.separator() | |
263 | |
264 layout.operator_context = 'EXEC_REGION_WIN' | |
265 layout.operator("uv.cube_project") | |
266 layout.operator("uv.cylinder_project") | |
267 layout.operator("uv.sphere_project") | |
268 | |
269 layout.separator() | |
270 | |
271 layout.operator_context = 'EXEC_REGION_WIN' | |
272 layout.operator("uv.project_from_view").scale_to_bounds = False | |
273 layout.operator("uv.project_from_view", text="Project from View (Bounds)
").scale_to_bounds = True | |
274 | |
275 layout.separator() | |
276 | |
277 layout.operator("uv.reset") | |
278 | |
279 | |
280 # ********** View menus ********** | |
281 | |
282 | |
283 class VIEW3D_MT_view(Menu): | |
284 bl_label = "View" | |
285 | |
286 def draw(self, context): | |
287 layout = self.layout | |
288 | |
289 layout.operator("view3d.properties", icon='MENU_PANEL') | |
290 layout.operator("view3d.toolshelf", icon='MENU_PANEL') | |
291 | |
292 layout.separator() | |
293 | |
294 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA' | |
295 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP' | |
296 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM' | |
297 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT' | |
298 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK' | |
299 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT' | |
300 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT' | |
301 | |
302 layout.menu("VIEW3D_MT_view_cameras", text="Cameras") | |
303 | |
304 layout.separator() | |
305 | |
306 layout.operator("view3d.view_persportho") | |
307 | |
308 layout.separator() | |
309 | |
310 layout.menu("VIEW3D_MT_view_navigation") | |
311 layout.menu("VIEW3D_MT_view_align") | |
312 | |
313 layout.separator() | |
314 | |
315 layout.operator_context = 'INVOKE_REGION_WIN' | |
316 | |
317 layout.operator("view3d.clip_border", text="Clipping Border...") | |
318 layout.operator("view3d.zoom_border", text="Zoom Border...") | |
319 | |
320 layout.separator() | |
321 | |
322 layout.operator("view3d.layers", text="Show All Layers").nr = 0 | |
323 | |
324 layout.separator() | |
325 | |
326 layout.operator("view3d.localview", text="View Global/Local") | |
327 layout.operator("view3d.view_selected") | |
328 layout.operator("view3d.view_all") | |
329 | |
330 layout.separator() | |
331 | |
332 layout.operator("screen.animation_play", text="Playback Animation") | |
333 | |
334 layout.separator() | |
335 | |
336 layout.operator("screen.area_dupli") | |
337 layout.operator("screen.region_quadview") | |
338 layout.operator("screen.screen_full_area") | |
339 | |
340 | |
341 class VIEW3D_MT_view_navigation(Menu): | |
342 bl_label = "Navigation" | |
343 | |
344 def draw(self, context): | |
345 layout = self.layout | |
346 | |
347 layout.operator_enum("view3d.view_orbit", "type") | |
348 | |
349 layout.separator() | |
350 | |
351 layout.operator_enum("view3d.view_pan", "type") | |
352 | |
353 layout.separator() | |
354 | |
355 layout.operator("view3d.zoom", text="Zoom In").delta = 1 | |
356 layout.operator("view3d.zoom", text="Zoom Out").delta = -1 | |
357 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1") | |
358 | |
359 layout.separator() | |
360 | |
361 layout.operator("view3d.fly") | |
362 | |
363 | |
364 class VIEW3D_MT_view_align(Menu): | |
365 bl_label = "Align View" | |
366 | |
367 def draw(self, context): | |
368 layout = self.layout | |
369 | |
370 layout.menu("VIEW3D_MT_view_align_selected") | |
371 | |
372 layout.separator() | |
373 | |
374 layout.operator("view3d.view_all", text="Center Cursor and View All").ce
nter = True | |
375 layout.operator("view3d.camera_to_view", text="Align Active Camera to Vi
ew") | |
376 layout.operator("view3d.camera_to_view_selected", text="Align Active Cam
era to Selected") | |
377 layout.operator("view3d.view_selected") | |
378 layout.operator("view3d.view_center_cursor") | |
379 | |
380 | |
381 class VIEW3D_MT_view_align_selected(Menu): | |
382 bl_label = "Align View to Selected" | |
383 | |
384 def draw(self, context): | |
385 layout = self.layout | |
386 | |
387 props = layout.operator("view3d.viewnumpad", text="Top") | |
388 props.align_active = True | |
389 props.type = 'TOP' | |
390 props = layout.operator("view3d.viewnumpad", text="Bottom") | |
391 props.align_active = True | |
392 props.type = 'BOTTOM' | |
393 props = layout.operator("view3d.viewnumpad", text="Front") | |
394 props.align_active = True | |
395 props.type = 'FRONT' | |
396 props = layout.operator("view3d.viewnumpad", text="Back") | |
397 props.align_active = True | |
398 props.type = 'BACK' | |
399 props = layout.operator("view3d.viewnumpad", text="Right") | |
400 props.align_active = True | |
401 props.type = 'RIGHT' | |
402 props = layout.operator("view3d.viewnumpad", text="Left") | |
403 props.align_active = True | |
404 props.type = 'LEFT' | |
405 | |
406 | |
407 class VIEW3D_MT_view_cameras(Menu): | |
408 bl_label = "Cameras" | |
409 | |
410 def draw(self, context): | |
411 layout = self.layout | |
412 | |
413 layout.operator("view3d.object_as_camera") | |
414 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMER
A' | |
415 | |
416 # ********** Select menus, suffix from context.mode ********** | |
417 | |
418 | |
419 class VIEW3D_MT_select_object(Menu): | |
420 bl_label = "Select" | |
421 | |
422 def draw(self, context): | |
423 layout = self.layout | |
424 | |
425 layout.operator("view3d.select_border") | |
426 layout.operator("view3d.select_circle") | |
427 | |
428 layout.separator() | |
429 | |
430 layout.operator("object.select_all").action = 'TOGGLE' | |
431 layout.operator("object.select_all", text="Inverse").action = 'INVERT' | |
432 layout.operator("object.select_random", text="Random") | |
433 layout.operator("object.select_mirror", text="Mirror") | |
434 layout.operator("object.select_by_layer", text="Select All by Layer") | |
435 layout.operator_menu_enum("object.select_by_type", "type", text="Select
All by Type...") | |
436 layout.operator("object.select_camera", text="Select Camera") | |
437 | |
438 layout.separator() | |
439 | |
440 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped
") | |
441 layout.operator_menu_enum("object.select_linked", "type", text="Linked") | |
442 layout.operator("object.select_pattern", text="Select Pattern...") | |
443 | |
444 | |
445 class VIEW3D_MT_select_pose(Menu): | |
446 bl_label = "Select" | |
447 | |
448 def draw(self, context): | |
449 layout = self.layout | |
450 | |
451 layout.operator("view3d.select_border") | |
452 | |
453 layout.separator() | |
454 | |
455 layout.operator("pose.select_all").action = 'TOGGLE' | |
456 layout.operator("pose.select_all", text="Inverse").action = 'INVERT' | |
457 layout.operator("pose.select_flip_active", text="Flip Active") | |
458 layout.operator("pose.select_constraint_target", text="Constraint Target
") | |
459 layout.operator("pose.select_linked", text="Linked") | |
460 | |
461 layout.separator() | |
462 | |
463 layout.operator("pose.select_hierarchy", text="Parent").direction = 'PAR
ENT' | |
464 layout.operator("pose.select_hierarchy", text="Child").direction = 'CHIL
D' | |
465 | |
466 layout.separator() | |
467 | |
468 props = layout.operator("pose.select_hierarchy", text="Extend Parent") | |
469 props.extend = True | |
470 props.direction = 'PARENT' | |
471 | |
472 props = layout.operator("pose.select_hierarchy", text="Extend Child") | |
473 props.extend = True | |
474 props.direction = 'CHILD' | |
475 | |
476 layout.separator() | |
477 | |
478 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped") | |
479 layout.operator("object.select_pattern", text="Select Pattern...") | |
480 | |
481 | |
482 class VIEW3D_MT_select_particle(Menu): | |
483 bl_label = "Select" | |
484 | |
485 def draw(self, context): | |
486 layout = self.layout | |
487 | |
488 layout.operator("view3d.select_border") | |
489 | |
490 layout.separator() | |
491 | |
492 layout.operator("particle.select_all").action = 'TOGGLE' | |
493 layout.operator("particle.select_linked") | |
494 layout.operator("particle.select_all", text="Inverse").action = 'INVERT' | |
495 | |
496 layout.separator() | |
497 | |
498 layout.operator("particle.select_more") | |
499 layout.operator("particle.select_less") | |
500 | |
501 layout.separator() | |
502 | |
503 layout.operator("particle.select_roots", text="Roots") | |
504 layout.operator("particle.select_tips", text="Tips") | |
505 | |
506 | |
507 class VIEW3D_MT_select_edit_mesh(Menu): | |
508 bl_label = "Select" | |
509 | |
510 def draw(self, context): | |
511 layout = self.layout | |
512 | |
513 layout.operator("view3d.select_border") | |
514 layout.operator("view3d.select_circle") | |
515 | |
516 layout.separator() | |
517 | |
518 layout.operator("mesh.select_all").action = 'TOGGLE' | |
519 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT' | |
520 | |
521 layout.separator() | |
522 | |
523 layout.operator("mesh.select_random", text="Random") | |
524 layout.operator("mesh.select_nth", text="Every N Number of Verts") | |
525 layout.operator("mesh.edges_select_sharp", text="Sharp Edges") | |
526 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces
") | |
527 layout.operator("mesh.select_interior_faces", text="Interior Faces") | |
528 layout.operator("mesh.select_axis", text="Side of Active") | |
529 | |
530 layout.separator() | |
531 | |
532 layout.operator("mesh.select_by_number_vertices", text="By Number of Ver
ts") | |
533 if context.scene.tool_settings.mesh_select_mode[2] == False: | |
534 layout.operator("mesh.select_non_manifold", text="Non Manifold") | |
535 layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges") | |
536 layout.operator("mesh.select_similar", text="Similar") | |
537 | |
538 layout.separator() | |
539 | |
540 layout.operator("mesh.select_less", text="Less") | |
541 layout.operator("mesh.select_more", text="More") | |
542 | |
543 layout.separator() | |
544 | |
545 layout.operator("mesh.select_mirror", text="Mirror") | |
546 | |
547 layout.operator("mesh.select_linked", text="Linked") | |
548 layout.operator("mesh.select_vertex_path", text="Vertex Path") | |
549 layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False | |
550 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True | |
551 | |
552 layout.separator() | |
553 | |
554 layout.operator("mesh.loop_to_region") | |
555 layout.operator("mesh.region_to_loop") | |
556 | |
557 | |
558 class VIEW3D_MT_select_edit_curve(Menu): | |
559 bl_label = "Select" | |
560 | |
561 def draw(self, context): | |
562 layout = self.layout | |
563 | |
564 layout.operator("view3d.select_border") | |
565 layout.operator("view3d.select_circle") | |
566 | |
567 layout.separator() | |
568 | |
569 layout.operator("curve.select_all").action = 'TOGGLE' | |
570 layout.operator("curve.select_all", text="Inverse").action = 'INVERT' | |
571 layout.operator("curve.select_random") | |
572 layout.operator("curve.select_nth", text="Every Nth Number of Points") | |
573 | |
574 layout.separator() | |
575 | |
576 layout.operator("curve.de_select_first") | |
577 layout.operator("curve.de_select_last") | |
578 layout.operator("curve.select_next") | |
579 layout.operator("curve.select_previous") | |
580 | |
581 layout.separator() | |
582 | |
583 layout.operator("curve.select_more") | |
584 layout.operator("curve.select_less") | |
585 | |
586 | |
587 class VIEW3D_MT_select_edit_surface(Menu): | |
588 bl_label = "Select" | |
589 | |
590 def draw(self, context): | |
591 layout = self.layout | |
592 | |
593 layout.operator("view3d.select_border") | |
594 layout.operator("view3d.select_circle") | |
595 | |
596 layout.separator() | |
597 | |
598 layout.operator("curve.select_all").action = 'TOGGLE' | |
599 layout.operator("curve.select_all", text="Inverse").action = 'INVERT' | |
600 layout.operator("curve.select_random") | |
601 layout.operator("curve.select_nth", text="Every Nth Number of Points") | |
602 | |
603 layout.separator() | |
604 | |
605 layout.operator("curve.select_row") | |
606 | |
607 layout.separator() | |
608 | |
609 layout.operator("curve.select_more") | |
610 layout.operator("curve.select_less") | |
611 | |
612 | |
613 class VIEW3D_MT_select_edit_metaball(Menu): | |
614 bl_label = "Select" | |
615 | |
616 def draw(self, context): | |
617 layout = self.layout | |
618 | |
619 layout.operator("view3d.select_border") | |
620 | |
621 layout.separator() | |
622 | |
623 layout.operator("mball.select_all").action = 'TOGGLE' | |
624 layout.operator("mball.select_all", text="Inverse").action = 'INVERT' | |
625 | |
626 layout.separator() | |
627 | |
628 layout.operator("mball.select_random_metaelems") | |
629 | |
630 | |
631 class VIEW3D_MT_select_edit_lattice(Menu): | |
632 bl_label = "Select" | |
633 | |
634 def draw(self, context): | |
635 layout = self.layout | |
636 | |
637 layout.operator("view3d.select_border") | |
638 | |
639 layout.separator() | |
640 | |
641 layout.operator("lattice.select_all").action = 'TOGGLE' | |
642 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT' | |
643 | |
644 | |
645 class VIEW3D_MT_select_edit_armature(Menu): | |
646 bl_label = "Select" | |
647 | |
648 def draw(self, context): | |
649 layout = self.layout | |
650 | |
651 layout.operator("view3d.select_border") | |
652 | |
653 layout.separator() | |
654 | |
655 layout.operator("armature.select_all").action = 'TOGGLE' | |
656 layout.operator("armature.select_all", text="Inverse").action = 'INVERT' | |
657 | |
658 layout.separator() | |
659 | |
660 layout.operator("armature.select_hierarchy", text="Parent").direction =
'PARENT' | |
661 layout.operator("armature.select_hierarchy", text="Child").direction = '
CHILD' | |
662 | |
663 layout.separator() | |
664 | |
665 props = layout.operator("armature.select_hierarchy", text="Extend Parent
") | |
666 props.extend = True | |
667 props.direction = 'PARENT' | |
668 | |
669 props = layout.operator("armature.select_hierarchy", text="Extend Child"
) | |
670 props.extend = True | |
671 props.direction = 'CHILD' | |
672 | |
673 layout.operator("object.select_pattern", text="Select Pattern...") | |
674 | |
675 | |
676 class VIEW3D_MT_select_face(Menu): # XXX no matching enum | |
677 bl_label = "Select" | |
678 | |
679 def draw(self, context): | |
680 # layout = self.layout | |
681 | |
682 # TODO | |
683 # see view3d_select_faceselmenu | |
684 pass | |
685 | |
686 # ********** Object menu ********** | |
687 | |
688 | |
689 class VIEW3D_MT_object(Menu): | |
690 bl_context = "objectmode" | |
691 bl_label = "Object" | |
692 | |
693 def draw(self, context): | |
694 layout = self.layout | |
695 | |
696 layout.operator("ed.undo") | |
697 layout.operator("ed.redo") | |
698 layout.operator("ed.undo_history") | |
699 | |
700 layout.separator() | |
701 | |
702 layout.menu("VIEW3D_MT_transform") | |
703 layout.menu("VIEW3D_MT_mirror") | |
704 layout.menu("VIEW3D_MT_object_clear") | |
705 layout.menu("VIEW3D_MT_object_apply") | |
706 layout.menu("VIEW3D_MT_snap") | |
707 | |
708 layout.separator() | |
709 | |
710 layout.menu("VIEW3D_MT_object_animation") | |
711 | |
712 layout.separator() | |
713 | |
714 layout.operator("object.duplicate_move") | |
715 layout.operator("object.duplicate_move_linked") | |
716 layout.operator("object.delete", text="Delete...") | |
717 layout.operator("object.proxy_make", text="Make Proxy...") | |
718 layout.menu("VIEW3D_MT_make_links", text="Make Links...") | |
719 layout.operator("object.make_dupli_face") | |
720 layout.operator_menu_enum("object.make_local", "type", text="Make Local.
..") | |
721 layout.menu("VIEW3D_MT_make_single_user") | |
722 | |
723 layout.separator() | |
724 | |
725 layout.menu("VIEW3D_MT_object_parent") | |
726 layout.menu("VIEW3D_MT_object_track") | |
727 layout.menu("VIEW3D_MT_object_group") | |
728 layout.menu("VIEW3D_MT_object_constraints") | |
729 | |
730 layout.separator() | |
731 | |
732 layout.menu("VIEW3D_MT_object_quick_effects") | |
733 | |
734 layout.separator() | |
735 | |
736 layout.menu("VIEW3D_MT_object_game") | |
737 | |
738 layout.separator() | |
739 | |
740 layout.operator("object.join") | |
741 | |
742 layout.separator() | |
743 | |
744 layout.operator("object.move_to_layer", text="Move to Layer...") | |
745 layout.menu("VIEW3D_MT_object_showhide") | |
746 | |
747 layout.operator_menu_enum("object.convert", "target") | |
748 | |
749 | |
750 class VIEW3D_MT_object_animation(Menu): | |
751 bl_label = "Animation" | |
752 | |
753 def draw(self, context): | |
754 layout = self.layout | |
755 | |
756 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...") | |
757 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...") | |
758 layout.operator("anim.keying_set_active_set", text="Change Keying Set...
") | |
759 | |
760 layout.separator() | |
761 | |
762 layout.operator("nla.bake", text="Bake Action...") | |
763 | |
764 | |
765 class VIEW3D_MT_object_clear(Menu): | |
766 bl_label = "Clear" | |
767 | |
768 def draw(self, context): | |
769 layout = self.layout | |
770 | |
771 layout.operator("object.location_clear", text="Location") | |
772 layout.operator("object.rotation_clear", text="Rotation") | |
773 layout.operator("object.scale_clear", text="Scale") | |
774 layout.operator("object.origin_clear", text="Origin") | |
775 | |
776 | |
777 class VIEW3D_MT_object_specials(Menu): | |
778 bl_label = "Specials" | |
779 | |
780 @classmethod | |
781 def poll(cls, context): | |
782 # add more special types | |
783 return context.object | |
784 | |
785 def draw(self, context): | |
786 layout = self.layout | |
787 | |
788 obj = context.object | |
789 if obj.type == 'CAMERA': | |
790 layout.operator_context = 'INVOKE_REGION_WIN' | |
791 | |
792 if obj.data.type == 'PERSP': | |
793 props = layout.operator("wm.context_modal_mouse", text="Camera L
ens Angle") | |
794 props.data_path_iter = "selected_editable_objects" | |
795 props.data_path_item = "data.lens" | |
796 props.input_scale = 0.1 | |
797 if obj.data.lens_unit == 'MILLIMETERS': | |
798 props.header_text = "Camera Lens Angle: %.1fmm" | |
799 else: | |
800 props.header_text = "Camera Lens Angle: %.1f\u00B0" | |
801 | |
802 else: | |
803 props = layout.operator("wm.context_modal_mouse", text="Camera L
ens Scale") | |
804 props.data_path_iter = "selected_editable_objects" | |
805 props.data_path_item = "data.ortho_scale" | |
806 props.input_scale = 0.01 | |
807 props.header_text = "Camera Lens Scale: %.3f" | |
808 | |
809 if not obj.data.dof_object: | |
810 #layout.label(text="Test Has DOF obj"); | |
811 props = layout.operator("wm.context_modal_mouse", text="DOF Dist
ance") | |
812 props.data_path_iter = "selected_editable_objects" | |
813 props.data_path_item = "data.dof_distance" | |
814 props.input_scale = 0.02 | |
815 props.header_text = "DOF Distance: %.3f" | |
816 | |
817 if obj.type in {'CURVE', 'FONT'}: | |
818 layout.operator_context = 'INVOKE_REGION_WIN' | |
819 | |
820 props = layout.operator("wm.context_modal_mouse", text="Extrude Size
") | |
821 props.data_path_iter = "selected_editable_objects" | |
822 props.data_path_item = "data.extrude" | |
823 props.input_scale = 0.01 | |
824 props.header_text = "Extrude Size: %.3f" | |
825 | |
826 props = layout.operator("wm.context_modal_mouse", text="Width Size") | |
827 props.data_path_iter = "selected_editable_objects" | |
828 props.data_path_item = "data.offset" | |
829 props.input_scale = 0.01 | |
830 props.header_text = "Width Size: %.3f" | |
831 | |
832 if obj.type == 'EMPTY': | |
833 layout.operator_context = 'INVOKE_REGION_WIN' | |
834 | |
835 props = layout.operator("wm.context_modal_mouse", text="Empty Draw S
ize") | |
836 props.data_path_iter = "selected_editable_objects" | |
837 props.data_path_item = "empty_draw_size" | |
838 props.input_scale = 0.01 | |
839 props.header_text = "Empty Draw Size: %.3f" | |
840 | |
841 if obj.type == 'LAMP': | |
842 layout.operator_context = 'INVOKE_REGION_WIN' | |
843 | |
844 props = layout.operator("wm.context_modal_mouse", text="Energy") | |
845 props.data_path_iter = "selected_editable_objects" | |
846 props.data_path_item = "data.energy" | |
847 props.header_text = "Lamp Energy: %.3f" | |
848 | |
849 if obj.data.type in {'SPOT', 'AREA', 'POINT'}: | |
850 props = layout.operator("wm.context_modal_mouse", text="Falloff
Distance") | |
851 props.data_path_iter = "selected_editable_objects" | |
852 props.data_path_item = "data.distance" | |
853 props.input_scale = 0.1 | |
854 props.header_text = "Lamp Falloff Distance: %.1f" | |
855 | |
856 if obj.data.type == 'SPOT': | |
857 layout.separator() | |
858 props = layout.operator("wm.context_modal_mouse", text="Spot Siz
e") | |
859 props.data_path_iter = "selected_editable_objects" | |
860 props.data_path_item = "data.spot_size" | |
861 props.input_scale = 0.01 | |
862 props.header_text = "Spot Size: %.2f" | |
863 | |
864 props = layout.operator("wm.context_modal_mouse", text="Spot Ble
nd") | |
865 props.data_path_iter = "selected_editable_objects" | |
866 props.data_path_item = "data.spot_blend" | |
867 props.input_scale = -0.01 | |
868 props.header_text = "Spot Blend: %.2f" | |
869 | |
870 props = layout.operator("wm.context_modal_mouse", text="Clip Sta
rt") | |
871 props.data_path_iter = "selected_editable_objects" | |
872 props.data_path_item = "data.shadow_buffer_clip_start" | |
873 props.input_scale = 0.05 | |
874 props.header_text = "Clip Start: %.2f" | |
875 | |
876 props = layout.operator("wm.context_modal_mouse", text="Clip End
") | |
877 props.data_path_iter = "selected_editable_objects" | |
878 props.data_path_item = "data.shadow_buffer_clip_end" | |
879 props.input_scale = 0.05 | |
880 props.header_text = "Clip End: %.2f" | |
881 | |
882 layout.separator() | |
883 | |
884 props = layout.operator("object.isolate_type_render") | |
885 props = layout.operator("object.hide_render_clear_all") | |
886 | |
887 | |
888 class VIEW3D_MT_object_apply(Menu): | |
889 bl_label = "Apply" | |
890 | |
891 def draw(self, context): | |
892 layout = self.layout | |
893 | |
894 props = layout.operator("object.transform_apply", text="Location") | |
895 props.location, props.rotation, props.scale = True, False, False | |
896 | |
897 props = layout.operator("object.transform_apply", text="Rotation") | |
898 props.location, props.rotation, props.scale = False, True, False | |
899 | |
900 props = layout.operator("object.transform_apply", text="Scale") | |
901 props.location, props.rotation, props.scale = False, False, True | |
902 props = layout.operator("object.transform_apply", text="Rotation & Scale
") | |
903 props.location, props.rotation, props.scale = False, True, True | |
904 | |
905 layout.separator() | |
906 | |
907 layout.operator("object.visual_transform_apply", text="Visual Transform"
) | |
908 layout.operator("object.duplicates_make_real") | |
909 | |
910 | |
911 class VIEW3D_MT_object_parent(Menu): | |
912 bl_label = "Parent" | |
913 | |
914 def draw(self, context): | |
915 layout = self.layout | |
916 | |
917 layout.operator_menu_enum("object.parent_set", "type", text="Set") | |
918 layout.operator_menu_enum("object.parent_clear", "type", text="Clear") | |
919 | |
920 | |
921 class VIEW3D_MT_object_track(Menu): | |
922 bl_label = "Track" | |
923 | |
924 def draw(self, context): | |
925 layout = self.layout | |
926 | |
927 layout.operator_menu_enum("object.track_set", "type", text="Set") | |
928 layout.operator_menu_enum("object.track_clear", "type", text="Clear") | |
929 | |
930 | |
931 class VIEW3D_MT_object_group(Menu): | |
932 bl_label = "Group" | |
933 | |
934 def draw(self, context): | |
935 layout = self.layout | |
936 | |
937 layout.operator("group.create") | |
938 layout.operator("group.objects_remove") | |
939 | |
940 layout.separator() | |
941 | |
942 layout.operator("group.objects_add_active") | |
943 layout.operator("group.objects_remove_active") | |
944 | |
945 | |
946 class VIEW3D_MT_object_constraints(Menu): | |
947 bl_label = "Constraints" | |
948 | |
949 def draw(self, context): | |
950 layout = self.layout | |
951 | |
952 layout.operator("object.constraint_add_with_targets") | |
953 layout.operator("object.constraints_copy") | |
954 layout.operator("object.constraints_clear") | |
955 | |
956 | |
957 class VIEW3D_MT_object_quick_effects(Menu): | |
958 bl_label = "Quick Effects" | |
959 | |
960 def draw(self, context): | |
961 layout = self.layout | |
962 | |
963 layout.operator("object.quick_fur") | |
964 layout.operator("object.quick_explode") | |
965 layout.operator("object.quick_smoke") | |
966 layout.operator("object.quick_fluid") | |
967 | |
968 | |
969 class VIEW3D_MT_object_showhide(Menu): | |
970 bl_label = "Show/Hide" | |
971 | |
972 def draw(self, context): | |
973 layout = self.layout | |
974 | |
975 layout.operator("object.hide_view_clear", text="Show Hidden") | |
976 layout.operator("object.hide_view_set", text="Hide Selected").unselected
= False | |
977 layout.operator("object.hide_view_set", text="Hide Unselected").unselect
ed = True | |
978 | |
979 | |
980 class VIEW3D_MT_make_single_user(Menu): | |
981 bl_label = "Make Single User" | |
982 | |
983 def draw(self, context): | |
984 layout = self.layout | |
985 | |
986 props = layout.operator("object.make_single_user", text="Object") | |
987 props.object = True | |
988 | |
989 props = layout.operator("object.make_single_user", text="Object & Data") | |
990 props.object = props.obdata = True | |
991 | |
992 props = layout.operator("object.make_single_user", text="Object & Data &
Materials+Tex") | |
993 props.object = props.obdata = props.material = props.texture = True | |
994 | |
995 props = layout.operator("object.make_single_user", text="Materials+Tex") | |
996 props.material = props.texture = True | |
997 | |
998 props = layout.operator("object.make_single_user", text="Object Animatio
n") | |
999 props.animation = True | |
1000 | |
1001 | |
1002 class VIEW3D_MT_make_links(Menu): | |
1003 bl_label = "Make Links" | |
1004 | |
1005 def draw(self, context): | |
1006 layout = self.layout | |
1007 | |
1008 if(len(bpy.data.scenes) > 10): | |
1009 layout.operator_context = 'INVOKE_DEFAULT' | |
1010 layout.operator("object.make_links_scene", text="Objects to Scene...
", icon='OUTLINER_OB_EMPTY') | |
1011 else: | |
1012 layout.operator_menu_enum("object.make_links_scene", "scene", text="
Objects to Scene...") | |
1013 | |
1014 layout.operator_enum("object.make_links_data", "type") # inline | |
1015 | |
1016 layout.operator("object.join_uvs") # stupid place to add this! | |
1017 | |
1018 | |
1019 class VIEW3D_MT_object_game(Menu): | |
1020 bl_label = "Game" | |
1021 | |
1022 def draw(self, context): | |
1023 layout = self.layout | |
1024 | |
1025 layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks") | |
1026 layout.operator("object.game_physics_copy", text="Copy Physics Propertie
s") | |
1027 | |
1028 layout.separator() | |
1029 | |
1030 layout.operator("object.game_property_copy", text="Replace Properties").
operation = 'REPLACE' | |
1031 layout.operator("object.game_property_copy", text="Merge Properties").op
eration = 'MERGE' | |
1032 layout.operator_menu_enum("object.game_property_copy", "property", text=
"Copy Properties...") | |
1033 | |
1034 layout.separator() | |
1035 | |
1036 layout.operator("object.game_property_clear") | |
1037 | |
1038 | |
1039 # ********** Brush menu ********** | |
1040 class VIEW3D_MT_brush(Menu): | |
1041 bl_label = "Brush" | |
1042 | |
1043 def draw(self, context): | |
1044 layout = self.layout | |
1045 | |
1046 settings = UnifiedPaintPanel.paint_settings(context) | |
1047 brush = settings.brush | |
1048 | |
1049 ups = context.tool_settings.unified_paint_settings | |
1050 layout.prop(ups, "use_unified_size", text="Unified Size") | |
1051 layout.prop(ups, "use_unified_strength", text="Unified Strength") | |
1052 layout.separator() | |
1053 | |
1054 # brush paint modes | |
1055 layout.menu("VIEW3D_MT_brush_paint_modes") | |
1056 | |
1057 # brush tool | |
1058 if context.sculpt_object: | |
1059 layout.operator("brush.reset") | |
1060 layout.prop_menu_enum(brush, "sculpt_tool") | |
1061 elif context.image_paint_object: | |
1062 layout.prop_menu_enum(brush, "image_tool") | |
1063 elif context.vertex_paint_object or context.weight_paint_object: | |
1064 layout.prop_menu_enum(brush, "vertex_tool") | |
1065 | |
1066 # skip if no active brush | |
1067 if not brush: | |
1068 return | |
1069 | |
1070 # TODO: still missing a lot of brush options here | |
1071 | |
1072 # sculpt options | |
1073 if context.sculpt_object: | |
1074 | |
1075 sculpt_tool = brush.sculpt_tool | |
1076 | |
1077 layout.separator() | |
1078 layout.operator_menu_enum("brush.curve_preset", "shape", text='Curve
Preset') | |
1079 layout.separator() | |
1080 | |
1081 if sculpt_tool != 'GRAB': | |
1082 layout.prop_menu_enum(brush, "stroke_method") | |
1083 | |
1084 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}: | |
1085 layout.prop_menu_enum(brush, "direction") | |
1086 | |
1087 if sculpt_tool == 'LAYER': | |
1088 layout.prop(brush, "use_persistent") | |
1089 layout.operator("sculpt.set_persistent_base") | |
1090 | |
1091 | |
1092 class VIEW3D_MT_brush_paint_modes(Menu): | |
1093 bl_label = "Enabled Modes" | |
1094 | |
1095 def draw(self, context): | |
1096 layout = self.layout | |
1097 | |
1098 settings = UnifiedPaintPanel.paint_settings(context) | |
1099 brush = settings.brush | |
1100 | |
1101 layout.prop(brush, "use_paint_sculpt", text="Sculpt") | |
1102 layout.prop(brush, "use_paint_vertex", text="Vertex Paint") | |
1103 layout.prop(brush, "use_paint_weight", text="Weight Paint") | |
1104 layout.prop(brush, "use_paint_image", text="Texture Paint") | |
1105 | |
1106 # ********** Vertex paint menu ********** | |
1107 | |
1108 | |
1109 class VIEW3D_MT_paint_vertex(Menu): | |
1110 bl_label = "Paint" | |
1111 | |
1112 def draw(self, context): | |
1113 layout = self.layout | |
1114 | |
1115 layout.operator("ed.undo") | |
1116 layout.operator("ed.redo") | |
1117 | |
1118 layout.separator() | |
1119 | |
1120 layout.operator("paint.vertex_color_set") | |
1121 layout.operator("paint.vertex_color_dirt") | |
1122 | |
1123 | |
1124 class VIEW3D_MT_hook(Menu): | |
1125 bl_label = "Hooks" | |
1126 | |
1127 def draw(self, context): | |
1128 layout = self.layout | |
1129 layout.operator_context = 'EXEC_AREA' | |
1130 layout.operator("object.hook_add_newob") | |
1131 layout.operator("object.hook_add_selob") | |
1132 | |
1133 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]: | |
1134 layout.separator() | |
1135 layout.operator_menu_enum("object.hook_assign", "modifier") | |
1136 layout.operator_menu_enum("object.hook_remove", "modifier") | |
1137 layout.separator() | |
1138 layout.operator_menu_enum("object.hook_select", "modifier") | |
1139 layout.operator_menu_enum("object.hook_reset", "modifier") | |
1140 layout.operator_menu_enum("object.hook_recenter", "modifier") | |
1141 | |
1142 | |
1143 class VIEW3D_MT_vertex_group(Menu): | |
1144 bl_label = "Vertex Groups" | |
1145 | |
1146 def draw(self, context): | |
1147 layout = self.layout | |
1148 layout.operator_context = 'EXEC_AREA' | |
1149 layout.operator("object.vertex_group_assign", text="Assign to New Group"
).new = True | |
1150 | |
1151 ob = context.active_object | |
1152 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH'
and ob.data.use_paint_mask_vertex): | |
1153 if ob.vertex_groups.active: | |
1154 layout.separator() | |
1155 layout.operator("object.vertex_group_assign", text="Assign to Ac
tive Group") | |
1156 layout.operator("object.vertex_group_remove_from", text="Remove
from Active Group").all = False | |
1157 layout.operator("object.vertex_group_remove_from", text="Remove
from All").all = True | |
1158 layout.separator() | |
1159 | |
1160 if ob.vertex_groups.active: | |
1161 layout.operator_menu_enum("object.vertex_group_set_active", "group",
text="Set Active Group") | |
1162 layout.operator("object.vertex_group_remove", text="Remove Active Gr
oup").all = False | |
1163 layout.operator("object.vertex_group_remove", text="Remove All Group
s").all = True | |
1164 | |
1165 # ********** Weight paint menu ********** | |
1166 | |
1167 | |
1168 class VIEW3D_MT_paint_weight(Menu): | |
1169 bl_label = "Weights" | |
1170 | |
1171 def draw(self, context): | |
1172 layout = self.layout | |
1173 | |
1174 layout.operator("ed.undo") | |
1175 layout.operator("ed.redo") | |
1176 layout.operator("ed.undo_history") | |
1177 | |
1178 layout.separator() | |
1179 | |
1180 layout.operator("paint.weight_from_bones", text="Assign Automatic From B
ones").type = 'AUTOMATIC' | |
1181 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelo
pes").type = 'ENVELOPES' | |
1182 | |
1183 layout.separator() | |
1184 | |
1185 layout.operator("object.vertex_group_normalize_all", text="Normalize All
") | |
1186 layout.operator("object.vertex_group_normalize", text="Normalize") | |
1187 layout.operator("object.vertex_group_mirror", text="Mirror") | |
1188 layout.operator("object.vertex_group_invert", text="Invert") | |
1189 layout.operator("object.vertex_group_clean", text="Clean") | |
1190 layout.operator("object.vertex_group_levels", text="Levels") | |
1191 layout.operator("object.vertex_group_blend", text="Blend") | |
1192 layout.operator("object.vertex_group_fix", text="Fix Deforms") | |
1193 | |
1194 layout.separator() | |
1195 | |
1196 layout.operator("paint.weight_set") | |
1197 | |
1198 # ********** Sculpt menu ********** | |
1199 | |
1200 | |
1201 class VIEW3D_MT_sculpt(Menu): | |
1202 bl_label = "Sculpt" | |
1203 | |
1204 def draw(self, context): | |
1205 layout = self.layout | |
1206 | |
1207 toolsettings = context.tool_settings | |
1208 sculpt = toolsettings.sculpt | |
1209 | |
1210 layout.operator("ed.undo") | |
1211 layout.operator("ed.redo") | |
1212 | |
1213 layout.separator() | |
1214 | |
1215 layout.prop(sculpt, "use_symmetry_x") | |
1216 layout.prop(sculpt, "use_symmetry_y") | |
1217 layout.prop(sculpt, "use_symmetry_z") | |
1218 layout.separator() | |
1219 layout.prop(sculpt, "lock_x") | |
1220 layout.prop(sculpt, "lock_y") | |
1221 layout.prop(sculpt, "lock_z") | |
1222 | |
1223 layout.separator() | |
1224 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt") | |
1225 layout.prop(sculpt, "show_low_resolution") | |
1226 layout.prop(sculpt, "show_brush") | |
1227 layout.prop(sculpt, "use_deform_only") | |
1228 | |
1229 | |
1230 class VIEW3D_MT_hide_mask(Menu): | |
1231 bl_label = "Hide/Mask" | |
1232 | |
1233 def draw(self, context): | |
1234 layout = self.layout | |
1235 | |
1236 op = layout.operator("paint.hide_show", text="Show All") | |
1237 op.action = 'SHOW' | |
1238 op.area = 'ALL' | |
1239 | |
1240 op = layout.operator("paint.hide_show", text="Hide Bounding Box") | |
1241 op.action = 'HIDE' | |
1242 op.area = 'INSIDE' | |
1243 | |
1244 op = layout.operator("paint.hide_show", text="Show Bounding Box") | |
1245 op.action = 'SHOW' | |
1246 op.area = 'INSIDE' | |
1247 ···· | |
1248 op = layout.operator("paint.hide_show", text="Hide Masked") | |
1249 op.area = 'MASKED' | |
1250 op.action = 'HIDE' | |
1251 | |
1252 layout.separator() | |
1253 | |
1254 op = layout.operator("paint.mask_flood_fill", text="Invert Mask") | |
1255 op.mode = 'INVERT' | |
1256 | |
1257 op = layout.operator("paint.mask_flood_fill", text="Fill Mask") | |
1258 op.mode = 'VALUE' | |
1259 op.value = 1 | |
1260 | |
1261 op = layout.operator("paint.mask_flood_fill", text="Clear Mask") | |
1262 op.mode = 'VALUE' | |
1263 op.value = 0 | |
1264 | |
1265 | |
1266 # ********** Particle menu ********** | |
1267 | |
1268 | |
1269 class VIEW3D_MT_particle(Menu): | |
1270 bl_label = "Particle" | |
1271 | |
1272 def draw(self, context): | |
1273 layout = self.layout | |
1274 | |
1275 particle_edit = context.tool_settings.particle_edit | |
1276 | |
1277 layout.operator("ed.undo") | |
1278 layout.operator("ed.redo") | |
1279 layout.operator("ed.undo_history") | |
1280 | |
1281 layout.separator() | |
1282 | |
1283 layout.operator("particle.mirror") | |
1284 | |
1285 layout.separator() | |
1286 | |
1287 layout.operator("particle.remove_doubles") | |
1288 layout.operator("particle.delete") | |
1289 | |
1290 if particle_edit.select_mode == 'POINT': | |
1291 layout.operator("particle.subdivide") | |
1292 | |
1293 layout.operator("particle.rekey") | |
1294 layout.operator("particle.weight_set") | |
1295 | |
1296 layout.separator() | |
1297 | |
1298 layout.menu("VIEW3D_MT_particle_showhide") | |
1299 | |
1300 | |
1301 class VIEW3D_MT_particle_specials(Menu): | |
1302 bl_label = "Specials" | |
1303 | |
1304 def draw(self, context): | |
1305 layout = self.layout | |
1306 particle_edit = context.tool_settings.particle_edit | |
1307 | |
1308 layout.operator("particle.rekey") | |
1309 | |
1310 layout.separator() | |
1311 if particle_edit.select_mode == 'POINT': | |
1312 layout.operator("particle.subdivide") | |
1313 layout.operator("particle.select_roots") | |
1314 layout.operator("particle.select_tips") | |
1315 | |
1316 layout.operator("particle.remove_doubles") | |
1317 | |
1318 | |
1319 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu): | |
1320 _operator_name = "particle" | |
1321 | |
1322 # ********** Pose Menu ********** | |
1323 | |
1324 | |
1325 class VIEW3D_MT_pose(Menu): | |
1326 bl_label = "Pose" | |
1327 | |
1328 def draw(self, context): | |
1329 layout = self.layout | |
1330 | |
1331 layout.operator("ed.undo") | |
1332 layout.operator("ed.redo") | |
1333 layout.operator("ed.undo_history") | |
1334 | |
1335 layout.separator() | |
1336 | |
1337 layout.menu("VIEW3D_MT_transform") | |
1338 | |
1339 layout.menu("VIEW3D_MT_pose_transform") | |
1340 layout.menu("VIEW3D_MT_pose_apply") | |
1341 | |
1342 layout.menu("VIEW3D_MT_snap") | |
1343 | |
1344 layout.separator() | |
1345 | |
1346 layout.menu("VIEW3D_MT_object_animation") | |
1347 | |
1348 layout.separator() | |
1349 | |
1350 layout.menu("VIEW3D_MT_pose_slide") | |
1351 layout.menu("VIEW3D_MT_pose_propagate") | |
1352 | |
1353 layout.separator() | |
1354 | |
1355 layout.operator("pose.copy") | |
1356 layout.operator("pose.paste") | |
1357 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = Tru
e | |
1358 | |
1359 layout.separator() | |
1360 | |
1361 layout.menu("VIEW3D_MT_pose_library") | |
1362 layout.menu("VIEW3D_MT_pose_motion") | |
1363 layout.menu("VIEW3D_MT_pose_group") | |
1364 | |
1365 layout.separator() | |
1366 | |
1367 layout.menu("VIEW3D_MT_object_parent") | |
1368 layout.menu("VIEW3D_MT_pose_ik") | |
1369 layout.menu("VIEW3D_MT_pose_constraints") | |
1370 | |
1371 layout.separator() | |
1372 | |
1373 layout.operator_context = 'EXEC_AREA' | |
1374 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis
= 'XAXIS' | |
1375 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis
= 'YAXIS' | |
1376 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis
= 'ZAXIS' | |
1377 | |
1378 layout.operator("pose.flip_names") | |
1379 | |
1380 layout.operator("pose.quaternions_flip") | |
1381 | |
1382 layout.separator() | |
1383 | |
1384 layout.operator_context = 'INVOKE_AREA' | |
1385 layout.operator("pose.armature_layers", text="Change Armature Layers..."
) | |
1386 layout.operator("pose.bone_layers", text="Change Bone Layers...") | |
1387 | |
1388 layout.separator() | |
1389 | |
1390 layout.menu("VIEW3D_MT_pose_showhide") | |
1391 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings") | |
1392 | |
1393 | |
1394 class VIEW3D_MT_pose_transform(Menu): | |
1395 bl_label = "Clear Transform" | |
1396 | |
1397 def draw(self, context): | |
1398 layout = self.layout | |
1399 | |
1400 layout.operator("pose.transforms_clear", text="All") | |
1401 | |
1402 layout.separator() | |
1403 | |
1404 layout.operator("pose.loc_clear", text="Location") | |
1405 layout.operator("pose.rot_clear", text="Rotation") | |
1406 layout.operator("pose.scale_clear", text="Scale") | |
1407 | |
1408 layout.separator() | |
1409 | |
1410 layout.operator("pose.user_transforms_clear", text="Reset unkeyed") | |
1411 | |
1412 | |
1413 class VIEW3D_MT_pose_slide(Menu): | |
1414 bl_label = "In-Betweens" | |
1415 | |
1416 def draw(self, context): | |
1417 layout = self.layout | |
1418 | |
1419 layout.operator("pose.push") | |
1420 layout.operator("pose.relax") | |
1421 layout.operator("pose.breakdown") | |
1422 | |
1423 | |
1424 class VIEW3D_MT_pose_propagate(Menu): | |
1425 bl_label = "Propagate" | |
1426 | |
1427 def draw(self, context): | |
1428 layout = self.layout | |
1429 | |
1430 layout.operator("pose.propagate").mode = 'WHILE_HELD' | |
1431 | |
1432 layout.separator() | |
1433 | |
1434 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_
KEY' | |
1435 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)")
.mode = 'LAST_KEY' | |
1436 | |
1437 layout.separator() | |
1438 | |
1439 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SE
LECTED_MARKERS' | |
1440 | |
1441 | |
1442 class VIEW3D_MT_pose_library(Menu): | |
1443 bl_label = "Pose Library" | |
1444 | |
1445 def draw(self, context): | |
1446 layout = self.layout | |
1447 | |
1448 layout.operator("poselib.browse_interactive", text="Browse Poses...") | |
1449 | |
1450 layout.separator() | |
1451 | |
1452 layout.operator("poselib.pose_add", text="Add Pose...") | |
1453 layout.operator("poselib.pose_rename", text="Rename Pose...") | |
1454 layout.operator("poselib.pose_remove", text="Remove Pose...") | |
1455 | |
1456 | |
1457 class VIEW3D_MT_pose_motion(Menu): | |
1458 bl_label = "Motion Paths" | |
1459 | |
1460 def draw(self, context): | |
1461 layout = self.layout | |
1462 | |
1463 layout.operator("pose.paths_calculate", text="Calculate") | |
1464 layout.operator("pose.paths_clear", text="Clear") | |
1465 | |
1466 | |
1467 class VIEW3D_MT_pose_group(Menu): | |
1468 bl_label = "Bone Groups" | |
1469 | |
1470 def draw(self, context): | |
1471 layout = self.layout | |
1472 layout.operator("pose.group_add") | |
1473 layout.operator("pose.group_remove") | |
1474 | |
1475 layout.separator() | |
1476 | |
1477 layout.operator("pose.group_assign") | |
1478 layout.operator("pose.group_unassign") | |
1479 | |
1480 | |
1481 class VIEW3D_MT_pose_ik(Menu): | |
1482 bl_label = "Inverse Kinematics" | |
1483 | |
1484 def draw(self, context): | |
1485 layout = self.layout | |
1486 | |
1487 layout.operator("pose.ik_add") | |
1488 layout.operator("pose.ik_clear") | |
1489 | |
1490 | |
1491 class VIEW3D_MT_pose_constraints(Menu): | |
1492 bl_label = "Constraints" | |
1493 | |
1494 def draw(self, context): | |
1495 layout = self.layout | |
1496 | |
1497 layout.operator("pose.constraint_add_with_targets", text="Add (With Targ
ets)...") | |
1498 layout.operator("pose.constraints_copy") | |
1499 layout.operator("pose.constraints_clear") | |
1500 | |
1501 | |
1502 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu): | |
1503 _operator_name = "pose" | |
1504 | |
1505 | |
1506 class VIEW3D_MT_pose_apply(Menu): | |
1507 bl_label = "Apply" | |
1508 | |
1509 def draw(self, context): | |
1510 layout = self.layout | |
1511 | |
1512 layout.operator("pose.armature_apply") | |
1513 layout.operator("pose.visual_transform_apply") | |
1514 | |
1515 | |
1516 class BoneOptions: | |
1517 def draw(self, context): | |
1518 layout = self.layout | |
1519 | |
1520 options = [ | |
1521 "show_wire", | |
1522 "use_deform", | |
1523 "use_envelope_multiply", | |
1524 "use_inherit_rotation", | |
1525 "use_inherit_scale", | |
1526 ] | |
1527 | |
1528 if context.mode == 'EDIT_ARMATURE': | |
1529 bone_props = bpy.types.EditBone.bl_rna.properties | |
1530 data_path_iter = "selected_bones" | |
1531 opt_suffix = "" | |
1532 options.append("lock") | |
1533 else: # pose-mode | |
1534 bone_props = bpy.types.Bone.bl_rna.properties | |
1535 data_path_iter = "selected_pose_bones" | |
1536 opt_suffix = "bone." | |
1537 | |
1538 for opt in options: | |
1539 props = layout.operator("wm.context_collection_boolean_set", text=bo
ne_props[opt].name) | |
1540 props.data_path_iter = data_path_iter | |
1541 props.data_path_item = opt_suffix + opt | |
1542 props.type = self.type | |
1543 | |
1544 | |
1545 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions): | |
1546 bl_label = "Toggle Bone Options" | |
1547 type = 'TOGGLE' | |
1548 | |
1549 | |
1550 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions): | |
1551 bl_label = "Enable Bone Options" | |
1552 type = 'ENABLE' | |
1553 | |
1554 | |
1555 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions): | |
1556 bl_label = "Disable Bone Options" | |
1557 type = 'DISABLE' | |
1558 | |
1559 # ********** Edit Menus, suffix from ob.type ********** | |
1560 | |
1561 | |
1562 class VIEW3D_MT_edit_mesh(Menu): | |
1563 bl_label = "Mesh" | |
1564 | |
1565 def draw(self, context): | |
1566 layout = self.layout | |
1567 | |
1568 toolsettings = context.tool_settings | |
1569 | |
1570 layout.operator("ed.undo") | |
1571 layout.operator("ed.redo") | |
1572 layout.operator("ed.undo_history") | |
1573 | |
1574 layout.separator() | |
1575 | |
1576 layout.menu("VIEW3D_MT_transform") | |
1577 layout.menu("VIEW3D_MT_mirror") | |
1578 layout.menu("VIEW3D_MT_snap") | |
1579 | |
1580 layout.separator() | |
1581 | |
1582 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...") | |
1583 | |
1584 layout.separator() | |
1585 | |
1586 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Re
gion") | |
1587 layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrud
e Individual") | |
1588 layout.operator("mesh.duplicate_move") | |
1589 layout.menu("VIEW3D_MT_edit_mesh_delete") | |
1590 layout.menu("VIEW3D_MT_edit_mesh_dissolve") | |
1591 | |
1592 layout.separator() | |
1593 | |
1594 layout.menu("VIEW3D_MT_edit_mesh_vertices") | |
1595 layout.menu("VIEW3D_MT_edit_mesh_edges") | |
1596 layout.menu("VIEW3D_MT_edit_mesh_faces") | |
1597 layout.menu("VIEW3D_MT_edit_mesh_normals") | |
1598 | |
1599 layout.separator() | |
1600 | |
1601 layout.prop(toolsettings, "use_mesh_automerge") | |
1602 layout.prop_menu_enum(toolsettings, "proportional_edit") | |
1603 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") | |
1604 | |
1605 layout.separator() | |
1606 | |
1607 layout.menu("VIEW3D_MT_edit_mesh_showhide") | |
1608 | |
1609 | |
1610 class VIEW3D_MT_edit_mesh_specials(Menu): | |
1611 bl_label = "Specials" | |
1612 | |
1613 def draw(self, context): | |
1614 layout = self.layout | |
1615 | |
1616 layout.operator_context = 'INVOKE_REGION_WIN' | |
1617 | |
1618 layout.operator("mesh.subdivide", text="Subdivide").smoothness = 0.0 | |
1619 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness =
1.0 | |
1620 layout.operator("mesh.merge", text="Merge...") | |
1621 layout.operator("mesh.remove_doubles") | |
1622 layout.operator("mesh.hide", text="Hide").unselected = False | |
1623 layout.operator("mesh.reveal", text="Reveal") | |
1624 layout.operator("mesh.select_all", text="Select Inverse").action = 'INVE
RT' | |
1625 layout.operator("mesh.flip_normals") | |
1626 layout.operator("mesh.vertices_smooth", text="Smooth") | |
1627 layout.operator("mesh.inset") | |
1628 layout.operator("mesh.bevel", text="Bevel") | |
1629 layout.operator("mesh.bridge_edge_loops") | |
1630 layout.operator("mesh.faces_shade_smooth") | |
1631 layout.operator("mesh.faces_shade_flat") | |
1632 layout.operator("mesh.blend_from_shape") | |
1633 layout.operator("mesh.shape_propagate_to_all") | |
1634 layout.operator("mesh.select_vertex_path") | |
1635 | |
1636 | |
1637 class VIEW3D_MT_edit_mesh_select_mode(Menu): | |
1638 bl_label = "Mesh Select Mode" | |
1639 | |
1640 def draw(self, context): | |
1641 layout = self.layout | |
1642 | |
1643 layout.operator_context = 'INVOKE_REGION_WIN' | |
1644 | |
1645 props = layout.operator("wm.context_set_value", text="Vertex", icon='VER
TEXSEL') | |
1646 props.value = "(True, False, False)" | |
1647 props.data_path = "tool_settings.mesh_select_mode" | |
1648 | |
1649 props = layout.operator("wm.context_set_value", text="Edge", icon='EDGES
EL') | |
1650 props.value = "(False, True, False)" | |
1651 props.data_path = "tool_settings.mesh_select_mode" | |
1652 | |
1653 props = layout.operator("wm.context_set_value", text="Face", icon='FACES
EL') | |
1654 props.value = "(False, False, True)" | |
1655 props.data_path = "tool_settings.mesh_select_mode" | |
1656 | |
1657 | |
1658 class VIEW3D_MT_edit_mesh_extrude(Menu): | |
1659 bl_label = "Extrude" | |
1660 | |
1661 _extrude_funcs = { | |
1662 'VERT': lambda layout: layout.operator("mesh.extrude_vertices_move", tex
t="Vertices Only"), | |
1663 'EDGE': lambda layout: layout.operator("mesh.extrude_edges_move", text="
Edges Only"), | |
1664 'FACE': lambda layout: layout.operator("mesh.extrude_faces_move", text="
Individual Faces"), | |
1665 'REGION': lambda layout: layout.operator("view3d.edit_mesh_extrude_move_
normal", text="Region"), | |
1666 } | |
1667 | |
1668 @staticmethod | |
1669 def extrude_options(context): | |
1670 mesh = context.object.data | |
1671 select_mode = context.tool_settings.mesh_select_mode | |
1672 | |
1673 menu = [] | |
1674 if mesh.total_face_sel: | |
1675 menu += ['REGION', 'FACE'] | |
1676 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]): | |
1677 menu += ['EDGE'] | |
1678 if mesh.total_vert_sel and select_mode[0]: | |
1679 menu += ['VERT'] | |
1680 | |
1681 # should never get here | |
1682 return menu | |
1683 | |
1684 def draw(self, context): | |
1685 layout = self.layout | |
1686 layout.operator_context = 'INVOKE_REGION_WIN' | |
1687 | |
1688 for menu_id in self.extrude_options(context): | |
1689 self._extrude_funcs[menu_id](layout) | |
1690 | |
1691 | |
1692 class VIEW3D_MT_edit_mesh_vertices(Menu): | |
1693 bl_label = "Vertices" | |
1694 | |
1695 def draw(self, context): | |
1696 layout = self.layout | |
1697 layout.operator_context = 'INVOKE_REGION_WIN' | |
1698 | |
1699 layout.operator("mesh.merge") | |
1700 layout.operator("mesh.rip_move") | |
1701 layout.operator("mesh.split") | |
1702 layout.operator_menu_enum("mesh.separate", "type") | |
1703 layout.operator("mesh.vert_connect") | |
1704 layout.operator("mesh.vert_slide") | |
1705 | |
1706 layout.separator() | |
1707 | |
1708 layout.operator("mesh.vertices_smooth") | |
1709 layout.operator("mesh.remove_doubles") | |
1710 layout.operator("mesh.vertices_sort") | |
1711 layout.operator("mesh.vertices_randomize") | |
1712 | |
1713 layout.operator("mesh.select_vertex_path") | |
1714 | |
1715 layout.operator("mesh.blend_from_shape") | |
1716 | |
1717 layout.operator("object.vertex_group_blend") | |
1718 layout.operator("mesh.shape_propagate_to_all") | |
1719 | |
1720 layout.separator() | |
1721 | |
1722 layout.menu("VIEW3D_MT_vertex_group") | |
1723 layout.menu("VIEW3D_MT_hook") | |
1724 | |
1725 | |
1726 class VIEW3D_MT_edit_mesh_edges(Menu): | |
1727 bl_label = "Edges" | |
1728 | |
1729 def draw(self, context): | |
1730 layout = self.layout | |
1731 layout.operator_context = 'INVOKE_REGION_WIN' | |
1732 | |
1733 layout.operator("mesh.edge_face_add") | |
1734 layout.operator("mesh.subdivide") | |
1735 | |
1736 layout.separator() | |
1737 | |
1738 layout.operator("mesh.mark_seam").clear = False | |
1739 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True | |
1740 | |
1741 layout.separator() | |
1742 | |
1743 layout.operator("mesh.mark_sharp").clear = False | |
1744 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True | |
1745 | |
1746 layout.separator() | |
1747 | |
1748 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = '
CW' | |
1749 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction =
'CCW' | |
1750 | |
1751 layout.separator() | |
1752 | |
1753 layout.operator("mesh.bevel") | |
1754 layout.operator("mesh.edge_split") | |
1755 layout.operator("mesh.bridge_edge_loops") | |
1756 | |
1757 layout.separator() | |
1758 | |
1759 layout.operator("TRANSFORM_OT_edge_slide") | |
1760 layout.operator("TRANSFORM_OT_edge_crease") | |
1761 layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False | |
1762 | |
1763 #~ uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1)
; | |
1764 #~ uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em,
0,0.0); | |
1765 | |
1766 layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True | |
1767 | |
1768 layout.operator("mesh.loop_to_region") | |
1769 layout.operator("mesh.region_to_loop") | |
1770 | |
1771 | |
1772 class VIEW3D_MT_edit_mesh_faces(Menu): | |
1773 bl_label = "Faces" | |
1774 bl_idname = "VIEW3D_MT_edit_mesh_faces" | |
1775 | |
1776 def draw(self, context): | |
1777 layout = self.layout | |
1778 layout.operator_context = 'INVOKE_REGION_WIN' | |
1779 | |
1780 layout.operator("mesh.flip_normals") | |
1781 layout.operator("mesh.edge_face_add") | |
1782 layout.operator("mesh.fill") | |
1783 layout.operator("mesh.beautify_fill") | |
1784 layout.operator("mesh.inset") | |
1785 layout.operator("mesh.bevel") | |
1786 layout.operator("mesh.solidify") | |
1787 layout.operator("mesh.wireframe") | |
1788 layout.operator("mesh.sort_faces") | |
1789 | |
1790 layout.separator() | |
1791 | |
1792 layout.operator("mesh.quads_convert_to_tris") | |
1793 layout.operator("mesh.tris_convert_to_quads") | |
1794 | |
1795 layout.separator() | |
1796 | |
1797 layout.operator("mesh.faces_shade_smooth") | |
1798 layout.operator("mesh.faces_shade_flat") | |
1799 | |
1800 layout.separator() | |
1801 | |
1802 # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em,
1); | |
1803 # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh
_set_face_flags(em, 0); | |
1804 | |
1805 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = '
CW' | |
1806 | |
1807 layout.separator() | |
1808 | |
1809 layout.operator_menu_enum("mesh.uvs_rotate", "direction") | |
1810 layout.operator("mesh.uvs_reverse") | |
1811 layout.operator_menu_enum("mesh.colors_rotate", "direction") | |
1812 layout.operator("mesh.colors_reverse") | |
1813 | |
1814 | |
1815 class VIEW3D_MT_edit_mesh_normals(Menu): | |
1816 bl_label = "Normals" | |
1817 | |
1818 def draw(self, context): | |
1819 layout = self.layout | |
1820 | |
1821 layout.operator("mesh.normals_make_consistent", text="Recalculate Outsid
e").inside = False | |
1822 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside
").inside = True | |
1823 | |
1824 layout.separator() | |
1825 | |
1826 layout.operator("mesh.flip_normals") | |
1827 | |
1828 | |
1829 class VIEW3D_MT_edit_mesh_delete(Menu): | |
1830 bl_label = "Delete" | |
1831 | |
1832 def draw(self, context): | |
1833 layout = self.layout | |
1834 | |
1835 layout.operator_enum("mesh.delete", "type") | |
1836 | |
1837 layout.separator() | |
1838 | |
1839 layout.operator("mesh.dissolve") | |
1840 layout.operator("mesh.edge_collapse") | |
1841 layout.operator("mesh.delete_edgeloop") | |
1842 | |
1843 | |
1844 class VIEW3D_MT_edit_mesh_dissolve(Menu): | |
1845 bl_label = "Dissolve" | |
1846 | |
1847 def draw(self, context): | |
1848 layout = self.layout | |
1849 | |
1850 layout.operator("mesh.dissolve") | |
1851 | |
1852 layout.separator() | |
1853 | |
1854 layout.operator_enum("mesh.dissolve", "type") | |
1855 | |
1856 layout.separator() | |
1857 | |
1858 layout.operator("mesh.dissolve_limited") | |
1859 | |
1860 | |
1861 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu): | |
1862 _operator_name = "mesh" | |
1863 | |
1864 # Edit Curve | |
1865 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface | |
1866 | |
1867 | |
1868 def draw_curve(self, context): | |
1869 layout = self.layout | |
1870 | |
1871 toolsettings = context.tool_settings | |
1872 | |
1873 layout.menu("VIEW3D_MT_transform") | |
1874 layout.menu("VIEW3D_MT_mirror") | |
1875 layout.menu("VIEW3D_MT_snap") | |
1876 | |
1877 layout.separator() | |
1878 | |
1879 layout.operator("curve.extrude") | |
1880 layout.operator("curve.duplicate") | |
1881 layout.operator("curve.separate") | |
1882 layout.operator("curve.make_segment") | |
1883 layout.operator("curve.cyclic_toggle") | |
1884 layout.operator("curve.delete", text="Delete...") | |
1885 | |
1886 layout.separator() | |
1887 | |
1888 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints") | |
1889 layout.menu("VIEW3D_MT_edit_curve_segments") | |
1890 | |
1891 layout.separator() | |
1892 | |
1893 layout.prop_menu_enum(toolsettings, "proportional_edit") | |
1894 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") | |
1895 | |
1896 layout.separator() | |
1897 | |
1898 layout.menu("VIEW3D_MT_edit_curve_showhide") | |
1899 | |
1900 | |
1901 class VIEW3D_MT_edit_curve(Menu): | |
1902 bl_label = "Curve" | |
1903 | |
1904 draw = draw_curve | |
1905 | |
1906 | |
1907 class VIEW3D_MT_edit_curve_ctrlpoints(Menu): | |
1908 bl_label = "Control Points" | |
1909 | |
1910 def draw(self, context): | |
1911 layout = self.layout | |
1912 | |
1913 edit_object = context.edit_object | |
1914 | |
1915 if edit_object.type == 'CURVE': | |
1916 layout.operator("transform.tilt") | |
1917 layout.operator("curve.tilt_clear") | |
1918 layout.operator("curve.separate") | |
1919 | |
1920 layout.separator() | |
1921 | |
1922 layout.operator_menu_enum("curve.handle_type_set", "type") | |
1923 | |
1924 layout.separator() | |
1925 | |
1926 layout.menu("VIEW3D_MT_hook") | |
1927 | |
1928 | |
1929 class VIEW3D_MT_edit_curve_segments(Menu): | |
1930 bl_label = "Segments" | |
1931 | |
1932 def draw(self, context): | |
1933 layout = self.layout | |
1934 | |
1935 layout.operator("curve.subdivide") | |
1936 layout.operator("curve.switch_direction") | |
1937 | |
1938 | |
1939 class VIEW3D_MT_edit_curve_specials(Menu): | |
1940 bl_label = "Specials" | |
1941 | |
1942 def draw(self, context): | |
1943 layout = self.layout | |
1944 | |
1945 layout.operator("curve.subdivide") | |
1946 layout.operator("curve.switch_direction") | |
1947 layout.operator("curve.spline_weight_set") | |
1948 layout.operator("curve.radius_set") | |
1949 layout.operator("curve.smooth") | |
1950 layout.operator("curve.smooth_radius") | |
1951 | |
1952 | |
1953 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu): | |
1954 _operator_name = "curve" | |
1955 | |
1956 | |
1957 class VIEW3D_MT_edit_surface(Menu): | |
1958 bl_label = "Surface" | |
1959 | |
1960 draw = draw_curve | |
1961 | |
1962 | |
1963 class VIEW3D_MT_edit_font(Menu): | |
1964 bl_label = "Text" | |
1965 | |
1966 def draw(self, context): | |
1967 layout = self.layout | |
1968 | |
1969 layout.operator("font.file_paste") | |
1970 | |
1971 layout.separator() | |
1972 | |
1973 layout.menu("VIEW3D_MT_edit_text_chars") | |
1974 | |
1975 layout.separator() | |
1976 | |
1977 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD' | |
1978 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITAL
IC' | |
1979 layout.operator("font.style_toggle", text="Toggle Underline").style = 'U
NDERLINE' | |
1980 layout.operator("font.style_toggle", text="Toggle Small Caps").style = '
SMALL_CAPS' | |
1981 | |
1982 | |
1983 class VIEW3D_MT_edit_text_chars(Menu): | |
1984 bl_label = "Special Characters" | |
1985 | |
1986 def draw(self, context): | |
1987 layout = self.layout | |
1988 | |
1989 layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00
A9" | |
1990 layout.operator("font.text_insert", text="Registered Trademark|Alt R").t
ext = "\u00AE" | |
1991 | |
1992 layout.separator() | |
1993 | |
1994 layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u
00B0" | |
1995 layout.operator("font.text_insert", text="Multiplication Sign|Alt x").te
xt = "\u00D7" | |
1996 layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A" | |
1997 layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "
\u00B9" | |
1998 layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "
\u00B2" | |
1999 layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "
\u00B3" | |
2000 layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00
BB" | |
2001 layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00
AB" | |
2002 layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2
030" | |
2003 | |
2004 layout.separator() | |
2005 | |
2006 layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\
u00A4" | |
2007 layout.operator("font.text_insert", text="British Pound|Alt L").text = "
\u00A3" | |
2008 layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\
u00A5" | |
2009 | |
2010 layout.separator() | |
2011 | |
2012 layout.operator("font.text_insert", text="German S|Alt S").text = "\u00D
F" | |
2013 layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").
text = "\u00BF" | |
2014 layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !
").text = "\u00A1" | |
2015 | |
2016 | |
2017 class VIEW3D_MT_edit_meta(Menu): | |
2018 bl_label = "Metaball" | |
2019 | |
2020 def draw(self, context): | |
2021 layout = self.layout | |
2022 | |
2023 toolsettings = context.tool_settings | |
2024 | |
2025 layout.operator("ed.undo") | |
2026 layout.operator("ed.redo") | |
2027 layout.operator("ed.undo_history") | |
2028 | |
2029 layout.separator() | |
2030 | |
2031 layout.menu("VIEW3D_MT_transform") | |
2032 layout.menu("VIEW3D_MT_mirror") | |
2033 layout.menu("VIEW3D_MT_snap") | |
2034 | |
2035 layout.separator() | |
2036 | |
2037 layout.operator("mball.delete_metaelems", text="Delete...") | |
2038 layout.operator("mball.duplicate_metaelems") | |
2039 | |
2040 layout.separator() | |
2041 | |
2042 layout.prop_menu_enum(toolsettings, "proportional_edit") | |
2043 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") | |
2044 | |
2045 layout.separator() | |
2046 | |
2047 layout.menu("VIEW3D_MT_edit_meta_showhide") | |
2048 | |
2049 | |
2050 class VIEW3D_MT_edit_meta_showhide(Menu): | |
2051 bl_label = "Show/Hide" | |
2052 | |
2053 def draw(self, context): | |
2054 layout = self.layout | |
2055 | |
2056 layout.operator("mball.reveal_metaelems", text="Show Hidden") | |
2057 layout.operator("mball.hide_metaelems", text="Hide Selected").unselected
= False | |
2058 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselect
ed = True | |
2059 | |
2060 | |
2061 class VIEW3D_MT_edit_lattice(Menu): | |
2062 bl_label = "Lattice" | |
2063 | |
2064 def draw(self, context): | |
2065 layout = self.layout | |
2066 | |
2067 toolsettings = context.tool_settings | |
2068 | |
2069 layout.menu("VIEW3D_MT_transform") | |
2070 layout.menu("VIEW3D_MT_mirror") | |
2071 layout.menu("VIEW3D_MT_snap") | |
2072 | |
2073 layout.separator() | |
2074 | |
2075 layout.operator("lattice.make_regular") | |
2076 | |
2077 layout.separator() | |
2078 | |
2079 layout.prop_menu_enum(toolsettings, "proportional_edit") | |
2080 layout.prop_menu_enum(toolsettings, "proportional_edit_falloff") | |
2081 | |
2082 | |
2083 class VIEW3D_MT_edit_armature(Menu): | |
2084 bl_label = "Armature" | |
2085 | |
2086 def draw(self, context): | |
2087 layout = self.layout | |
2088 | |
2089 edit_object = context.edit_object | |
2090 arm = edit_object.data | |
2091 | |
2092 layout.menu("VIEW3D_MT_transform") | |
2093 layout.menu("VIEW3D_MT_mirror") | |
2094 layout.menu("VIEW3D_MT_snap") | |
2095 layout.menu("VIEW3D_MT_edit_armature_roll") | |
2096 | |
2097 layout.separator() | |
2098 | |
2099 layout.operator("armature.extrude_move") | |
2100 | |
2101 if arm.use_mirror_x: | |
2102 layout.operator("armature.extrude_forked") | |
2103 | |
2104 layout.operator("armature.duplicate_move") | |
2105 layout.operator("armature.merge") | |
2106 layout.operator("armature.fill") | |
2107 layout.operator("armature.delete") | |
2108 layout.operator("armature.separate") | |
2109 | |
2110 layout.separator() | |
2111 | |
2112 layout.operator("armature.subdivide", text="Subdivide") | |
2113 layout.operator("armature.switch_direction", text="Switch Direction") | |
2114 | |
2115 layout.separator() | |
2116 | |
2117 layout.operator_context = 'EXEC_AREA' | |
2118 layout.operator("armature.autoside_names", text="AutoName Left/Right").t
ype = 'XAXIS' | |
2119 layout.operator("armature.autoside_names", text="AutoName Front/Back").t
ype = 'YAXIS' | |
2120 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").t
ype = 'ZAXIS' | |
2121 layout.operator("armature.flip_names") | |
2122 | |
2123 layout.separator() | |
2124 | |
2125 layout.operator_context = 'INVOKE_DEFAULT' | |
2126 layout.operator("armature.armature_layers") | |
2127 layout.operator("armature.bone_layers") | |
2128 | |
2129 layout.separator() | |
2130 | |
2131 layout.menu("VIEW3D_MT_edit_armature_parent") | |
2132 | |
2133 layout.separator() | |
2134 | |
2135 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings") | |
2136 | |
2137 | |
2138 class VIEW3D_MT_armature_specials(Menu): | |
2139 bl_label = "Specials" | |
2140 | |
2141 def draw(self, context): | |
2142 layout = self.layout | |
2143 | |
2144 layout.operator_context = 'INVOKE_REGION_WIN' | |
2145 | |
2146 layout.operator("armature.subdivide", text="Subdivide") | |
2147 layout.operator("armature.switch_direction", text="Switch Direction") | |
2148 | |
2149 layout.separator() | |
2150 | |
2151 layout.operator_context = 'EXEC_REGION_WIN' | |
2152 layout.operator("armature.autoside_names", text="AutoName Left/Right").t
ype = 'XAXIS' | |
2153 layout.operator("armature.autoside_names", text="AutoName Front/Back").t
ype = 'YAXIS' | |
2154 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").t
ype = 'ZAXIS' | |
2155 layout.operator("armature.flip_names", text="Flip Names") | |
2156 | |
2157 | |
2158 class VIEW3D_MT_edit_armature_parent(Menu): | |
2159 bl_label = "Parent" | |
2160 | |
2161 def draw(self, context): | |
2162 layout = self.layout | |
2163 | |
2164 layout.operator("armature.parent_set", text="Make") | |
2165 layout.operator("armature.parent_clear", text="Clear") | |
2166 | |
2167 | |
2168 class VIEW3D_MT_edit_armature_roll(Menu): | |
2169 bl_label = "Bone Roll" | |
2170 | |
2171 def draw(self, context): | |
2172 layout = self.layout | |
2173 | |
2174 layout.operator_menu_enum("armature.calculate_roll", "type") | |
2175 | |
2176 layout.separator() | |
2177 | |
2178 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROL
L' | |
2179 | |
2180 # ********** Panel ********** | |
2181 | |
2182 | |
2183 class VIEW3D_PT_view3d_properties(Panel): | |
2184 bl_space_type = 'VIEW_3D' | |
2185 bl_region_type = 'UI' | |
2186 bl_label = "View" | |
2187 | |
2188 @classmethod | |
2189 def poll(cls, context): | |
2190 view = context.space_data | |
2191 return (view) | |
2192 | |
2193 def draw(self, context): | |
2194 layout = self.layout | |
2195 | |
2196 view = context.space_data | |
2197 | |
2198 col = layout.column() | |
2199 col.active = bool(view.region_3d.view_perspective != 'CAMERA' or | |
2200 view.region_quadview) | |
2201 col.prop(view, "lens") | |
2202 col.label(text="Lock to Object:") | |
2203 col.prop(view, "lock_object", text="") | |
2204 lock_object = view.lock_object | |
2205 if lock_object: | |
2206 if lock_object.type == 'ARMATURE': | |
2207 col.prop_search(view, "lock_bone", lock_object.data, | |
2208 "edit_bones" if lock_object.mode == 'EDIT' | |
2209 else "bones", | |
2210 text="") | |
2211 else: | |
2212 col.prop(view, "lock_cursor", text="Lock to Cursor") | |
2213 | |
2214 col = layout.column() | |
2215 col.prop(view, "lock_camera") | |
2216 | |
2217 col = layout.column(align=True) | |
2218 col.label(text="Clip:") | |
2219 col.prop(view, "clip_start", text="Start") | |
2220 col.prop(view, "clip_end", text="End") | |
2221 | |
2222 subcol = col.column() | |
2223 subcol.enabled = not view.lock_camera_and_layers | |
2224 subcol.label(text="Local Camera:") | |
2225 subcol.prop(view, "camera", text="") | |
2226 | |
2227 | |
2228 class VIEW3D_PT_view3d_cursor(Panel): | |
2229 bl_space_type = 'VIEW_3D' | |
2230 bl_region_type = 'UI' | |
2231 bl_label = "3D Cursor" | |
2232 | |
2233 @classmethod | |
2234 def poll(cls, context): | |
2235 view = context.space_data | |
2236 return (view) | |
2237 | |
2238 def draw(self, context): | |
2239 layout = self.layout | |
2240 | |
2241 view = context.space_data | |
2242 layout.column().prop(view, "cursor_location", text="Location") | |
2243 | |
2244 | |
2245 class VIEW3D_PT_view3d_name(Panel): | |
2246 bl_space_type = 'VIEW_3D' | |
2247 bl_region_type = 'UI' | |
2248 bl_label = "Item" | |
2249 | |
2250 @classmethod | |
2251 def poll(cls, context): | |
2252 return (context.space_data and context.active_object) | |
2253 | |
2254 def draw(self, context): | |
2255 layout = self.layout | |
2256 | |
2257 ob = context.active_object | |
2258 row = layout.row() | |
2259 row.label(text="", icon='OBJECT_DATA') | |
2260 row.prop(ob, "name", text="") | |
2261 | |
2262 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}: | |
2263 bone = context.active_bone | |
2264 if bone: | |
2265 row = layout.row() | |
2266 row.label(text="", icon='BONE_DATA') | |
2267 row.prop(bone, "name", text="") | |
2268 | |
2269 | |
2270 class VIEW3D_PT_view3d_display(Panel): | |
2271 bl_space_type = 'VIEW_3D' | |
2272 bl_region_type = 'UI' | |
2273 bl_label = "Display" | |
2274 bl_options = {'DEFAULT_CLOSED'} | |
2275 | |
2276 @classmethod | |
2277 def poll(cls, context): | |
2278 view = context.space_data | |
2279 return (view) | |
2280 | |
2281 def draw(self, context): | |
2282 layout = self.layout | |
2283 | |
2284 view = context.space_data | |
2285 scene = context.scene | |
2286 gs = scene.game_settings | |
2287 ob = context.object | |
2288 | |
2289 col = layout.column() | |
2290 col.prop(view, "show_only_render") | |
2291 | |
2292 col = layout.column() | |
2293 display_all = not view.show_only_render | |
2294 col.active = display_all | |
2295 col.prop(view, "show_outline_selected") | |
2296 col.prop(view, "show_all_objects_origin") | |
2297 col.prop(view, "show_relationship_lines") | |
2298 if ob and ob.type == 'MESH': | |
2299 mesh = ob.data | |
2300 col.prop(mesh, "show_all_edges") | |
2301 | |
2302 col = layout.column() | |
2303 col.active = display_all | |
2304 split = col.split(percentage=0.55) | |
2305 split.prop(view, "show_floor", text="Grid Floor") | |
2306 | |
2307 row = split.row(align=True) | |
2308 row.prop(view, "show_axis_x", text="X", toggle=True) | |
2309 row.prop(view, "show_axis_y", text="Y", toggle=True) | |
2310 row.prop(view, "show_axis_z", text="Z", toggle=True) | |
2311 | |
2312 sub = col.column(align=True) | |
2313 sub.active = (display_all and view.show_floor) | |
2314 sub.prop(view, "grid_lines", text="Lines") | |
2315 sub.prop(view, "grid_scale", text="Scale") | |
2316 subsub = sub.column(align=True) | |
2317 subsub.active = scene.unit_settings.system == 'NONE' | |
2318 subsub.prop(view, "grid_subdivisions", text="Subdivisions") | |
2319 | |
2320 if not scene.render.use_shading_nodes: | |
2321 col = layout.column() | |
2322 col.label(text="Shading:") | |
2323 col.prop(gs, "material_mode", text="") | |
2324 col.prop(view, "show_textured_solid") | |
2325 | |
2326 layout.separator() | |
2327 | |
2328 region = view.region_quadview | |
2329 | |
2330 layout.operator("screen.region_quadview", text="Toggle Quad View") | |
2331 | |
2332 if region: | |
2333 col = layout.column() | |
2334 col.prop(region, "lock_rotation") | |
2335 row = col.row() | |
2336 row.enabled = region.lock_rotation | |
2337 row.prop(region, "show_sync_view") | |
2338 row = col.row() | |
2339 row.enabled = region.lock_rotation and region.show_sync_view | |
2340 row.prop(region, "use_box_clip") | |
2341 | |
2342 | |
2343 class VIEW3D_PT_view3d_motion_tracking(Panel): | |
2344 bl_space_type = 'VIEW_3D' | |
2345 bl_region_type = 'UI' | |
2346 bl_label = "Motion Tracking" | |
2347 bl_options = {'DEFAULT_CLOSED'} | |
2348 | |
2349 @classmethod | |
2350 def poll(cls, context): | |
2351 view = context.space_data | |
2352 return (view) | |
2353 | |
2354 def draw_header(self, context): | |
2355 view = context.space_data | |
2356 | |
2357 self.layout.prop(view, "show_reconstruction", text="") | |
2358 | |
2359 def draw(self, context): | |
2360 layout = self.layout | |
2361 | |
2362 view = context.space_data | |
2363 | |
2364 col = layout.column() | |
2365 col.active = view.show_reconstruction | |
2366 col.prop(view, "show_bundle_names") | |
2367 col.prop(view, "show_camera_path") | |
2368 col.label(text="Tracks:") | |
2369 col.prop(view, "tracks_draw_type", text="") | |
2370 col.prop(view, "tracks_draw_size", text="Size") | |
2371 | |
2372 | |
2373 class VIEW3D_PT_view3d_meshdisplay(Panel): | |
2374 bl_space_type = 'VIEW_3D' | |
2375 bl_region_type = 'UI' | |
2376 bl_label = "Mesh Display" | |
2377 | |
2378 @classmethod | |
2379 def poll(cls, context): | |
2380 # The active object check is needed because of local-mode | |
2381 return (context.active_object and (context.mode == 'EDIT_MESH')) | |
2382 | |
2383 def draw(self, context): | |
2384 layout = self.layout | |
2385 | |
2386 mesh = context.active_object.data | |
2387 | |
2388 col = layout.column() | |
2389 col.label(text="Overlays:") | |
2390 col.prop(mesh, "show_edges", text="Edges") | |
2391 col.prop(mesh, "show_faces", text="Faces") | |
2392 col.prop(mesh, "show_edge_crease", text="Creases") | |
2393 col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights") | |
2394 col.prop(mesh, "show_edge_seams", text="Seams") | |
2395 col.prop(mesh, "show_edge_sharp", text="Sharp") | |
2396 | |
2397 col.separator() | |
2398 col.label(text="Normals:") | |
2399 row = col.row(align=True) | |
2400 row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL') | |
2401 row.prop(mesh, "show_normal_face", text="", icon='FACESEL') | |
2402 row.prop(context.scene.tool_settings, "normal_size", text="Size") | |
2403 | |
2404 col.separator() | |
2405 col.label(text="Numerics:") | |
2406 col.prop(mesh, "show_extra_edge_length") | |
2407 col.prop(mesh, "show_extra_face_angle") | |
2408 col.prop(mesh, "show_extra_face_area") | |
2409 if bpy.app.debug: | |
2410 col.prop(mesh, "show_extra_indices") | |
2411 | |
2412 | |
2413 class VIEW3D_PT_view3d_curvedisplay(Panel): | |
2414 bl_space_type = 'VIEW_3D' | |
2415 bl_region_type = 'UI' | |
2416 bl_label = "Curve Display" | |
2417 | |
2418 @classmethod | |
2419 def poll(cls, context): | |
2420 editmesh = context.mode == 'EDIT_CURVE' | |
2421 return (editmesh) | |
2422 | |
2423 def draw(self, context): | |
2424 layout = self.layout | |
2425 | |
2426 curve = context.active_object.data | |
2427 | |
2428 col = layout.column() | |
2429 col.label(text="Overlays:") | |
2430 col.prop(curve, "show_handles", text="Handles") | |
2431 col.prop(curve, "show_normal_face", text="Normals") | |
2432 col.prop(context.scene.tool_settings, "normal_size", text="Normal Size") | |
2433 | |
2434 | |
2435 class VIEW3D_PT_background_image(Panel): | |
2436 bl_space_type = 'VIEW_3D' | |
2437 bl_region_type = 'UI' | |
2438 bl_label = "Background Images" | |
2439 bl_options = {'DEFAULT_CLOSED'} | |
2440 | |
2441 def draw_header(self, context): | |
2442 view = context.space_data | |
2443 | |
2444 self.layout.prop(view, "show_background_images", text="") | |
2445 | |
2446 def draw(self, context): | |
2447 layout = self.layout | |
2448 | |
2449 view = context.space_data | |
2450 | |
2451 col = layout.column() | |
2452 col.operator("view3d.background_image_add", text="Add Image") | |
2453 | |
2454 for i, bg in enumerate(view.background_images): | |
2455 layout.active = view.show_background_images | |
2456 box = layout.box() | |
2457 row = box.row(align=True) | |
2458 row.prop(bg, "show_expanded", text="", emboss=False) | |
2459 if bg.source == 'IMAGE' and bg.image: | |
2460 row.prop(bg.image, "name", text="", emboss=False) | |
2461 elif bg.source == 'MOVIE_CLIP' and bg.clip: | |
2462 row.prop(bg.clip, "name", text="", emboss=False) | |
2463 else: | |
2464 row.label(text="Not Set") | |
2465 | |
2466 if bg.show_background_image: | |
2467 row.prop(bg, "show_background_image", text="", emboss=False, ico
n='RESTRICT_VIEW_OFF') | |
2468 else: | |
2469 row.prop(bg, "show_background_image", text="", emboss=False, ico
n='RESTRICT_VIEW_ON') | |
2470 | |
2471 row.operator("view3d.background_image_remove", text="", emboss=False
, icon='X').index = i | |
2472 | |
2473 box.prop(bg, "view_axis", text="Axis") | |
2474 | |
2475 if bg.show_expanded: | |
2476 row = box.row() | |
2477 row.prop(bg, "source", expand=True) | |
2478 | |
2479 has_bg = False | |
2480 if bg.source == 'IMAGE': | |
2481 row = box.row() | |
2482 row.template_ID(bg, "image", open="image.open") | |
2483 if (bg.image): | |
2484 box.template_image(bg, "image", bg.image_user, compact=T
rue) | |
2485 has_bg = True | |
2486 | |
2487 elif bg.source == 'MOVIE_CLIP': | |
2488 box.prop(bg, 'use_camera_clip') | |
2489 | |
2490 column = box.column() | |
2491 column.active = not bg.use_camera_clip | |
2492 column.template_ID(bg, "clip", open="clip.open") | |
2493 | |
2494 if bg.clip: | |
2495 column.template_movieclip(bg, "clip", compact=True) | |
2496 | |
2497 if bg.use_camera_clip or bg.clip: | |
2498 has_bg = True | |
2499 | |
2500 column = box.column() | |
2501 column.active = has_bg | |
2502 column.prop(bg.clip_user, "proxy_render_size", text="") | |
2503 column.prop(bg.clip_user, "use_render_undistorted") | |
2504 | |
2505 if has_bg: | |
2506 col = box.column() | |
2507 col.prop(bg, "show_on_foreground") | |
2508 col.prop(bg, "opacity", slider=True) | |
2509 if bg.view_axis != 'CAMERA': | |
2510 col.prop(bg, "size") | |
2511 row = col.row(align=True) | |
2512 row.prop(bg, "offset_x", text="X") | |
2513 row.prop(bg, "offset_y", text="Y") | |
2514 | |
2515 | |
2516 class VIEW3D_PT_transform_orientations(Panel): | |
2517 bl_space_type = 'VIEW_3D' | |
2518 bl_region_type = 'UI' | |
2519 bl_label = "Transform Orientations" | |
2520 bl_options = {'DEFAULT_CLOSED'} | |
2521 | |
2522 @classmethod | |
2523 def poll(cls, context): | |
2524 view = context.space_data | |
2525 return (view) | |
2526 | |
2527 def draw(self, context): | |
2528 layout = self.layout | |
2529 | |
2530 view = context.space_data | |
2531 orientation = view.current_orientation | |
2532 | |
2533 row = layout.row(align=True) | |
2534 row.prop(view, "transform_orientation", text="") | |
2535 row.operator("transform.create_orientation", text="", icon='ZOOMIN') | |
2536 | |
2537 if orientation: | |
2538 row = layout.row(align=True) | |
2539 row.prop(orientation, "name", text="") | |
2540 row.operator("transform.delete_orientation", text="", icon="X") | |
2541 | |
2542 | |
2543 class VIEW3D_PT_etch_a_ton(Panel): | |
2544 bl_space_type = 'VIEW_3D' | |
2545 bl_region_type = 'UI' | |
2546 bl_label = "Skeleton Sketching" | |
2547 bl_options = {'DEFAULT_CLOSED'} | |
2548 | |
2549 @classmethod | |
2550 def poll(cls, context): | |
2551 scene = context.space_data | |
2552 ob = context.active_object | |
2553 return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT' | |
2554 | |
2555 def draw_header(self, context): | |
2556 layout = self.layout | |
2557 toolsettings = context.scene.tool_settings | |
2558 | |
2559 layout.prop(toolsettings, "use_bone_sketching", text="") | |
2560 | |
2561 def draw(self, context): | |
2562 layout = self.layout | |
2563 toolsettings = context.scene.tool_settings | |
2564 | |
2565 col = layout.column() | |
2566 | |
2567 col.prop(toolsettings, "use_etch_quick") | |
2568 col.prop(toolsettings, "use_etch_overdraw") | |
2569 | |
2570 col.prop(toolsettings, "etch_convert_mode") | |
2571 | |
2572 if toolsettings.etch_convert_mode == 'LENGTH': | |
2573 col.prop(toolsettings, "etch_length_limit") | |
2574 elif toolsettings.etch_convert_mode == 'ADAPTIVE': | |
2575 col.prop(toolsettings, "etch_adaptive_limit") | |
2576 elif toolsettings.etch_convert_mode == 'FIXED': | |
2577 col.prop(toolsettings, "etch_subdivision_number") | |
2578 elif toolsettings.etch_convert_mode == 'RETARGET': | |
2579 col.prop(toolsettings, "etch_template") | |
2580 col.prop(toolsettings, "etch_roll_mode") | |
2581 col.prop(toolsettings, "use_etch_autoname") | |
2582 col.prop(toolsettings, "etch_number") | |
2583 col.prop(toolsettings, "etch_side") | |
2584 | |
2585 col.operator("sketch.convert", text="Convert") | |
2586 | |
2587 | |
2588 class VIEW3D_PT_context_properties(Panel): | |
2589 bl_space_type = 'VIEW_3D' | |
2590 bl_region_type = 'UI' | |
2591 bl_label = "Properties" | |
2592 bl_options = {'DEFAULT_CLOSED'} | |
2593 | |
2594 def _active_context_member(context): | |
2595 obj = context.object | |
2596 if obj: | |
2597 mode = obj.mode | |
2598 if mode == 'POSE': | |
2599 return "active_pose_bone" | |
2600 elif mode == 'EDIT' and obj.type == 'ARMATURE': | |
2601 return "active_bone" | |
2602 else: | |
2603 return "object" | |
2604 | |
2605 return "" | |
2606 | |
2607 @classmethod | |
2608 def poll(cls, context): | |
2609 member = cls._active_context_member(context) | |
2610 if member: | |
2611 context_member = getattr(context, member) | |
2612 return context_member and context_member.keys() | |
2613 | |
2614 return False | |
2615 | |
2616 def draw(self, context): | |
2617 import rna_prop_ui | |
2618 member = VIEW3D_PT_context_properties._active_context_member(context) | |
2619 | |
2620 if member: | |
2621 # Draw with no edit button | |
2622 rna_prop_ui.draw(self.layout, context, member, object, False) | |
2623 | |
2624 | |
2625 def register(): | |
2626 bpy.utils.register_module(__name__) | |
2627 | |
2628 | |
2629 def unregister(): | |
2630 bpy.utils.unregister_module(__name__) | |
2631 | |
2632 if __name__ == "__main__": | |
2633 register() | |
2634 | |
2635 if __name__ == "__main__": # only for live edit. | |
2636 bpy.utils.register_module(__name__) | |
LEFT | RIGHT |