uv smart project now in unwrap menu with 2 most important options
[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.item_menu_enumO("object.make_local", "type", text="Make Local...")
483         layout.itemM("VIEW3D_MT_make_single_user")
484
485         layout.itemS()
486
487         layout.itemM("VIEW3D_MT_object_parent")
488         layout.itemM("VIEW3D_MT_object_track")
489         layout.itemM("VIEW3D_MT_object_group")
490         layout.itemM("VIEW3D_MT_object_constraints")
491
492         layout.itemS()
493
494         layout.itemO("object.join")
495
496         layout.itemS()
497
498         layout.itemO("object.move_to_layer", text="Move to Layer...")
499         layout.itemM("VIEW3D_MT_object_showhide")
500
501         layout.item_menu_enumO("object.convert", "target")
502
503
504 class VIEW3D_MT_object_clear(bpy.types.Menu):
505     bl_label = "Clear"
506
507     def draw(self, context):
508         layout = self.layout
509
510         layout.itemO("object.location_clear", text="Location")
511         layout.itemO("object.rotation_clear", text="Rotation")
512         layout.itemO("object.scale_clear", text="Scale")
513         layout.itemO("object.origin_clear", text="Origin")
514
515
516 class VIEW3D_MT_object_apply(bpy.types.Menu):
517     bl_label = "Apply"
518
519     def draw(self, context):
520         layout = self.layout
521
522         layout.itemO("object.location_apply", text="Location")
523         layout.itemO("object.rotation_apply", text="Rotation")
524         layout.itemO("object.scale_apply", text="Scale")
525         layout.itemS()
526         layout.itemO("object.visual_transform_apply", text="Visual Transform")
527         layout.itemO("object.duplicates_make_real")
528
529
530 class VIEW3D_MT_object_parent(bpy.types.Menu):
531     bl_label = "Parent"
532
533     def draw(self, context):
534         layout = self.layout
535
536         layout.itemO("object.parent_set", text="Set")
537         layout.itemO("object.parent_clear", text="Clear")
538
539
540 class VIEW3D_MT_object_track(bpy.types.Menu):
541     bl_label = "Track"
542
543     def draw(self, context):
544         layout = self.layout
545
546         layout.itemO("object.track_set", text="Set")
547         layout.itemO("object.track_clear", text="Clear")
548
549
550 class VIEW3D_MT_object_group(bpy.types.Menu):
551     bl_label = "Group"
552
553     def draw(self, context):
554         layout = self.layout
555
556         layout.itemO("group.group_create")
557         layout.itemO("group.objects_remove")
558
559         layout.itemS()
560
561         layout.itemO("group.objects_add_active")
562         layout.itemO("group.objects_remove_active")
563
564
565 class VIEW3D_MT_object_constraints(bpy.types.Menu):
566     bl_label = "Constraints"
567
568     def draw(self, context):
569         layout = self.layout
570
571         layout.itemO("object.constraint_add_with_targets")
572         layout.itemO("object.constraints_clear")
573
574
575 class VIEW3D_MT_object_showhide(bpy.types.Menu):
576     bl_label = "Show/Hide"
577
578     def draw(self, context):
579         layout = self.layout
580
581         layout.itemO("object.restrictview_clear", text="Show Hidden")
582         layout.itemO("object.restrictview_set", text="Hide Selected")
583         layout.item_booleanO("object.restrictview_set", "unselected", True, text="Hide Unselected")
584
585
586 class VIEW3D_MT_make_single_user(bpy.types.Menu):
587     bl_label = "Make Single User"
588
589     def draw(self, context):
590         layout = self.layout
591
592         props = layout.itemO("object.make_single_user", properties=True, text="Object")
593         props.object = True
594
595         props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData")
596         props.object = props.obdata = True
597
598         props = layout.itemO("object.make_single_user", properties=True, text="Object & ObData & Materials+Tex")
599         props.object = props.obdata = props.material = props.texture = True
600
601         props = layout.itemO("object.make_single_user", properties=True, text="Materials+Tex")
602         props.material = props.texture = True
603
604         props = layout.itemO("object.make_single_user", properties=True, text="Animation")
605         props.animation = True
606
607 # ********** Vertex paint menu **********
608
609
610 class VIEW3D_MT_paint_vertex(bpy.types.Menu):
611     bl_label = "Paint"
612
613     def draw(self, context):
614         layout = self.layout
615
616         sculpt = context.tool_settings.sculpt
617
618         layout.itemO("paint.vertex_color_set")
619         props = layout.itemO("paint.vertex_color_set", text="Set Selected Vertex Colors", properties=True)
620         props.selected = True
621
622 # ********** Sculpt menu **********
623
624
625 class VIEW3D_MT_sculpt(bpy.types.Menu):
626     bl_label = "Sculpt"
627
628     def draw(self, context):
629         layout = self.layout
630
631         sculpt = context.tool_settings.sculpt
632         brush = context.tool_settings.sculpt.brush
633
634         layout.itemR(sculpt, "symmetry_x")
635         layout.itemR(sculpt, "symmetry_y")
636         layout.itemR(sculpt, "symmetry_z")
637         layout.itemS()
638         layout.itemR(sculpt, "lock_x")
639         layout.itemR(sculpt, "lock_y")
640         layout.itemR(sculpt, "lock_z")
641         layout.itemS()
642         layout.item_menu_enumO("brush.curve_preset", property="shape")
643         layout.itemS()
644
645         if brush.sculpt_tool != 'GRAB':
646             layout.itemR(brush, "use_airbrush")
647
648             if brush.sculpt_tool != 'LAYER':
649                 layout.itemR(brush, "use_anchor")
650
651             if brush.sculpt_tool in ('DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'):
652                 layout.itemR(brush, "flip_direction")
653
654             if brush.sculpt_tool == 'LAYER':
655                 layout.itemR(brush, "use_persistent")
656                 layout.itemO("sculpt.set_persistent_base")
657
658 # ********** Particle menu **********
659
660
661 class VIEW3D_MT_particle(bpy.types.Menu):
662     bl_label = "Particle"
663
664     def draw(self, context):
665         layout = self.layout
666
667         particle_edit = context.tool_settings.particle_edit
668
669         layout.itemO("particle.mirror")
670
671         layout.itemS()
672
673         layout.itemO("particle.remove_doubles")
674         layout.itemO("particle.delete")
675
676         if particle_edit.selection_mode == 'POINT':
677             layout.itemO("particle.subdivide")
678
679         layout.itemO("particle.rekey")
680
681         layout.itemS()
682
683         layout.itemM("VIEW3D_MT_particle_showhide")
684
685
686 class VIEW3D_MT_particle_showhide(VIEW3D_MT_showhide):
687     _operator_name = "particle"
688
689 # ********** Pose Menu **********
690
691
692 class VIEW3D_MT_pose(bpy.types.Menu):
693     bl_label = "Pose"
694
695     def draw(self, context):
696         layout = self.layout
697
698         arm = context.active_object.data
699
700         if arm.drawtype in ('BBONE', 'ENVELOPE'):
701             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance")
702
703         layout.itemM("VIEW3D_MT_pose_transform")
704
705         layout.itemS()
706
707         layout.itemO("anim.insert_keyframe_menu", text="Insert Keyframe...")
708         layout.itemO("anim.delete_keyframe_v3d", text="Delete Keyframe...")
709
710         layout.itemS()
711
712         layout.itemO("pose.apply")
713         layout.itemO("pose.relax")
714
715         layout.itemS()
716
717         layout.itemO("pose.copy")
718         layout.itemO("pose.paste")
719         layout.item_booleanO("pose.paste", "flipped", True, text="Paste X-Flipped Pose")
720
721         layout.itemS()
722
723         layout.itemM("VIEW3D_MT_pose_pose")
724         layout.itemM("VIEW3D_MT_pose_motion")
725         layout.itemM("VIEW3D_MT_pose_group")
726
727         layout.itemS()
728
729         layout.itemM("VIEW3D_MT_pose_ik")
730         layout.itemM("VIEW3D_MT_pose_constraints")
731
732         layout.itemS()
733
734         layout.operator_context = "EXEC_AREA"
735         layout.item_enumO("pose.autoside_names", "axis", 'XAXIS', text="AutoName Left/Right")
736         layout.item_enumO("pose.autoside_names", "axis", 'YAXIS', text="AutoName Front/Back")
737         layout.item_enumO("pose.autoside_names", "axis", 'ZAXIS', text="AutoName Top/Bottom")
738
739         layout.itemO("pose.flip_names")
740
741         layout.itemS()
742
743         layout.operator_context = "INVOKE_AREA"
744         layout.itemO("pose.armature_layers", text="Change Armature Layers...")
745         layout.itemO("pose.bone_layers", text="Change Bone Layers...")
746
747         layout.itemS()
748
749         layout.itemM("VIEW3D_MT_pose_showhide")
750         layout.item_menu_enumO("pose.flags_set", 'mode', text="Bone Settings")
751
752
753 class VIEW3D_MT_pose_transform(bpy.types.Menu):
754     bl_label = "Clear Transform"
755
756     def draw(self, context):
757         layout = self.layout
758
759         layout.itemL(text="User Transform")
760
761         layout.itemO("pose.loc_clear", text="Location")
762         layout.itemO("pose.rot_clear", text="Rotation")
763         layout.itemO("pose.scale_clear", text="Scale")
764
765         layout.itemL(text="Origin")
766
767
768 class VIEW3D_MT_pose_pose(bpy.types.Menu):
769     bl_label = "Pose Library"
770
771     def draw(self, context):
772         layout = self.layout
773
774         layout.itemO("poselib.browse_interactive", text="Browse Poses...")
775
776         layout.itemS()
777
778         layout.itemO("poselib.pose_add", text="Add Pose...")
779         layout.itemO("poselib.pose_rename", text="Rename Pose...")
780         layout.itemO("poselib.pose_remove", text="Remove Pose...")
781
782
783 class VIEW3D_MT_pose_motion(bpy.types.Menu):
784     bl_label = "Motion Paths"
785
786     def draw(self, context):
787         layout = self.layout
788
789         layout.itemO("pose.paths_calculate", text="Calculate")
790         layout.itemO("pose.paths_clear", text="Clear")
791
792
793 class VIEW3D_MT_pose_group(bpy.types.Menu):
794     bl_label = "Bone Groups"
795
796     def draw(self, context):
797         layout = self.layout
798         layout.itemO("pose.group_add")
799         layout.itemO("pose.group_remove")
800
801         layout.itemS()
802
803         layout.itemO("pose.group_assign")
804         layout.itemO("pose.group_unassign")
805
806
807 class VIEW3D_MT_pose_ik(bpy.types.Menu):
808     bl_label = "Inverse Kinematics"
809
810     def draw(self, context):
811         layout = self.layout
812
813         layout.itemO("pose.ik_add")
814         layout.itemO("pose.ik_clear")
815
816
817 class VIEW3D_MT_pose_constraints(bpy.types.Menu):
818     bl_label = "Constraints"
819
820     def draw(self, context):
821         layout = self.layout
822
823         layout.itemO("pose.constraint_add_with_targets", text="Add (With Targets)...")
824         layout.itemO("pose.constraints_clear")
825
826
827 class VIEW3D_MT_pose_showhide(VIEW3D_MT_showhide):
828     _operator_name = "pose"
829
830 # ********** Edit Menus, suffix from ob.type **********
831
832
833 class VIEW3D_MT_edit_mesh(bpy.types.Menu):
834     bl_label = "Mesh"
835
836     def draw(self, context):
837         layout = self.layout
838
839         settings = context.tool_settings
840
841         layout.itemO("ed.undo")
842         layout.itemO("ed.redo")
843
844         layout.itemS()
845
846         layout.itemM("VIEW3D_MT_snap")
847
848         layout.itemS()
849
850         layout.itemM("VIEW3D_MT_uv_map", text="UV Unwrap...")
851
852         layout.itemS()
853
854         layout.itemO("mesh.extrude_move")
855         layout.itemO("mesh.duplicate_move")
856         layout.itemO("mesh.delete", text="Delete...")
857
858         layout.itemS()
859
860         layout.itemM("VIEW3D_MT_edit_mesh_vertices")
861         layout.itemM("VIEW3D_MT_edit_mesh_edges")
862         layout.itemM("VIEW3D_MT_edit_mesh_faces")
863         layout.itemM("VIEW3D_MT_edit_mesh_normals")
864
865         layout.itemS()
866
867         layout.itemR(settings, "automerge_editing")
868         layout.item_menu_enumR(settings, "proportional_editing")
869         layout.item_menu_enumR(settings, "proportional_editing_falloff")
870
871         layout.itemS()
872
873         layout.itemM("VIEW3D_MT_edit_mesh_showhide")
874
875
876 class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
877     bl_label = "Specials"
878
879     def draw(self, context):
880         layout = self.layout
881
882         layout.operator_context = 'INVOKE_REGION_WIN'
883
884         layout.itemO("mesh.subdivide", text="Subdivide")
885         layout.item_floatO("mesh.subdivide", "smoothness", 1.0, text="Subdivide Smooth")
886         layout.itemO("mesh.merge", text="Merge...")
887         layout.itemO("mesh.remove_doubles")
888         layout.itemO("mesh.hide", text="Hide")
889         layout.itemO("mesh.reveal", text="Reveal")
890         layout.itemO("mesh.select_inverse")
891         layout.itemO("mesh.flip_normals")
892         layout.itemO("mesh.vertices_smooth", text="Smooth")
893         # layout.itemO("mesh.bevel", text="Bevel")
894         layout.itemO("mesh.faces_shade_smooth")
895         layout.itemO("mesh.faces_shade_flat")
896         layout.itemO("mesh.blend_from_shape")
897         layout.itemO("mesh.shape_propagate_to_all")
898         layout.itemO("mesh.select_vertex_path")
899
900
901 class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
902     bl_label = "Vertices"
903
904     def draw(self, context):
905         layout = self.layout
906         layout.operator_context = 'INVOKE_REGION_WIN'
907
908         layout.itemO("mesh.merge")
909         layout.itemO("mesh.rip")
910         layout.itemO("mesh.split")
911         layout.itemO("mesh.separate")
912
913         layout.itemS()
914
915         layout.itemO("mesh.vertices_smooth")
916         layout.itemO("mesh.remove_doubles")
917
918         layout.itemO("mesh.select_vertex_path")
919
920         layout.itemO("mesh.blend_from_shape")
921
922         layout.itemO("object.vertex_group_blend")
923         layout.itemO("mesh.shape_propagate_to_all")
924
925
926 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
927     bl_label = "Edges"
928
929     def draw(self, context):
930         layout = self.layout
931         layout.operator_context = 'INVOKE_REGION_WIN'
932
933         layout.itemO("mesh.edge_face_add")
934         layout.itemO("mesh.subdivide")
935
936         layout.itemS()
937
938         layout.itemO("mesh.mark_seam")
939         layout.item_booleanO("mesh.mark_seam", "clear", True, text="Clear Seam")
940
941         layout.itemS()
942
943         layout.itemO("mesh.mark_sharp")
944         layout.item_booleanO("mesh.mark_sharp", "clear", True, text="Clear Sharp")
945
946         layout.itemS()
947
948         layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
949         layout.item_enumO("mesh.edge_rotate", "direction", 'CCW', text="Rotate Edge CCW")
950
951         layout.itemS()
952
953         layout.itemO("TFM_OT_edge_slide", text="Edge Slide")
954         layout.itemO("mesh.loop_multi_select", text="Edge Loop")
955
956         # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
957         # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
958
959         layout.item_booleanO("mesh.loop_multi_select", "ring", True, text="Edge Ring")
960
961         layout.itemO("mesh.loop_to_region")
962         layout.itemO("mesh.region_to_loop")
963
964
965 class VIEW3D_MT_edit_mesh_faces(dynamic_menu.DynMenu):
966     bl_label = "Faces"
967     bl_idname = "VIEW3D_MT_edit_mesh_faces"
968
969     def draw(self, context):
970         layout = self.layout
971         layout.operator_context = 'INVOKE_REGION_WIN'
972
973         # layout.itemO("mesh.bevel")
974         # layout.itemO("mesh.bevel")
975         layout.itemO("mesh.edge_face_add")
976         layout.itemO("mesh.fill")
977         layout.itemO("mesh.beauty_fill")
978
979         layout.itemS()
980
981         layout.itemO("mesh.quads_convert_to_tris")
982         layout.itemO("mesh.tris_convert_to_quads")
983         layout.itemO("mesh.edge_flip")
984
985         layout.itemS()
986
987         layout.itemO("mesh.faces_shade_smooth")
988         layout.itemO("mesh.faces_shade_flat")
989
990         layout.itemS()
991
992         # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
993         # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
994
995         layout.item_enumO("mesh.edge_rotate", "direction", 'CW', text="Rotate Edge CW")
996
997         layout.itemS()
998
999         layout.item_menu_enumO("mesh.uvs_rotate", "direction")
1000         layout.item_menu_enumO("mesh.uvs_mirror", "axis")
1001         layout.item_menu_enumO("mesh.colors_rotate", "direction")
1002         layout.item_menu_enumO("mesh.colors_mirror", "axis")
1003
1004
1005 class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
1006     bl_label = "Normals"
1007
1008     def draw(self, context):
1009         layout = self.layout
1010
1011         layout.itemO("mesh.normals_make_consistent", text="Recalculate Outside")
1012         layout.item_booleanO("mesh.normals_make_consistent", "inside", True, text="Recalculate Inside")
1013
1014         layout.itemS()
1015
1016         layout.itemO("mesh.flip_normals")
1017
1018
1019 class VIEW3D_MT_edit_mesh_showhide(VIEW3D_MT_showhide):
1020     _operator_name = "mesh"
1021
1022 # Edit Curve
1023 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
1024
1025
1026 def draw_curve(self, context):
1027     layout = self.layout
1028
1029     settings = context.tool_settings
1030
1031     layout.itemM("VIEW3D_MT_snap")
1032
1033     layout.itemS()
1034
1035     layout.itemO("curve.extrude")
1036     layout.itemO("curve.duplicate")
1037     layout.itemO("curve.separate")
1038     layout.itemO("curve.make_segment")
1039     layout.itemO("curve.cyclic_toggle")
1040     layout.itemO("curve.delete", text="Delete...")
1041
1042     layout.itemS()
1043
1044     layout.itemM("VIEW3D_MT_edit_curve_ctrlpoints")
1045     layout.itemM("VIEW3D_MT_edit_curve_segments")
1046
1047     layout.itemS()
1048
1049     layout.item_menu_enumR(settings, "proportional_editing")
1050     layout.item_menu_enumR(settings, "proportional_editing_falloff")
1051
1052     layout.itemS()
1053
1054     layout.itemM("VIEW3D_MT_edit_curve_showhide")
1055
1056
1057 class VIEW3D_MT_edit_curve(bpy.types.Menu):
1058     bl_label = "Curve"
1059
1060     draw = draw_curve
1061
1062
1063 class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
1064     bl_label = "Control Points"
1065
1066     def draw(self, context):
1067         layout = self.layout
1068
1069         edit_object = context.edit_object
1070
1071         if edit_object.type == 'CURVE':
1072             layout.item_enumO("tfm.transform", "mode", 'TILT')
1073             layout.itemO("curve.tilt_clear")
1074             layout.itemO("curve.separate")
1075
1076             layout.itemS()
1077
1078             layout.item_menu_enumO("curve.handle_type_set", "type")
1079
1080
1081 class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
1082     bl_label = "Segments"
1083
1084     def draw(self, context):
1085         layout = self.layout
1086
1087         layout.itemO("curve.subdivide")
1088         layout.itemO("curve.switch_direction")
1089
1090
1091 class VIEW3D_MT_edit_curve_showhide(VIEW3D_MT_showhide):
1092     _operator_name = "curve"
1093
1094
1095 class VIEW3D_MT_edit_surface(bpy.types.Menu):
1096     bl_label = "Surface"
1097
1098     draw = draw_curve
1099
1100
1101 class VIEW3D_MT_edit_text(bpy.types.Menu):
1102     bl_label = "Text"
1103
1104     def draw(self, context):
1105         layout = self.layout
1106
1107         layout.itemO("font.file_paste")
1108
1109         layout.itemS()
1110
1111         layout.itemM("VIEW3D_MT_edit_text_chars")
1112
1113
1114 class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
1115     bl_label = "Special Characters"
1116
1117     def draw(self, context):
1118         layout = self.layout
1119
1120         layout.item_stringO("font.text_insert", "text", b'\xC2\xA9'.decode(), text="Copyright|Alt C")
1121         layout.item_stringO("font.text_insert", "text", b'\xC2\xAE'.decode(), text="Registered Trademark|Alt R")
1122
1123         layout.itemS()
1124
1125         layout.item_stringO("font.text_insert", "text", b'\xC2\xB0'.decode(), text="Degree Sign|Alt G")
1126         layout.item_stringO("font.text_insert", "text", b'\xC3\x97'.decode(), text="Multiplication Sign|Alt x")
1127         layout.item_stringO("font.text_insert", "text", b'\xC2\x8A'.decode(), text="Circle|Alt .")
1128         layout.item_stringO("font.text_insert", "text", b'\xC2\xB9'.decode(), text="Superscript 1|Alt 1")
1129         layout.item_stringO("font.text_insert", "text", b'\xC2\xB2'.decode(), text="Superscript 2|Alt 2")
1130         layout.item_stringO("font.text_insert", "text", b'\xC2\xB3'.decode(), text="Superscript 3|Alt 3")
1131         layout.item_stringO("font.text_insert", "text", b'\xC2\xBB'.decode(), text="Double >>|Alt >")
1132         layout.item_stringO("font.text_insert", "text", b'\xC2\xAB'.decode(), text="Double <<|Alt <")
1133         layout.item_stringO("font.text_insert", "text", b'\xE2\x80\xB0'.decode(), text="Promillage|Alt %")
1134
1135         layout.itemS()
1136
1137         layout.item_stringO("font.text_insert", "text", b'\xC2\xA4'.decode(), text="Dutch Florin|Alt F")
1138         layout.item_stringO("font.text_insert", "text", b'\xC2\xA3'.decode(), text="British Pound|Alt L")
1139         layout.item_stringO("font.text_insert", "text", b'\xC2\xA5'.decode(), text="Japanese Yen|Alt Y")
1140
1141         layout.itemS()
1142
1143         layout.item_stringO("font.text_insert", "text", b'\xC3\x9F'.decode(), text="German S|Alt S")
1144         layout.item_stringO("font.text_insert", "text", b'\xC2\xBF'.decode(), text="Spanish Question Mark|Alt ?")
1145         layout.item_stringO("font.text_insert", "text", b'\xC2\xA1'.decode(), text="Spanish Exclamation Mark|Alt !")
1146
1147
1148 class VIEW3D_MT_edit_meta(bpy.types.Menu):
1149     bl_label = "Metaball"
1150
1151     def draw(self, context):
1152         layout = self.layout
1153
1154         settings = context.tool_settings
1155
1156         layout.itemO("ed.undo")
1157         layout.itemO("ed.redo")
1158
1159         layout.itemS()
1160
1161         layout.itemM("VIEW3D_MT_snap")
1162
1163         layout.itemS()
1164
1165         layout.itemO("mball.delete_metaelems", text="Delete...")
1166         layout.itemO("mball.duplicate_metaelems")
1167
1168         layout.itemS()
1169
1170         layout.item_menu_enumR(settings, "proportional_editing")
1171         layout.item_menu_enumR(settings, "proportional_editing_falloff")
1172
1173         layout.itemS()
1174
1175         layout.itemM("VIEW3D_MT_edit_meta_showhide")
1176
1177
1178 class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
1179     bl_label = "Show/Hide"
1180
1181     def draw(self, context):
1182         layout = self.layout
1183
1184         layout.itemO("mball.reveal_metaelems", text="Show Hidden")
1185         layout.itemO("mball.hide_metaelems", text="Hide Selected")
1186         layout.item_booleanO("mball.hide_metaelems", "unselected", True, text="Hide Unselected")
1187
1188
1189 class VIEW3D_MT_edit_lattice(bpy.types.Menu):
1190     bl_label = "Lattice"
1191
1192     def draw(self, context):
1193         layout = self.layout
1194
1195         settings = context.tool_settings
1196
1197         layout.itemM("VIEW3D_MT_snap")
1198
1199         layout.itemS()
1200
1201         layout.itemO("lattice.make_regular")
1202
1203         layout.itemS()
1204
1205         layout.item_menu_enumR(settings, "proportional_editing")
1206         layout.item_menu_enumR(settings, "proportional_editing_falloff")
1207
1208
1209 class VIEW3D_MT_edit_armature(bpy.types.Menu):
1210     bl_label = "Armature"
1211
1212     def draw(self, context):
1213         layout = self.layout
1214
1215         edit_object = context.edit_object
1216         arm = edit_object.data
1217
1218         layout.itemM("VIEW3D_MT_snap")
1219         layout.itemM("VIEW3D_MT_edit_armature_roll")
1220
1221         if arm.drawtype == 'ENVELOPE':
1222             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale Envelope Distance")
1223         else:
1224             layout.item_enumO("tfm.transform", "mode", 'BONESIZE', text="Scale B-Bone Width")
1225
1226         layout.itemS()
1227
1228         layout.itemO("armature.extrude_move")
1229
1230 # EXTRUDE FORKED DOESN'T WORK YET
1231 #               if arm.x_axis_mirror:
1232 #                       layout.item_booleanO("armature.extrude_move", "forked", True, text="Extrude Forked")
1233
1234         layout.itemO("armature.duplicate_move")
1235         layout.itemO("armature.merge")
1236         layout.itemO("armature.fill")
1237         layout.itemO("armature.delete")
1238         layout.itemO("armature.separate")
1239
1240         layout.itemS()
1241
1242         layout.itemO("armature.subdivide_multi", text="Subdivide")
1243
1244         layout.itemS()
1245
1246         layout.operator_context = "EXEC_AREA"
1247         layout.item_enumO("armature.autoside_names", "type", 'XAXIS', text="AutoName Left/Right")
1248         layout.item_enumO("armature.autoside_names", "type", 'YAXIS', text="AutoName Front/Back")
1249         layout.item_enumO("armature.autoside_names", "type", 'ZAXIS', text="AutoName Top/Bottom")
1250         layout.itemO("armature.flip_names")
1251
1252         layout.itemS()
1253
1254         layout.operator_context = "INVOKE_DEFAULT"
1255         layout.itemO("armature.armature_layers")
1256         layout.itemO("armature.bone_layers")
1257
1258         layout.itemS()
1259
1260         layout.itemM("VIEW3D_MT_edit_armature_parent")
1261
1262         layout.itemS()
1263
1264         layout.item_menu_enumO("armature.flags_set", "mode", text="Bone Settings")
1265
1266
1267 class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
1268     bl_label = "Parent"
1269
1270     def draw(self, context):
1271         layout = self.layout
1272
1273         layout.itemO("armature.parent_set", text="Make")
1274         layout.itemO("armature.parent_clear", text="Clear")
1275
1276
1277 class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
1278     bl_label = "Bone Roll"
1279
1280     def draw(self, context):
1281         layout = self.layout
1282
1283         layout.item_enumO("armature.calculate_roll", "type", 'GLOBALUP', text="Clear Roll (Z-Axis Up)")
1284         layout.item_enumO("armature.calculate_roll", "type", 'CURSOR', text="Roll to Cursor")
1285
1286         layout.itemS()
1287
1288         layout.item_enumO("tfm.transform", "mode", 'BONE_ROLL', text="Set Roll")
1289
1290 # ********** Panel **********
1291
1292
1293 class VIEW3D_PT_3dview_properties(bpy.types.Panel):
1294     bl_space_type = 'VIEW_3D'
1295     bl_region_type = 'UI'
1296     bl_label = "View"
1297
1298     def poll(self, context):
1299         view = context.space_data
1300         return (view)
1301
1302     def draw(self, context):
1303         layout = self.layout
1304
1305         view = context.space_data
1306         scene = context.scene
1307
1308         col = layout.column()
1309         col.itemL(text="Camera:")
1310         col.itemR(view, "camera", text="")
1311         col.itemR(view, "lens")
1312
1313         col = layout.column(align=True)
1314         col.itemL(text="Clip:")
1315         col.itemR(view, "clip_start", text="Start")
1316         col.itemR(view, "clip_end", text="End")
1317
1318         col = layout.column(align=True)
1319         col.itemL(text="Grid:")
1320         col.itemR(view, "grid_lines", text="Lines")
1321         col.itemR(view, "grid_spacing", text="Spacing")
1322         col.itemR(view, "grid_subdivisions", text="Subdivisions")
1323
1324         layout.column().itemR(scene, "cursor_location", text="3D Cursor:")
1325
1326
1327 class VIEW3D_PT_3dview_display(bpy.types.Panel):
1328     bl_space_type = 'VIEW_3D'
1329     bl_region_type = 'UI'
1330     bl_label = "Display"
1331     bl_default_closed = True
1332
1333     def poll(self, context):
1334         view = context.space_data
1335         return (view)
1336
1337     def draw(self, context):
1338         layout = self.layout
1339
1340         view = context.space_data
1341         gs = context.scene.game_data
1342         ob = context.object
1343
1344         col = layout.column()
1345         col.itemR(view, "display_floor", text="Grid Floor")
1346         col.itemR(view, "display_x_axis", text="X Axis")
1347         col.itemR(view, "display_y_axis", text="Y Axis")
1348         col.itemR(view, "display_z_axis", text="Z Axis")
1349         col.itemR(view, "outline_selected")
1350         col.itemR(view, "all_object_centers")
1351         col.itemR(view, "relationship_lines")
1352         if ob and ob.type == 'MESH':
1353             mesh = ob.data
1354             col.itemR(mesh, "all_edges")
1355
1356         col = layout.column()
1357         col.itemL(text="Shading:")
1358         col.itemR(gs, "material_mode", text="")
1359         col.itemR(view, "textured_solid")
1360
1361 # XXX - the Quad View options don't work yet
1362 #               layout.itemS()
1363 #
1364 #               layout.itemO("screen.region_foursplit", text="Toggle Quad View")
1365 #               col = layout.column()
1366 #               col.itemR(view, "lock_rotation")
1367 #               col.itemR(view, "box_preview")
1368 #               col.itemR(view, "box_clip")
1369
1370
1371 class VIEW3D_PT_3dview_meshdisplay(bpy.types.Panel):
1372     bl_space_type = 'VIEW_3D'
1373     bl_region_type = 'UI'
1374     bl_label = "Mesh Display"
1375
1376     def poll(self, context):
1377         editmesh = context.mode == 'EDIT_MESH'
1378         return (editmesh)
1379
1380     def draw(self, context):
1381         layout = self.layout
1382
1383         mesh = context.active_object.data
1384
1385         col = layout.column()
1386         col.itemL(text="Overlays:")
1387         col.itemR(mesh, "draw_edges", text="Edges")
1388         col.itemR(mesh, "draw_faces", text="Faces")
1389         col.itemR(mesh, "draw_creases", text="Creases")
1390         col.itemR(mesh, "draw_bevel_weights", text="Bevel Weights")
1391         col.itemR(mesh, "draw_seams", text="Seams")
1392         col.itemR(mesh, "draw_sharp", text="Sharp")
1393
1394         col.itemS()
1395         col.itemL(text="Normals:")
1396         col.itemR(mesh, "draw_normals", text="Face")
1397         col.itemR(mesh, "draw_vertex_normals", text="Vertex")
1398         col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size")
1399
1400         col.itemS()
1401         col.itemL(text="Numerics:")
1402         col.itemR(mesh, "draw_edge_lenght")
1403         col.itemR(mesh, "draw_edge_angle")
1404         col.itemR(mesh, "draw_face_area")
1405
1406
1407 class VIEW3D_PT_3dview_curvedisplay(bpy.types.Panel):
1408     bl_space_type = 'VIEW_3D'
1409     bl_region_type = 'UI'
1410     bl_label = "Curve Display"
1411
1412     def poll(self, context):
1413         editmesh = context.mode == 'EDIT_CURVE'
1414         return (editmesh)
1415
1416     def draw(self, context):
1417         layout = self.layout
1418
1419         curve = context.active_object.data
1420
1421         col = layout.column()
1422         col.itemL(text="Overlays:")
1423         col.itemR(curve, "draw_handles", text="Handles")
1424         col.itemR(curve, "draw_normals", text="Normals")
1425         col.itemR(context.scene.tool_settings, "normal_size", text="Normal Size")
1426
1427
1428 class VIEW3D_PT_background_image(bpy.types.Panel):
1429     bl_space_type = 'VIEW_3D'
1430     bl_region_type = 'UI'
1431     bl_label = "Background Image"
1432     bl_default_closed = True
1433
1434     def poll(self, context):
1435         view = context.space_data
1436         bg = context.space_data.background_image
1437         return (view)
1438
1439     def draw_header(self, context):
1440         layout = self.layout
1441         view = context.space_data
1442
1443         layout.itemR(view, "display_background_image", text="")
1444
1445     def draw(self, context):
1446         layout = self.layout
1447
1448         view = context.space_data
1449         bg = view.background_image
1450
1451         if bg:
1452             layout.active = view.display_background_image
1453
1454             col = layout.column()
1455             col.itemR(bg, "image", text="")
1456             #col.itemR(bg, "image_user")
1457             col.itemR(bg, "size")
1458             col.itemR(bg, "transparency", slider=True)
1459
1460
1461             col = layout.column(align=True)
1462             col.itemL(text="Offset:")
1463             col.itemR(bg, "offset_x", text="X")
1464             col.itemR(bg, "offset_y", text="Y")
1465
1466
1467 class VIEW3D_PT_transform_orientations(bpy.types.Panel):
1468     bl_space_type = 'VIEW_3D'
1469     bl_region_type = 'UI'
1470     bl_label = "Transform Orientations"
1471     bl_default_closed = True
1472
1473     def poll(self, context):
1474         view = context.space_data
1475         return (view)
1476
1477     def draw(self, context):
1478         layout = self.layout
1479
1480         view = context.space_data
1481
1482         col = layout.column()
1483
1484         col.itemR(view, "transform_orientation")
1485         col.itemO("tfm.create_orientation", text="Create")
1486
1487         orientation = view.current_orientation
1488
1489         if orientation:
1490             col.itemR(orientation, "name")
1491             col.itemO("tfm.delete_orientation", text="Delete")
1492
1493
1494 class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
1495     bl_space_type = 'VIEW_3D'
1496     bl_region_type = 'UI'
1497     bl_label = "Skeleton Sketching"
1498     bl_default_closed = True
1499
1500     def poll(self, context):
1501         scene = context.space_data
1502         ob = context.active_object
1503         return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
1504
1505     def draw_header(self, context):
1506         layout = self.layout
1507         toolsettings = context.scene.tool_settings
1508
1509         layout.itemR(toolsettings, "bone_sketching", text="")
1510
1511     def draw(self, context):
1512         layout = self.layout
1513         toolsettings = context.scene.tool_settings
1514
1515         col = layout.column()
1516
1517         col.itemR(toolsettings, "etch_quick")
1518         col.itemR(toolsettings, "etch_overdraw")
1519
1520         col.itemR(toolsettings, "etch_convert_mode")
1521
1522         if toolsettings.etch_convert_mode == "LENGTH":
1523             col.itemR(toolsettings, "etch_length_limit")
1524         elif toolsettings.etch_convert_mode == "ADAPTIVE":
1525             col.itemR(toolsettings, "etch_adaptive_limit")
1526         elif toolsettings.etch_convert_mode == "FIXED":
1527             col.itemR(toolsettings, "etch_subdivision_number")
1528         elif toolsettings.etch_convert_mode == "RETARGET":
1529             col.itemR(toolsettings, "etch_template")
1530             col.itemR(toolsettings, "etch_roll_mode")
1531             col.itemR(toolsettings, "etch_autoname")
1532             col.itemR(toolsettings, "etch_number")
1533             col.itemR(toolsettings, "etch_side")
1534
1535
1536 # Operators
1537 from bpy.props import *
1538
1539
1540 class OBJECT_OT_select_pattern(bpy.types.Operator):
1541     '''Select object matching a naming pattern.'''
1542     bl_idname = "object.select_pattern"
1543     bl_label = "Select Pattern"
1544     bl_register = True
1545     bl_undo = True
1546
1547     pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen=32, default="*")
1548     case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default=False)
1549     extend = BoolProperty(name="Extend", description="Extend the existing selection", default=True)
1550
1551     def execute(self, context):
1552
1553         import fnmatch
1554
1555         if self.case_sensitive:
1556             pattern_match = fnmatch.fnmatchcase
1557         else:
1558             pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
1559
1560         for ob in context.visible_objects:
1561             if pattern_match(ob.name, self.pattern):
1562                 ob.selected = True
1563             elif not self.extend:
1564                 ob.selected = False
1565
1566         return ('FINISHED',)
1567
1568         # TODO - python cant do popups yet
1569     '''
1570     def invoke(self, context, event):
1571         wm = context.manager
1572         wm.add_fileselect(self)
1573         return ('RUNNING_MODAL',)
1574     '''
1575
1576 bpy.types.register(VIEW3D_HT_header) # Header
1577
1578 bpy.types.register(VIEW3D_MT_view) #View Menus
1579 bpy.types.register(VIEW3D_MT_view_navigation)
1580 bpy.types.register(VIEW3D_MT_view_align)
1581 bpy.types.register(VIEW3D_MT_view_cameras)
1582
1583 bpy.types.register(VIEW3D_MT_select_object) # Select Menus
1584 bpy.types.register(VIEW3D_MT_select_pose)
1585 bpy.types.register(VIEW3D_MT_select_particle)
1586 bpy.types.register(VIEW3D_MT_select_edit_mesh)
1587 bpy.types.register(VIEW3D_MT_select_edit_curve)
1588 bpy.types.register(VIEW3D_MT_select_edit_surface)
1589 bpy.types.register(VIEW3D_MT_select_edit_metaball)
1590 bpy.types.register(VIEW3D_MT_select_edit_lattice)
1591 bpy.types.register(VIEW3D_MT_select_edit_armature)
1592 bpy.types.register(VIEW3D_MT_select_face) # XXX todo
1593
1594 bpy.types.register(VIEW3D_MT_object) # Object Menu
1595 bpy.types.register(VIEW3D_MT_object_apply)
1596 bpy.types.register(VIEW3D_MT_object_clear)
1597 bpy.types.register(VIEW3D_MT_object_parent)
1598 bpy.types.register(VIEW3D_MT_object_track)
1599 bpy.types.register(VIEW3D_MT_object_group)
1600 bpy.types.register(VIEW3D_MT_object_constraints)
1601 bpy.types.register(VIEW3D_MT_object_showhide)
1602 bpy.types.register(VIEW3D_MT_make_single_user)
1603
1604
1605 bpy.types.register(VIEW3D_MT_sculpt) # Sculpt Menu
1606
1607 bpy.types.register(VIEW3D_MT_paint_vertex)
1608
1609 bpy.types.register(VIEW3D_MT_particle) # Particle Menu
1610 bpy.types.register(VIEW3D_MT_particle_showhide)
1611
1612 bpy.types.register(VIEW3D_MT_pose) # POSE Menu
1613 bpy.types.register(VIEW3D_MT_pose_transform)
1614 bpy.types.register(VIEW3D_MT_pose_pose)
1615 bpy.types.register(VIEW3D_MT_pose_motion)
1616 bpy.types.register(VIEW3D_MT_pose_group)
1617 bpy.types.register(VIEW3D_MT_pose_ik)
1618 bpy.types.register(VIEW3D_MT_pose_constraints)
1619 bpy.types.register(VIEW3D_MT_pose_showhide)
1620
1621 bpy.types.register(VIEW3D_MT_snap) # Edit Menus
1622 bpy.types.register(VIEW3D_MT_uv_map) # Edit Menus
1623
1624 bpy.types.register(VIEW3D_MT_edit_mesh)
1625 bpy.types.register(VIEW3D_MT_edit_mesh_specials) # Only as a menu for keybindings
1626 bpy.types.register(VIEW3D_MT_edit_mesh_vertices)
1627 bpy.types.register(VIEW3D_MT_edit_mesh_edges)
1628 bpy.types.register(VIEW3D_MT_edit_mesh_faces)
1629 bpy.types.register(VIEW3D_MT_edit_mesh_normals)
1630 bpy.types.register(VIEW3D_MT_edit_mesh_showhide)
1631
1632 bpy.types.register(VIEW3D_MT_edit_curve)
1633 bpy.types.register(VIEW3D_MT_edit_curve_ctrlpoints)
1634 bpy.types.register(VIEW3D_MT_edit_curve_segments)
1635 bpy.types.register(VIEW3D_MT_edit_curve_showhide)
1636
1637 bpy.types.register(VIEW3D_MT_edit_surface)
1638
1639 bpy.types.register(VIEW3D_MT_edit_text)
1640 bpy.types.register(VIEW3D_MT_edit_text_chars)
1641
1642 bpy.types.register(VIEW3D_MT_edit_meta)
1643 bpy.types.register(VIEW3D_MT_edit_meta_showhide)
1644
1645 bpy.types.register(VIEW3D_MT_edit_lattice)
1646
1647 bpy.types.register(VIEW3D_MT_edit_armature)
1648 bpy.types.register(VIEW3D_MT_edit_armature_parent)
1649 bpy.types.register(VIEW3D_MT_edit_armature_roll)
1650
1651 bpy.types.register(VIEW3D_PT_3dview_properties) # Panels
1652 bpy.types.register(VIEW3D_PT_3dview_display)
1653 bpy.types.register(VIEW3D_PT_3dview_meshdisplay)
1654 bpy.types.register(VIEW3D_PT_3dview_curvedisplay)
1655 bpy.types.register(VIEW3D_PT_background_image)
1656 bpy.types.register(VIEW3D_PT_transform_orientations)
1657 bpy.types.register(VIEW3D_PT_etch_a_ton)
1658
1659 bpy.ops.add(OBJECT_OT_select_pattern)