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