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