* Fix for camera+internal surface object inside ztransp volume
[blender.git] / release / ui / space_view3d.py
1
2 import bpy
3
4 # ********** Header **********
5
6 class VIEW3D_HT_header(bpy.types.Header):
7         __space_type__ = 'VIEW_3D'
8
9         def draw(self, context):
10                 layout = self.layout
11                 
12                 view = context.space_data
13                 mode_string = context.mode
14                 edit_object = context.edit_object
15                 object = context.active_object
16                 
17                 row = layout.row(align=True)
18                 row.template_header()
19
20                 # Menus
21                 if context.area.show_menus:
22                         sub = row.row(align=True)
23
24                         sub.itemM("VIEW3D_MT_view")
25                         
26                         # Select Menu
27                         if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE', 'PARTICLE'):
28                                 # XXX: Particle Mode has Select Menu.
29                                 sub.itemM("VIEW3D_MT_select_%s" % mode_string)
30                         
31                         if edit_object:
32                                 sub.itemM("VIEW3D_MT_edit_%s" % edit_object.type)
33                         elif object:
34                                 ob_mode_string = object.mode
35                                 
36                                 if ob_mode_string == 'OBJECT':
37                                         sub.itemM("VIEW3D_MT_object")
38                                 elif ob_mode_string == 'SCULPT':
39                                         sub.itemM("VIEW3D_MT_sculpt")
40                                 elif ob_mode_string == 'VERTEX_PAINT':
41                                         sub.itemM("VIEW3D_MT_vertex_paint")
42
43                 layout.template_header_3D()
44
45 # ********** Menu **********
46
47 # ********** View menus **********
48
49 class VIEW3D_MT_view(bpy.types.Menu):
50         __space_type__ = 'VIEW_3D'
51         __label__ = "View"
52
53         def draw(self, context):
54                 layout = self.layout
55
56                 layout.itemO("view3d.properties", icon='ICON_MENU_PANEL')
57                 layout.itemO("view3d.toolbar", icon='ICON_MENU_PANEL')
58                 
59                 layout.itemS()
60                 
61                 layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA')
62                 layout.item_enumO("view3d.viewnumpad", "type", 'TOP')
63                 layout.item_enumO("view3d.viewnumpad", "type", 'FRONT')
64                 layout.item_enumO("view3d.viewnumpad", "type", 'RIGHT')
65                 
66                 # layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
67                 
68                 layout.itemS()
69
70                 layout.itemO("view3d.view_persportho")
71                 
72                 layout.itemS()
73                 
74                 # layout.itemO("view3d.view_show_all_layers")
75                 
76                 # layout.itemS()
77                 
78                 # layout.itemO("view3d.view_local_view")
79                 # layout.itemO("view3d.view_global_view")
80                 
81                 # layout.itemS()
82                 
83                 layout.itemM("VIEW3D_MT_view_navigation")
84                 # layout.itemM("VIEW3D_MT_view_align", text="Align View")
85                 
86                 layout.itemS()
87
88                 layout.operator_context = "INVOKE_REGION_WIN"
89
90                 layout.itemO("view3d.clip_border")
91                 layout.itemO("view3d.zoom_border")
92                 
93                 layout.itemS()
94                 
95                 layout.itemO("view3d.view_center")
96                 layout.itemO("view3d.view_all")
97                 
98                 layout.itemS()
99                 
100                 layout.itemO("screen.region_foursplit", text="Toggle Quad View")
101                 layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
102                 
103 class VIEW3D_MT_view_navigation(bpy.types.Menu):
104         __space_type__ = 'VIEW_3D'
105         __label__ = "Navigation"
106
107         def draw(self, context):
108                 layout = self.layout
109
110                 # layout.itemO("view3d.view_fly_mode")
111                 # layout.itemS()
112                 
113                 layout.items_enumO("view3d.view_orbit", "type")
114                 
115                 layout.itemS()
116                 
117                 layout.items_enumO("view3d.view_pan", "type")
118                 
119                 layout.itemS()
120                 
121                 layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
122                 layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
123
124 # ********** Select menus, suffix from context.mode **********
125
126 class VIEW3D_MT_select_OBJECT(bpy.types.Menu):
127         __space_type__ = 'VIEW_3D'
128         __label__ = "Select"
129
130         def draw(self, context):
131                 layout = self.layout
132
133                 layout.itemO("view3d.select_border")
134
135                 layout.itemS()
136
137                 layout.itemO("object.select_all_toggle", text="Select/Deselect All")
138                 layout.itemO("object.select_inverse", text="Inverse")
139                 layout.itemO("object.select_random", text="Random")
140                 layout.itemO("object.select_by_layer", text="Select All by Layer")
141                 layout.item_enumO("object.select_by_type", "type", "", text="Select All by Type")
142                 layout.itemO("object.select_grouped", text="Select Grouped")
143
144 class VIEW3D_MT_select_POSE(bpy.types.Menu):
145         __space_type__ = 'VIEW_3D'
146         __label__ = "Select"
147
148         def draw(self, context):
149                 layout = self.layout
150
151                 layout.itemO("view3d.select_border")
152
153                 layout.itemS()
154                 
155                 layout.itemO("pose.select_all_toggle", text="Select/Deselect All")
156                 layout.itemO("pose.select_inverse", text="Inverse")
157                 layout.itemO("pose.select_constraint_target", text="Constraint Target")
158                 
159                 layout.itemS()
160                 
161                 layout.item_enumO("pose.select_hierarchy", "direction", 'PARENT')
162                 layout.item_enumO("pose.select_hierarchy", "direction", 'CHILD')
163                 
164                 layout.itemS()
165                 
166                 props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Parent")
167                 props.extend = True
168                 props.direction = 'PARENT'
169
170                 props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Child")
171                 props.extend = True
172                 props.direction = 'CHILD'
173
174 class VIEW3D_MT_select_PARTICLE(bpy.types.Menu):
175         __space_type__ = 'VIEW_3D'
176         __label__ = "Select"
177
178         def draw(self, context):
179                 layout = self.layout
180
181                 layout.itemO("view3d.select_border")
182
183                 layout.itemS()
184                 
185                 layout.itemO("particle.select_all_toggle", text="Select/Deselect All")
186                 layout.itemO("particle.select_linked")
187                 
188                 layout.itemS()
189                 
190                 #layout.itemO("particle.select_last")
191                 #layout.itemO("particle.select_first")
192                 
193                 layout.itemO("particle.select_more")
194                 layout.itemO("particle.select_less")
195
196 class VIEW3D_MT_select_EDIT_MESH(bpy.types.Menu):
197         __space_type__ = 'VIEW_3D'
198         __label__ = "Select"
199
200         def draw(self, context):
201                 layout = self.layout
202
203                 layout.itemO("view3d.select_border")
204
205                 layout.itemS()
206
207                 layout.itemO("mesh.select_all_toggle", text="Select/Deselect All")
208                 layout.itemO("mesh.select_inverse", text="Inverse")
209
210                 layout.itemS()
211
212                 layout.itemO("mesh.select_random", text="Random...")
213                 layout.itemO("mesh.edges_select_sharp", text="Sharp Edges")
214                 layout.itemO("mesh.faces_select_linked_flat", text="Linked Flat Faces")
215
216                 layout.itemS()
217
218                 layout.item_enumO("mesh.select_by_number_vertices", "type", 'TRIANGLES', text="Triangles")
219                 layout.item_enumO("mesh.select_by_number_vertices", "type", 'QUADS', text="Quads")
220                 layout.item_enumO("mesh.select_by_number_vertices", "type", 'OTHER', text="Loose Verts/Edges")
221                 layout.itemO("mesh.select_similar", text="Similar...")
222
223                 layout.itemS()
224
225                 layout.itemO("mesh.select_less", text="Less")
226                 layout.itemO("mesh.select_more", text="More")
227
228                 layout.itemS()
229
230                 layout.itemO("mesh.select_linked", text="Linked")
231                 layout.itemO("mesh.select_vertex_path", text="Vertex Path")
232                 layout.itemO("mesh.loop_multi_select", text="Edge Loop")
233                 layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
234
235                 layout.itemS()
236
237                 layout.itemO("mesh.loop_to_region")
238                 layout.itemO("mesh.region_to_loop")
239
240 class VIEW3D_MT_select_EDIT_CURVE(bpy.types.Menu):
241         __space_type__ = 'VIEW_3D'
242         __label__ = "Select"
243
244         def draw(self, context):
245                 layout = self.layout
246
247                 layout.itemO("view3d.select_border")
248                 layout.itemO("view3d.select_circle")
249
250                 layout.itemS()
251                 
252                 layout.itemO("curve.select_all_toggle", text="Select/Deselect All")
253                 layout.itemO("curve.select_inverse")
254                 layout.itemO("curve.select_random")
255                 layout.itemO("curve.select_every_nth")
256
257                 layout.itemS()
258                 
259                 layout.itemO("curve.de_select_first")
260                 layout.itemO("curve.de_select_last")
261                 layout.itemO("curve.select_next")
262                 layout.itemO("curve.select_previous")
263
264                 layout.itemS()
265                 
266                 layout.itemO("curve.select_more")
267                 layout.itemO("curve.select_less")
268
269 class VIEW3D_MT_select_EDIT_SURFACE(bpy.types.Menu):
270         __space_type__ = 'VIEW_3D'
271         __label__ = "Select"
272
273         def draw(self, context):
274                 layout = self.layout
275
276                 layout.itemO("view3d.select_border")
277                 layout.itemO("view3d.select_circle")
278
279                 layout.itemS()
280                 
281                 layout.itemO("curve.select_all_toggle", text="Select/Deselect All")
282                 layout.itemO("curve.select_inverse")
283                 layout.itemO("curve.select_random")
284                 layout.itemO("curve.select_every_nth")
285
286                 layout.itemS()
287                 
288                 layout.itemO("curve.select_row")
289
290                 layout.itemS()
291                 
292                 layout.itemO("curve.select_more")
293                 layout.itemO("curve.select_less")
294
295 class VIEW3D_MT_select_EDIT_METABALL(bpy.types.Menu):
296         __space_type__ = 'VIEW_3D'
297         __label__ = "Select"
298
299         def draw(self, context):
300                 layout = self.layout
301
302                 layout.itemO("view3d.select_border")
303                 
304                 layout.itemS()
305                 
306                 layout.itemL(text="Select/Deselect All")
307                 layout.itemL(text="Inverse")
308                 
309                 layout.itemS()
310                 
311                 layout.itemL(text="Random")
312
313 class VIEW3D_MT_select_EDIT_LATTICE(bpy.types.Menu):
314         __space_type__ = 'VIEW_3D'
315         __label__ = "Select"
316
317         def draw(self, context):
318                 layout = self.layout
319
320                 layout.itemO("view3d.select_border")
321
322                 layout.itemS()
323                 
324                 layout.itemO("lattice.select_all_toggle", text="Select/Deselect All")
325
326 class VIEW3D_MT_select_EDIT_ARMATURE(bpy.types.Menu):
327         __space_type__ = 'VIEW_3D'
328         __label__ = "Select"
329
330         def draw(self, context):
331                 layout = self.layout
332
333                 layout.itemO("view3d.select_border")
334
335                 layout.itemS()
336                 
337                 layout.itemO("armature.select_all_toggle", text="Select/Deselect All")
338                 layout.itemO("armature.select_inverse", text="Inverse")
339
340                 layout.itemS()
341                 
342                 layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT', text="Parent")
343                 layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD', text="Child")
344                 
345                 layout.itemS()
346                 
347                 props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Parent")
348                 props.extend = True
349                 props.direction = 'PARENT'
350
351                 props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Child")
352                 props.extend = True
353                 props.direction = 'CHILD'
354
355 class VIEW3D_MT_select_FACE(bpy.types.Menu):# XXX no matching enum
356         __space_type__ = 'VIEW_3D'
357         __label__ = "Select"
358
359         def draw(self, context):
360                 layout = self.layout
361
362                 layout.view3d_select_faceselmenu()
363
364 # ********** Object menu **********
365
366 class VIEW3D_MT_object(bpy.types.Menu):
367         __space_type__ = 'VIEW_3D'
368         __context__ = "objectmode"
369         __label__ = "Object"
370
371         def draw(self, context):
372                 layout = self.layout
373
374                 layout.itemM("VIEW3D_MT_object_clear")
375                 layout.itemM("VIEW3D_MT_object_snap")
376                 
377                 layout.itemS()
378                 
379                 layout.itemO("anim.insert_keyframe_menu")
380                 layout.itemO("anim.delete_keyframe_v3d")
381                 
382                 layout.itemS()
383                 
384                 layout.itemO("object.duplicate")
385                 layout.item_booleanO("object.duplicate", "linked", True, text="Duplicate Linked")
386                 layout.itemO("object.delete")
387                 layout.itemO("object.proxy_make")
388                 
389                 layout.itemS()
390                 
391                 layout.itemM("VIEW3D_MT_object_parent")
392                 layout.itemM("VIEW3D_MT_object_track")
393                 layout.itemM("VIEW3D_MT_object_group")
394                 layout.itemM("VIEW3D_MT_object_constraints")
395                 
396                 layout.itemS()
397                 
398                 layout.itemO("object.join")
399                 
400                 layout.itemS()
401                 
402                 layout.itemM("VIEW3D_MT_object_show")
403                 
404 class VIEW3D_MT_object_clear(bpy.types.Menu):
405         __space_type__ = 'VIEW_3D'
406         __label__ = "Clear"
407
408         def draw(self, context):
409                 layout = self.layout
410                 
411                 layout.itemO("object.location_clear")
412                 layout.itemO("object.rotation_clear")
413                 layout.itemO("object.scale_clear")
414                 layout.itemO("object.origin_clear")
415                 
416 class VIEW3D_MT_object_snap(bpy.types.Menu):
417         __space_type__ = 'VIEW_3D'
418         __label__ = "Snap"
419
420         def draw(self, context):
421                 layout = self.layout
422                 
423                 layout.itemO("view3d.snap_selected_to_grid")
424                 layout.itemO("view3d.snap_selected_to_cursor")
425                 layout.itemO("view3d.snap_selected_to_center")
426                 
427                 layout.itemS()
428                 
429                 layout.itemO("view3d.snap_cursor_to_selected")
430                 layout.itemO("view3d.snap_cursor_to_grid")
431                 layout.itemO("view3d.snap_cursor_to_active")
432                 
433 class VIEW3D_MT_object_parent(bpy.types.Menu):
434         __space_type__ = 'VIEW_3D'
435         __label__ = "Parent"
436
437         def draw(self, context):
438                 layout = self.layout
439                 
440                 layout.itemO("object.parent_set")
441                 layout.itemO("object.parent_clear")
442                 
443 class VIEW3D_MT_object_track(bpy.types.Menu):
444         __space_type__ = 'VIEW_3D'
445         __label__ = "Track"
446
447         def draw(self, context):
448                 layout = self.layout
449                 
450                 layout.itemO("object.track_set")
451                 layout.itemO("object.track_clear")
452                 
453 class VIEW3D_MT_object_group(bpy.types.Menu):
454         __space_type__ = 'VIEW_3D'
455         __label__ = "Group"
456
457         def draw(self, context):
458                 layout = self.layout
459                 
460                 layout.itemO("group.group_create")
461                 layout.itemO("group.objects_remove")
462                 
463                 layout.itemS()
464                 
465                 layout.itemO("group.objects_add_active")
466                 layout.itemO("group.objects_remove_active")
467                 
468 class VIEW3D_MT_object_constraints(bpy.types.Menu):
469         __space_type__ = 'VIEW_3D'
470         __label__ = "Constraints"
471
472         def draw(self, context):
473                 layout = self.layout
474                 
475                 layout.itemO("object.constraint_add_with_targets")
476                 layout.itemO("object.constraints_clear")
477                 
478 class VIEW3D_MT_object_show(bpy.types.Menu):
479         __space_type__ = 'VIEW_3D'
480         __label__ = "Show/Hide"
481
482         def draw(self, context):
483                 layout = self.layout
484                 
485                 layout.itemO("object.restrictview_clear")
486                 layout.itemO("object.restrictview_set")
487                 layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected")
488
489 # ********** Vertex paint menu **********       
490         
491 class VIEW3D_MT_vertex_paint(bpy.types.Menu):
492         __space_type__ = 'VIEW_3D'
493         __label__ = "Paint"
494
495         def draw(self, context):
496                 layout = self.layout
497                 
498                 sculpt = context.tool_settings.sculpt
499
500                 layout.itemO("paint.vertex_color_set")
501                 props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True)
502                 props.selected = True
503
504 # ********** Sculpt menu **********     
505         
506 class VIEW3D_MT_sculpt(bpy.types.Menu):
507         __space_type__ = 'VIEW_3D'
508         __label__ = "Sculpt"
509
510         def draw(self, context):
511                 layout = self.layout
512                 
513                 sculpt = context.tool_settings.sculpt
514                 brush = context.tool_settings.sculpt.brush
515                 
516                 layout.itemR(sculpt, "symmetry_x")
517                 layout.itemR(sculpt, "symmetry_y")
518                 layout.itemR(sculpt, "symmetry_z")
519                 layout.itemS()
520                 layout.itemR(sculpt, "lock_x")
521                 layout.itemR(sculpt, "lock_y")
522                 layout.itemR(sculpt, "lock_z")
523                 layout.itemS()
524                 layout.item_menu_enumO("brush.curve_preset", property="shape")
525                 layout.itemS()
526                 
527                 if brush.sculpt_tool != 'GRAB':
528                         layout.itemR(brush, "airbrush")
529                         
530                         if brush.sculpt_tool != 'LAYER':
531                                 layout.itemR(brush, "anchored")
532                         
533                         if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
534                                 layout.itemR(brush, "flip_direction")
535
536                         if brush.sculpt_tool == 'LAYER':
537                                 layout.itemR(brush, "persistent")
538                                 layout.itemO("sculpt.set_persistent_base")
539
540 # ********** Edit Menus, suffix from ob.type **********
541
542 class VIEW3D_MT_edit_snap(bpy.types.Menu):
543         __space_type__ = 'VIEW_3D'
544         __label__ = "Snap"
545
546         def draw(self, context):
547                 layout = self.layout
548                 
549                 layout.itemO("view3d.snap_selected_to_grid")
550                 layout.itemO("view3d.snap_selected_to_cursor")
551                 layout.itemO("view3d.snap_selected_to_center")
552                 
553                 layout.itemS()
554                 
555                 layout.itemO("view3d.snap_cursor_to_selected")
556                 layout.itemO("view3d.snap_cursor_to_grid")
557                 layout.itemO("view3d.snap_cursor_to_active")
558
559 # Edit MESH
560 class VIEW3D_MT_edit_MESH(bpy.types.Menu):
561         __space_type__ = 'VIEW_3D'
562         __label__ = "Mesh"
563
564         def draw(self, context):
565                 layout = self.layout
566                 
567                 settings = context.tool_settings
568
569                 layout.itemO("ed.undo")
570                 layout.itemO("ed.redo")
571                 
572                 layout.itemS()
573                 
574                 layout.itemM("VIEW3D_MT_edit_snap")
575                 
576                 layout.itemS()
577                 
578                 layout.itemO("uv.mapping_menu")
579                 
580                 layout.itemS()
581                 
582                 layout.itemO("mesh.extrude")
583                 layout.itemO("mesh.duplicate")
584                 layout.itemO("mesh.delete")
585                 
586                 layout.itemS()
587                 
588                 layout.itemM("VIEW3D_MT_edit_MESH_vertices")
589                 layout.itemM("VIEW3D_MT_edit_MESH_edges")
590                 layout.itemM("VIEW3D_MT_edit_MESH_faces")
591                 layout.itemM("VIEW3D_MT_edit_MESH_normals")
592                 
593                 layout.itemS()
594                 
595                 layout.itemR(settings, "automerge_editing")
596                 layout.itemR(settings, "proportional_editing")
597                 layout.item_menu_enumR(settings, "proportional_editing_falloff")
598                 
599                 layout.itemS()
600                 
601                 layout.itemM("VIEW3D_MT_edit_MESH_showhide")
602
603 class VIEW3D_MT_edit_MESH_vertices(bpy.types.Menu):
604         __space_type__ = 'VIEW_3D'
605         __label__ = "Vertices"
606
607         def draw(self, context):
608                 layout = self.layout
609                 
610                 layout.itemO("mesh.merge")
611                 layout.itemO("mesh.rip")
612                 layout.itemO("mesh.split")
613                 layout.itemO("mesh.separate")
614
615                 layout.itemS()
616                 
617                 layout.itemO("mesh.vertices_smooth")
618                 layout.itemO("mesh.remove_doubles")
619                 
620 class VIEW3D_MT_edit_MESH_edges(bpy.types.Menu):
621         __space_type__ = 'VIEW_3D'
622         __label__ = "Edges"
623
624         def draw(self, context):
625                 layout = self.layout
626
627                 layout.itemO("mesh.edge_face_add")
628                 layout.itemO("mesh.subdivide")
629                 layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth")
630
631                 layout.itemS()
632                 
633                 layout.itemO("mesh.mark_seam")
634                 layout.item_booleanO("mesh.mark_seam", "clear", True, text="Clear Seam")
635                 
636                 layout.itemS()
637                 
638                 layout.itemO("mesh.mark_sharp")
639                 layout.item_booleanO("mesh.mark_sharp", "clear", True, text="Clear Sharp")
640                 
641                 layout.itemS()
642                 
643                 layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
644                 layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
645                 
646 class VIEW3D_MT_edit_MESH_faces(bpy.types.Menu):
647         __space_type__ = 'VIEW_3D'
648         __label__ = "Faces"
649
650         def draw(self, context):
651                 layout = self.layout
652
653                 layout.itemO("mesh.edge_face_add")
654                 layout.itemO("mesh.fill")
655                 layout.itemO("mesh.beauty_fill")
656
657                 layout.itemS()
658                 
659                 layout.itemO("mesh.quads_convert_to_tris")
660                 layout.itemO("mesh.tris_convert_to_quads")
661                 layout.itemO("mesh.edge_flip")
662                 
663                 layout.itemS()
664                 
665                 layout.itemO("mesh.faces_shade_smooth")
666                 layout.itemO("mesh.faces_shade_flat")
667
668 class VIEW3D_MT_edit_MESH_normals(bpy.types.Menu):
669         __space_type__ = 'VIEW_3D'
670         __label__ = "Normals"
671
672         def draw(self, context):
673                 layout = self.layout
674
675                 layout.itemO("mesh.normals_make_consistent", text="Recalculate Outside")
676                 layout.item_booleanO("mesh.normals_make_consistent", "inside", True, text="Recalculate Inside")
677
678                 layout.itemS()
679                 
680                 layout.itemO("mesh.flip_normals")
681                 
682 class VIEW3D_MT_edit_MESH_showhide(bpy.types.Menu):
683         __space_type__ = 'VIEW_3D'
684         __label__ = "Show/Hide"
685
686         def draw(self, context):
687                 layout = self.layout
688
689                 layout.itemO("mesh.reveal")
690                 layout.itemO("mesh.hide")
691                 layout.item_booleanO("mesh.hide", "unselected", True, text="Hide Unselected")
692
693 # Edit CURVE
694
695 # draw_CURVE is used by VIEW3D_MT_edit_CURVE and VIEW3D_MT_edit_SURFACE
696 def draw_CURVE(self, context):
697         layout = self.layout
698         
699         settings = context.tool_settings
700
701         layout.itemM("VIEW3D_MT_edit_snap")
702         
703         layout.itemS()
704         
705         layout.itemO("curve.extrude")
706         layout.itemO("curve.duplicate")
707         layout.itemO("curve.separate")
708         layout.itemO("curve.make_segment")
709         layout.itemO("curve.cyclic_toggle")
710         layout.itemO("curve.delete")
711         
712         layout.itemS()
713         
714         layout.itemM("VIEW3D_MT_edit_CURVE_ctrlpoints")
715         layout.itemM("VIEW3D_MT_edit_CURVE_segments")
716         
717         layout.itemS()
718         
719         layout.itemR(settings, "proportional_editing")
720         layout.item_menu_enumR(settings, "proportional_editing_falloff")
721         
722         layout.itemS()
723         
724         layout.itemM("VIEW3D_MT_edit_CURVE_showhide")
725
726 class VIEW3D_MT_edit_CURVE(bpy.types.Menu):
727         __space_type__ = 'VIEW_3D'
728         __label__ = "Curve"
729
730         draw = draw_CURVE
731         
732 class VIEW3D_MT_edit_CURVE_ctrlpoints(bpy.types.Menu):
733         __space_type__ = 'VIEW_3D'
734         __label__ = "Control Points"
735
736         def draw(self, context):
737                 layout = self.layout
738                 
739                 edit_object = context.edit_object
740                 
741                 if edit_object.type == 'CURVE':
742                         layout.item_enumO("tfm.transform", "mode", 'TILT')
743                         layout.itemO("curve.tilt_clear")
744                         layout.itemO("curve.separate")
745                         
746                         layout.itemS()
747                         
748                         layout.item_menu_enumO("curve.handle_type_set", "type")
749                 
750 class VIEW3D_MT_edit_CURVE_segments(bpy.types.Menu):
751         __space_type__ = 'VIEW_3D'
752         __label__ = "Segments"
753
754         def draw(self, context):
755                 layout = self.layout
756                 
757                 layout.itemO("curve.subdivide")
758                 layout.itemO("curve.switch_direction")
759
760 class VIEW3D_MT_edit_CURVE_showhide(bpy.types.Menu):
761         __space_type__ = 'VIEW_3D'
762         __label__ = "Show/Hide"
763
764         def draw(self, context):
765                 layout = self.layout
766                 
767                 layout.itemO("curve.reveal")
768                 layout.itemO("curve.hide")
769                 layout.item_booleanO("curve.hide", "unselected", True, text="Hide Unselected")
770
771 # Edit SURFACE
772 class VIEW3D_MT_edit_SURFACE(bpy.types.Menu):
773         __space_type__ = 'VIEW_3D'
774         __label__ = "Surface"
775
776         draw = draw_CURVE
777
778 # Edit TEXT
779 class VIEW3D_MT_edit_TEXT(bpy.types.Menu):
780         __space_type__ = 'VIEW_3D'
781         __label__ = "Text"
782
783         def draw(self, context):
784                 layout = self.layout
785                 
786                 layout.itemO("font.file_paste")
787                 
788                 layout.itemS()
789                 
790                 layout.itemM("VIEW3D_MT_edit_TEXT_chars")
791
792 class VIEW3D_MT_edit_TEXT_chars(bpy.types.Menu):
793         __space_type__ = 'VIEW_3D'
794         __label__ = "Special Characters"
795
796         def draw(self, context):
797                 layout = self.layout
798                 
799                 layout.item_stringO("font.text_insert", "text", b'\xC2\xA9'.decode(), text="Copyright|Alt C")
800                 layout.item_stringO("font.text_insert", "text", b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R")
801                 
802                 layout.itemS()
803                 
804                 layout.item_stringO("font.text_insert", "text", b'\xC2\xB0'.decode(), text="Degree Sign|Alt G")
805                 layout.item_stringO("font.text_insert", "text", b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x")
806                 layout.item_stringO("font.text_insert", "text", b'\xC2\x8A'.decode(), text="Circle|Alt .")
807                 layout.item_stringO("font.text_insert", "text", b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1")
808                 layout.item_stringO("font.text_insert", "text", b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2")
809                 layout.item_stringO("font.text_insert", "text", b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3")
810                 layout.item_stringO("font.text_insert", "text", b'\xC2\xBB'.decode(), text="Double >>|Alt >")
811                 layout.item_stringO("font.text_insert", "text", b'\xC2\xAB'.decode(), text="Double <<|Alt <")
812                 layout.item_stringO("font.text_insert", "text", b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %")
813                 
814                 layout.itemS()
815                 
816                 layout.item_stringO("font.text_insert", "text", b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F")
817                 layout.item_stringO("font.text_insert", "text", b'\xC2\xA3'.decode(), text="British Pound|Alt L")
818                 layout.item_stringO("font.text_insert", "text", b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y")
819                 
820                 layout.itemS()
821                 
822                 layout.item_stringO("font.text_insert", "text", b'\xC3\x9F'.decode(), text="German S|Alt S")
823                 layout.item_stringO("font.text_insert", "text", b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?")
824                 layout.item_stringO("font.text_insert", "text", b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !")
825
826 # Edit META
827 class VIEW3D_MT_edit_META(bpy.types.Menu):
828         __space_type__ = 'VIEW_3D'
829         __label__ = "Metaball"
830
831         def draw(self, context):
832                 layout = self.layout
833                 
834                 settings = context.tool_settings
835
836                 layout.itemO("ed.undo")
837                 layout.itemO("ed.redo")
838                 
839                 layout.itemS()
840                 
841                 layout.itemM("VIEW3D_MT_edit_snap")
842                 
843                 layout.itemS()
844                 
845                 layout.itemO("mball.delete_metaelems")
846                 layout.itemO("mball.duplicate_metaelems")
847                 
848                 layout.itemS()
849                 
850                 layout.itemR(settings, "proportional_editing")
851                 layout.item_menu_enumR(settings, "proportional_editing_falloff")
852                 
853                 layout.itemS()
854                 
855                 layout.itemM("VIEW3D_MT_edit_META_showhide")
856
857 class VIEW3D_MT_edit_META_showhide(bpy.types.Menu):
858         __space_type__ = 'VIEW_3D'
859         __label__ = "Show/Hide"
860
861         def draw(self, context):
862                 layout = self.layout
863                 
864                 layout.itemO("mball.reveal_metaelems")
865                 layout.itemO("mball.hide_metaelems")
866                 layout.item_booleanO("mball.hide_metaelems", "unselected", True, text="Hide Unselected")
867
868 # Edit LATTICE
869 class VIEW3D_MT_edit_LATTICE(bpy.types.Menu):
870         __space_type__ = 'VIEW_3D'
871         __label__ = "Lattice"
872
873         def draw(self, context):
874                 layout = self.layout
875                 
876                 settings = context.tool_settings
877
878                 layout.itemM("VIEW3D_MT_edit_snap")
879                 
880                 layout.itemS()
881                 
882                 layout.itemO("lattice.make_regular")
883                 
884                 layout.itemS()
885                 
886                 layout.itemR(settings, "proportional_editing")
887                 layout.item_menu_enumR(settings, "proportional_editing_falloff")
888
889 # Edit ARMATURE
890 class VIEW3D_MT_edit_ARMATURE(bpy.types.Menu):
891         __space_type__ = 'VIEW_3D'
892         __label__ = "Armature"
893
894         def draw(self, context):
895                 layout = self.layout
896                 
897                 edit_object = context.edit_object
898                 arm = edit_object.data
899                 
900                 layout.itemM("VIEW3D_MT_edit_snap")
901                 layout.itemM("VIEW3D_MT_edit_ARMATURE_roll")
902                 
903                 if arm.drawtype == 'ENVELOPE':
904                         layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance")
905                 else:
906                         layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale B-Bone Width")
907                                 
908                 layout.itemS()
909                 
910                 layout.itemO("armature.extrude")
911                 
912                 if arm.x_axis_mirror:
913                         layout.item_booleanO("armature.extrude", "forked", True, text="Extrude Forked")
914                 
915                 layout.itemO("armature.duplicate")
916                 layout.itemO("armature.merge")
917                 layout.itemO("armature.fill")
918                 layout.itemO("armature.delete")
919                 layout.itemO("armature.separate")
920
921                 layout.itemS()
922
923                 layout.itemO("armature.subdivide_simple")
924                 layout.itemO("armature.subdivide_multi")
925                 
926                 layout.itemS()
927
928                 layout.item_enumO("armature.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right")
929                 layout.item_enumO("armature.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back")
930                 layout.item_enumO("armature.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom")
931                 layout.itemO("armature.flip_names")
932
933                 layout.itemS()
934
935                 layout.itemO("armature.armature_layers")
936                 layout.itemO("armature.bone_layers")
937
938                 layout.itemS()
939
940                 layout.itemM("VIEW3D_MT_edit_ARMATURE_parent")
941
942                 layout.itemS()
943
944                 layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings")
945
946 class VIEW3D_MT_edit_ARMATURE_parent(bpy.types.Menu):
947         __space_type__ = 'VIEW_3D'
948         __label__ = "Parent"
949
950         def draw(self, context):
951                 layout = self.layout
952                 
953                 layout.itemO("armature.parent_set")
954                 layout.itemO("armature.parent_clear")
955
956 class VIEW3D_MT_edit_ARMATURE_roll(bpy.types.Menu):
957         __space_type__ = 'VIEW_3D'
958         __label__ = "Bone Roll"
959
960         def draw(self, context):
961                 layout = self.layout
962                 
963                 layout.item_enumO("armature.calculate_roll", "type", 'GLOBALUP', text="Clear Roll (Z-Axis Up)")
964                 layout.item_enumO("armature.calculate_roll", "type", 'CURSOR', text="Roll to Cursor")
965                 
966                 layout.itemS()
967                 
968                 layout.item_enumO("tfm.transform", "mode", 'BONE_ROLL', text="Set Roll")
969
970 # ********** Panel **********
971
972 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
973         __space_type__ = 'VIEW_3D'
974         __region_type__ = 'UI'
975         __label__ = "View"
976
977         def poll(self, context):
978                 view = context.space_data
979                 return (view)
980
981         def draw(self, context):
982                 layout = self.layout
983                 
984                 view = context.space_data
985                 scene = context.scene
986                 
987                 col = layout.column()
988                 col.itemR(view, "camera")
989                 col.itemR(view, "lens")
990                 
991                 layout.itemL(text="Clip:")
992                 col = layout.column(align=True)
993                 col.itemR(view, "clip_start", text="Start")
994                 col.itemR(view, "clip_end", text="End")
995                 
996                 layout.itemL(text="Grid:")
997                 col = layout.column(align=True)
998                 col.itemR(view, "grid_lines", text="Lines")
999                 col.itemR(view, "grid_spacing", text="Spacing")
1000                 col.itemR(view, "grid_subdivisions", text="Subdivisions")
1001                 
1002                 layout.column().itemR(scene, "cursor_location", text="3D Cursor:")
1003                 
1004 class VIEW3D_PT_3dview_display(bpy.types.Panel):
1005         __space_type__ = 'VIEW_3D'
1006         __region_type__ = 'UI'
1007         __label__ = "Display"
1008
1009         def poll(self, context):
1010                 view = context.space_data
1011                 return (view)
1012
1013         def draw(self, context):
1014                 layout = self.layout
1015                 view = context.space_data
1016                 
1017                 col = layout.column()
1018                 col.itemR(view, "display_floor", text="Grid Floor")
1019                 col.itemR(view, "display_x_axis", text="X Axis")
1020                 col.itemR(view, "display_y_axis", text="Y Axis")
1021                 col.itemR(view, "display_z_axis", text="Z Axis")
1022                 col.itemR(view, "outline_selected")
1023                 col.itemR(view, "all_object_centers")
1024                 col.itemR(view, "relationship_lines")
1025                 col.itemR(view, "textured_solid")
1026                 
1027                 layout.itemS()
1028                 
1029                 layout.itemO("screen.region_foursplit")
1030                 
1031                 col = layout.column()
1032                 col.itemR(view, "lock_rotation")
1033                 col.itemR(view, "box_preview")
1034                 col.itemR(view, "box_clip")
1035
1036 class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel):
1037         __space_type__ = 'VIEW_3D'
1038         __region_type__ = 'UI'
1039         __label__ = "Mesh Display"
1040
1041         def poll(self, context):
1042                 editmesh = context.mode == 'EDIT_MESH'
1043                 return (editmesh)
1044
1045         def draw(self, context):
1046                 layout = self.layout
1047
1048                 mesh = context.active_object.data
1049                 
1050                 col = layout.column()
1051                 col.itemL(text="Overlays:")
1052                 col.itemR(mesh, "draw_edges", text="Edges")
1053                 col.itemR(mesh, "draw_faces", text="Faces")
1054                 col.itemR(mesh, "draw_creases", text="Creases")
1055                 col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights")
1056                 col.itemR(mesh, "draw_seams", text="Seams")
1057                 col.itemR(mesh, "draw_sharp", text="Sharp")
1058                 
1059                 col.itemS()
1060                 col.itemL(text="Normals:")
1061                 col.itemR(mesh, "draw_normals", text="Face")
1062                 col.itemR(mesh, "draw_vertex_normals", text="Vertex")
1063                 
1064                 col.itemS()
1065                 col.itemL(text="Numerics:")
1066                 col.itemR(mesh, "draw_edge_lenght")
1067                 col.itemR(mesh, "draw_edge_angle")
1068                 col.itemR(mesh, "draw_face_area")
1069         
1070 class VIEW3D_PT_background_image(bpy.types.Panel):
1071         __space_type__ = 'VIEW_3D'
1072         __region_type__ = 'UI'
1073         __label__ = "Background Image"
1074         __default_closed__ = True
1075
1076         def poll(self, context):
1077                 view = context.space_data
1078                 bg = context.space_data.background_image
1079                 return (view)
1080
1081         def draw_header(self, context):
1082                 layout = self.layout
1083                 view = context.space_data
1084
1085                 layout.itemR(view, "display_background_image", text="")
1086
1087         def draw(self, context):
1088                 layout = self.layout
1089                 
1090                 view = context.space_data
1091                 bg = view.background_image
1092
1093                 if bg:
1094                         layout.active = view.display_background_image
1095
1096                         col = layout.column()
1097                         col.itemR(bg, "image", text="")
1098                         #col.itemR(bg, "image_user")
1099                         col.itemR(bg, "size")
1100                         col.itemR(bg, "transparency", slider=True)
1101                         col.itemL(text="Offset:")
1102                         
1103                         col = layout.column(align=True)
1104                         col.itemR(bg, "x_offset", text="X")
1105                         col.itemR(bg, "y_offset", text="Y")
1106
1107 bpy.types.register(VIEW3D_HT_header) # Header
1108
1109 bpy.types.register(VIEW3D_MT_view) #View Menus
1110 bpy.types.register(VIEW3D_MT_view_navigation)
1111
1112 bpy.types.register(VIEW3D_MT_select_OBJECT) # Select Menus
1113 bpy.types.register(VIEW3D_MT_select_POSE)
1114 bpy.types.register(VIEW3D_MT_select_PARTICLE)
1115 bpy.types.register(VIEW3D_MT_select_EDIT_MESH)
1116 bpy.types.register(VIEW3D_MT_select_EDIT_CURVE)
1117 bpy.types.register(VIEW3D_MT_select_EDIT_SURFACE)
1118 bpy.types.register(VIEW3D_MT_select_EDIT_METABALL)
1119 bpy.types.register(VIEW3D_MT_select_EDIT_LATTICE)
1120 bpy.types.register(VIEW3D_MT_select_EDIT_ARMATURE)
1121 bpy.types.register(VIEW3D_MT_select_FACE) # XXX todo
1122
1123 bpy.types.register(VIEW3D_MT_object) # Object Menu
1124 bpy.types.register(VIEW3D_MT_object_clear)
1125 bpy.types.register(VIEW3D_MT_object_snap)
1126 bpy.types.register(VIEW3D_MT_object_parent)
1127 bpy.types.register(VIEW3D_MT_object_track)
1128 bpy.types.register(VIEW3D_MT_object_group)
1129 bpy.types.register(VIEW3D_MT_object_constraints)
1130 bpy.types.register(VIEW3D_MT_object_show)
1131
1132 bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
1133
1134 bpy.types.register(VIEW3D_MT_vertex_paint)
1135
1136 bpy.types.register(VIEW3D_MT_edit_snap) # Edit Menus
1137
1138 bpy.types.register(VIEW3D_MT_edit_MESH)
1139 bpy.types.register(VIEW3D_MT_edit_MESH_vertices)
1140 bpy.types.register(VIEW3D_MT_edit_MESH_edges)
1141 bpy.types.register(VIEW3D_MT_edit_MESH_faces)
1142 bpy.types.register(VIEW3D_MT_edit_MESH_normals)
1143 bpy.types.register(VIEW3D_MT_edit_MESH_showhide)
1144
1145 bpy.types.register(VIEW3D_MT_edit_CURVE)
1146 bpy.types.register(VIEW3D_MT_edit_CURVE_ctrlpoints)
1147 bpy.types.register(VIEW3D_MT_edit_CURVE_segments)
1148 bpy.types.register(VIEW3D_MT_edit_CURVE_showhide)
1149
1150 bpy.types.register(VIEW3D_MT_edit_SURFACE)
1151
1152 bpy.types.register(VIEW3D_MT_edit_TEXT)
1153 bpy.types.register(VIEW3D_MT_edit_TEXT_chars)
1154
1155 bpy.types.register(VIEW3D_MT_edit_META)
1156 bpy.types.register(VIEW3D_MT_edit_META_showhide)
1157
1158 bpy.types.register(VIEW3D_MT_edit_LATTICE)
1159
1160 bpy.types.register(VIEW3D_MT_edit_ARMATURE)
1161 bpy.types.register(VIEW3D_MT_edit_ARMATURE_parent)
1162 bpy.types.register(VIEW3D_MT_edit_ARMATURE_roll)
1163
1164 bpy.types.register(VIEW3D_PT_3dview_properties) # Panels
1165 bpy.types.register(VIEW3D_PT_3dview_display)
1166 bpy.types.register(VIEW3D_PT_3dview_meshdisplay)
1167 bpy.types.register(VIEW3D_PT_background_image)