1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Header, Menu, Panel
22 from .properties_grease_pencil_common import (
23 GreasePencilDataPanel,
24 GreasePencilPaletteColorPanel,
26 from .properties_paint_common import UnifiedPaintPanel
27 from bpy.app.translations import contexts as i18n_contexts
30 class VIEW3D_HT_header(Header):
31 bl_space_type = 'VIEW_3D'
33 def draw(self, context):
36 view = context.space_data
37 shading = view.shading
38 # mode_string = context.mode
39 obj = context.active_object
40 toolsettings = context.tool_settings
42 row = layout.row(align=True)
45 mode = 'OBJECT' if obj is None else obj.mode
46 act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[mode]
47 layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
50 layout.template_header_3D_mode()
52 VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
54 # Contains buttons like Mode, Pivot, Manipulator, Layer, Mesh Select Mode...
56 row.popover(space_type='VIEW_3D', region_type='UI', panel_type="VIEW3D_PT_shading", text="Shading")
57 row.popover(space_type='VIEW_3D', region_type='UI', panel_type="VIEW3D_PT_overlay", text="Overlay")
59 layout.template_header_3D()
66 if mode == 'PARTICLE_EDIT':
67 row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
70 if ((shading.type not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or
71 (mode in {'WEIGHT_PAINT', 'VERTEX_PAINT'})):
72 row.prop(view, "use_occlude_geometry", text="")
74 # Proportional editing
75 if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
76 row = layout.row(align=True)
77 row.prop(toolsettings, "proportional_edit", icon_only=True)
78 if toolsettings.proportional_edit != 'DISABLED':
79 row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
80 elif mode in {'EDIT', 'PARTICLE_EDIT'}:
81 row = layout.row(align=True)
82 row.prop(toolsettings, "proportional_edit", icon_only=True)
83 if toolsettings.proportional_edit != 'DISABLED':
84 row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
85 elif mode == 'OBJECT':
86 row = layout.row(align=True)
87 row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True)
88 if toolsettings.use_proportional_edit_objects:
89 row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
91 # Proportional editing
92 if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
93 row = layout.row(align=True)
94 row.prop(toolsettings, "proportional_edit", icon_only=True)
95 if toolsettings.proportional_edit != 'DISABLED':
96 row.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
103 if mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
106 paint_settings = UnifiedPaintPanel.paint_settings(context)
108 brush = paint_settings.brush
109 if brush and brush.stroke_method == 'CURVE':
113 snap_element = toolsettings.snap_element
114 row = layout.row(align=True)
115 row.prop(toolsettings, "use_snap", text="")
116 row.prop(toolsettings, "snap_element", icon_only=True)
117 if snap_element == 'INCREMENT':
118 row.prop(toolsettings, "use_snap_grid_absolute", text="")
120 row.prop(toolsettings, "snap_target", text="")
123 row.prop(toolsettings, "use_snap_self", text="")
124 if mode in {'OBJECT', 'POSE', 'EDIT'} and snap_element != 'VOLUME':
125 row.prop(toolsettings, "use_snap_align_rotation", text="")
127 if snap_element == 'VOLUME':
128 row.prop(toolsettings, "use_snap_peel_object", text="")
129 elif snap_element == 'FACE':
130 row.prop(toolsettings, "use_snap_project", text="")
134 if (mode == 'EDIT' and obj.type == 'MESH'):
135 layout.prop(toolsettings, "use_mesh_automerge", text="", icon='AUTOMERGE_ON')
138 row = layout.row(align=True)
139 row.operator("render.opengl", text="", icon='RENDER_STILL')
140 row.operator("render.opengl", text="", icon='RENDER_ANIMATION').animation = True
143 if obj and mode == 'POSE':
144 row = layout.row(align=True)
145 row.operator("pose.copy", text="", icon='COPYDOWN')
146 row.operator("pose.paste", text="", icon='PASTEDOWN').flipped = False
147 row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True
150 if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
151 row = layout.row(align=True)
152 row.operator("gpencil.copy", text="", icon='COPYDOWN')
153 row.operator("gpencil.paste", text="", icon='PASTEDOWN')
156 layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH')
158 row = layout.row(align=True)
159 row.prop(context.tool_settings.gpencil_sculpt, "use_select_mask")
160 row.prop(context.tool_settings.gpencil_sculpt, "selection_alpha", slider=True)
163 class VIEW3D_MT_editor_menus(Menu):
164 bl_space_type = 'VIEW3D_MT_editor_menus'
167 def draw(self, context):
168 self.draw_menus(self.layout, context)
171 def draw_menus(layout, context):
172 obj = context.active_object
173 mode_string = context.mode
174 edit_object = context.edit_object
175 gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode
177 layout.menu("VIEW3D_MT_view")
181 layout.menu("VIEW3D_MT_select_gpencil")
182 elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
184 if mesh.use_paint_mask:
185 layout.menu("VIEW3D_MT_select_paint_mask")
186 elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
187 layout.menu("VIEW3D_MT_select_paint_mask_vertex")
188 elif mode_string != 'SCULPT':
189 layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
193 elif mode_string == 'OBJECT':
194 layout.menu("INFO_MT_add", text="Add")
195 elif mode_string == 'EDIT_MESH':
196 layout.menu("INFO_MT_mesh_add", text="Add")
197 elif mode_string == 'EDIT_CURVE':
198 layout.menu("INFO_MT_curve_add", text="Add")
199 elif mode_string == 'EDIT_SURFACE':
200 layout.menu("INFO_MT_surface_add", text="Add")
201 elif mode_string == 'EDIT_METABALL':
202 layout.menu("INFO_MT_metaball_add", text="Add")
203 elif mode_string == 'EDIT_ARMATURE':
204 layout.menu("INFO_MT_edit_armature_add", text="Add")
207 layout.menu("VIEW3D_MT_edit_gpencil")
209 layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
211 if mode_string != 'PAINT_TEXTURE':
212 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
213 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
214 layout.menu("VIEW3D_MT_brush")
215 if mode_string == 'SCULPT':
216 layout.menu("VIEW3D_MT_hide_mask")
218 layout.menu("VIEW3D_MT_object")
221 # ********** Menu **********
224 # ********** Utilities **********
228 bl_label = "Show/Hide"
231 def draw(self, context):
234 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
235 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
236 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
239 # Standard transforms which apply to all cases
240 # NOTE: this doesn't seem to be able to be used directly
241 class VIEW3D_MT_transform_base(Menu):
242 bl_label = "Transform"
244 # TODO: get rid of the custom text strings?
245 def draw(self, context):
250 layout.operator("transform.tosphere", text="To Sphere")
251 layout.operator("transform.shear", text="Shear")
252 layout.operator("transform.bend", text="Bend")
253 layout.operator("transform.push_pull", text="Push/Pull")
255 if context.mode != 'OBJECT':
256 layout.operator("transform.vertex_warp", text="Warp")
257 layout.operator("transform.vertex_random", text="Randomize")
260 # Generic transform menu - geometry types
261 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
262 def draw(self, context):
264 VIEW3D_MT_transform_base.draw(self, context)
268 layout.operator("transform.shrink_fatten", text="Shrink Fatten")
272 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
273 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
276 # Object-specific extensions to Transform menu
277 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
278 def draw(self, context):
282 VIEW3D_MT_transform_base.draw(self, context)
284 # object-specific option follow...
287 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
288 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
292 layout.operator_context = 'EXEC_REGION_WIN'
293 # XXX see alignmenu() in edit.c of b2.4x to get this working
294 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN'
298 layout.operator_context = 'EXEC_AREA'
300 layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
301 layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
302 layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
303 layout.operator("object.origin_set", text="Origin to Center of Mass (Surface)").type = 'ORIGIN_CENTER_OF_MASS'
304 layout.operator("object.origin_set", text="Origin to Center of Mass (Volume)").type = 'ORIGIN_CENTER_OF_VOLUME'
307 layout.operator("object.randomize_transform")
308 layout.operator("object.align")
310 # TODO: there is a strange context bug here.
312 layout.operator_context = 'INVOKE_REGION_WIN'
313 layout.operator("object.transform_axis_target")
317 # Armature EditMode extensions to Transform menu
318 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
319 def draw(self, context):
323 VIEW3D_MT_transform_base.draw(self, context)
325 # armature specific extensions follow...
327 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
328 if obj.data.draw_type == 'BBONE':
331 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
332 elif obj.data.draw_type == 'ENVELOPE':
335 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
336 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
338 if context.edit_object and context.edit_object.type == 'ARMATURE':
341 layout.operator("armature.align")
344 class VIEW3D_MT_mirror(Menu):
347 def draw(self, context):
350 layout.operator("transform.mirror", text="Interactive Mirror")
354 layout.operator_context = 'INVOKE_REGION_WIN'
356 props = layout.operator("transform.mirror", text="X Global")
357 props.constraint_axis = (True, False, False)
358 props.constraint_orientation = 'GLOBAL'
359 props = layout.operator("transform.mirror", text="Y Global")
360 props.constraint_axis = (False, True, False)
361 props.constraint_orientation = 'GLOBAL'
362 props = layout.operator("transform.mirror", text="Z Global")
363 props.constraint_axis = (False, False, True)
364 props.constraint_orientation = 'GLOBAL'
366 if context.edit_object:
369 props = layout.operator("transform.mirror", text="X Local")
370 props.constraint_axis = (True, False, False)
371 props.constraint_orientation = 'LOCAL'
372 props = layout.operator("transform.mirror", text="Y Local")
373 props.constraint_axis = (False, True, False)
374 props.constraint_orientation = 'LOCAL'
375 props = layout.operator("transform.mirror", text="Z Local")
376 props.constraint_axis = (False, False, True)
377 props.constraint_orientation = 'LOCAL'
379 layout.operator("object.vertex_group_mirror")
382 class VIEW3D_MT_snap(Menu):
385 def draw(self, context):
388 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
389 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
390 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)").use_offset = True
391 layout.operator("view3d.snap_selected_to_active", text="Selection to Active")
395 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
396 layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
397 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
398 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
401 class VIEW3D_MT_uv_map(Menu):
402 bl_label = "UV Mapping"
404 def draw(self, context):
407 layout.operator("uv.unwrap")
409 layout.operator_context = 'INVOKE_DEFAULT'
410 layout.operator("uv.smart_project")
411 layout.operator("uv.lightmap_pack")
412 layout.operator("uv.follow_active_quads")
416 layout.operator_context = 'EXEC_REGION_WIN'
417 layout.operator("uv.cube_project")
418 layout.operator("uv.cylinder_project")
419 layout.operator("uv.sphere_project")
423 layout.operator_context = 'INVOKE_REGION_WIN'
424 layout.operator("uv.project_from_view").scale_to_bounds = False
425 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
429 layout.operator("uv.reset")
432 class VIEW3D_MT_edit_proportional(Menu):
433 bl_label = "Proportional Editing"
435 def draw(self, context):
438 layout.props_enum(context.tool_settings, "proportional_edit")
442 layout.label("Falloff:")
443 layout.props_enum(context.tool_settings, "proportional_edit_falloff")
446 # ********** View menus **********
449 class VIEW3D_MT_view(Menu):
452 def draw(self, context):
454 view = context.space_data
456 layout.operator("view3d.properties", icon='MENU_PANEL')
457 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
461 layout.operator("view3d.view_selected").use_all_regions = False
462 if view.region_quadviews:
463 layout.operator("view3d.view_selected", text="View Selected (Quad View)").use_all_regions = True
465 layout.operator("view3d.view_all").center = False
466 layout.operator("view3d.view_persportho")
470 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
473 layout.menu("VIEW3D_MT_view_viewpoint")
474 layout.menu("VIEW3D_MT_view_navigation")
475 layout.menu("VIEW3D_MT_view_align")
479 layout.operator_context = 'INVOKE_REGION_WIN'
480 layout.menu("VIEW3D_MT_view_borders", text="View Borders")
484 layout.operator("view3d.layers", text="Show All Layers").nr = 0
488 layout.operator("screen.animation_play", text="Playback Animation")
492 layout.operator("screen.area_dupli")
493 layout.operator("screen.region_quadview")
494 layout.operator("screen.screen_full_area")
495 layout.operator("screen.screen_full_area", text="Toggle Fullscreen Area").use_hide_panels = True
498 class VIEW3D_MT_view_cameras(Menu):
501 def draw(self, context):
504 layout.operator("view3d.object_as_camera")
505 layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
508 class VIEW3D_MT_view_viewpoint(Menu):
509 bl_label = "Viewpoint"
511 def draw(self, context):
514 layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
518 layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
519 layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
523 layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
524 layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
528 layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
529 layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
532 class VIEW3D_MT_view_navigation(Menu):
533 bl_label = "Navigation"
535 def draw(self, context):
539 layout.operator_enum("view3d.view_orbit", "type")
540 props = layout.operator("view3d.view_orbit", "Orbit Opposite")
541 props.type = 'ORBITRIGHT'
546 layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
547 layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
551 layout.operator_enum("view3d.view_pan", "type")
555 layout.operator("view3d.zoom", text="Zoom In").delta = 1
556 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
557 layout.operator("view3d.zoom_border", text="Zoom Border...")
558 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
562 layout.operator("view3d.fly")
563 layout.operator("view3d.walk")
566 class VIEW3D_MT_view_align(Menu):
567 bl_label = "Align View"
569 def draw(self, context):
572 layout.menu("VIEW3D_MT_view_align_selected")
576 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
577 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
578 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
579 layout.operator("view3d.view_center_cursor")
583 layout.operator("view3d.view_lock_to_active")
584 layout.operator("view3d.view_lock_clear")
587 class VIEW3D_MT_view_align_selected(Menu):
588 bl_label = "Align View to Active"
590 def draw(self, context):
593 props = layout.operator("view3d.viewnumpad", text="Top")
594 props.align_active = True
597 props = layout.operator("view3d.viewnumpad", text="Bottom")
598 props.align_active = True
599 props.type = 'BOTTOM'
601 props = layout.operator("view3d.viewnumpad", text="Front")
602 props.align_active = True
605 props = layout.operator("view3d.viewnumpad", text="Back")
606 props.align_active = True
609 props = layout.operator("view3d.viewnumpad", text="Right")
610 props.align_active = True
613 props = layout.operator("view3d.viewnumpad", text="Left")
614 props.align_active = True
618 class VIEW3D_MT_view_borders(Menu):
619 bl_label = "View Borders"
621 def draw(self, context):
623 layout.operator("view3d.clip_border", text="Clipping Border...")
624 layout.operator("view3d.render_border", text="Render Border...").camera_only = False
628 layout.operator("view3d.clear_render_border")
631 # ********** Select menus, suffix from context.mode **********
633 class VIEW3D_MT_select_object_more_less(Menu):
634 bl_label = "Select More/Less"
636 def draw(self, context):
641 layout.operator("object.select_more", text="More")
642 layout.operator("object.select_less", text="Less")
646 props = layout.operator("object.select_hierarchy", text="Parent")
648 props.direction = 'PARENT'
650 props = layout.operator("object.select_hierarchy", text="Child")
652 props.direction = 'CHILD'
656 props = layout.operator("object.select_hierarchy", text="Extend Parent")
658 props.direction = 'PARENT'
660 props = layout.operator("object.select_hierarchy", text="Extend Child")
662 props.direction = 'CHILD'
665 class VIEW3D_MT_select_object(Menu):
668 def draw(self, context):
671 layout.operator("view3d.select_border")
672 layout.operator("view3d.select_circle")
676 layout.operator("object.select_all").action = 'TOGGLE'
677 layout.operator("object.select_all", text="Inverse").action = 'INVERT'
678 layout.operator("object.select_random", text="Random")
679 layout.operator("object.select_mirror", text="Mirror")
680 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
681 layout.operator("object.select_camera", text="Select Camera")
685 layout.menu("VIEW3D_MT_select_object_more_less")
689 layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
690 layout.operator_menu_enum("object.select_linked", "type", text="Linked")
691 layout.operator("object.select_pattern", text="Select Pattern...")
694 class VIEW3D_MT_select_pose_more_less(Menu):
695 bl_label = "Select More/Less"
697 def draw(self, context):
702 props = layout.operator("pose.select_hierarchy", text="Parent")
704 props.direction = 'PARENT'
706 props = layout.operator("pose.select_hierarchy", text="Child")
708 props.direction = 'CHILD'
712 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
714 props.direction = 'PARENT'
716 props = layout.operator("pose.select_hierarchy", text="Extend Child")
718 props.direction = 'CHILD'
721 class VIEW3D_MT_select_pose(Menu):
724 def draw(self, context):
727 layout.operator("view3d.select_border")
728 layout.operator("view3d.select_circle")
732 layout.operator("pose.select_all").action = 'TOGGLE'
733 layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
734 layout.operator("pose.select_mirror", text="Flip Active")
738 layout.operator("pose.select_constraint_target", text="Constraint Target")
739 layout.operator("pose.select_linked", text="Linked")
743 layout.menu("VIEW3D_MT_select_pose_more_less")
747 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
748 layout.operator("object.select_pattern", text="Select Pattern...")
751 class VIEW3D_MT_select_particle(Menu):
754 def draw(self, context):
757 layout.operator("view3d.select_border")
758 layout.operator("view3d.select_circle")
762 layout.operator("particle.select_all").action = 'TOGGLE'
763 layout.operator("particle.select_linked")
764 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
768 layout.operator("particle.select_more")
769 layout.operator("particle.select_less")
773 layout.operator("particle.select_random")
777 layout.operator("particle.select_roots", text="Roots")
778 layout.operator("particle.select_tips", text="Tips")
781 class VIEW3D_MT_edit_mesh_select_similar(Menu):
782 bl_label = "Select Similar"
784 def draw(self, context):
787 layout.operator_enum("mesh.select_similar", "type")
791 layout.operator("mesh.select_similar_region", text="Face Regions")
794 class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
795 bl_label = "Select All by Trait"
797 def draw(self, context):
799 if context.scene.tool_settings.mesh_select_mode[2] is False:
800 layout.operator("mesh.select_non_manifold", text="Non Manifold")
801 layout.operator("mesh.select_loose", text="Loose Geometry")
802 layout.operator("mesh.select_interior_faces", text="Interior Faces")
803 layout.operator("mesh.select_face_by_sides", text="Faces by Sides")
807 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
810 class VIEW3D_MT_edit_mesh_select_more_less(Menu):
811 bl_label = "Select More/Less"
813 def draw(self, context):
816 layout.operator("mesh.select_more", text="More")
817 layout.operator("mesh.select_less", text="Less")
821 layout.operator("mesh.select_next_item", text="Next Active")
822 layout.operator("mesh.select_prev_item", text="Previous Active")
825 class VIEW3D_MT_edit_mesh_select_linked(Menu):
826 bl_label = "Select Linked"
828 def draw(self, context):
831 layout.operator("mesh.select_linked", text="Linked")
832 layout.operator("mesh.shortest_path_select", text="Shortest Path")
833 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
836 class VIEW3D_MT_edit_mesh_select_loops(Menu):
837 bl_label = "Select Loops"
839 def draw(self, context):
842 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
843 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
847 layout.operator("mesh.loop_to_region")
848 layout.operator("mesh.region_to_loop")
851 class VIEW3D_MT_select_edit_mesh(Menu):
854 def draw(self, context):
857 layout.operator("view3d.select_border")
858 layout.operator("view3d.select_circle")
863 layout.operator("mesh.select_all").action = 'TOGGLE'
864 layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
869 layout.operator("mesh.select_random", text="Random")
870 layout.operator("mesh.select_nth")
875 layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
880 layout.menu("VIEW3D_MT_edit_mesh_select_similar")
884 layout.menu("VIEW3D_MT_edit_mesh_select_by_trait")
888 layout.menu("VIEW3D_MT_edit_mesh_select_more_less")
892 layout.menu("VIEW3D_MT_edit_mesh_select_loops")
896 layout.menu("VIEW3D_MT_edit_mesh_select_linked")
900 layout.operator("mesh.select_axis", text="Side of Active")
901 layout.operator("mesh.select_mirror", text="Mirror")
904 class VIEW3D_MT_select_edit_curve(Menu):
907 def draw(self, context):
910 layout.operator("view3d.select_border")
911 layout.operator("view3d.select_circle")
915 layout.operator("curve.select_all").action = 'TOGGLE'
916 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
920 layout.operator("curve.select_random")
921 layout.operator("curve.select_nth")
922 layout.operator("curve.select_linked", text="Select Linked")
923 layout.operator("curve.select_similar", text="Select Similar")
927 layout.operator("curve.de_select_first")
928 layout.operator("curve.de_select_last")
929 layout.operator("curve.select_next")
930 layout.operator("curve.select_previous")
934 layout.operator("curve.select_more")
935 layout.operator("curve.select_less")
938 class VIEW3D_MT_select_edit_surface(Menu):
941 def draw(self, context):
944 layout.operator("view3d.select_border")
945 layout.operator("view3d.select_circle")
949 layout.operator("curve.select_all").action = 'TOGGLE'
950 layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
954 layout.operator("curve.select_random")
955 layout.operator("curve.select_nth")
956 layout.operator("curve.select_linked", text="Select Linked")
957 layout.operator("curve.select_similar", text="Select Similar")
961 layout.operator("curve.select_row")
965 layout.operator("curve.select_more")
966 layout.operator("curve.select_less")
969 class VIEW3D_MT_select_edit_text(Menu):
970 # intentional name mis-match
971 # select menu for 3d-text doesn't make sense
974 def draw(self, context):
977 layout.menu("VIEW3D_MT_undo_redo")
981 layout.operator("font.text_paste", text="Paste")
982 layout.operator("font.text_cut", text="Cut")
983 layout.operator("font.text_copy", text="Copy")
987 layout.operator("font.text_paste_from_file")
991 layout.operator("font.select_all")
994 class VIEW3D_MT_select_edit_metaball(Menu):
997 def draw(self, context):
1000 layout.operator("view3d.select_border")
1001 layout.operator("view3d.select_circle")
1005 layout.operator("mball.select_all").action = 'TOGGLE'
1006 layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
1010 layout.operator("mball.select_random_metaelems")
1014 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
1017 class VIEW3D_MT_select_edit_lattice(Menu):
1020 def draw(self, context):
1021 layout = self.layout
1023 layout.operator("view3d.select_border")
1024 layout.operator("view3d.select_circle")
1028 layout.operator("lattice.select_all").action = 'TOGGLE'
1029 layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
1033 layout.operator("lattice.select_mirror")
1034 layout.operator("lattice.select_random")
1038 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
1041 class VIEW3D_MT_select_edit_armature(Menu):
1044 def draw(self, context):
1045 layout = self.layout
1047 layout.operator("view3d.select_border")
1048 layout.operator("view3d.select_circle")
1052 layout.operator("armature.select_all").action = 'TOGGLE'
1053 layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
1054 layout.operator("armature.select_mirror", text="Mirror").extend = False
1058 layout.operator("armature.select_more", text="More")
1059 layout.operator("armature.select_less", text="Less")
1063 props = layout.operator("armature.select_hierarchy", text="Parent")
1064 props.extend = False
1065 props.direction = 'PARENT'
1067 props = layout.operator("armature.select_hierarchy", text="Child")
1068 props.extend = False
1069 props.direction = 'CHILD'
1073 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
1075 props.direction = 'PARENT'
1077 props = layout.operator("armature.select_hierarchy", text="Extend Child")
1079 props.direction = 'CHILD'
1081 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
1082 layout.operator("object.select_pattern", text="Select Pattern...")
1085 class VIEW3D_MT_select_gpencil(Menu):
1088 def draw(self, context):
1089 layout = self.layout
1091 layout.operator("gpencil.select_border")
1092 layout.operator("gpencil.select_circle")
1096 layout.operator("gpencil.select_all", text="(De)select All").action = 'TOGGLE'
1097 layout.operator("gpencil.select_all", text="Inverse").action = 'INVERT'
1101 layout.operator("gpencil.select_linked", text="Linked")
1102 layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
1106 layout.operator("gpencil.select_first")
1107 layout.operator("gpencil.select_last")
1111 layout.operator("gpencil.select_more")
1112 layout.operator("gpencil.select_less")
1115 class VIEW3D_MT_select_paint_mask(Menu):
1118 def draw(self, context):
1119 layout = self.layout
1121 layout.operator("view3d.select_border")
1122 layout.operator("view3d.select_circle")
1126 layout.operator("paint.face_select_all").action = 'TOGGLE'
1127 layout.operator("paint.face_select_all", text="Inverse").action = 'INVERT'
1131 layout.operator("paint.face_select_linked", text="Linked")
1134 class VIEW3D_MT_select_paint_mask_vertex(Menu):
1137 def draw(self, context):
1138 layout = self.layout
1140 layout.operator("view3d.select_border")
1141 layout.operator("view3d.select_circle")
1145 layout.operator("paint.vert_select_all").action = 'TOGGLE'
1146 layout.operator("paint.vert_select_all", text="Inverse").action = 'INVERT'
1150 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
1153 class VIEW3D_MT_angle_control(Menu):
1154 bl_label = "Angle Control"
1157 def poll(cls, context):
1158 settings = UnifiedPaintPanel.paint_settings(context)
1162 brush = settings.brush
1163 tex_slot = brush.texture_slot
1165 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
1167 def draw(self, context):
1168 layout = self.layout
1170 settings = UnifiedPaintPanel.paint_settings(context)
1171 brush = settings.brush
1173 sculpt = (context.sculpt_object is not None)
1175 tex_slot = brush.texture_slot
1177 layout.prop(tex_slot, "use_rake", text="Rake")
1179 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
1181 if brush.sculpt_capabilities.has_random_texture_angle:
1182 layout.prop(tex_slot, "use_random", text="Random")
1184 layout.prop(tex_slot, "use_random", text="Random")
1187 # XXX: INFO_MT_ names used to keep backwards compatibility (Add-ons etc. that hook into the menu)
1188 class INFO_MT_mesh_add(Menu):
1189 bl_idname = "INFO_MT_mesh_add"
1192 def draw(self, context):
1193 layout = self.layout
1195 layout.operator_context = 'INVOKE_REGION_WIN'
1197 layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
1198 layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
1199 layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
1200 layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
1201 layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
1202 layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
1203 layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
1204 layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
1208 layout.operator("mesh.primitive_grid_add", text="Grid", icon='MESH_GRID')
1209 layout.operator("mesh.primitive_monkey_add", text="Monkey", icon='MESH_MONKEY')
1212 class INFO_MT_curve_add(Menu):
1213 bl_idname = "INFO_MT_curve_add"
1216 def draw(self, context):
1217 layout = self.layout
1219 layout.operator_context = 'INVOKE_REGION_WIN'
1221 layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
1222 layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
1226 layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
1227 layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
1228 layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
1232 layout.operator("curve.draw", icon='LINE_DATA')
1235 class INFO_MT_surface_add(Menu):
1236 bl_idname = "INFO_MT_surface_add"
1237 bl_label = "Surface"
1239 def draw(self, context):
1240 layout = self.layout
1242 layout.operator_context = 'INVOKE_REGION_WIN'
1244 layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
1245 layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
1249 layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
1250 layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
1251 layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
1255 layout.operator("curve.draw", icon='LINE_DATA')
1258 class INFO_MT_metaball_add(Menu):
1259 bl_idname = "INFO_MT_metaball_add"
1260 bl_label = "Metaball"
1262 def draw(self, context):
1263 layout = self.layout
1265 layout.operator_context = 'INVOKE_REGION_WIN'
1266 layout.operator_enum("object.metaball_add", "type")
1269 class INFO_MT_edit_curve_add(Menu):
1270 bl_idname = "INFO_MT_edit_curve_add"
1273 def draw(self, context):
1274 is_surf = context.active_object.type == 'SURFACE'
1276 layout = self.layout
1277 layout.operator_context = 'EXEC_REGION_WIN'
1280 INFO_MT_surface_add.draw(self, context)
1282 INFO_MT_curve_add.draw(self, context)
1285 class INFO_MT_edit_armature_add(Menu):
1286 bl_idname = "INFO_MT_edit_armature_add"
1287 bl_label = "Armature"
1289 def draw(self, context):
1290 layout = self.layout
1292 layout.operator_context = 'EXEC_REGION_WIN'
1293 layout.operator("armature.bone_primitive_add", text="Single Bone", icon='BONE_DATA')
1296 class INFO_MT_armature_add(Menu):
1297 bl_idname = "INFO_MT_armature_add"
1298 bl_label = "Armature"
1300 def draw(self, context):
1301 layout = self.layout
1303 layout.operator_context = 'EXEC_REGION_WIN'
1304 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
1307 class INFO_MT_lamp_add(Menu):
1308 bl_idname = "INFO_MT_lamp_add"
1311 def draw(self, context):
1312 layout = self.layout
1314 layout.operator_context = 'INVOKE_REGION_WIN'
1315 layout.operator_enum("object.lamp_add", "type")
1318 class INFO_MT_lightprobe_add(Menu):
1319 bl_idname = "INFO_MT_lightprobe_add"
1320 bl_label = "Light Probe"
1322 def draw(self, context):
1323 layout = self.layout
1325 layout.operator_context = 'INVOKE_REGION_WIN'
1326 layout.operator_enum("object.lightprobe_add", "type")
1329 class INFO_MT_camera_add(Menu):
1330 bl_idname = "INFO_MT_camera_add"
1333 def draw(self, context):
1334 layout = self.layout
1335 layout.operator_context = 'EXEC_REGION_WIN'
1336 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
1339 class INFO_MT_add(Menu):
1342 def draw(self, context):
1343 layout = self.layout
1345 # note, don't use 'EXEC_SCREEN' or operators wont get the 'v3d' context.
1347 # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
1348 # "align_view" to work on first call (see [#32719]).
1349 layout.operator_context = 'EXEC_REGION_WIN'
1351 # layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
1352 layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
1354 # layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
1355 layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
1356 # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
1357 layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
1358 layout.menu("INFO_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
1359 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
1362 layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
1363 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1364 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1367 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1370 if INFO_MT_camera_add.is_extended():
1371 layout.menu("INFO_MT_camera_add", icon='OUTLINER_OB_CAMERA')
1373 INFO_MT_camera_add.draw(self, context)
1375 layout.menu("INFO_MT_lamp_add", icon='OUTLINER_OB_LAMP')
1377 layout.menu("INFO_MT_lightprobe_add")
1380 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
1383 if len(bpy.data.groups) > 10:
1384 layout.operator_context = 'INVOKE_REGION_WIN'
1385 layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_GROUP_INSTANCE')
1387 layout.operator_menu_enum(
1388 "object.group_instance_add",
1390 text="Group Instance",
1391 icon='OUTLINER_OB_GROUP_INSTANCE',
1395 class VIEW3D_MT_undo_redo(Menu):
1396 bl_label = "Undo/Redo"
1399 def draw(self, context):
1400 layout = self.layout
1402 layout.operator("ed.undo")
1403 layout.operator("ed.redo")
1407 layout.operator("ed.undo_history")
1410 class VIEW3D_MT_object_relations(Menu):
1411 bl_label = "Relations"
1413 def draw(self, context):
1414 layout = self.layout
1416 layout.operator("object.proxy_make", text="Make Proxy...")
1418 layout.operator("object.make_dupli_face")
1422 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1423 layout.menu("VIEW3D_MT_make_single_user")
1427 layout.operator("object.data_transfer")
1428 layout.operator("object.datalayout_transfer")
1431 class VIEW3D_MT_object(Menu):
1432 bl_context = "objectmode"
1435 def draw(self, context):
1436 layout = self.layout
1438 layout.menu("VIEW3D_MT_undo_redo")
1442 layout.operator("object.delete", text="Delete...").use_global = False
1446 layout.menu("VIEW3D_MT_transform_object")
1447 layout.menu("VIEW3D_MT_mirror")
1448 layout.menu("VIEW3D_MT_object_clear")
1449 layout.menu("VIEW3D_MT_object_apply")
1450 layout.menu("VIEW3D_MT_object_shading")
1454 layout.menu("VIEW3D_MT_object_parent")
1455 layout.menu("VIEW3D_MT_object_group")
1456 layout.menu("VIEW3D_MT_snap")
1460 layout.operator("object.duplicate_move")
1461 layout.operator("object.duplicate_move_linked")
1462 layout.operator("object.join")
1464 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
1465 layout.menu("VIEW3D_MT_object_relations")
1466 layout.menu("VIEW3D_MT_object_constraints")
1467 layout.menu("VIEW3D_MT_object_track")
1471 layout.menu("VIEW3D_MT_object_animation")
1472 layout.menu("VIEW3D_MT_object_rigid_body")
1476 layout.menu("VIEW3D_MT_object_quick_effects")
1480 layout.operator_menu_enum("object.convert", "target")
1483 class VIEW3D_MT_object_animation(Menu):
1484 bl_label = "Animation"
1486 def draw(self, context):
1487 layout = self.layout
1489 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1490 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
1491 layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
1492 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1496 layout.operator("nla.bake", text="Bake Action...")
1499 class VIEW3D_MT_object_rigid_body(Menu):
1500 bl_label = "Rigid Body"
1502 def draw(self, context):
1503 layout = self.layout
1505 layout.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
1506 layout.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
1510 layout.operator("rigidbody.objects_remove", text="Remove")
1514 layout.operator("rigidbody.shape_change", text="Change Shape")
1515 layout.operator("rigidbody.mass_calculate", text="Calculate Mass")
1516 layout.operator("rigidbody.object_settings_copy", text="Copy from Active")
1517 layout.operator("object.visual_transform_apply", text="Apply Transformation")
1518 layout.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
1522 layout.operator("rigidbody.connect", text="Connect")
1525 class VIEW3D_MT_object_clear(Menu):
1528 def draw(self, context):
1529 layout = self.layout
1531 layout.operator("object.location_clear", text="Location").clear_delta = False
1532 layout.operator("object.rotation_clear", text="Rotation").clear_delta = False
1533 layout.operator("object.scale_clear", text="Scale").clear_delta = False
1537 layout.operator("object.origin_clear", text="Origin")
1540 class VIEW3D_MT_object_specials(Menu):
1541 bl_label = "Specials"
1544 def poll(cls, context):
1545 # add more special types
1546 return context.object
1548 def draw(self, context):
1549 layout = self.layout
1551 scene = context.scene
1552 obj = context.object
1554 if obj.type == 'CAMERA':
1555 layout.operator_context = 'INVOKE_REGION_WIN'
1557 if obj.data.type == 'PERSP':
1558 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
1559 props.data_path_iter = "selected_editable_objects"
1560 props.data_path_item = "data.lens"
1561 props.input_scale = 0.1
1562 if obj.data.lens_unit == 'MILLIMETERS':
1563 props.header_text = "Camera Lens Angle: %.1fmm"
1565 props.header_text = "Camera Lens Angle: %.1f\u00B0"
1568 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
1569 props.data_path_iter = "selected_editable_objects"
1570 props.data_path_item = "data.ortho_scale"
1571 props.input_scale = 0.01
1572 props.header_text = "Camera Lens Scale: %.3f"
1574 if not obj.data.dof_object:
1575 view = context.space_data
1576 if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
1577 props = layout.operator("ui.eyedropper_depth", text="DOF Distance (Pick)")
1579 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
1580 props.data_path_iter = "selected_editable_objects"
1581 props.data_path_item = "data.dof_distance"
1582 props.input_scale = 0.02
1583 props.header_text = "DOF Distance: %.3f"
1586 if obj.type in {'CURVE', 'FONT'}:
1587 layout.operator_context = 'INVOKE_REGION_WIN'
1589 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
1590 props.data_path_iter = "selected_editable_objects"
1591 props.data_path_item = "data.extrude"
1592 props.input_scale = 0.01
1593 props.header_text = "Extrude Size: %.3f"
1595 props = layout.operator("wm.context_modal_mouse", text="Width Size")
1596 props.data_path_iter = "selected_editable_objects"
1597 props.data_path_item = "data.offset"
1598 props.input_scale = 0.01
1599 props.header_text = "Width Size: %.3f"
1601 if obj.type == 'EMPTY':
1602 layout.operator_context = 'INVOKE_REGION_WIN'
1604 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
1605 props.data_path_iter = "selected_editable_objects"
1606 props.data_path_item = "empty_draw_size"
1607 props.input_scale = 0.01
1608 props.header_text = "Empty Draw Size: %.3f"
1610 if obj.type == 'LAMP':
1613 layout.operator_context = 'INVOKE_REGION_WIN'
1615 emission_node = None
1617 for node in lamp.node_tree.nodes:
1618 if getattr(node, "type", None) == 'EMISSION':
1619 emission_node = node
1622 if emission_node is not None:
1623 props = layout.operator("wm.context_modal_mouse", text="Strength")
1624 props.data_path_iter = "selected_editable_objects"
1625 props.data_path_item = "data.node_tree" \
1626 ".nodes[\"" + emission_node.name + "\"]" \
1627 ".inputs[\"Strength\"].default_value"
1628 props.header_text = "Lamp Strength: %.3f"
1629 props.input_scale = 0.1
1631 if lamp.type == 'AREA':
1632 props = layout.operator("wm.context_modal_mouse", text="Size X")
1633 props.data_path_iter = "selected_editable_objects"
1634 props.data_path_item = "data.size"
1635 props.header_text = "Lamp Size X: %.3f"
1637 if lamp.shape == 'RECTANGLE':
1638 props = layout.operator("wm.context_modal_mouse", text="Size Y")
1639 props.data_path_iter = "selected_editable_objects"
1640 props.data_path_item = "data.size_y"
1641 props.header_text = "Lamp Size Y: %.3f"
1643 elif lamp.type in {'SPOT', 'POINT', 'SUN'}:
1644 props = layout.operator("wm.context_modal_mouse", text="Size")
1645 props.data_path_iter = "selected_editable_objects"
1646 props.data_path_item = "data.shadow_soft_size"
1647 props.header_text = "Lamp Size: %.3f"
1649 if lamp.type == 'SPOT':
1651 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
1652 props.data_path_iter = "selected_editable_objects"
1653 props.data_path_item = "data.spot_size"
1654 props.input_scale = 0.01
1655 props.header_text = "Spot Size: %.2f"
1657 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
1658 props.data_path_iter = "selected_editable_objects"
1659 props.data_path_item = "data.spot_blend"
1660 props.input_scale = -0.01
1661 props.header_text = "Spot Blend: %.2f"
1665 props = layout.operator("object.isolate_type_render")
1666 props = layout.operator("object.hide_render_clear_all")
1669 class VIEW3D_MT_object_shading(Menu):
1670 # XXX, this menu is a place to store shading operator in object mode
1671 bl_label = "Shading"
1673 def draw(self, context):
1674 layout = self.layout
1675 layout.operator("object.shade_smooth", text="Smooth")
1676 layout.operator("object.shade_flat", text="Flat")
1679 class VIEW3D_MT_object_apply(Menu):
1682 def draw(self, context):
1683 layout = self.layout
1685 props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
1686 props.location, props.rotation, props.scale = True, False, False
1688 props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
1689 props.location, props.rotation, props.scale = False, True, False
1691 props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
1692 props.location, props.rotation, props.scale = False, False, True
1693 props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
1694 props.location, props.rotation, props.scale = False, True, True
1699 "object.transforms_to_deltas",
1700 text="Location to Deltas",
1701 text_ctxt=i18n_contexts.default,
1704 "object.transforms_to_deltas",
1705 text="Rotation to Deltas",
1706 text_ctxt=i18n_contexts.default,
1709 "object.transforms_to_deltas",
1710 text="Scale to Deltas",
1711 text_ctxt=i18n_contexts.default,
1715 "object.transforms_to_deltas",
1716 text="All Transforms to Deltas",
1717 text_ctxt=i18n_contexts.default,
1719 layout.operator("object.anim_transforms_to_deltas")
1724 "object.visual_transform_apply",
1725 text="Visual Transform",
1726 text_ctxt=i18n_contexts.default,
1730 text="Visual Geometry to Mesh",
1731 text_ctxt=i18n_contexts.default,
1733 layout.operator("object.duplicates_make_real")
1736 class VIEW3D_MT_object_parent(Menu):
1739 def draw(self, context):
1740 layout = self.layout
1742 layout.operator_enum("object.parent_set", "type")
1746 layout.operator_enum("object.parent_clear", "type")
1749 class VIEW3D_MT_object_track(Menu):
1752 def draw(self, context):
1753 layout = self.layout
1755 layout.operator_enum("object.track_set", "type")
1759 layout.operator_enum("object.track_clear", "type")
1762 class VIEW3D_MT_object_group(Menu):
1765 def draw(self, context):
1766 layout = self.layout
1768 layout.operator("group.create")
1769 # layout.operator_menu_enum("group.objects_remove", "group") # BUGGY
1770 layout.operator("group.objects_remove")
1771 layout.operator("group.objects_remove_all")
1775 layout.operator("group.objects_add_active")
1776 layout.operator("group.objects_remove_active")
1779 class VIEW3D_MT_object_constraints(Menu):
1780 bl_label = "Constraints"
1782 def draw(self, context):
1783 layout = self.layout
1785 layout.operator("object.constraint_add_with_targets")
1786 layout.operator("object.constraints_copy")
1790 layout.operator("object.constraints_clear")
1793 class VIEW3D_MT_object_quick_effects(Menu):
1794 bl_label = "Quick Effects"
1796 def draw(self, context):
1797 layout = self.layout
1799 layout.operator("object.quick_fur")
1800 layout.operator("object.quick_explode")
1801 layout.operator("object.quick_smoke")
1802 layout.operator("object.quick_fluid")
1805 class VIEW3D_MT_make_single_user(Menu):
1806 bl_label = "Make Single User"
1808 def draw(self, context):
1809 layout = self.layout
1811 props = layout.operator("object.make_single_user", text="Object")
1813 props.obdata = props.material = props.texture = props.animation = False
1815 props = layout.operator("object.make_single_user", text="Object & Data")
1816 props.object = props.obdata = True
1817 props.material = props.texture = props.animation = False
1819 props = layout.operator("object.make_single_user", text="Object & Data & Materials")
1820 props.object = props.obdata = props.material = True
1821 props.animation = False
1823 props = layout.operator("object.make_single_user", text="Materials")
1824 props.material = True
1825 props.object = props.obdata = props.animation = False
1827 props = layout.operator("object.make_single_user", text="Object Animation")
1828 props.animation = True
1829 props.object = props.obdata = props.material = False
1832 class VIEW3D_MT_make_links(Menu):
1833 bl_label = "Make Links"
1835 def draw(self, context):
1836 layout = self.layout
1837 operator_context_default = layout.operator_context
1839 if len(bpy.data.scenes) > 10:
1840 layout.operator_context = 'INVOKE_REGION_WIN'
1841 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
1843 layout.operator_context = 'EXEC_REGION_WIN'
1844 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene")
1848 layout.operator_context = operator_context_default
1850 layout.operator_enum("object.make_links_data", "type") # inline
1852 layout.operator("object.join_uvs") # stupid place to add this!
1855 class VIEW3D_MT_brush(Menu):
1858 def draw(self, context):
1859 layout = self.layout
1861 settings = UnifiedPaintPanel.paint_settings(context)
1862 brush = getattr(settings, "brush", None)
1864 ups = context.tool_settings.unified_paint_settings
1865 layout.prop(ups, "use_unified_size", text="Unified Size")
1866 layout.prop(ups, "use_unified_strength", text="Unified Strength")
1867 if context.image_paint_object or context.vertex_paint_object:
1868 layout.prop(ups, "use_unified_color", text="Unified Color")
1871 # skip if no active brush
1873 layout.label(text="No Brushes currently available", icon='INFO')
1877 layout.menu("VIEW3D_MT_brush_paint_modes")
1880 if context.sculpt_object:
1881 layout.operator("brush.reset")
1882 layout.prop_menu_enum(brush, "sculpt_tool")
1883 elif context.image_paint_object:
1884 layout.prop_menu_enum(brush, "image_tool")
1885 elif context.vertex_paint_object or context.weight_paint_object:
1886 layout.prop_menu_enum(brush, "vertex_tool")
1888 # TODO: still missing a lot of brush options here
1891 if context.sculpt_object:
1893 sculpt_tool = brush.sculpt_tool
1896 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
1899 if sculpt_tool != 'GRAB':
1900 layout.prop_menu_enum(brush, "stroke_method")
1902 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
1903 layout.prop_menu_enum(brush, "direction")
1905 if sculpt_tool == 'LAYER':
1906 layout.prop(brush, "use_persistent")
1907 layout.operator("sculpt.set_persistent_base")
1910 class VIEW3D_MT_brush_paint_modes(Menu):
1911 bl_label = "Enabled Modes"
1913 def draw(self, context):
1914 layout = self.layout
1916 settings = UnifiedPaintPanel.paint_settings(context)
1917 brush = settings.brush
1919 layout.prop(brush, "use_paint_sculpt", text="Sculpt")
1920 layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
1921 layout.prop(brush, "use_paint_weight", text="Weight Paint")
1922 layout.prop(brush, "use_paint_image", text="Texture Paint")
1925 class VIEW3D_MT_paint_vertex(Menu):
1928 def draw(self, context):
1929 layout = self.layout
1931 layout.menu("VIEW3D_MT_undo_redo")
1935 layout.operator("paint.vertex_color_set")
1936 layout.operator("paint.vertex_color_smooth")
1937 layout.operator("paint.vertex_color_dirt")
1938 layout.operator("paint.vertex_color_from_weight")
1942 layout.operator("paint.vertex_color_invert", text="Invert")
1943 layout.operator("paint.vertex_color_levels", text="Levels")
1944 layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
1945 layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
1948 class VIEW3D_MT_hook(Menu):
1951 def draw(self, context):
1952 layout = self.layout
1953 layout.operator_context = 'EXEC_AREA'
1954 layout.operator("object.hook_add_newob")
1955 layout.operator("object.hook_add_selob").use_bone = False
1956 layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
1958 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
1961 layout.operator_menu_enum("object.hook_assign", "modifier")
1962 layout.operator_menu_enum("object.hook_remove", "modifier")
1966 layout.operator_menu_enum("object.hook_select", "modifier")
1967 layout.operator_menu_enum("object.hook_reset", "modifier")
1968 layout.operator_menu_enum("object.hook_recenter", "modifier")
1971 class VIEW3D_MT_vertex_group(Menu):
1972 bl_label = "Vertex Groups"
1974 def draw(self, context):
1975 layout = self.layout
1977 layout.operator_context = 'EXEC_AREA'
1978 layout.operator("object.vertex_group_assign_new")
1980 ob = context.active_object
1981 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
1982 if ob.vertex_groups.active:
1985 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
1987 "object.vertex_group_remove_from",
1988 text="Remove from Active Group",
1989 ).use_all_groups = False
1990 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
1992 if ob.vertex_groups.active:
1995 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
1996 layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
1997 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
2000 class VIEW3D_MT_paint_weight(Menu):
2001 bl_label = "Weights"
2004 def draw_generic(layout, is_editmode=False):
2007 layout.menu("VIEW3D_MT_undo_redo")
2011 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
2012 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
2016 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
2017 layout.operator("object.vertex_group_normalize", text="Normalize")
2021 layout.operator("object.vertex_group_mirror", text="Mirror")
2022 layout.operator("object.vertex_group_invert", text="Invert")
2023 layout.operator("object.vertex_group_clean", text="Clean")
2027 layout.operator("object.vertex_group_quantize", text="Quantize")
2028 layout.operator("object.vertex_group_levels", text="Levels")
2029 layout.operator("object.vertex_group_smooth", text="Smooth")
2032 props = layout.operator("object.data_transfer", text="Transfer Weights")
2033 props.use_reverse_transfer = True
2034 props.data_type = 'VGROUP_WEIGHTS'
2036 layout.operator("object.vertex_group_limit_total", text="Limit Total")
2037 layout.operator("object.vertex_group_fix", text="Fix Deforms")
2043 layout.operator("paint.weight_set")
2045 def draw(self, context):
2046 self.draw_generic(self.layout, is_editmode=False);
2049 class VIEW3D_MT_sculpt(Menu):
2052 def draw(self, context):
2053 layout = self.layout
2055 toolsettings = context.tool_settings
2056 sculpt = toolsettings.sculpt
2058 layout.menu("VIEW3D_MT_undo_redo")
2062 layout.prop(sculpt, "use_symmetry_x")
2063 layout.prop(sculpt, "use_symmetry_y")
2064 layout.prop(sculpt, "use_symmetry_z")
2068 layout.prop(sculpt, "lock_x")
2069 layout.prop(sculpt, "lock_y")
2070 layout.prop(sculpt, "lock_z")
2074 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
2075 layout.prop(sculpt, "show_low_resolution")
2076 layout.prop(sculpt, "show_brush")
2077 layout.prop(sculpt, "use_deform_only")
2078 layout.prop(sculpt, "show_diffuse_color")
2079 layout.prop(sculpt, "show_mask")
2082 class VIEW3D_MT_hide_mask(Menu):
2083 bl_label = "Hide/Mask"
2085 def draw(self, context):
2086 layout = self.layout
2088 props = layout.operator("paint.hide_show", text="Show All")
2089 props.action = 'SHOW'
2092 props = layout.operator("paint.hide_show", text="Hide Bounding Box")
2093 props.action = 'HIDE'
2094 props.area = 'INSIDE'
2096 props = layout.operator("paint.hide_show", text="Show Bounding Box")
2097 props.action = 'SHOW'
2098 props.area = 'INSIDE'
2100 props = layout.operator("paint.hide_show", text="Hide Masked")
2101 props.area = 'MASKED'
2102 props.action = 'HIDE'
2106 props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
2107 props.mode = 'INVERT'
2109 props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
2110 props.mode = 'VALUE'
2113 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
2114 props.mode = 'VALUE'
2117 props = layout.operator("view3d.select_border", text="Box Mask")
2118 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
2121 class VIEW3D_MT_particle(Menu):
2122 bl_label = "Particle"
2124 def draw(self, context):
2125 layout = self.layout
2127 particle_edit = context.tool_settings.particle_edit
2129 layout.menu("VIEW3D_MT_undo_redo")
2133 layout.operator("particle.delete")
2137 layout.operator("particle.mirror")
2139 layout.operator("particle.remove_doubles")
2143 if particle_edit.select_mode == 'POINT':
2144 layout.operator("particle.subdivide")
2146 layout.operator("particle.unify_length")
2147 layout.operator("particle.rekey")
2148 layout.operator("particle.weight_set")
2152 layout.menu("VIEW3D_MT_particle_showhide")
2155 class VIEW3D_MT_particle_specials(Menu):
2156 bl_label = "Specials"
2158 def draw(self, context):
2159 layout = self.layout
2161 particle_edit = context.tool_settings.particle_edit
2163 layout.operator("particle.rekey")
2167 layout.operator("particle.delete")
2171 layout.operator("particle.remove_doubles")
2172 layout.operator("particle.unify_length")
2174 if particle_edit.select_mode == 'POINT':
2175 layout.operator("particle.subdivide")
2177 layout.operator("particle.weight_set")
2181 layout.operator("particle.mirror")
2183 if particle_edit.select_mode == 'POINT':
2185 layout.operator("particle.select_roots")
2186 layout.operator("particle.select_tips")
2190 layout.operator("particle.select_random")
2194 layout.operator("particle.select_more")
2195 layout.operator("particle.select_less")
2199 layout.operator("particle.select_all").action = 'TOGGLE'
2200 layout.operator("particle.select_linked")
2201 layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
2204 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
2205 _operator_name = "particle"
2208 class VIEW3D_MT_pose(Menu):
2211 def draw(self, context):
2212 layout = self.layout
2214 layout.menu("VIEW3D_MT_undo_redo")
2218 layout.menu("VIEW3D_MT_transform_armature")
2220 layout.menu("VIEW3D_MT_pose_transform")
2221 layout.menu("VIEW3D_MT_pose_apply")
2223 layout.menu("VIEW3D_MT_snap")
2227 layout.menu("VIEW3D_MT_object_animation")
2231 layout.menu("VIEW3D_MT_pose_slide")
2232 layout.menu("VIEW3D_MT_pose_propagate")
2236 layout.operator("pose.copy")
2237 layout.operator("pose.paste").flipped = False
2238 layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
2242 layout.menu("VIEW3D_MT_pose_library")
2243 layout.menu("VIEW3D_MT_pose_motion")
2244 layout.menu("VIEW3D_MT_pose_group")
2248 layout.menu("VIEW3D_MT_object_parent")
2249 layout.menu("VIEW3D_MT_pose_ik")
2250 layout.menu("VIEW3D_MT_pose_constraints")
2254 layout.operator_context = 'EXEC_AREA'
2255 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
2256 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
2257 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2259 layout.operator("pose.flip_names")
2261 layout.operator("pose.quaternions_flip")
2265 layout.operator_context = 'INVOKE_AREA'
2266 layout.operator("armature.armature_layers", text="Change Armature Layers...")
2267 layout.operator("pose.bone_layers", text="Change Bone Layers...")
2271 layout.menu("VIEW3D_MT_pose_showhide")
2272 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2275 class VIEW3D_MT_pose_transform(Menu):
2276 bl_label = "Clear Transform"
2278 def draw(self, context):
2279 layout = self.layout
2281 layout.operator("pose.transforms_clear", text="All")
2285 layout.operator("pose.loc_clear", text="Location")
2286 layout.operator("pose.rot_clear", text="Rotation")
2287 layout.operator("pose.scale_clear", text="Scale")
2291 layout.operator("pose.user_transforms_clear", text="Reset Unkeyed")
2294 class VIEW3D_MT_pose_slide(Menu):
2295 bl_label = "In-Betweens"
2297 def draw(self, context):
2298 layout = self.layout
2300 layout.operator("pose.push")
2301 layout.operator("pose.relax")
2302 layout.operator("pose.breakdown")
2305 class VIEW3D_MT_pose_propagate(Menu):
2306 bl_label = "Propagate"
2308 def draw(self, context):
2309 layout = self.layout
2311 layout.operator("pose.propagate").mode = 'WHILE_HELD'
2315 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2316 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2320 layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2324 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2327 class VIEW3D_MT_pose_library(Menu):
2328 bl_label = "Pose Library"
2330 def draw(self, context):
2331 layout = self.layout
2333 layout.operator("poselib.browse_interactive", text="Browse Poses...")
2337 layout.operator("poselib.pose_add", text="Add Pose...")
2338 layout.operator("poselib.pose_rename", text="Rename Pose...")
2339 layout.operator("poselib.pose_remove", text="Remove Pose...")
2342 class VIEW3D_MT_pose_motion(Menu):
2343 bl_label = "Motion Paths"
2345 def draw(self, context):
2346 layout = self.layout
2348 layout.operator("pose.paths_calculate", text="Calculate")
2349 layout.operator("pose.paths_clear", text="Clear")
2352 class VIEW3D_MT_pose_group(Menu):
2353 bl_label = "Bone Groups"
2355 def draw(self, context):
2356 layout = self.layout
2358 pose = context.active_object.pose
2360 layout.operator_context = 'EXEC_AREA'
2361 layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2363 if pose.bone_groups:
2364 active_group = pose.bone_groups.active_index + 1
2365 layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2369 # layout.operator_context = 'INVOKE_AREA'
2370 layout.operator("pose.group_unassign")
2371 layout.operator("pose.group_remove")
2374 class VIEW3D_MT_pose_ik(Menu):
2375 bl_label = "Inverse Kinematics"
2377 def draw(self, context):
2378 layout = self.layout
2380 layout.operator("pose.ik_add")
2381 layout.operator("pose.ik_clear")
2384 class VIEW3D_MT_pose_constraints(Menu):
2385 bl_label = "Constraints"
2387 def draw(self, context):
2388 layout = self.layout
2390 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2391 layout.operator("pose.constraints_copy")
2392 layout.operator("pose.constraints_clear")
2395 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2396 _operator_name = "pose"
2399 class VIEW3D_MT_pose_apply(Menu):
2402 def draw(self, context):
2403 layout = self.layout
2405 layout.operator("pose.armature_apply")
2406 layout.operator("pose.visual_transform_apply")
2409 class VIEW3D_MT_pose_specials(Menu):
2410 bl_label = "Specials"
2412 def draw(self, context):
2413 layout = self.layout
2415 layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type = 'AUTOMATIC'
2416 layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type = 'ENVELOPES'
2420 layout.operator("pose.select_constraint_target")
2421 layout.operator("pose.flip_names")
2425 layout.operator("pose.paths_calculate")
2426 layout.operator("pose.paths_clear")
2427 layout.operator("pose.user_transforms_clear")
2428 layout.operator("pose.user_transforms_clear", text="Clear User Transforms (All)").only_selected = False
2429 layout.operator("pose.relax")
2433 layout.operator_menu_enum("pose.autoside_names", "axis")
2437 def draw(self, context):
2438 layout = self.layout
2443 "use_envelope_multiply",
2444 "use_inherit_rotation",
2445 "use_inherit_scale",
2448 if context.mode == 'EDIT_ARMATURE':
2449 bone_props = bpy.types.EditBone.bl_rna.properties
2450 data_path_iter = "selected_bones"
2452 options.append("lock")
2454 bone_props = bpy.types.Bone.bl_rna.properties
2455 data_path_iter = "selected_pose_bones"
2456 opt_suffix = "bone."
2459 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2460 text_ctxt=i18n_contexts.default)
2461 props.data_path_iter = data_path_iter
2462 props.data_path_item = opt_suffix + opt
2463 props.type = self.type
2466 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2467 bl_label = "Toggle Bone Options"
2471 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2472 bl_label = "Enable Bone Options"
2476 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2477 bl_label = "Disable Bone Options"
2481 # ********** Edit Menus, suffix from ob.type **********
2484 class VIEW3D_MT_edit_mesh(Menu):
2487 def draw(self, context):
2488 layout = self.layout
2490 toolsettings = context.tool_settings
2492 layout.menu("VIEW3D_MT_undo_redo")
2496 layout.menu("VIEW3D_MT_edit_mesh_delete")
2500 layout.menu("VIEW3D_MT_transform")
2501 layout.menu("VIEW3D_MT_mirror")
2502 layout.menu("VIEW3D_MT_snap")
2506 layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
2510 layout.operator("mesh.duplicate_move")
2511 layout.menu("VIEW3D_MT_edit_mesh_extrude")
2515 layout.menu("VIEW3D_MT_edit_mesh_vertices")
2516 layout.menu("VIEW3D_MT_edit_mesh_edges")
2517 layout.menu("VIEW3D_MT_edit_mesh_faces")
2521 layout.menu("VIEW3D_MT_edit_mesh_normals")
2522 layout.menu("VIEW3D_MT_edit_mesh_shading")
2523 layout.menu("VIEW3D_MT_edit_mesh_weights")
2524 layout.menu("VIEW3D_MT_edit_mesh_clean")
2528 layout.operator("mesh.symmetrize")
2529 layout.operator("mesh.symmetry_snap")
2530 layout.operator("mesh.bisect")
2531 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2535 layout.prop(toolsettings, "use_mesh_automerge")
2536 layout.menu("VIEW3D_MT_edit_proportional")
2540 layout.menu("VIEW3D_MT_edit_mesh_showhide")
2543 class VIEW3D_MT_edit_mesh_specials(Menu):
2544 bl_label = "Specials"
2546 def draw(self, context):
2547 layout = self.layout
2549 layout.operator_context = 'INVOKE_REGION_WIN'
2551 layout.operator("mesh.subdivide", text="Subdivide").smoothness = 0.0
2552 layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
2556 layout.operator("mesh.merge", text="Merge...")
2557 layout.operator("mesh.remove_doubles")
2561 layout.operator("mesh.hide", text="Hide").unselected = False
2562 layout.operator("mesh.reveal", text="Reveal")
2563 layout.operator("mesh.select_all", text="Select Inverse").action = 'INVERT'
2567 layout.operator("mesh.flip_normals")
2568 layout.operator("mesh.vertices_smooth", text="Smooth")
2569 layout.operator("mesh.vertices_smooth_laplacian", text="Laplacian Smooth")
2573 layout.operator("mesh.inset")
2574 layout.operator("mesh.bevel", text="Bevel")
2575 layout.operator("mesh.bridge_edge_loops")
2579 layout.operator("mesh.faces_shade_smooth")
2580 layout.operator("mesh.faces_shade_flat")
2584 layout.operator("mesh.blend_from_shape")
2585 layout.operator("mesh.shape_propagate_to_all")
2586 layout.operator("mesh.shortest_path_select")
2587 layout.operator("mesh.sort_elements")
2588 layout.operator("mesh.symmetrize")
2589 layout.operator("mesh.symmetry_snap")
2592 class VIEW3D_MT_edit_mesh_select_mode(Menu):
2593 bl_label = "Mesh Select Mode"
2595 def draw(self, context):
2596 layout = self.layout
2598 layout.operator_context = 'INVOKE_REGION_WIN'
2599 layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
2600 layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
2601 layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
2604 class VIEW3D_MT_edit_mesh_extrude(Menu):
2605 bl_label = "Extrude"
2608 'VERT': lambda layout:
2609 layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
2610 'EDGE': lambda layout:
2611 layout.operator("mesh.extrude_edges_move", text="Edges Only"),
2612 'FACE': lambda layout:
2613 layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
2614 'REGION': lambda layout:
2615 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
2616 'REGION_VERT_NORMAL': lambda layout:
2617 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Region (Vertex Normals)"),
2621 def extrude_options(context):
2622 mesh = context.object.data
2623 select_mode = context.tool_settings.mesh_select_mode
2626 if mesh.total_face_sel:
2627 menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
2628 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
2630 if mesh.total_vert_sel and select_mode[0]:
2633 # should never get here
2636 def draw(self, context):
2637 layout = self.layout
2638 layout.operator_context = 'INVOKE_REGION_WIN'
2640 for menu_id in self.extrude_options(context):
2641 self._extrude_funcs[menu_id](layout)
2644 class VIEW3D_MT_edit_mesh_vertices(Menu):
2645 bl_label = "Vertices"
2647 def draw(self, context):
2648 layout = self.layout
2649 layout.operator_context = 'INVOKE_REGION_WIN'
2651 with_bullet = bpy.app.build_options.bullet
2653 layout.operator("mesh.merge")
2654 layout.operator("mesh.remove_doubles")
2655 layout.operator("mesh.rip_move")
2656 layout.operator("mesh.rip_move_fill")
2657 layout.operator("mesh.rip_edge_move")
2658 layout.operator("mesh.split")
2659 layout.operator_menu_enum("mesh.separate", "type")
2660 layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2661 layout.operator("mesh.vert_connect", text="Connect Vertices")
2662 layout.operator("transform.vert_slide", text="Slide")
2666 layout.operator("mesh.mark_sharp", text="Mark Sharp Edges").use_verts = True
2667 props = layout.operator("mesh.mark_sharp", text="Clear Sharp Edges")
2668 props.use_verts = True
2673 layout.operator("mesh.bevel").vertex_only = True
2675 layout.operator("mesh.convex_hull")
2676 layout.operator("mesh.vertices_smooth")
2678 layout.operator("mesh.blend_from_shape")
2680 layout.operator("object.vertex_group_smooth")
2681 layout.operator("mesh.shape_propagate_to_all")
2685 layout.menu("VIEW3D_MT_vertex_group")
2686 layout.menu("VIEW3D_MT_hook")
2690 layout.operator("object.vertex_parent_set")
2693 class VIEW3D_MT_edit_mesh_edges_data(Menu):
2694 bl_label = "Edge Data"
2696 def draw(self, context):
2697 layout = self.layout
2699 with_freestyle = bpy.app.build_options.freestyle
2701 layout.operator_context = 'INVOKE_REGION_WIN'
2703 layout.operator("transform.edge_crease")
2704 layout.operator("transform.edge_bevelweight")
2708 layout.operator("mesh.mark_seam").clear = False
2709 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
2713 layout.operator("mesh.mark_sharp")
2714 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2719 layout.operator("mesh.mark_freestyle_edge").clear = False
2720 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
2724 class VIEW3D_MT_edit_mesh_edges(Menu):
2727 def draw(self, context):
2728 layout = self.layout
2730 layout.operator_context = 'INVOKE_REGION_WIN'
2732 layout.operator("mesh.edge_face_add")
2733 layout.operator("mesh.subdivide")
2734 layout.operator("mesh.subdivide_edgering")
2735 layout.operator("mesh.unsubdivide")
2739 layout.menu("VIEW3D_MT_edit_mesh_edges_data")
2743 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2744 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
2748 layout.operator("mesh.bevel").vertex_only = False
2749 layout.operator("mesh.edge_split")
2750 layout.operator("mesh.bridge_edge_loops")
2754 layout.operator("transform.edge_slide")
2755 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
2756 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
2757 layout.operator("mesh.loop_to_region")
2758 layout.operator("mesh.region_to_loop")
2761 class VIEW3D_MT_edit_mesh_faces(Menu):
2763 bl_idname = "VIEW3D_MT_edit_mesh_faces"
2765 def draw(self, context):
2766 layout = self.layout
2768 with_freestyle = bpy.app.build_options.freestyle
2770 layout.operator_context = 'INVOKE_REGION_WIN'
2772 layout.operator("mesh.flip_normals")
2773 layout.operator("mesh.edge_face_add")
2774 layout.operator("mesh.fill")
2775 layout.operator("mesh.fill_grid")
2776 layout.operator("mesh.beautify_fill")
2777 layout.operator("mesh.inset")
2778 layout.operator("mesh.bevel").vertex_only = False
2779 layout.operator("mesh.solidify")
2780 layout.operator("mesh.intersect")
2781 layout.operator("mesh.intersect_boolean")
2782 layout.operator("mesh.wireframe")
2787 layout.operator("mesh.mark_freestyle_face").clear = False
2788 layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
2791 layout.operator("mesh.poke")
2792 props = layout.operator("mesh.quads_convert_to_tris")
2793 props.quad_method = props.ngon_method = 'BEAUTY'
2794 layout.operator("mesh.tris_convert_to_quads")
2795 layout.operator("mesh.face_split_by_edges")
2799 layout.operator("mesh.faces_shade_smooth")
2800 layout.operator("mesh.faces_shade_flat")
2802 layout.operator("mesh.normals_make_consistent", text="Recalculate Normals").inside = False
2806 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2810 layout.operator("mesh.uvs_rotate")
2811 layout.operator("mesh.uvs_reverse")
2812 layout.operator("mesh.colors_rotate")
2813 layout.operator("mesh.colors_reverse")
2816 class VIEW3D_MT_edit_mesh_normals(Menu):
2817 bl_label = "Normals"
2819 def draw(self, context):
2820 layout = self.layout
2822 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
2823 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
2827 layout.operator("mesh.flip_normals")
2828 layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
2831 class VIEW3D_MT_edit_mesh_shading(Menu):
2832 bl_label = "Shading"
2834 def draw(self, context):
2835 layout = self.layout
2837 layout.label(text="Faces:")
2838 layout.operator("mesh.faces_shade_smooth", text="Smooth")
2839 layout.operator("mesh.faces_shade_flat", text="Flat")
2840 layout.label(text="Edges:")
2841 layout.operator("mesh.mark_sharp", text="Smooth").clear = True
2842 layout.operator("mesh.mark_sharp", text="Sharp")
2843 layout.label(text="Vertices:")
2844 props = layout.operator("mesh.mark_sharp", text="Smooth")
2845 props.use_verts = True
2847 layout.operator("mesh.mark_sharp", text="Sharp").use_verts = True
2850 class VIEW3D_MT_edit_mesh_weights(Menu):
2851 bl_label = "Weights"
2853 def draw(self, context):
2854 VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True)
2857 class VIEW3D_MT_edit_mesh_clean(Menu):
2858 bl_label = "Clean Up"
2860 def draw(self, context):
2861 layout = self.layout
2863 layout.operator("mesh.delete_loose")
2867 layout.operator("mesh.decimate")
2868 layout.operator("mesh.dissolve_degenerate")
2869 layout.operator("mesh.dissolve_limited")
2870 layout.operator("mesh.face_make_planar")
2874 layout.operator("mesh.vert_connect_nonplanar")
2875 layout.operator("mesh.vert_connect_concave")
2876 layout.operator("mesh.remove_doubles")
2877 layout.operator("mesh.fill_holes")
2880 class VIEW3D_MT_edit_mesh_delete(Menu):
2883 def draw(self, context):
2884 layout = self.layout
2886 layout.operator_enum("mesh.delete", "type")
2890 layout.operator("mesh.dissolve_verts")
2891 layout.operator("mesh.dissolve_edges")
2892 layout.operator("mesh.dissolve_faces")
2896 layout.operator("mesh.dissolve_limited")
2900 layout.operator("mesh.edge_collapse")
2901 layout.operator("mesh.delete_edgeloop", text="Edge Loops")
2904 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
2905 _operator_name = "mesh"
2908 class VIEW3D_MT_edit_gpencil_delete(Menu):
2911 def draw(self, context):
2912 layout = self.layout
2914 layout.operator_enum("gpencil.delete", "type")
2918 layout.operator("gpencil.dissolve")
2922 layout.operator("gpencil.active_frames_delete_all")
2926 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
2929 def draw_curve(self, context):
2930 layout = self.layout
2932 layout.menu("VIEW3D_MT_undo_redo")
2936 layout.menu("VIEW3D_MT_edit_curve_delete")
2940 layout.menu("VIEW3D_MT_transform")
2941 layout.menu("VIEW3D_MT_mirror")
2942 layout.menu("VIEW3D_MT_snap")
2946 layout.operator("curve.extrude_move")
2947 layout.operator("curve.spin")
2948 layout.operator("curve.duplicate_move")
2952 layout.operator("curve.split")
2953 layout.operator("curve.separate")
2954 layout.operator("curve.make_segment")
2955 layout.operator("curve.cyclic_toggle")
2959 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
2960 layout.menu("VIEW3D_MT_edit_curve_segments")
2964 layout.menu("VIEW3D_MT_edit_curve_clean")
2968 layout.menu("VIEW3D_MT_edit_proportional")
2972 layout.menu("VIEW3D_MT_edit_curve_showhide")
2975 class VIEW3D_MT_edit_curve(Menu):
2981 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
2982 bl_label = "Control Points"
2984 def draw(self, context):
2985 layout = self.layout
2987 edit_object = context.edit_object
2989 if edit_object.type == 'CURVE':
2990 layout.operator("transform.tilt")
2991 layout.operator("curve.tilt_clear")
2995 layout.operator_menu_enum("curve.handle_type_set", "type")
2996 layout.operator("curve.normals_make_consistent")
3000 layout.menu("VIEW3D_MT_hook")
3004 layout.operator("object.vertex_parent_set")
3007 class VIEW3D_MT_edit_curve_segments(Menu):
3008 bl_label = "Segments"
3010 def draw(self, context):
3011 layout = self.layout
3013 layout.operator("curve.subdivide")
3014 layout.operator("curve.switch_direction")
3016 class VIEW3D_MT_edit_curve_clean(Menu):
3017 bl_label = "Clean Up"
3019 def draw(self, context):
3020 layout = self.layout
3022 layout.operator("curve.decimate")
3025 class VIEW3D_MT_edit_curve_specials(Menu):
3026 bl_label = "Specials"
3028 def draw(self, context):
3029 layout = self.layout
3031 layout.operator("curve.subdivide")
3032 layout.operator("curve.switch_direction")
3033 layout.operator("curve.spline_weight_set")
3034 layout.operator("curve.radius_set")
3038 layout.operator("curve.smooth")
3039 layout.operator("curve.smooth_weight")
3040 layout.operator("curve.smooth_radius")
3041 layout.operator("curve.smooth_tilt")
3044 class VIEW3D_MT_edit_curve_delete(Menu):
3047 def draw(self, context):
3048 layout = self.layout
3050 layout.operator_enum("curve.delete", "type")
3054 layout.operator("curve.dissolve_verts")
3057 class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu):
3058 _operator_name = "curve"
3061 class VIEW3D_MT_edit_surface(Menu):
3062 bl_label = "Surface"
3067 class VIEW3D_MT_edit_font(Menu):
3070 def draw(self, context):
3071 layout = self.layout
3073 # Break convention of having undo menu here,
3074 # instead place in "Edit" menu, matching the text menu.
3076 layout.menu("VIEW3D_MT_edit_text_chars")
3080 layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
3081 layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
3085 layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
3086 layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
3089 class VIEW3D_MT_edit_text_chars(Menu):
3090 bl_label = "Special Characters"
3092 def draw(self, context):
3093 layout = self.layout
3095 layout.operator("font.text_insert", text="Copyright").text = "\u00A9"
3096 layout.operator("font.text_insert", text="Registered Trademark").text = "\u00AE"
3100 layout.operator("font.text_insert", text="Degree Sign").text = "\u00B0"
3101 layout.operator("font.text_insert", text="Multiplication Sign").text = "\u00D7"
3102 layout.operator("font.text_insert", text="Circle").text = "\u008A"
3106 layout.operator("font.text_insert", text="Superscript 1").text = "\u00B9"
3107 layout.operator("font.text_insert", text="Superscript 2").text = "\u00B2"
3108 layout.operator("font.text_insert", text="Superscript 3").text = "\u00B3"
3112 layout.operator("font.text_insert", text="Double >>").text = "\u00BB"
3113 layout.operator("font.text_insert", text="Double <<").text = "\u00AB"
3114 layout.operator("font.text_insert", text="Promillage").text = "\u2030"
3118 layout.operator("font.text_insert", text="Dutch Florin").text = "\u00A4"
3119 layout.operator("font.text_insert", text="British Pound").text = "\u00A3"
3120 layout.operator("font.text_insert", text="Japanese Yen").text = "\u00A5"
3124 layout.operator("font.text_insert", text="German S").text = "\u00DF"
3125 layout.operator("font.text_insert", text="Spanish Question Mark").text = "\u00BF"
3126 layout.operator("font.text_insert", text="Spanish Exclamation Mark").text = "\u00A1"
3129 class VIEW3D_MT_edit_meta(Menu):
3130 bl_label = "Metaball"
3132 def draw(self, context):
3133 layout = self.layout
3135 layout.menu("VIEW3D_MT_undo_redo")
3139 layout.operator("mball.delete_metaelems", text="Delete...")
3143 layout.menu("VIEW3D_MT_transform")
3144 layout.menu("VIEW3D_MT_mirror")
3145 layout.menu("VIEW3D_MT_snap")
3149 layout.operator("mball.duplicate_metaelems")
3153 layout.menu("VIEW3D_MT_edit_proportional")
3157 layout.menu("VIEW3D_MT_edit_meta_showhide")
3160 class VIEW3D_MT_edit_meta_showhide(Menu):
3161 bl_label = "Show/Hide"
3163 def draw(self, context):
3164 layout = self.layout
3166 layout.operator("mball.reveal_metaelems", text="Show Hidden")
3167 layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
3168 layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
3171 class VIEW3D_MT_edit_lattice(Menu):
3172 bl_label = "Lattice"
3174 def draw(self, context):
3175 layout = self.layout
3177 layout.menu("VIEW3D_MT_undo_redo")
3181 layout.menu("VIEW3D_MT_transform")
3182 layout.menu("VIEW3D_MT_mirror")
3183 layout.menu("VIEW3D_MT_snap")
3184 layout.operator_menu_enum("lattice.flip", "axis")
3188 layout.operator("lattice.make_regular")
3192 layout.operator("object.vertex_parent_set")
3196 layout.menu("VIEW3D_MT_edit_proportional")
3199 class VIEW3D_MT_edit_armature(Menu):
3200 bl_label = "Armature"
3202 def draw(self, context):
3203 layout = self.layout
3205 edit_object = context.edit_object
3206 arm = edit_object.data
3208 layout.menu("VIEW3D_MT_undo_redo")
3212 layout.operator("armature.delete")
3216 layout.menu("VIEW3D_MT_transform_armature")
3217 layout.menu("VIEW3D_MT_mirror")
3218 layout.menu("VIEW3D_MT_snap")
3219 layout.menu("VIEW3D_MT_edit_armature_roll")
3223 layout.operator("armature.extrude_move")
3225 if arm.use_mirror_x:
3226 layout.operator("armature.extrude_forked")
3228 layout.operator("armature.duplicate_move")
3229 layout.operator("armature.merge")
3230 layout.operator("armature.fill")
3231 layout.operator("armature.split")
3232 layout.operator("armature.separate")
3236 layout.operator("armature.subdivide", text="Subdivide")
3237 layout.operator("armature.switch_direction", text="Switch Direction")
3241 layout.operator_context = 'EXEC_AREA'
3242 layout.operator("armature.symmetrize")
3243 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
3244 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
3245 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
3246 layout.operator("armature.flip_names")
3250 layout.operator_context = 'INVOKE_DEFAULT'
3251 layout.operator("armature.armature_layers")
3252 layout.operator("armature.bone_layers")
3256 layout.menu("VIEW3D_MT_edit_armature_parent")
3260 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
3263 class VIEW3D_MT_armature_specials(Menu):
3264 bl_label = "Specials"
3266 def draw(self, context):
3267 layout = self.layout
3269 layout.operator_context = 'INVOKE_REGION_WIN'
3271 layout.operator("armature.subdivide", text="Subdivide")
3272 layout.operator("armature.switch_direction", text="Switch Direction")
3276 layout.operator_context = 'EXEC_REGION_WIN'
3277 layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
3278 layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
3279 layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
3280 layout.operator("armature.flip_names", text="Flip Names")
3281 layout.operator("armature.symmetrize")
3284 class VIEW3D_MT_edit_armature_parent(Menu):
3287 def draw(self, context):
3288 layout = self.layout
3290 layout.operator("armature.parent_set", text="Make")
3291 layout.operator("armature.parent_clear", text="Clear")
3294 class VIEW3D_MT_edit_armature_roll(Menu):
3295 bl_label = "Bone Roll"
3297 def draw(self, context):
3298 layout = self.layout
3300 layout.operator_menu_enum("armature.calculate_roll", "type")
3304 layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
3305 layout.operator("armature.roll_clear")
3308 class VIEW3D_MT_edit_armature_delete(Menu):
3311 def draw(self, context):
3312 layout = self.layout
3314 layout.operator("armature.delete", text="Delete Bones")
3318 layout.operator("armature.dissolve", text="Dissolve")
3321 # ********** GPencil Stroke Edit menu **********
3324 class VIEW3D_MT_edit_gpencil(Menu):
3325 bl_label = "GPencil"
3327 def draw(self, context):
3328 toolsettings = context.tool_settings
3330 layout = self.layout
3332 layout.menu("VIEW3D_MT_undo_redo")
3336 layout.menu("VIEW3D_MT_edit_gpencil_delete")
3340 layout.menu("VIEW3D_MT_edit_gpencil_transform")
3341 layout.operator("transform.mirror", text="Mirror")
3342 layout.menu("GPENCIL_MT_snap")
3346 layout.operator("gpencil.brush_paint", text="Sculpt Strokes").wait_for_input = True
3347 layout.prop_menu_enum(toolsettings.gpencil_sculpt, "tool", text="Sculpt Brush")
3351 layout.menu("VIEW3D_MT_object_animation") # NOTE: provides keyingset access...
3352 layout.menu("VIEW3D_MT_edit_gpencil_interpolate")
3356 layout.operator("gpencil.duplicate_move", text="Duplicate")
3357 layout.operator("gpencil.stroke_subdivide", text="Subdivide")
3361 layout.operator_menu_enum("gpencil.stroke_join", "type", text="Join...")
3362 layout.operator("gpencil.stroke_flip", text="Flip Direction")
3366 layout.operator("gpencil.copy", text="Copy")
3367 layout.operator("gpencil.paste", text="Paste")
3371 layout.menu("VIEW3D_MT_edit_proportional")
3375 layout.operator("gpencil.reveal")
3376 layout.operator("gpencil.hide", text="Show Active Layer Only").unselected = True
3377 layout.operator("gpencil.hide", text="Hide Active Layer").unselected = False
3381 layout.operator_menu_enum("gpencil.move_to_layer", "layer", text="Move to Layer")
3382 layout.operator("gpencil.stroke_change_color", text="Move to Color")
3383 layout.operator_menu_enum("gpencil.stroke_arrange", "direction", text="Arrange Strokes...")
3387 layout.operator_menu_enum("gpencil.convert", "type", text="Convert to Geometry...")
3390 class VIEW3D_MT_edit_gpencil_transform(Menu):
3391 bl_label = "Transform"
3393 def draw(self, context):
3394 layout = self.layout
3396 layout.operator("transform.translate")
3397 layout.operator("transform.rotate")
3398 layout.operator("transform.resize", text="Scale")
3402 layout.operator("transform.bend", text="Bend")
3403 layout.operator("transform.shear", text="Shear")
3404 layout.operator("transform.tosphere", text="To Sphere")
3405 layout.operator("transform.transform", text="Shrink Fatten").mode = 'GPENCIL_SHRINKFATTEN'
3409 layout.operator("gpencil.reproject")
3412 class VIEW3D_MT_edit_gpencil_interpolate(Menu):
3413 bl_label = "Interpolate"
3415 def draw(self, context):
3416 layout = self.layout
3418 layout.operator("gpencil.interpolate", text="Interpolate")
3419 layout.operator("gpencil.interpolate_sequence", text="Sequence")
3422 # ********** Panel **********
3425 class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
3426 bl_space_type = 'VIEW_3D'
3427 bl_region_type = 'UI'
3429 # NOTE: this is just a wrapper around the generic GP Panel
3432 class VIEW3D_PT_grease_pencil_palettecolor(GreasePencilPaletteColorPanel, Panel):
3433 bl_space_type = 'VIEW_3D'
3434 bl_region_type = 'UI'
3436 # NOTE: this is just a wrapper around the generic GP Panel
3439 class VIEW3D_PT_view3d_properties(Panel):
3440 bl_space_type = 'VIEW_3D'
3441 bl_region_type = 'UI'
3445 def poll(cls, context):
3446 view = context.space_data
3449 def draw(self, context):
3450 layout = self.layout
3452 view = context.space_data
3454 col = layout.column()
3455 col.active = bool(view.region_3d.view_perspective != 'CAMERA' or view.region_quadviews)
3456 col.prop(view, "lens")
3457 col.label(text="Lock to Object:")
3458 col.prop(view, "lock_object", text="")
3459 lock_object = view.lock_object
3461 if lock_object.type == 'ARMATURE':
3462 col.prop_search(view, "lock_bone", lock_object.data,
3463 "edit_bones" if lock_object.mode == 'EDIT'
3467 col.prop(view, "lock_cursor", text="Lock to Cursor")
3469 col = layout.column()
3470 col.prop(view, "lock_camera")
3472 col = layout.column(align=True)
3473 col.label(text="Clip:")
3474 col.prop(view, "clip_start", text="Start")
3475 col.prop(view, "clip_end", text="End")
3477 subcol = col.column(align=True)
3478 subcol.enabled = not view.lock_camera_and_layers
3479 subcol.label(text="Local Camera:")
3480 subcol.prop(view, "camera", text="")
3482 col = layout.column(align=True)
3483 col.prop(view, "use_render_border")
3484 col.active = view.region_3d.view_perspective != 'CAMERA'
3487 class VIEW3D_PT_view3d_cursor(Panel):
3488 bl_space_type = 'VIEW_3D'
3489 bl_region_type = 'UI'
3490 bl_label = "3D Cursor"
3493 def poll(cls, context):
3494 view = context.space_data
3495 return (view is not None)
3497 def draw(self, context):
3498 layout = self.layout
3500 view = context.space_data
3501 layout.column().prop(view, "cursor_location", text="Location")
3504 class VIEW3D_PT_view3d_name(Panel):
3505 bl_space_type = 'VIEW_3D'
3506 bl_region_type = 'UI'
3510 def poll(cls, context):
3511 return (context.space_data and context.active_object)
3513 def draw(self, context):
3514 layout = self.layout
3516 ob = context.active_object
3518 row.label(text="", icon='OBJECT_DATA')
3519 row.prop(ob, "name", text="")
3521 if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
3522 bone = context.active_bone
3525 row.label(text="", icon='BONE_DATA')
3526 row.prop(bone, "name", text="")
3529 class VIEW3D_PT_shading(Panel):
3530 bl_space_type = 'VIEW_3D'
3531 bl_region_type = 'UI'
3532 bl_label = "Shading"
3535 def poll(cls, context):
3538 def draw(self, context):
3539 layout = self.layout
3541 view = context.space_data
3542 shading = view.shading
3544 col = layout.column()
3545 col.prop(shading, "type", expand=True)
3547 if shading.type == 'SOLID':
3549 col.row().prop(shading, "light", expand=True)
3552 col.prop(shading, "show_random_object_colors")
3553 col.prop(shading, "show_object_overlap")
3555 if shading.light == 'STUDIO':
3556 # TODO: don't store these settings in the scene
3557 scene = context.scene
3558 props = scene.layer_properties['BLENDER_WORKBENCH']
3563 sub.label(text="Left/Right:")
3564 row = sub.row(align=True)
3565 row.prop(props, "diffuse_light_x_neg", text="")
3566 row.prop(props, "diffuse_light_x_pos", text="")
3569 sub.label(text="Up/Down:")
3570 row = sub.row(align=True)
3571 row.prop(props, "diffuse_light_y_neg", text="")
3572 row.prop(props, "diffuse_light_y_pos", text="")
3575 sub.label(text="Front/Back:")
3576 row = sub.row(align=True)
3577 row.prop(props, "diffuse_light_z_neg", text="")
3578 row.prop(props, "diffuse_light_z_pos", text="")
3581 class VIEW3D_PT_overlay(Panel):
3582 bl_space_type = 'VIEW_3D'
3583 bl_region_type = 'UI'
3584 bl_label = "Overlay"
3587 def poll(cls, context):
3590 def draw(self, context):
3591 layout = self.layout
3593 view = context.space_data
3594 overlay = view.overlay
3595 shading = view.shading
3596 scene = context.scene
3598 col = layout.column()
3599 col.prop(overlay, "show_overlays")
3602 col.prop(view, "show_world")