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