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