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