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