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