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