tabs to spaces, remove trailing white space. (apart of pep8)
[blender-staging.git] / release / scripts / ui / space_view3d.py
1
2 import bpy
3
4 import dynamic_menu
5
6 # ********** Header **********
7
8 class VIEW3D_HT_header(bpy.types.Header):
9     bl_space_type = 'VIEW_3D'
10
11     def draw(self, context):
12         layout = self.layout
13
14         view = context.space_data
15         mode_string = context.mode
16         edit_object = context.edit_object
17         object = context.active_object
18
19         row = layout.row(align=True)
20         row.template_header()
21
22         # Menus
23         if context.area.show_menus:
24             sub = row.row(align=True)
25
26             sub.itemM("VIEW3D_MT_view")
27
28             # Select Menu
29             if mode_string not in ('EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'):
30                 sub.itemM("VIEW3D_MT_select_%s" % mode_string.lower())
31
32             if edit_object:
33                 sub.itemM("VIEW3D_MT_edit_%s" % edit_object.type.lower())
34             elif object:
35                 ob_mode_string = object.mode
36
37                 if mode_string not in ['PAINT_WEIGHT', 'PAINT_TEXTURE']:
38                     sub.itemM("VIEW3D_MT_%s" % mode_string.lower())
39             else:
40                 sub.itemM("VIEW3D_MT_object")
41
42         layout.template_header_3D()
43
44 # ********** Menu **********
45
46 # ********** Utilities **********
47
48 class VIEW3D_MT_showhide(bpy.types.Menu):
49     bl_label = "Show/Hide"
50     _operator_name = ""
51
52     def draw(self, context):
53         layout = self.layout
54
55         layout.itemO("%s.reveal" % self._operator_name, text="Show Hidden")
56         layout.itemO("%s.hide" % self._operator_name, text="Hide Selected")
57         layout.item_booleanO("%s.hide" % self._operator_name, "unselected", True, text="Hide Unselected")
58
59 class VIEW3D_MT_snap(bpy.types.Menu):
60     bl_label = "Snap"
61
62     def draw(self, context):
63         layout = self.layout
64
65         layout.itemO("view3d.snap_selected_to_grid", text="Selection to Grid")
66         layout.itemO("view3d.snap_selected_to_cursor", text="Selection to Cursor")
67         layout.itemO("view3d.snap_selected_to_center", text="Selection to Center")
68
69         layout.itemS()
70
71         layout.itemO("view3d.snap_cursor_to_selected", text="Cursor to Selected")
72         layout.itemO("view3d.snap_cursor_to_grid", text="Cursor to Grid")
73         layout.itemO("view3d.snap_cursor_to_active", text="Cursor to Active")
74
75 # ********** View menus **********
76
77 class VIEW3D_MT_view(bpy.types.Menu):
78     bl_label = "View"
79
80     def draw(self, context):
81         layout = self.layout
82
83         layout.itemO("view3d.properties", icon='ICON_MENU_PANEL')
84         layout.itemO("view3d.toolbar", icon='ICON_MENU_PANEL')
85
86         layout.itemS()
87
88         layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA')
89         layout.item_enumO("view3d.viewnumpad", "type", 'TOP')
90         layout.item_enumO("view3d.viewnumpad", "type", 'FRONT')
91         layout.item_enumO("view3d.viewnumpad", "type", 'RIGHT')
92
93         layout.itemM("VIEW3D_MT_view_cameras", text="Cameras")
94
95         layout.itemS()
96
97         layout.itemO("view3d.view_persportho")
98
99         layout.itemS()
100
101         layout.itemM("VIEW3D_MT_view_navigation")
102         layout.itemM("VIEW3D_MT_view_align")
103
104         layout.itemS()
105
106         layout.operator_context = "INVOKE_REGION_WIN"
107
108         layout.itemO("view3d.clip_border", text="Clipping Border...")
109         layout.itemO("view3d.zoom_border", text="Zoom Border...")
110
111         layout.itemS()
112
113         layout.item_intO("view3d.layers", "nr", 0, text="Show All Layers")
114
115         layout.itemS()
116
117         layout.itemO("view3d.localview", text="View Global/Local")
118         layout.itemO("view3d.view_center")
119         layout.itemO("view3d.view_all")
120
121         layout.itemS()
122
123         layout.itemO("screen.region_foursplit", text="Toggle Quad View")
124         layout.itemO("screen.screen_full_area", text="Toggle Full Screen")
125
126         layout.itemS()
127
128         layout.itemO("screen.animation_play", text="Playback Animation", icon='ICON_PLAY')
129 class VIEW3D_MT_view_navigation(bpy.types.Menu):
130     bl_label = "Navigation"
131
132     def draw(self, context):
133         layout = self.layout
134
135         layout.items_enumO("view3d.view_orbit", "type")
136
137         layout.itemS()
138
139         layout.items_enumO("view3d.view_pan", "type")
140
141         layout.itemS()
142
143         layout.item_floatO("view3d.zoom", "delta", 1.0, text="Zoom In")
144         layout.item_floatO("view3d.zoom", "delta", -1.0, text="Zoom Out")
145
146         layout.itemS()
147
148         layout.itemO("view3d.fly")
149
150 class VIEW3D_MT_view_align(bpy.types.Menu):
151     bl_label = "Align View"
152
153     def draw(self, context):
154         layout = self.layout
155
156         layout.item_booleanO("view3d.view_all", "center", True, text="Center Cursor and View All")
157         layout.itemO("view3d.camera_to_view", text="Align Active Camera to View")
158         layout.itemO("view3d.view_center")
159
160 class VIEW3D_MT_view_cameras(bpy.types.Menu):
161     bl_label = "Cameras"
162
163     def draw(self, context):
164         layout = self.layout
165
166         layout.itemO("view3d.object_as_camera")
167         layout.item_enumO("view3d.viewnumpad", "type", 'CAMERA', text="Active Camera")
168
169 # ********** Select menus, suffix from context.mode **********
170
171 class VIEW3D_MT_select_object(bpy.types.Menu):
172     bl_label = "Select"
173
174     def draw(self, context):
175         layout = self.layout
176
177         layout.itemO("view3d.select_border")
178
179         layout.itemS()
180
181         layout.itemO("object.select_all_toggle", text="Select/Deselect All")
182         layout.itemO("object.select_inverse", text="Inverse")
183         layout.itemO("object.select_random", text="Random")
184         layout.itemO("object.select_mirror", text="Mirror")
185         layout.itemO("object.select_by_layer", text="Select All by Layer")
186         layout.item_menu_enumO("object.select_by_type", "type", "", text="Select All by Type...")
187         layout.item_menu_enumO("object.select_grouped", "type", text="Select Grouped...")
188         layout.itemO("object.select_pattern", text="Select Pattern...")
189
190 class VIEW3D_MT_select_pose(bpy.types.Menu):
191     bl_label = "Select"
192
193     def draw(self, context):
194         layout = self.layout
195
196         layout.itemO("view3d.select_border", text="Border Select...")
197
198         layout.itemS()
199
200         layout.itemO("pose.select_all_toggle", text="Select/Deselect All")
201         layout.itemO("pose.select_inverse", text="Inverse")
202         layout.itemO("pose.select_constraint_target", text="Constraint Target")
203         layout.itemO("pose.select_linked", text="Linked")
204
205         layout.itemS()
206
207         layout.item_enumO("pose.select_hierarchy", "direction", 'PARENT')
208         layout.item_enumO("pose.select_hierarchy", "direction", 'CHILD')
209
210         layout.itemS()
211
212         props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Parent")
213         props.extend = True
214         props.direction = 'PARENT'
215
216         props = layout.itemO("pose.select_hierarchy", properties=True, text="Extend Child")
217         props.extend = True
218         props.direction = 'CHILD'
219
220 class VIEW3D_MT_select_particle(bpy.types.Menu):
221     bl_label = "Select"
222
223     def draw(self, context):
224         layout = self.layout
225
226         layout.itemO("view3d.select_border")
227
228         layout.itemS()
229
230         layout.itemO("particle.select_all_toggle", text="Select/Deselect All")
231         layout.itemO("particle.select_linked")
232
233         layout.itemS()
234
235         layout.itemO("particle.select_more")
236         layout.itemO("particle.select_less")
237
238 class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
239     bl_label = "Select"
240
241     def draw(self, context):
242         layout = self.layout
243
244         layout.itemO("view3d.select_border", text="Border Select...")
245
246         layout.itemS()
247
248         layout.itemO("mesh.select_all_toggle", text="Select/Deselect All")
249         layout.itemO("mesh.select_inverse", text="Inverse")
250
251         layout.itemS()
252
253         layout.itemO("mesh.select_random", text="Random...")
254         layout.itemO("mesh.edges_select_sharp", text="Sharp Edges")
255         layout.itemO("mesh.faces_select_linked_flat", text="Linked Flat Faces")
256
257         layout.itemS()
258
259         layout.item_enumO("mesh.select_by_number_vertices", "type", 'TRIANGLES', text="Triangles")
260         layout.item_enumO("mesh.select_by_number_vertices", "type", 'QUADS', text="Quads")
261         layout.item_enumO("mesh.select_by_number_vertices", "type", 'OTHER', text="Loose Verts/Edges")
262         layout.itemO("mesh.select_similar", text="Similar...")
263
264         layout.itemS()
265
266         layout.itemO("mesh.select_less", text="Less")
267         layout.itemO("mesh.select_more", text="More")
268
269         layout.itemS()
270
271         layout.itemO("mesh.select_mirror", text="Mirror")
272
273         layout.itemO("mesh.select_linked", text="Linked")
274         layout.itemO("mesh.select_vertex_path", text="Vertex Path")
275         layout.itemO("mesh.loop_multi_select", text="Edge Loop")
276         layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
277
278         layout.itemS()
279
280         layout.itemO("mesh.loop_to_region")
281         layout.itemO("mesh.region_to_loop")
282
283 class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
284     bl_label = "Select"
285
286     def draw(self, context):
287         layout = self.layout
288
289         layout.itemO("view3d.select_border", text="Border Select...")
290         layout.itemO("view3d.select_circle", text="Circle Select...")
291
292         layout.itemS()
293
294         layout.itemO("curve.select_all_toggle", text="Select/Deselect All")
295         layout.itemO("curve.select_inverse")
296         layout.itemO("curve.select_random")
297         layout.itemO("curve.select_every_nth")
298
299         layout.itemS()
300
301         layout.itemO("curve.de_select_first")
302         layout.itemO("curve.de_select_last")
303         layout.itemO("curve.select_next")
304         layout.itemO("curve.select_previous")
305
306         layout.itemS()
307
308         layout.itemO("curve.select_more")
309         layout.itemO("curve.select_less")
310
311 class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
312     bl_label = "Select"
313
314     def draw(self, context):
315         layout = self.layout
316
317         layout.itemO("view3d.select_border", text="Border Select...")
318         layout.itemO("view3d.select_circle", text="Circle Select...")
319
320         layout.itemS()
321
322         layout.itemO("curve.select_all_toggle", text="Select/Deselect All")
323         layout.itemO("curve.select_inverse")
324         layout.itemO("curve.select_random")
325         layout.itemO("curve.select_every_nth")
326
327         layout.itemS()
328
329         layout.itemO("curve.select_row")
330
331         layout.itemS()
332
333         layout.itemO("curve.select_more")
334         layout.itemO("curve.select_less")
335
336 class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
337     bl_label = "Select"
338
339     def draw(self, context):
340         layout = self.layout
341
342         layout.itemO("view3d.select_border")
343
344         layout.itemS()
345
346         layout.itemO("mball.select_deselect_all_metaelems")
347         layout.itemO("mball.select_inverse_metaelems")
348
349         layout.itemS()
350
351         layout.itemO("mball.select_random_metaelems")
352
353 class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
354     bl_label = "Select"
355
356     def draw(self, context):
357         layout = self.layout
358
359         layout.itemO("view3d.select_border")
360
361         layout.itemS()
362
363         layout.itemO("lattice.select_all_toggle", text="Select/Deselect All")
364
365 class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
366     bl_label = "Select"
367
368     def draw(self, context):
369         layout = self.layout
370
371         layout.itemO("view3d.select_border", text="Border Select...")
372
373         layout.itemS()
374
375         layout.itemO("armature.select_all_toggle", text="Select/Deselect All")
376         layout.itemO("armature.select_inverse", text="Inverse")
377
378         layout.itemS()
379
380         layout.item_enumO("armature.select_hierarchy", "direction", 'PARENT', text="Parent")
381         layout.item_enumO("armature.select_hierarchy", "direction", 'CHILD', text="Child")
382
383         layout.itemS()
384
385         props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Parent")
386         props.extend = True
387         props.direction = 'PARENT'
388
389         props = layout.itemO("armature.select_hierarchy", properties=True, text="Extend Child")
390         props.extend = True
391         props.direction = 'CHILD'
392
393 class VIEW3D_MT_select_face(bpy.types.Menu):# XXX no matching enum
394     bl_label = "Select"
395
396     def draw(self, context):
397         layout = self.layout
398
399         layout.view3d_select_faceselmenu()
400
401 # ********** Object menu **********
402
403 class VIEW3D_MT_object(bpy.types.Menu):
404     bl_context = "objectmode"
405     bl_label = "Object"
406
407     def draw(self, context):
408         layout = self.layout
409
410         layout.itemM("VIEW3D_MT_object_clear")
411         layout.itemM("VIEW3D_MT_object_apply")
412         layout.itemM("VIEW3D_MT_snap")
413
414         layout.itemS()
415
416         layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...")
417         layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...")
418
419         layout.itemS()
420
421         layout.itemO("object.duplicate_move")
422         layout.item_booleanO("object.duplicate", "linked", True, text="Duplicate Linked")
423         layout.itemO("object.delete", text="Delete...")
424         layout.itemO("object.proxy_make", text="Make Proxy...")
425         layout.item_menu_enumO("object.make_local", "type", text="Make Local...")
426         layout.itemM("VIEW3D_MT_make_single_user")
427
428         layout.itemS()
429
430         layout.itemM("VIEW3D_MT_object_parent")
431         layout.itemM("VIEW3D_MT_object_track")
432         layout.itemM("VIEW3D_MT_object_group")
433         layout.itemM("VIEW3D_MT_object_constraints")
434
435         layout.itemS()
436
437         layout.itemO("object.join")
438
439         layout.itemS()
440
441         layout.itemO("object.move_to_layer", text="Move to Layer...")
442         layout.itemM("VIEW3D_MT_object_showhide")
443
444         layout.item_menu_enumO("object.convert", "target")
445
446 class VIEW3D_MT_object_clear(bpy.types.Menu):
447     bl_label = "Clear"
448
449     def draw(self, context):
450         layout = self.layout
451
452         layout.itemO("object.location_clear", text="Location")
453         layout.itemO("object.rotation_clear", text="Rotation")
454         layout.itemO("object.scale_clear", text="Scale")
455         layout.itemO("object.origin_clear", text="Origin")
456
457 class VIEW3D_MT_object_apply(bpy.types.Menu):
458     bl_label = "Apply"
459
460     def draw(self, context):
461         layout = self.layout
462
463         layout.itemO("object.location_apply", text="Location")
464         layout.itemO("object.rotation_apply", text="Rotation")
465         layout.itemO("object.scale_apply", text="Scale")
466         layout.itemS()
467         layout.itemO("object.visual_transform_apply", text="Visual Transform")
468         layout.itemO("object.duplicates_make_real")
469
470
471 class VIEW3D_MT_object_parent(bpy.types.Menu):
472     bl_label = "Parent"
473
474     def draw(self, context):
475         layout = self.layout
476
477         layout.itemO("object.parent_set", text="Set")
478         layout.itemO("object.parent_clear", text="Clear")
479
480 class VIEW3D_MT_object_track(bpy.types.Menu):
481     bl_label = "Track"
482
483     def draw(self, context):
484         layout = self.layout
485
486         layout.itemO("object.track_set", text="Set")
487         layout.itemO("object.track_clear", text="Clear")
488
489 class VIEW3D_MT_object_group(bpy.types.Menu):
490     bl_label = "Group"
491
492     def draw(self, context):
493         layout = self.layout
494
495         layout.itemO("group.group_create")
496         layout.itemO("group.objects_remove")
497
498         layout.itemS()
499
500         layout.itemO("group.objects_add_active")
501         layout.itemO("group.objects_remove_active")
502
503 class VIEW3D_MT_object_constraints(bpy.types.Menu):
504     bl_label = "Constraints"
505
506     def draw(self, context):
507         layout = self.layout
508
509         layout.itemO("object.constraint_add_with_targets")
510         layout.itemO("object.constraints_clear")
511
512 class VIEW3D_MT_object_showhide(bpy.types.Menu):
513     bl_label = "Show/Hide"
514
515     def draw(self, context):
516         layout = self.layout
517
518         layout.itemO("object.restrictview_clear", text="Show Hidden")
519         layout.itemO("object.restrictview_set", text="Hide Selected")
520         layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected")
521
522 class VIEW3D_MT_make_single_user(bpy.types.Menu):
523     bl_label = "Make Single User"
524
525     def draw(self, context):
526         layout = self.layout
527
528         props = layout.itemO("object.make_single_user", properties=True, text="Object")
529         props.object = True
530
531         props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData")
532         props.object = props.obdata = True
533
534         props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData & Materials+Tex")
535         props.object = props.obdata = props.material = props.texture = True
536
537         props = layout.itemO("object.make_single_user", properties=True, text="Materials+Tex")
538         props.material = props.texture = True
539
540         props = layout.itemO("object.make_single_user", properties=True, text="Animation")
541         props.animation = True
542
543 # ********** Vertex paint menu **********
544
545 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
546     bl_label = "Paint"
547
548     def draw(self, context):
549         layout = self.layout
550
551         sculpt = context.tool_settings.sculpt
552
553         layout.itemO("paint.vertex_color_set")
554         props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True)
555         props.selected = True
556
557 # ********** Sculpt menu **********
558
559 class VIEW3D_MT_sculpt(bpy.types.Menu):
560     bl_label = "Sculpt"
561
562     def draw(self, context):
563         layout = self.layout
564
565         sculpt = context.tool_settings.sculpt
566         brush = context.tool_settings.sculpt.brush
567
568         layout.itemR(sculpt, "symmetry_x")
569         layout.itemR(sculpt, "symmetry_y")
570         layout.itemR(sculpt, "symmetry_z")
571         layout.itemS()
572         layout.itemR(sculpt, "lock_x")
573         layout.itemR(sculpt, "lock_y")
574         layout.itemR(sculpt, "lock_z")
575         layout.itemS()
576         layout.item_menu_enumO("brush.curve_preset", property="shape")
577         layout.itemS()
578
579         if brush.sculpt_tool != 'GRAB':
580             layout.itemR(brush, "use_airbrush")
581
582             if brush.sculpt_tool != 'LAYER':
583                 layout.itemR(brush, "use_anchor")
584
585             if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
586                 layout.itemR(brush, "flip_direction")
587
588             if brush.sculpt_tool == 'LAYER':
589                 layout.itemR(brush, "use_persistent")
590                 layout.itemO("sculpt.set_persistent_base")
591
592 # ********** Particle menu **********
593
594 class VIEW3D_MT_particle(bpy.types.Menu):
595     bl_label = "Particle"
596
597     def draw(self, context):
598         layout = self.layout
599
600         particle_edit = context.tool_settings.particle_edit
601
602         layout.itemO("particle.mirror")
603
604         layout.itemS()
605
606         layout.itemO("particle.remove_doubles")
607         layout.itemO("particle.delete")
608
609         if particle_edit.selection_mode == 'POINT':
610             layout.itemO("particle.subdivide")
611
612         layout.itemO("particle.rekey")
613
614         layout.itemS()
615
616         layout.itemM("VIEW3D_MT_particle_showhide")
617
618 class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
619     _operator_name = "particle"
620
621 # ********** Pose Menu **********
622
623 class VIEW3D_MT_pose(bpy.types.Menu):
624     bl_label = "Pose"
625
626     def draw(self, context):
627         layout = self.layout
628
629         arm = context.active_object.data
630
631         if arm.drawtype in ('BBONE', 'ENVELOPE'):
632             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance")
633
634         layout.itemM("VIEW3D_MT_pose_transform")
635
636         layout.itemS()
637
638         layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...")
639         layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...")
640
641         layout.itemS()
642
643         layout.itemO("pose.apply")
644
645         layout.itemS()
646
647         layout.itemO("pose.copy")
648         layout.itemO("pose.paste")
649         layout.item_booleanO("pose.paste", "flipped", True, text="Paste X-Flipped Pose")
650
651         layout.itemS()
652
653         layout.itemM("VIEW3D_MT_pose_pose")
654         layout.itemM("VIEW3D_MT_pose_motion")
655         layout.itemM("VIEW3D_MT_pose_group")
656
657         layout.itemS()
658
659         layout.itemM("VIEW3D_MT_pose_ik")
660         layout.itemM("VIEW3D_MT_pose_constraints")
661
662         layout.itemS()
663
664         layout.operator_context = "EXEC_AREA"
665         layout.item_enumO("pose.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right")
666         layout.item_enumO("pose.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back")
667         layout.item_enumO("pose.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom")
668
669         layout.itemO("pose.flip_names")
670
671         layout.itemS()
672
673         layout.operator_context = "INVOKE_AREA"
674         layout.itemO("pose.armature_layers", text="Change Armature Layers...")
675         layout.itemO("pose.bone_layers", text="Change Bone Layers...")
676
677         layout.itemS()
678
679         layout.itemM("VIEW3D_MT_pose_showhide")
680         layout.item_menu_enumO("pose.flags_set", 'mode', text="Bone Settings")
681
682 class VIEW3D_MT_pose_transform(bpy.types.Menu):
683     bl_label = "Clear Transform"
684
685     def draw(self, context):
686         layout = self.layout
687
688         layout.itemL(text="User Transform")
689
690         layout.itemO("pose.loc_clear", text="Location")
691         layout.itemO("pose.rot_clear", text="Rotation")
692         layout.itemO("pose.scale_clear", text="Scale")
693
694         layout.itemL(text="Origin")
695
696 class VIEW3D_MT_pose_pose(bpy.types.Menu):
697     bl_label = "Pose Library"
698
699     def draw(self, context):
700         layout = self.layout
701
702         layout.itemO("poselib.browse_interactive", text="Browse Poses...")
703
704         layout.itemS()
705
706         layout.itemO("poselib.pose_add", text="Add Pose...")
707         layout.itemO("poselib.pose_rename", text="Rename Pose...")
708         layout.itemO("poselib.pose_remove", text="Remove Pose...")
709
710 class VIEW3D_MT_pose_motion(bpy.types.Menu):
711     bl_label = "Motion Paths"
712
713     def draw(self, context):
714         layout = self.layout
715
716         layout.itemO("pose.paths_calculate", text="Calculate")
717         layout.itemO("pose.paths_clear", text="Clear")
718
719 class VIEW3D_MT_pose_group(bpy.types.Menu):
720     bl_label = "Bone Groups"
721
722     def draw(self, context):
723         layout = self.layout
724         layout.itemO("pose.group_add")
725         layout.itemO("pose.group_remove")
726
727         layout.itemS()
728
729         layout.itemO("pose.group_assign")
730         layout.itemO("pose.group_unassign")
731
732
733 class VIEW3D_MT_pose_ik(bpy.types.Menu):
734     bl_label = "Inverse Kinematics"
735
736     def draw(self, context):
737         layout = self.layout
738
739         layout.itemO("pose.ik_add")
740         layout.itemO("pose.ik_clear")
741
742 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
743     bl_label = "Constraints"
744
745     def draw(self, context):
746         layout = self.layout
747
748         layout.itemO("pose.constraint_add_with_targets", text="Add (With Targets)...")
749         layout.itemO("pose.constraints_clear")
750
751 class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide):
752     _operator_name = "pose"
753
754 # ********** Edit Menus, suffix from ob.type **********
755
756 # Edit MESH
757 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
758     bl_label = "Mesh"
759
760     def draw(self, context):
761         layout = self.layout
762
763         settings = context.tool_settings
764
765         layout.itemO("ed.undo")
766         layout.itemO("ed.redo")
767
768         layout.itemS()
769
770         layout.itemM("VIEW3D_MT_snap")
771
772         layout.itemS()
773
774         layout.itemO("uv.mapping_menu", text="UV Unwrap...")
775
776         layout.itemS()
777
778         layout.itemO("mesh.extrude_move")
779         layout.itemO("mesh.duplicate_move")
780         layout.itemO("mesh.delete", text="Delete...")
781
782         layout.itemS()
783
784         layout.itemM("VIEW3D_MT_edit_mesh_vertices")
785         layout.itemM("VIEW3D_MT_edit_mesh_edges")
786         layout.itemM("VIEW3D_MT_edit_mesh_faces")
787         layout.itemM("VIEW3D_MT_edit_mesh_normals")
788
789         layout.itemS()
790
791         layout.itemR(settings, "automerge_editing")
792         layout.item_menu_enumR(settings, "proportional_editing")
793         layout.item_menu_enumR(settings, "proportional_editing_falloff")
794
795         layout.itemS()
796
797         layout.itemM("VIEW3D_MT_edit_mesh_showhide")
798
799 # Only used by the menu
800 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
801     bl_label = "Specials"
802
803     def draw(self, context):
804         layout = self.layout
805
806         layout.operator_context = 'INVOKE_REGION_WIN'
807
808         layout.itemO("mesh.subdivide", text="Subdivide")
809         layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth")
810         layout.itemO("mesh.merge", text="Merge...")
811         layout.itemO("mesh.remove_doubles")
812         layout.itemO("mesh.hide", text="Hide")
813         layout.itemO("mesh.reveal", text="Reveal")
814         layout.itemO("mesh.select_inverse")
815         layout.itemO("mesh.flip_normals")
816         layout.itemO("mesh.vertices_smooth", text="Smooth")
817         # layout.itemO("mesh.bevel", text="Bevel")
818         layout.itemO("mesh.faces_shade_smooth")
819         layout.itemO("mesh.faces_shade_flat")
820         layout.itemO("mesh.blend_from_shape")
821         layout.itemO("mesh.shape_propagate_to_all")
822         layout.itemO("mesh.select_vertex_path")
823
824 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
825     bl_label = "Vertices"
826
827     def draw(self, context):
828         layout = self.layout
829         layout.operator_context = 'INVOKE_REGION_WIN'
830
831         layout.itemO("mesh.merge")
832         layout.itemO("mesh.rip")
833         layout.itemO("mesh.split")
834         layout.itemO("mesh.separate")
835
836         layout.itemS()
837
838         layout.itemO("mesh.vertices_smooth")
839         layout.itemO("mesh.remove_doubles")
840
841         layout.itemO("mesh.select_vertex_path")
842
843         layout.itemO("mesh.blend_from_shape")
844
845         layout.itemO("object.vertex_group_blend")
846         layout.itemO("mesh.shape_propagate_to_all")
847
848 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
849     bl_label = "Edges"
850
851     def draw(self, context):
852         layout = self.layout
853         layout.operator_context = 'INVOKE_REGION_WIN'
854
855         layout.itemO("mesh.edge_face_add")
856         layout.itemO("mesh.subdivide")
857
858         layout.itemS()
859
860         layout.itemO("mesh.mark_seam")
861         layout.item_booleanO("mesh.mark_seam", "clear", True, text="Clear Seam")
862
863         layout.itemS()
864
865         layout.itemO("mesh.mark_sharp")
866         layout.item_booleanO("mesh.mark_sharp", "clear", True, text="Clear Sharp")
867
868         layout.itemS()
869
870         layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
871         layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
872
873         layout.itemS()
874
875         layout.itemO("TFM_OT_edge_slide", text="Edge Slide")
876         layout.itemO("mesh.loop_multi_select", text="Edge Loop")
877
878         # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
879         # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
880
881         layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
882
883         layout.itemO("mesh.loop_to_region")
884         layout.itemO("mesh.region_to_loop")
885
886
887 class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu):
888     bl_label = "Faces"
889     bl_idname = "VIEW3D_MT_edit_mesh_faces"
890
891     def draw(self, context):
892         layout = self.layout
893         layout.operator_context = 'INVOKE_REGION_WIN'
894
895         layout.itemO("mesh.flip_normals")
896         # layout.itemO("mesh.bevel")
897         # layout.itemO("mesh.bevel")
898         layout.itemO("mesh.edge_face_add")
899         layout.itemO("mesh.fill")
900         layout.itemO("mesh.beauty_fill")
901
902         layout.itemS()
903
904         layout.itemO("mesh.quads_convert_to_tris")
905         layout.itemO("mesh.tris_convert_to_quads")
906         layout.itemO("mesh.edge_flip")
907
908         layout.itemS()
909
910         layout.itemO("mesh.faces_shade_smooth")
911         layout.itemO("mesh.faces_shade_flat")
912
913         layout.itemS()
914
915         # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
916         # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
917
918         layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
919
920         layout.itemS()
921
922         layout.item_menu_enumO("mesh.uvs_rotate", "direction")
923         layout.item_menu_enumO("mesh.uvs_mirror", "axis")
924         layout.item_menu_enumO("mesh.colors_rotate", "direction")
925         layout.item_menu_enumO("mesh.colors_mirror", "axis")
926
927
928 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
929     bl_label = "Normals"
930
931     def draw(self, context):
932         layout = self.layout
933
934         layout.itemO("mesh.normals_make_consistent", text="Recalculate Outside")
935         layout.item_booleanO("mesh.normals_make_consistent", "inside", True, text="Recalculate Inside")
936
937         layout.itemS()
938
939         layout.itemO("mesh.flip_normals")
940
941 class VIEW3D_MT_edit_mesh_showhide(VIEW3D_MT_showhide):
942     _operator_name = "mesh"
943
944 # Edit Curve
945
946 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
947 def draw_curve(self, context):
948     layout = self.layout
949
950     settings = context.tool_settings
951
952     layout.itemM("VIEW3D_MT_snap")
953
954     layout.itemS()
955
956     layout.itemO("curve.extrude")
957     layout.itemO("curve.duplicate")
958     layout.itemO("curve.separate")
959     layout.itemO("curve.make_segment")
960     layout.itemO("curve.cyclic_toggle")
961     layout.itemO("curve.delete", text="Delete...")
962
963     layout.itemS()
964
965     layout.itemM("VIEW3D_MT_edit_curve_ctrlpoints")
966     layout.itemM("VIEW3D_MT_edit_curve_segments")
967
968     layout.itemS()
969
970     layout.itemR(settings, "proportional_editing")
971     layout.item_menu_enumR(settings, "proportional_editing_falloff")
972
973     layout.itemS()
974
975     layout.itemM("VIEW3D_MT_edit_curve_showhide")
976
977 class VIEW3D_MT_edit_curve(bpy.types.Menu):
978     bl_label = "Curve"
979
980     draw = draw_curve
981
982 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
983     bl_label = "Control Points"
984
985     def draw(self, context):
986         layout = self.layout
987
988         edit_object = context.edit_object
989
990         if edit_object.type == 'CURVE':
991             layout.item_enumO("tfm.transform", "mode", 'TILT')
992             layout.itemO("curve.tilt_clear")
993             layout.itemO("curve.separate")
994
995             layout.itemS()
996
997             layout.item_menu_enumO("curve.handle_type_set", "type")
998
999 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1000     bl_label = "Segments"
1001
1002     def draw(self, context):
1003         layout = self.layout
1004
1005         layout.itemO("curve.subdivide")
1006         layout.itemO("curve.switch_direction")
1007
1008 class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
1009     _operator_name = "curve"
1010
1011 # Edit SURFACE
1012 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1013     bl_label = "Surface"
1014
1015     draw = draw_curve
1016
1017 # Edit TEXT
1018 class VIEW3D_MT_edit_text(bpy.types.Menu):
1019     bl_label = "Text"
1020
1021     def draw(self, context):
1022         layout = self.layout
1023
1024         layout.itemO("font.file_paste")
1025
1026         layout.itemS()
1027
1028         layout.itemm("view3d_mt_edit_text_chars")
1029
1030 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1031     bl_label = "Special Characters"
1032
1033     def draw(self, context):
1034         layout = self.layout
1035
1036         layout.item_stringO("font.text_insert", "text", b'\xC2\xA9'.decode(), text="Copyright|Alt C")
1037         layout.item_stringO("font.text_insert", "text", b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R")
1038
1039         layout.itemS()
1040
1041         layout.item_stringO("font.text_insert", "text", b'\xC2\xB0'.decode(), text="Degree Sign|Alt G")
1042         layout.item_stringO("font.text_insert", "text", b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x")
1043         layout.item_stringO("font.text_insert", "text", b'\xC2\x8A'.decode(), text="Circle|Alt .")
1044         layout.item_stringO("font.text_insert", "text", b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1")
1045         layout.item_stringO("font.text_insert", "text", b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2")
1046         layout.item_stringO("font.text_insert", "text", b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3")
1047         layout.item_stringO("font.text_insert", "text", b'\xC2\xBB'.decode(), text="Double >>|Alt >")
1048         layout.item_stringO("font.text_insert", "text", b'\xC2\xAB'.decode(), text="Double <<|Alt <")
1049         layout.item_stringO("font.text_insert", "text", b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %")
1050
1051         layout.itemS()
1052
1053         layout.item_stringO("font.text_insert", "text", b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F")
1054         layout.item_stringO("font.text_insert", "text", b'\xC2\xA3'.decode(), text="British Pound|Alt L")
1055         layout.item_stringO("font.text_insert", "text", b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y")
1056
1057         layout.itemS()
1058
1059         layout.item_stringO("font.text_insert", "text", b'\xC3\x9F'.decode(), text="German S|Alt S")
1060         layout.item_stringO("font.text_insert", "text", b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?")
1061         layout.item_stringO("font.text_insert", "text", b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !")
1062
1063 # Edit META
1064 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1065     bl_label = "Metaball"
1066
1067     def draw(self, context):
1068         layout = self.layout
1069
1070         settings = context.tool_settings
1071
1072         layout.itemO("ed.undo")
1073         layout.itemO("ed.redo")
1074
1075         layout.itemS()
1076
1077         layout.itemM("VIEW3D_MT_snap")
1078
1079         layout.itemS()
1080
1081         layout.itemO("mball.delete_metaelems", text="Delete...")
1082         layout.itemO("mball.duplicate_metaelems")
1083
1084         layout.itemS()
1085
1086         layout.itemR(settings, "proportional_editing")
1087         layout.item_menu_enumR(settings, "proportional_editing_falloff")
1088
1089         layout.itemS()
1090
1091         layout.itemM("VIEW3D_MT_edit_meta_showhide")
1092
1093 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1094     bl_label = "Show/Hide"
1095
1096     def draw(self, context):
1097         layout = self.layout
1098
1099         layout.itemO("mball.reveal_metaelems", text="Show Hidden")
1100         layout.itemO("mball.hide_metaelems", text="Hide Selected")
1101         layout.item_booleanO("mball.hide_metaelems", "unselected", True, text="Hide Unselected")
1102
1103 # Edit LATTICE
1104 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1105     bl_label = "Lattice"
1106
1107     def draw(self, context):
1108         layout = self.layout
1109
1110         settings = context.tool_settings
1111
1112         layout.itemM("VIEW3D_MT_snap")
1113
1114         layout.itemS()
1115
1116         layout.itemO("lattice.make_regular")
1117
1118         layout.itemS()
1119
1120         layout.itemR(settings, "proportional_editing")
1121         layout.item_menu_enumR(settings, "proportional_editing_falloff")
1122
1123 # Edit ARMATURE
1124 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1125     bl_label = "Armature"
1126
1127     def draw(self, context):
1128         layout = self.layout
1129
1130         edit_object = context.edit_object
1131         arm = edit_object.data
1132
1133         layout.itemM("VIEW3D_MT_snap")
1134         layout.itemM("VIEW3D_MT_edit_armature_roll")
1135
1136         if arm.drawtype == 'ENVELOPE':
1137             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance")
1138         else:
1139             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale B-Bone Width")
1140
1141         layout.itemS()
1142
1143         layout.itemO("armature.extrude_move")
1144
1145 # EXTRUDE FORKED DOESN'T WORK YET
1146 #               if arm.x_axis_mirror:
1147 #                       layout.item_booleanO("armature.extrude_move", "forked", True, text="Extrude Forked")
1148
1149         layout.itemO("armature.duplicate_move")
1150         layout.itemO("armature.merge")
1151         layout.itemO("armature.fill")
1152         layout.itemO("armature.delete")
1153         layout.itemO("armature.separate")
1154
1155         layout.itemS()
1156
1157         layout.itemO("armature.subdivide_multi", text="Subdivide")
1158
1159         layout.itemS()
1160
1161         layout.operator_context = "EXEC_AREA"
1162         layout.item_enumO("armature.autoside_names", "type", 'XAXIS', text="AutoName Left/Right")
1163         layout.item_enumO("armature.autoside_names", "type", 'YAXIS', text="AutoName Front/Back")
1164         layout.item_enumO("armature.autoside_names", "type", 'ZAXIS', text="AutoName Top/Bottom")
1165         layout.itemO("armature.flip_names")
1166
1167         layout.itemS()
1168
1169         layout.operator_context = "INVOKE_DEFAULT"
1170         layout.itemO("armature.armature_layers")
1171         layout.itemO("armature.bone_layers")
1172
1173         layout.itemS()
1174
1175         layout.itemM("VIEW3D_MT_edit_armature_parent")
1176
1177         layout.itemS()
1178
1179         layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings")
1180
1181 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
1182     bl_label = "Parent"
1183
1184     def draw(self, context):
1185         layout = self.layout
1186
1187         layout.itemO("armature.parent_set", text="Make")
1188         layout.itemO("armature.parent_clear", text="Clear")
1189
1190 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
1191     bl_label = "Bone Roll"
1192
1193     def draw(self, context):
1194         layout = self.layout
1195
1196         layout.item_enumO("armature.calculate_roll", "type", 'GLOBALUP', text="Clear Roll (Z-Axis Up)")
1197         layout.item_enumO("armature.calculate_roll", "type", 'CURSOR', text="Roll to Cursor")
1198
1199         layout.itemS()
1200
1201         layout.item_enumO("tfm.transform", "mode", 'BONE_ROLL', text="Set Roll")
1202
1203 # ********** Panel **********
1204
1205 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
1206     bl_space_type = 'VIEW_3D'
1207     bl_region_type = 'UI'
1208     bl_label = "View"
1209
1210     def poll(self, context):
1211         view = context.space_data
1212         return (view)
1213
1214     def draw(self, context):
1215         layout = self.layout
1216
1217         view = context.space_data
1218         scene = context.scene
1219
1220         col = layout.column()
1221         col.itemL(text="Camera:")
1222         col.itemR(view, "camera", text="")
1223         col.itemR(view, "lens")
1224
1225         col = layout.column(align=True)
1226         col.itemL(text="Clip:")
1227         col.itemR(view, "clip_start", text="Start")
1228         col.itemR(view, "clip_end", text="End")
1229
1230         col = layout.column(align=True)
1231         col.itemL(text="Grid:")
1232         col.itemR(view, "grid_lines", text="Lines")
1233         col.itemR(view, "grid_spacing", text="Spacing")
1234         col.itemR(view, "grid_subdivisions", text="Subdivisions")
1235
1236         layout.column().itemR(scene, "cursor_location", text="3D Cursor:")
1237
1238 class VIEW3D_PT_3dview_display(bpy.types.Panel):
1239     bl_space_type = 'VIEW_3D'
1240     bl_region_type = 'UI'
1241     bl_label = "Display"
1242     bl_default_closed = True
1243
1244     def poll(self, context):
1245         view = context.space_data
1246         return (view)
1247
1248     def draw(self, context):
1249         layout = self.layout
1250
1251         view = context.space_data
1252         gs = context.scene.game_data
1253         ob = context.object
1254
1255         col = layout.column()
1256         col.itemR(view, "display_floor", text="Grid Floor")
1257         col.itemR(view, "display_x_axis", text="X Axis")
1258         col.itemR(view, "display_y_axis", text="Y Axis")
1259         col.itemR(view, "display_z_axis", text="Z Axis")
1260         col.itemR(view, "outline_selected")
1261         col.itemR(view, "all_object_centers")
1262         col.itemR(view, "relationship_lines")
1263         if ob and ob.type =='MESH':
1264             mesh = context.active_object.data
1265             col.itemR(mesh, "all_edges")
1266
1267         col = layout.column()
1268         col.itemL(text="Shading:")
1269         col.itemR(gs, "material_mode", text="")
1270         col.itemR(view, "textured_solid")
1271
1272 # XXX - the Quad View options don't work yet
1273 #               layout.itemS()
1274 #
1275 #               layout.itemO("screen.region_foursplit", text="Toggle Quad View")
1276 #               col = layout.column()
1277 #               col.itemR(view, "lock_rotation")
1278 #               col.itemR(view, "box_preview")
1279 #               col.itemR(view, "box_clip")
1280
1281 class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel):
1282     bl_space_type = 'VIEW_3D'
1283     bl_region_type = 'UI'
1284     bl_label = "Mesh Display"
1285
1286     def poll(self, context):
1287         editmesh = context.mode == 'EDIT_MESH'
1288         return (editmesh)
1289
1290     def draw(self, context):
1291         layout = self.layout
1292
1293         mesh = context.active_object.data
1294
1295         col = layout.column()
1296         col.itemL(text="Overlays:")
1297         col.itemR(mesh, "draw_edges", text="Edges")
1298         col.itemR(mesh, "draw_faces", text="Faces")
1299         col.itemR(mesh, "draw_creases", text="Creases")
1300         col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights")
1301         col.itemR(mesh, "draw_seams", text="Seams")
1302         col.itemR(mesh, "draw_sharp", text="Sharp")
1303
1304         col.itemS()
1305         col.itemL(text="Normals:")
1306         col.itemR(mesh, "draw_normals", text="Face")
1307         col.itemR(mesh, "draw_vertex_normals", text="Vertex")
1308         col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size")
1309
1310         col.itemS()
1311         col.itemL(text="Numerics:")
1312         col.itemR(mesh, "draw_edge_lenght")
1313         col.itemR(mesh, "draw_edge_angle")
1314         col.itemR(mesh, "draw_face_area")
1315
1316 class VIEW3D_PT_3dview_curvedisplay(bpy.types.Panel):
1317     bl_space_type = 'VIEW_3D'
1318     bl_region_type = 'UI'
1319     bl_label = "Curve Display"
1320
1321     def poll(self, context):
1322         editmesh = context.mode == 'EDIT_CURVE'
1323         return (editmesh)
1324
1325     def draw(self, context):
1326         layout = self.layout
1327
1328         curve = context.active_object.data
1329
1330         col = layout.column()
1331         col.itemL(text="Overlays:")
1332         col.itemR(curve, "draw_handles", text="Handles")
1333         col.itemR(curve, "draw_normals", text="Normals")
1334         col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size")
1335
1336 class VIEW3D_PT_background_image(bpy.types.Panel):
1337     bl_space_type = 'VIEW_3D'
1338     bl_region_type = 'UI'
1339     bl_label = "Background Image"
1340     bl_default_closed = True
1341
1342     def poll(self, context):
1343         view = context.space_data
1344         bg = context.space_data.background_image
1345         return (view)
1346
1347     def draw_header(self, context):
1348         layout = self.layout
1349         view = context.space_data
1350
1351         layout.itemR(view, "display_background_image", text="")
1352
1353     def draw(self, context):
1354         layout = self.layout
1355
1356         view = context.space_data
1357         bg = view.background_image
1358
1359         if bg:
1360             layout.active = view.display_background_image
1361
1362             col = layout.column()
1363             col.itemR(bg, "image", text="")
1364             #col.itemR(bg, "image_user")
1365             col.itemR(bg, "size")
1366             col.itemR(bg, "transparency", slider=True)
1367
1368
1369             col = layout.column(align=True)
1370             col.itemL(text="Offset:")
1371             col.itemR(bg, "offset_x", text="X")
1372             col.itemR(bg, "offset_y", text="Y")
1373
1374 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
1375     bl_space_type = 'VIEW_3D'
1376     bl_region_type = 'UI'
1377     bl_label = "Transform Orientations"
1378     bl_default_closed = True
1379
1380     def poll(self, context):
1381         view = context.space_data
1382         return (view)
1383
1384     def draw(self, context):
1385         layout = self.layout
1386
1387         view = context.space_data
1388
1389         col = layout.column()
1390
1391         col.itemR(view, "transform_orientation")
1392         col.itemO("tfm.create_orientation", text="Create")
1393
1394         orientation = view.current_orientation
1395
1396         if orientation:
1397             col.itemR(orientation, "name")
1398             col.itemO("tfm.delete_orientation", text="Delete")
1399
1400 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
1401     bl_space_type = 'VIEW_3D'
1402     bl_region_type = 'UI'
1403     bl_label = "Skeleton Sketching"
1404     bl_default_closed = True
1405
1406     def poll(self, context):
1407         scene = context.space_data
1408         ob = context.active_object
1409         return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
1410
1411     def draw_header(self, context):
1412         layout = self.layout
1413         toolsettings = context.scene.tool_settings
1414
1415         layout.itemR(toolsettings, "bone_sketching", text="")
1416
1417     def draw(self, context):
1418         layout = self.layout
1419         toolsettings = context.scene.tool_settings
1420
1421         col = layout.column()
1422
1423         col.itemR(toolsettings, "etch_quick")
1424         col.itemR(toolsettings, "etch_overdraw")
1425
1426         col.itemR(toolsettings, "etch_convert_mode")
1427
1428         if toolsettings.etch_convert_mode == "LENGTH":
1429             col.itemR(toolsettings, "etch_length_limit")
1430         elif toolsettings.etch_convert_mode == "ADAPTIVE":
1431             col.itemR(toolsettings, "etch_adaptive_limit")
1432         elif toolsettings.etch_convert_mode == "FIXED":
1433             col.itemR(toolsettings, "etch_subdivision_number")
1434         elif toolsettings.etch_convert_mode == "RETARGET":
1435             col.itemR(toolsettings, "etch_template")
1436             col.itemR(toolsettings, "etch_roll_mode")
1437             col.itemR(toolsettings, "etch_autoname")
1438             col.itemR(toolsettings, "etch_number")
1439             col.itemR(toolsettings, "etch_side")
1440
1441
1442 # Operators
1443 from bpy.props import *
1444
1445
1446 class OBJECT_OT_select_pattern(bpy.types.Operator):
1447     '''Select object matching a naming pattern.'''
1448     bl_idname = "object.select_pattern"
1449     bl_label = "Select Pattern"
1450     bl_register = True
1451     bl_undo = True
1452
1453     pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen= 32, default= "*")
1454     case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default= False)
1455     extend = BoolProperty(name="Extend", description="Extend the existing selection", default= True)
1456
1457
1458     def execute(self, context):
1459
1460         import fnmatch
1461         if self.case_sensitive: pattern_match = fnmatch.fnmatchcase
1462         else:                                   pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
1463
1464         for ob in context.visible_objects:
1465             if pattern_match(ob.name, self.pattern):
1466                 ob.selected = True
1467             elif not self.extend:
1468                 ob.selected = False
1469
1470         return ('FINISHED',)
1471
1472         # TODO - python cant do popups yet
1473     '''
1474     def invoke(self, context, event):
1475         wm = context.manager
1476         wm.add_fileselect(self.__operator__)
1477         return ('RUNNING_MODAL',)
1478     '''
1479
1480 bpy.types.register(VIEW3D_HT_header) # Header
1481
1482 bpy.types.register(VIEW3D_MT_view) #View Menus
1483 bpy.types.register(VIEW3D_MT_view_navigation)
1484 bpy.types.register(VIEW3D_MT_view_align)
1485 bpy.types.register(VIEW3D_MT_view_cameras)
1486
1487 bpy.types.register(VIEW3D_MT_select_object) # Select Menus
1488 bpy.types.register(VIEW3D_MT_select_pose)
1489 bpy.types.register(VIEW3D_MT_select_particle)
1490 bpy.types.register(VIEW3D_MT_select_edit_mesh)
1491 bpy.types.register(VIEW3D_MT_select_edit_curve)
1492 bpy.types.register(VIEW3D_MT_select_edit_surface)
1493 bpy.types.register(VIEW3D_MT_select_edit_metaball)
1494 bpy.types.register(VIEW3D_MT_select_edit_lattice)
1495 bpy.types.register(VIEW3D_MT_select_edit_armature)
1496 bpy.types.register(VIEW3D_MT_select_face) # XXX todo
1497
1498 bpy.types.register(VIEW3D_MT_object) # Object Menu
1499 bpy.types.register(VIEW3D_MT_object_apply)
1500 bpy.types.register(VIEW3D_MT_object_clear)
1501 bpy.types.register(VIEW3D_MT_object_parent)
1502 bpy.types.register(VIEW3D_MT_object_track)
1503 bpy.types.register(VIEW3D_MT_object_group)
1504 bpy.types.register(VIEW3D_MT_object_constraints)
1505 bpy.types.register(VIEW3D_MT_object_showhide)
1506 bpy.types.register(VIEW3D_MT_make_single_user)
1507
1508
1509 bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
1510
1511 bpy.types.register(VIEW3D_MT_paint_vertex)
1512
1513 bpy.types.register(VIEW3D_MT_particle) # Particle Menu
1514 bpy.types.register(VIEW3D_MT_particle_showhide)
1515
1516 bpy.types.register(VIEW3D_MT_pose) # POSE Menu
1517 bpy.types.register(VIEW3D_MT_pose_transform)
1518 bpy.types.register(VIEW3D_MT_pose_pose)
1519 bpy.types.register(VIEW3D_MT_pose_motion)
1520 bpy.types.register(VIEW3D_MT_pose_group)
1521 bpy.types.register(VIEW3D_MT_pose_ik)
1522 bpy.types.register(VIEW3D_MT_pose_constraints)
1523 bpy.types.register(VIEW3D_MT_pose_showhide)
1524
1525 bpy.types.register(VIEW3D_MT_snap) # Edit Menus
1526
1527 bpy.types.register(VIEW3D_MT_edit_mesh)
1528 bpy.types.register(VIEW3D_MT_edit_mesh_specials) # Only as a menu for keybindings
1529 bpy.types.register(VIEW3D_MT_edit_mesh_vertices)
1530 bpy.types.register(VIEW3D_MT_edit_mesh_edges)
1531 bpy.types.register(VIEW3D_MT_edit_mesh_faces)
1532 bpy.types.register(VIEW3D_MT_edit_mesh_normals)
1533 bpy.types.register(VIEW3D_MT_edit_mesh_showhide)
1534
1535 bpy.types.register(VIEW3D_MT_edit_curve)
1536 bpy.types.register(VIEW3D_MT_edit_curve_ctrlpoints)
1537 bpy.types.register(VIEW3D_MT_edit_curve_segments)
1538 bpy.types.register(VIEW3D_MT_edit_curve_showhide)
1539
1540 bpy.types.register(VIEW3D_MT_edit_surface)
1541
1542 bpy.types.register(VIEW3D_MT_edit_text)
1543 bpy.types.register(VIEW3D_MT_edit_text_chars)
1544
1545 bpy.types.register(VIEW3D_MT_edit_meta)
1546 bpy.types.register(VIEW3D_MT_edit_meta_showhide)
1547
1548 bpy.types.register(VIEW3D_MT_edit_lattice)
1549
1550 bpy.types.register(VIEW3D_MT_edit_armature)
1551 bpy.types.register(VIEW3D_MT_edit_armature_parent)
1552 bpy.types.register(VIEW3D_MT_edit_armature_roll)
1553
1554 bpy.types.register(VIEW3D_PT_3dview_properties) # Panels
1555 bpy.types.register(VIEW3D_PT_3dview_display)
1556 bpy.types.register(VIEW3D_PT_3dview_meshdisplay)
1557 bpy.types.register(VIEW3D_PT_3dview_curvedisplay)
1558 bpy.types.register(VIEW3D_PT_background_image)
1559 bpy.types.register(VIEW3D_PT_transform_orientations)
1560 bpy.types.register(VIEW3D_PT_etch_a_ton)
1561
1562 bpy.ops.add(OBJECT_OT_select_pattern)
1563