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