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