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 (
26 from .properties_paint_common import (
29 from .properties_grease_pencil_common import (
32 GreasePencilMaterialsPanel,
34 from bpy.app.translations import contexts as i18n_contexts
37 class VIEW3D_HT_header(Header):
38 bl_space_type = 'VIEW_3D'
40 def draw(self, context):
43 view = context.space_data
44 shading = view.shading
45 # mode_string = context.mode
46 obj = context.active_object
47 overlay = view.overlay
48 tool_settings = context.tool_settings
50 row = layout.row(align=True)
53 object_mode = 'OBJECT' if obj is None else obj.mode
55 act_mode_item = bpy.types.Object.bl_rna.properties["mode"].enum_items[object_mode]
61 sub.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
64 layout.template_header_3D_mode()
66 # Contains buttons like Mode, Pivot, Layer, Mesh Select Mode...
69 if object_mode == 'PARTICLE_EDIT':
71 row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True)
74 if obj and obj.type == 'GPENCIL' and context.gpencil_data:
75 gpd = context.gpencil_data
77 if gpd.is_stroke_paint_mode:
79 sub = row.row(align=True)
80 sub.prop(tool_settings, "use_gpencil_draw_onback", text="", icon='MOD_OPACITY')
81 sub.separator(factor=0.4)
82 sub.prop(tool_settings, "use_gpencil_weight_data_add", text="", icon='WPAINT_HLT')
83 sub.separator(factor=0.4)
84 sub.prop(tool_settings, "use_gpencil_draw_additive", text="", icon='FREEZE')
86 if gpd.use_stroke_edit_mode:
87 row = layout.row(align=True)
88 row.prop(tool_settings, "gpencil_selectmode", text="", expand=True)
90 if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode:
91 row = layout.row(align=True)
93 if gpd.is_stroke_sculpt_mode:
94 row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="")
97 row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING')
99 sub = row.row(align=True)
100 sub.active = gpd.use_multiedit
102 panel="VIEW3D_PT_gpencil_multi_frame",
106 if gpd.use_stroke_edit_mode:
107 row = layout.row(align=True)
108 row.prop(tool_settings.gpencil_sculpt, "use_select_mask", text="")
111 panel="VIEW3D_PT_tools_grease_pencil_interpolate",
115 VIEW3D_MT_editor_menus.draw_collapsible(context, layout)
117 layout.separator_spacer()
119 # Mode & Transform Settings
120 scene = context.scene
123 if object_mode in {'OBJECT', 'EDIT', 'POSE', 'EDIT_GPENCIL'}:
124 orient_slot = scene.transform_orientation_slots[0]
125 custom_orientation = orient_slot.custom_orientation
126 trans_name, trans_icon = orient_slot.ui_info()
128 row = layout.row(align=True)
133 panel="VIEW3D_PT_transform_orientations",
135 icon_value=trans_icon,
143 if object_mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT',
144 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}:
148 from .properties_paint_common import UnifiedPaintPanel
149 paint_settings = UnifiedPaintPanel.paint_settings(context)
152 brush = paint_settings.brush
153 if brush and brush.stroke_method == 'CURVE':
157 snap_items = bpy.types.ToolSettings.bl_rna.properties["snap_elements"].enum_items
158 snap_elements = tool_settings.snap_elements
159 if len(snap_elements) == 1:
161 for elem in snap_elements:
162 icon = snap_items[elem].icon
167 del snap_items, snap_elements
169 row = layout.row(align=True)
170 row.prop(tool_settings, "use_snap", text="")
172 sub = row.row(align=True)
174 panel="VIEW3D_PT_snapping",
179 # Proportional editing
181 gpd = context.gpencil_data
182 if object_mode in {'EDIT', 'PARTICLE_EDIT'}:
183 row = layout.row(align=True)
184 row.prop(tool_settings, "proportional_edit", icon_only=True)
185 sub = row.row(align=True)
186 sub.active = tool_settings.proportional_edit != 'DISABLED'
187 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
189 elif object_mode == 'OBJECT':
190 row = layout.row(align=True)
191 row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
192 sub = row.row(align=True)
193 sub.active = tool_settings.use_proportional_edit_objects
194 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
196 elif gpd is not None and obj.type == 'GPENCIL':
197 if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode:
198 row = layout.row(align=True)
199 row.prop(tool_settings, "proportional_edit", icon_only=True)
201 sub = row.row(align=True)
202 sub.active = tool_settings.proportional_edit != 'DISABLED'
203 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
205 if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
206 row = layout.row(align=True)
207 row.prop(tool_settings, "proportional_edit", icon_only=True)
208 sub = row.row(align=True)
209 sub.active = tool_settings.proportional_edit != 'DISABLED'
210 sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
213 if object_mode in {'OBJECT', 'EDIT', 'POSE', 'EDIT_GPENCIL', 'SCULPT_GPENCIL'}:
214 pivot_point = tool_settings.transform_pivot_point
215 act_pivot_point = bpy.types.ToolSettings.bl_rna.properties["transform_pivot_point"].enum_items[pivot_point]
216 row = layout.row(align=True)
218 panel="VIEW3D_PT_pivot_point",
219 icon=act_pivot_point.icon,
223 if object_mode == 'PAINT_GPENCIL':
224 origin = tool_settings.gpencil_stroke_placement_view3d
225 gp_origin = tool_settings.bl_rna.properties["gpencil_stroke_placement_view3d"].enum_items[origin]
227 or_icon = getattr(gp_origin, "icon", "BLANK1")
228 or_name = getattr(gp_origin, "name", "Stroke Placement")
230 panel="VIEW3D_PT_gpencil_origin",
235 if object_mode in {'PAINT_GPENCIL', 'SCULPT_GPENCIL'}:
236 lock = tool_settings.gpencil_sculpt.lock_axis
237 gp_lock = tool_settings.gpencil_sculpt.bl_rna.properties["lock_axis"].enum_items[lock]
239 lk_icon = getattr(gp_lock, "icon", "BLANK1")
240 lk_name = getattr(gp_lock, "name", "None")
242 row.enabled = tool_settings.gpencil_stroke_placement_view3d in {'ORIGIN', 'CURSOR'}
244 panel="VIEW3D_PT_gpencil_lock",
249 if object_mode in {'PAINT_GPENCIL'}:
250 if context.workspace.tools.from_space_view3d_mode(object_mode).name == "Draw":
251 settings = tool_settings.gpencil_sculpt.guide
252 row = layout.row(align=True)
253 row.prop(settings, "use_guide", text="", icon='GRID')
254 sub = row.row(align=True)
255 sub.active = settings.use_guide
257 panel="VIEW3D_PT_gpencil_guide",
261 layout.separator_spacer()
263 # Collection Visibility
265 panel="VIEW3D_PT_collections",
272 panel="VIEW3D_PT_object_type_visibility",
273 icon_value=view.icon_from_show_object_viewport,
277 row = layout.row(align=True)
278 row.prop(overlay, "show_overlays", icon='OVERLAY', text="")
279 sub = row.row(align=True)
280 sub.active = overlay.show_overlays
281 sub.popover(panel="VIEW3D_PT_overlay")
284 row.active = (shading.type in {'WIREFRAME', 'SOLID'}) or object_mode in {'EDIT'}
286 if shading.type == 'WIREFRAME':
287 row.prop(shading, "show_xray_wireframe", text="", icon='XRAY')
289 row.prop(shading, "show_xray", text="", icon='XRAY')
291 row = layout.row(align=True)
292 row.prop(shading, "type", text="", expand=True)
293 sub = row.row(align=True)
294 # TODO, currently render shading type ignores mesh two-side, until it's supported
295 # show the shading popover which shows double-sided option.
297 # sub.enabled = shading.type != 'RENDERED'
298 sub.popover(panel="VIEW3D_PT_shading")
301 class VIEW3D_MT_editor_menus(Menu):
302 bl_space_type = 'VIEW3D_MT_editor_menus'
305 def draw(self, context):
307 obj = context.active_object
308 mode_string = context.mode
309 edit_object = context.edit_object
310 gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}
312 layout.menu("VIEW3D_MT_view")
316 if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
317 layout.menu("VIEW3D_MT_select_gpencil")
318 elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
320 if mesh.use_paint_mask:
321 layout.menu("VIEW3D_MT_select_paint_mask")
322 elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
323 layout.menu("VIEW3D_MT_select_paint_mask_vertex")
324 elif mode_string != 'SCULPT':
325 layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
329 elif mode_string == 'OBJECT':
330 layout.menu("VIEW3D_MT_add", text="Add")
331 elif mode_string == 'EDIT_MESH':
332 layout.menu("VIEW3D_MT_mesh_add", text="Add")
333 elif mode_string == 'EDIT_CURVE':
334 layout.menu("VIEW3D_MT_curve_add", text="Add")
335 elif mode_string == 'EDIT_SURFACE':
336 layout.menu("VIEW3D_MT_surface_add", text="Add")
337 elif mode_string == 'EDIT_METABALL':
338 layout.menu("VIEW3D_MT_metaball_add", text="Add")
339 elif mode_string == 'EDIT_ARMATURE':
340 layout.menu("TOPBAR_MT_edit_armature_add", text="Add")
343 if obj and obj.mode == 'PAINT_GPENCIL':
344 layout.menu("VIEW3D_MT_paint_gpencil")
345 elif obj and obj.mode == 'EDIT_GPENCIL':
346 layout.menu("VIEW3D_MT_edit_gpencil")
347 elif obj and obj.mode == 'WEIGHT_GPENCIL':
348 layout.menu("VIEW3D_MT_weight_gpencil")
351 layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
353 if mode_string == 'EDIT_MESH':
354 layout.menu("VIEW3D_MT_edit_mesh_vertices")
355 layout.menu("VIEW3D_MT_edit_mesh_edges")
356 layout.menu("VIEW3D_MT_edit_mesh_faces")
357 layout.menu("VIEW3D_MT_uv_map", text="UV")
358 elif mode_string in {'EDIT_CURVE', 'EDIT_SURFACE'}:
359 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
360 layout.menu("VIEW3D_MT_edit_curve_segments")
363 if mode_string != 'PAINT_TEXTURE':
364 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
365 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
366 layout.menu("VIEW3D_MT_brush")
367 if mode_string == 'SCULPT':
368 layout.menu("VIEW3D_MT_hide_mask")
370 layout.menu("VIEW3D_MT_object")
373 # ********** Menu **********
376 # ********** Utilities **********
380 bl_label = "Show/Hide"
383 def draw(self, context):
386 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
387 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
388 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
391 # Standard transforms which apply to all cases
392 # NOTE: this doesn't seem to be able to be used directly
393 class VIEW3D_MT_transform_base(Menu):
394 bl_label = "Transform"
397 # TODO: get rid of the custom text strings?
398 def draw(self, context):
401 layout.operator("transform.tosphere", text="To Sphere")
402 layout.operator("transform.shear", text="Shear")
403 layout.operator("transform.bend", text="Bend")
404 layout.operator("transform.push_pull", text="Push/Pull")
406 if context.mode != 'OBJECT':
407 layout.operator("transform.vertex_warp", text="Warp")
408 layout.operator("transform.vertex_random", text="Randomize")
411 # Generic transform menu - geometry types
412 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
413 def draw(self, context):
415 VIEW3D_MT_transform_base.draw(self, context)
419 layout.operator("transform.shrink_fatten", text="Shrink Fatten")
423 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
424 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
427 # Object-specific extensions to Transform menu
428 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
429 def draw(self, context):
433 VIEW3D_MT_transform_base.draw(self, context)
435 # object-specific option follow...
438 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
439 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
443 layout.operator_context = 'EXEC_REGION_WIN'
444 # XXX see alignmenu() in edit.c of b2.4x to get this working
445 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN'
449 layout.operator("object.randomize_transform")
450 layout.operator("object.align")
452 # TODO: there is a strange context bug here.
454 layout.operator_context = 'INVOKE_REGION_WIN'
455 layout.operator("object.transform_axis_target")
459 # Armature EditMode extensions to Transform menu
460 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
461 def draw(self, context):
465 VIEW3D_MT_transform_base.draw(self, context)
467 # armature specific extensions follow...
469 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
470 if obj.data.display_type == 'BBONE':
473 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
474 elif obj.data.display_type == 'ENVELOPE':
477 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
478 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
480 if context.edit_object and context.edit_object.type == 'ARMATURE':
483 layout.operator("armature.align")
486 class VIEW3D_MT_mirror(Menu):
489 def draw(self, context):
492 layout.operator("transform.mirror", text="Interactive Mirror")
496 layout.operator_context = 'INVOKE_REGION_WIN'
498 props = layout.operator("transform.mirror", text="X Global")
499 props.constraint_axis = (True, False, False)
500 props.constraint_orientation = 'GLOBAL'
501 props = layout.operator("transform.mirror", text="Y Global")
502 props.constraint_axis = (False, True, False)
503 props.constraint_orientation = 'GLOBAL'
504 props = layout.operator("transform.mirror", text="Z Global")
505 props.constraint_axis = (False, False, True)
506 props.constraint_orientation = 'GLOBAL'
508 if context.edit_object:
511 props = layout.operator("transform.mirror", text="X Local")
512 props.constraint_axis = (True, False, False)
513 props.constraint_orientation = 'LOCAL'
514 props = layout.operator("transform.mirror", text="Y Local")
515 props.constraint_axis = (False, True, False)
516 props.constraint_orientation = 'LOCAL'
517 props = layout.operator("transform.mirror", text="Z Local")
518 props.constraint_axis = (False, False, True)
519 props.constraint_orientation = 'LOCAL'
521 layout.operator("object.vertex_group_mirror")
524 class VIEW3D_MT_snap(Menu):
527 def draw(self, context):
530 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
531 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
532 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Keep Offset)").use_offset = True
533 layout.operator("view3d.snap_selected_to_active", text="Selection to Active")
537 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
538 layout.operator("view3d.snap_cursor_to_center", text="Cursor to World Origin")
539 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
540 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
543 class VIEW3D_MT_uv_map(Menu):
544 bl_label = "UV Mapping"
546 def draw(self, context):
549 layout.operator("uv.unwrap")
551 layout.operator_context = 'INVOKE_DEFAULT'
552 layout.operator("uv.smart_project")
553 layout.operator("uv.lightmap_pack")
554 layout.operator("uv.follow_active_quads")
558 layout.operator_context = 'EXEC_REGION_WIN'
559 layout.operator("uv.cube_project")
560 layout.operator("uv.cylinder_project")
561 layout.operator("uv.sphere_project")
565 layout.operator_context = 'INVOKE_REGION_WIN'
566 layout.operator("uv.project_from_view").scale_to_bounds = False
567 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
571 layout.operator("mesh.mark_seam").clear = False
572 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
576 layout.operator("uv.reset")
579 class VIEW3D_MT_edit_proportional(Menu):
580 bl_label = "Proportional Editing"
582 def draw(self, context):
585 layout.props_enum(tool_settings, "proportional_edit")
589 layout.label(text="Falloff:")
590 layout.props_enum(tool_settings, "proportional_edit_falloff")
593 # ********** View menus **********
596 class VIEW3D_MT_view(Menu):
599 def draw(self, context):
601 view = context.space_data
603 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
604 layout.operator("view3d.properties", icon='MENU_PANEL')
608 layout.operator("view3d.view_selected", text="Frame Selected").use_all_regions = False
609 if view.region_quadviews:
610 layout.operator("view3d.view_selected", text="Frame Selected (Quad View)").use_all_regions = True
612 layout.operator("view3d.view_all", text="Frame All").center = False
613 layout.operator("view3d.view_persportho", text="Perspective/Orthographic")
614 layout.menu("VIEW3D_MT_view_local")
618 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
621 layout.menu("VIEW3D_MT_view_viewpoint")
622 layout.menu("VIEW3D_MT_view_navigation")
623 layout.menu("VIEW3D_MT_view_align")
627 layout.operator_context = 'INVOKE_REGION_WIN'
628 layout.menu("VIEW3D_MT_view_borders", text="View Borders")
632 layout.operator("screen.animation_play", text="Play Animation")
636 layout.operator("render.opengl", icon='RENDER_STILL')
637 layout.operator("render.opengl", text="Viewport Render Animation", icon='RENDER_ANIMATION').animation = True
641 layout.menu("INFO_MT_area")
644 class VIEW3D_MT_view_local(Menu):
645 bl_label = "Local View"
647 def draw(self, context):
649 view = context.space_data
651 layout.operator("view3d.localview", text="Toggle Local View")
652 layout.operator("view3d.localview_remove_from")
655 class VIEW3D_MT_view_cameras(Menu):
658 def draw(self, context):
661 layout.operator("view3d.object_as_camera")
662 layout.operator("view3d.view_camera", text="Active Camera")
665 class VIEW3D_MT_view_viewpoint(Menu):
666 bl_label = "Viewpoint"
668 def draw(self, context):
671 layout.operator("view3d.view_camera", text="Camera")
675 layout.operator("view3d.view_axis", text="Top").type = 'TOP'
676 layout.operator("view3d.view_axis", text="Bottom").type = 'BOTTOM'
680 layout.operator("view3d.view_axis", text="Front").type = 'FRONT'
681 layout.operator("view3d.view_axis", text="Back").type = 'BACK'
685 layout.operator("view3d.view_axis", text="Right").type = 'RIGHT'
686 layout.operator("view3d.view_axis", text="Left").type = 'LEFT'
689 class VIEW3D_MT_view_navigation(Menu):
690 bl_label = "Navigation"
692 def draw(self, context):
696 layout.operator_enum("view3d.view_orbit", "type")
697 props = layout.operator("view3d.view_orbit", text="Orbit Opposite")
698 props.type = 'ORBITRIGHT'
703 layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
704 layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
708 layout.operator_enum("view3d.view_pan", "type")
712 layout.operator("view3d.zoom", text="Zoom In").delta = 1
713 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
714 layout.operator("view3d.zoom_border", text="Zoom Border...")
715 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
719 layout.operator("view3d.fly")
720 layout.operator("view3d.walk")
723 class VIEW3D_MT_view_align(Menu):
724 bl_label = "Align View"
726 def draw(self, context):
729 layout.menu("VIEW3D_MT_view_align_selected")
733 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
734 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
738 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
739 layout.operator("view3d.view_center_cursor")
743 layout.operator("view3d.view_lock_to_active")
744 layout.operator("view3d.view_lock_clear")
747 class VIEW3D_MT_view_align_selected(Menu):
748 bl_label = "Align View to Active"
750 def draw(self, context):
753 props = layout.operator("view3d.view_axis", text="Top")
754 props.align_active = True
757 props = layout.operator("view3d.view_axis", text="Bottom")
758 props.align_active = True
759 props.type = 'BOTTOM'
763 props = layout.operator("view3d.view_axis", text="Front")
764 props.align_active = True
767 props = layout.operator("view3d.view_axis", text="Back")
768 props.align_active = True
773 props = layout.operator("view3d.view_axis", text="Right")
774 props.align_active = True
777 props = layout.operator("view3d.view_axis", text="Left")
778 props.align_active = True
782 class VIEW3D_MT_view_borders(Menu):
783 bl_label = "View Borders"
785 def draw(self, context):
787 layout.operator("view3d.clip_border", text="Clipping Border...")
788 layout.operator("view3d.render_border", text="Render Border...")
792 layout.operator("view3d.clear_render_border")
795 # ********** Select menus, suffix from context.mode **********
797 class VIEW3D_MT_select_object_more_less(Menu):
798 bl_label = "Select More/Less"
800 def draw(self, context):
805 layout.operator("object.select_more", text="More")
806 layout.operator("object.select_less", text="Less")
810 props = layout.operator("object.select_hierarchy", text="Parent")
812 props.direction = 'PARENT'
814 props = layout.operator("object.select_hierarchy", text="Child")
816 props.direction = 'CHILD'
820 props = layout.operator("object.select_hierarchy", text="Extend Parent")
822 props.direction = 'PARENT'
824 props = layout.operator("object.select_hierarchy", text="Extend Child")
826 props.direction = 'CHILD'
829 class VIEW3D_MT_select_object(Menu):
832 def draw(self, context):
835 layout.operator("object.select_all", text="All").action = 'SELECT'
836 layout.operator("object.select_all", text="None").action = 'DESELECT'
837 layout.operator("object.select_all", text="Invert").action = 'INVERT'
841 layout.operator("view3d.select_box")
842 layout.operator("view3d.select_circle")
846 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
847 layout.operator("object.select_camera", text="Select Active Camera")
848 layout.operator("object.select_mirror", text="Mirror Selection")
849 layout.operator("object.select_random", text="Select Random")
853 layout.menu("VIEW3D_MT_select_object_more_less")
857 layout.operator_menu_enum("object.select_grouped", "type", text="Select Grouped")
858 layout.operator_menu_enum("object.select_linked", "type", text="Select Linked")
859 layout.operator("object.select_pattern", text="Select Pattern...")
862 class VIEW3D_MT_select_pose_more_less(Menu):
863 bl_label = "Select More/Less"
865 def draw(self, context):
870 props = layout.operator("pose.select_hierarchy", text="Parent")
872 props.direction = 'PARENT'
874 props = layout.operator("pose.select_hierarchy", text="Child")
876 props.direction = 'CHILD'
880 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
882 props.direction = 'PARENT'
884 props = layout.operator("pose.select_hierarchy", text="Extend Child")
886 props.direction = 'CHILD'
889 class VIEW3D_MT_select_pose(Menu):
892 def draw(self, context):
895 layout.operator("pose.select_all", text="All").action = 'SELECT'
896 layout.operator("pose.select_all", text="None").action = 'DESELECT'
897 layout.operator("pose.select_all", text="Invert").action = 'INVERT'
901 layout.operator("view3d.select_box")
902 layout.operator("view3d.select_circle")
906 layout.operator("pose.select_mirror", text="Flip Active")
910 layout.operator("pose.select_constraint_target", text="Constraint Target")
911 layout.operator("pose.select_linked", text="Linked")
915 layout.menu("VIEW3D_MT_select_pose_more_less")
919 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
920 layout.operator("object.select_pattern", text="Select Pattern...")
923 class VIEW3D_MT_select_particle(Menu):
926 def draw(self, context):
929 layout.operator("particle.select_all", text="All").action = 'SELECT'
930 layout.operator("particle.select_all", text="None").action = 'DESELECT'
931 layout.operator("particle.select_all", text="Invert").action = 'INVERT'
935 layout.operator("view3d.select_box")
936 layout.operator("view3d.select_circle")
940 layout.operator("particle.select_linked")
944 layout.operator("particle.select_more")
945 layout.operator("particle.select_less")
949 layout.operator("particle.select_random")
953 layout.operator("particle.select_roots", text="Roots")
954 layout.operator("particle.select_tips", text="Tips")
957 class VIEW3D_MT_edit_mesh_select_similar(Menu):
958 bl_label = "Select Similar"
960 def draw(self, context):
963 layout.operator_enum("mesh.select_similar", "type")
967 layout.operator("mesh.select_similar_region", text="Face Regions")
970 class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
971 bl_label = "Select All by Trait"
973 def draw(self, context):
975 tool_settings = context.tool_settings
976 if tool_settings.mesh_select_mode[2] is False:
977 layout.operator("mesh.select_non_manifold", text="Non Manifold")
978 layout.operator("mesh.select_loose", text="Loose Geometry")
979 layout.operator("mesh.select_interior_faces", text="Interior Faces")
980 layout.operator("mesh.select_face_by_sides", text="Faces by Sides")
984 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
987 class VIEW3D_MT_edit_mesh_select_more_less(Menu):
988 bl_label = "Select More/Less"
990 def draw(self, context):
993 layout.operator("mesh.select_more", text="More")
994 layout.operator("mesh.select_less", text="Less")
998 layout.operator("mesh.select_next_item", text="Next Active")
999 layout.operator("mesh.select_prev_item", text="Previous Active")
1002 class VIEW3D_MT_edit_mesh_select_linked(Menu):
1003 bl_label = "Select Linked"
1005 def draw(self, context):
1006 layout = self.layout
1008 layout.operator("mesh.select_linked", text="Linked")
1009 layout.operator("mesh.shortest_path_select", text="Shortest Path")
1010 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
1013 class VIEW3D_MT_edit_mesh_select_loops(Menu):
1014 bl_label = "Select Loops"
1016 def draw(self, context):
1017 layout = self.layout
1019 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
1020 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
1024 layout.operator("mesh.loop_to_region")
1025 layout.operator("mesh.region_to_loop")
1028 class VIEW3D_MT_select_edit_mesh(Menu):
1031 def draw(self, context):
1032 layout = self.layout
1035 layout.operator("mesh.select_all", text="All").action = 'SELECT'
1036 layout.operator("mesh.select_all", text="None").action = 'DESELECT'
1037 layout.operator("mesh.select_all", text="Invert").action = 'INVERT'
1041 layout.operator("view3d.select_box")
1042 layout.operator("view3d.select_circle")
1047 layout.operator("mesh.select_random", text="Select Random")
1048 layout.operator("mesh.select_nth")
1053 layout.operator("mesh.edges_select_sharp", text="Select Sharp Edges")
1058 layout.menu("VIEW3D_MT_edit_mesh_select_similar")
1062 layout.menu("VIEW3D_MT_edit_mesh_select_by_trait")
1066 layout.menu("VIEW3D_MT_edit_mesh_select_more_less")
1070 layout.menu("VIEW3D_MT_edit_mesh_select_loops")
1074 layout.menu("VIEW3D_MT_edit_mesh_select_linked")
1078 layout.operator("mesh.select_axis", text="Side of Active")
1079 layout.operator("mesh.select_mirror", text="Mirror Selection")
1082 class VIEW3D_MT_select_edit_curve(Menu):
1085 def draw(self, context):
1086 layout = self.layout
1088 layout.operator("curve.select_all", text="All").action = 'SELECT'
1089 layout.operator("curve.select_all", text="None").action = 'DESELECT'
1090 layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1094 layout.operator("view3d.select_box")
1095 layout.operator("view3d.select_circle")
1099 layout.operator("curve.select_random")
1100 layout.operator("curve.select_nth")
1101 layout.operator("curve.select_linked", text="Select Linked")
1102 layout.operator("curve.select_similar", text="Select Similar")
1106 layout.operator("curve.de_select_first")
1107 layout.operator("curve.de_select_last")
1108 layout.operator("curve.select_next")
1109 layout.operator("curve.select_previous")
1113 layout.operator("curve.select_more")
1114 layout.operator("curve.select_less")
1117 class VIEW3D_MT_select_edit_surface(Menu):
1120 def draw(self, context):
1121 layout = self.layout
1123 layout.operator("curve.select_all", text="All").action = 'SELECT'
1124 layout.operator("curve.select_all", text="None").action = 'DESELECT'
1125 layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1129 layout.operator("view3d.select_box")
1130 layout.operator("view3d.select_circle")
1134 layout.operator("curve.select_random")
1135 layout.operator("curve.select_nth")
1136 layout.operator("curve.select_linked", text="Select Linked")
1137 layout.operator("curve.select_similar", text="Select Similar")
1141 layout.operator("curve.select_row")
1145 layout.operator("curve.select_more")
1146 layout.operator("curve.select_less")
1149 class VIEW3D_MT_select_edit_text(Menu):
1150 # intentional name mismatch
1151 # select menu for 3d-text doesn't make sense
1154 def draw(self, context):
1155 layout = self.layout
1157 layout.operator("font.text_cut", text="Cut")
1158 layout.operator("font.text_copy", text="Copy", icon='COPYDOWN')
1159 layout.operator("font.text_paste", text="Paste", icon='PASTEDOWN')
1163 layout.operator("font.text_paste_from_file")
1167 layout.operator("font.select_all")
1170 class VIEW3D_MT_select_edit_metaball(Menu):
1173 def draw(self, context):
1174 layout = self.layout
1176 layout.operator("mball.select_all", text="All").action = 'SELECT'
1177 layout.operator("mball.select_all", text="None").action = 'DESELECT'
1178 layout.operator("mball.select_all", text="Invert").action = 'INVERT'
1182 layout.operator("view3d.select_box")
1183 layout.operator("view3d.select_circle")
1187 layout.operator("mball.select_random_metaelems")
1191 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
1194 class VIEW3D_MT_select_edit_lattice(Menu):
1197 def draw(self, context):
1198 layout = self.layout
1200 layout.operator("lattice.select_all", text="All").action = 'SELECT'
1201 layout.operator("lattice.select_all", text="None").action = 'DESELECT'
1202 layout.operator("lattice.select_all", text="Invert").action = 'INVERT'
1206 layout.operator("view3d.select_box")
1207 layout.operator("view3d.select_circle")
1211 layout.operator("lattice.select_mirror")
1212 layout.operator("lattice.select_random")
1216 layout.operator("lattice.select_more")
1217 layout.operator("lattice.select_less")
1221 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
1224 class VIEW3D_MT_select_edit_armature(Menu):
1227 def draw(self, context):
1228 layout = self.layout
1230 layout.operator("armature.select_all", text="All").action = 'SELECT'
1231 layout.operator("armature.select_all", text="None").action = 'DESELECT'
1232 layout.operator("armature.select_all", text="Invert").action = 'INVERT'
1236 layout.operator("view3d.select_box")
1237 layout.operator("view3d.select_circle")
1241 layout.operator("armature.select_mirror", text="Mirror").extend = False
1245 layout.operator("armature.select_more", text="More")
1246 layout.operator("armature.select_less", text="Less")
1250 props = layout.operator("armature.select_hierarchy", text="Parent")
1251 props.extend = False
1252 props.direction = 'PARENT'
1254 props = layout.operator("armature.select_hierarchy", text="Child")
1255 props.extend = False
1256 props.direction = 'CHILD'
1260 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
1262 props.direction = 'PARENT'
1264 props = layout.operator("armature.select_hierarchy", text="Extend Child")
1266 props.direction = 'CHILD'
1268 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
1269 layout.operator("object.select_pattern", text="Select Pattern...")
1272 class VIEW3D_MT_select_gpencil(Menu):
1275 def draw(self, context):
1276 layout = self.layout
1278 layout.operator("gpencil.select_all", text="All").action = 'SELECT'
1279 layout.operator("gpencil.select_all", text="None").action = 'DESELECT'
1280 layout.operator("gpencil.select_all", text="Invert").action = 'INVERT'
1284 layout.operator("gpencil.select_box")
1285 layout.operator("gpencil.select_circle")
1289 layout.operator("gpencil.select_linked", text="Linked")
1290 layout.operator("gpencil.select_alternate")
1291 layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
1295 layout.operator("gpencil.select_first")
1296 layout.operator("gpencil.select_last")
1300 layout.operator("gpencil.select_more")
1301 layout.operator("gpencil.select_less")
1304 class VIEW3D_MT_select_paint_mask(Menu):
1307 def draw(self, context):
1308 layout = self.layout
1310 layout.operator("paint.face_select_all", text="All").action = 'SELECT'
1311 layout.operator("paint.face_select_all", text="None").action = 'DESELECT'
1312 layout.operator("paint.face_select_all", text="Invert").action = 'INVERT'
1316 layout.operator("view3d.select_box")
1317 layout.operator("view3d.select_circle")
1321 layout.operator("paint.face_select_linked", text="Linked")
1324 class VIEW3D_MT_select_paint_mask_vertex(Menu):
1327 def draw(self, context):
1328 layout = self.layout
1330 layout.operator("paint.vert_select_all", text="All").action = 'SELECT'
1331 layout.operator("paint.vert_select_all", text="None").action = 'DESELECT'
1332 layout.operator("paint.vert_select_all", text="Invert").action = 'INVERT'
1336 layout.operator("view3d.select_box")
1337 layout.operator("view3d.select_circle")
1341 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
1344 class VIEW3D_MT_angle_control(Menu):
1345 bl_label = "Angle Control"
1348 def poll(cls, context):
1349 settings = UnifiedPaintPanel.paint_settings(context)
1353 brush = settings.brush
1354 tex_slot = brush.texture_slot
1356 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
1358 def draw(self, context):
1359 layout = self.layout
1361 settings = UnifiedPaintPanel.paint_settings(context)
1362 brush = settings.brush
1364 sculpt = (context.sculpt_object is not None)
1366 tex_slot = brush.texture_slot
1368 layout.prop(tex_slot, "use_rake", text="Rake")
1370 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
1372 if brush.sculpt_capabilities.has_random_texture_angle:
1373 layout.prop(tex_slot, "use_random", text="Random")
1375 layout.prop(tex_slot, "use_random", text="Random")
1378 class VIEW3D_MT_mesh_add(Menu):
1379 bl_idname = "VIEW3D_MT_mesh_add"
1382 def draw(self, context):
1383 layout = self.layout
1385 layout.operator_context = 'INVOKE_REGION_WIN'
1387 layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
1388 layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
1389 layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
1390 layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
1391 layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
1392 layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
1393 layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
1394 layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
1398 layout.operator("mesh.primitive_grid_add", text="Grid", icon='MESH_GRID')
1399 layout.operator("mesh.primitive_monkey_add", text="Monkey", icon='MESH_MONKEY')
1402 class VIEW3D_MT_curve_add(Menu):
1403 bl_idname = "VIEW3D_MT_curve_add"
1406 def draw(self, context):
1407 layout = self.layout
1409 layout.operator_context = 'INVOKE_REGION_WIN'
1411 layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
1412 layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
1416 layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
1417 layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
1418 layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
1421 class VIEW3D_MT_surface_add(Menu):
1422 bl_idname = "VIEW3D_MT_surface_add"
1423 bl_label = "Surface"
1425 def draw(self, context):
1426 layout = self.layout
1428 layout.operator_context = 'INVOKE_REGION_WIN'
1430 layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
1431 layout.operator("surface.primitive_nurbs_surface_circle_add", text="Nurbs Circle", icon='SURFACE_NCIRCLE')
1432 layout.operator("surface.primitive_nurbs_surface_surface_add", text="Nurbs Surface", icon='SURFACE_NSURFACE')
1433 layout.operator("surface.primitive_nurbs_surface_cylinder_add",
1434 text="Nurbs Cylinder", icon='SURFACE_NCYLINDER')
1435 layout.operator("surface.primitive_nurbs_surface_sphere_add", text="Nurbs Sphere", icon='SURFACE_NSPHERE')
1436 layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS')
1439 class VIEW3D_MT_metaball_add(Menu):
1440 bl_idname = "VIEW3D_MT_metaball_add"
1441 bl_label = "Metaball"
1443 def draw(self, context):
1444 layout = self.layout
1446 layout.operator_context = 'INVOKE_REGION_WIN'
1447 layout.operator_enum("object.metaball_add", "type")
1450 class TOPBAR_MT_edit_curve_add(Menu):
1451 bl_idname = "TOPBAR_MT_edit_curve_add"
1454 def draw(self, context):
1455 is_surf = context.active_object.type == 'SURFACE'
1457 layout = self.layout
1458 layout.operator_context = 'EXEC_REGION_WIN'
1461 VIEW3D_MT_surface_add.draw(self, context)
1463 VIEW3D_MT_curve_add.draw(self, context)
1466 class TOPBAR_MT_edit_armature_add(Menu):
1467 bl_idname = "TOPBAR_MT_edit_armature_add"
1468 bl_label = "Armature"
1470 def draw(self, context):
1471 layout = self.layout
1473 layout.operator_context = 'EXEC_REGION_WIN'
1474 layout.operator("armature.bone_primitive_add", text="Single Bone", icon='BONE_DATA')
1477 class VIEW3D_MT_armature_add(Menu):
1478 bl_idname = "VIEW3D_MT_armature_add"
1479 bl_label = "Armature"
1481 def draw(self, context):
1482 layout = self.layout
1484 layout.operator_context = 'EXEC_REGION_WIN'
1485 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
1488 class VIEW3D_MT_light_add(Menu):
1489 bl_idname = "VIEW3D_MT_light_add"
1492 def draw(self, context):
1493 layout = self.layout
1495 layout.operator_context = 'INVOKE_REGION_WIN'
1496 layout.operator_enum("object.light_add", "type")
1499 class VIEW3D_MT_lightprobe_add(Menu):
1500 bl_idname = "VIEW3D_MT_lightprobe_add"
1501 bl_label = "Light Probe"
1503 def draw(self, context):
1504 layout = self.layout
1506 layout.operator_context = 'INVOKE_REGION_WIN'
1507 layout.operator_enum("object.lightprobe_add", "type")
1510 class VIEW3D_MT_camera_add(Menu):
1511 bl_idname = "VIEW3D_MT_camera_add"
1514 def draw(self, context):
1515 layout = self.layout
1516 layout.operator_context = 'EXEC_REGION_WIN'
1517 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
1520 class VIEW3D_MT_add(Menu):
1523 def draw(self, context):
1524 layout = self.layout
1526 # note, don't use 'EXEC_SCREEN' or operators won't get the 'v3d' context.
1528 # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
1529 # "align_view" to work on first call (see [#32719]).
1530 layout.operator_context = 'EXEC_REGION_WIN'
1532 # layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
1533 layout.menu("VIEW3D_MT_mesh_add", icon='OUTLINER_OB_MESH')
1535 # layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
1536 layout.menu("VIEW3D_MT_curve_add", icon='OUTLINER_OB_CURVE')
1537 # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
1538 layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE')
1539 layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
1540 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
1541 layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
1544 layout.menu("VIEW3D_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
1545 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1546 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1547 layout.menu("VIEW3D_MT_image_add", text="Image", icon='OUTLINER_OB_IMAGE')
1551 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1554 if VIEW3D_MT_camera_add.is_extended():
1555 layout.menu("VIEW3D_MT_camera_add", icon='OUTLINER_OB_CAMERA')
1557 VIEW3D_MT_camera_add.draw(self, context)
1559 layout.menu("VIEW3D_MT_light_add", icon='OUTLINER_OB_LIGHT')
1561 layout.menu("VIEW3D_MT_lightprobe_add", icon='OUTLINER_OB_LIGHTPROBE')
1564 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
1567 has_collections = bool(bpy.data.collections)
1568 col = layout.column()
1569 col.enabled = has_collections
1571 if not has_collections or len(bpy.data.collections) > 10:
1572 col.operator_context = 'INVOKE_REGION_WIN'
1574 "object.collection_instance_add",
1575 text="Collection Instance..." if has_collections else "No Collections to Instance",
1576 icon='OUTLINER_OB_GROUP_INSTANCE',
1579 col.operator_menu_enum(
1580 "object.collection_instance_add",
1582 text="Collection Instance",
1583 icon='OUTLINER_OB_GROUP_INSTANCE',
1587 class VIEW3D_MT_image_add(Menu):
1588 bl_label = "Add Image"
1590 def draw(self, context):
1591 layout = self.layout
1592 layout.operator("object.load_reference_image", text="Reference", icon='IMAGE_REFERENCE')
1593 layout.operator("object.load_background_image", text="Background", icon='IMAGE_BACKGROUND')
1596 class VIEW3D_MT_object_relations(Menu):
1597 bl_label = "Relations"
1599 def draw(self, context):
1600 layout = self.layout
1602 layout.operator("object.proxy_make", text="Make Proxy...")
1604 layout.operator("object.make_dupli_face")
1608 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1609 layout.menu("VIEW3D_MT_make_single_user")
1613 layout.operator("object.data_transfer")
1614 layout.operator("object.datalayout_transfer")
1617 class VIEW3D_MT_object(Menu):
1618 bl_context = "objectmode"
1621 def draw(self, context):
1622 layout = self.layout
1624 layout.menu("VIEW3D_MT_transform_object")
1625 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1626 layout.menu("VIEW3D_MT_mirror")
1627 layout.menu("VIEW3D_MT_object_clear")
1628 layout.menu("VIEW3D_MT_object_apply")
1629 layout.menu("VIEW3D_MT_snap")
1633 layout.operator("object.duplicate_move")
1634 layout.operator("object.duplicate_move_linked")
1635 layout.operator("object.join")
1639 layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1640 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1644 layout.menu("VIEW3D_MT_object_parent")
1645 layout.menu("VIEW3D_MT_object_collection")
1646 layout.menu("VIEW3D_MT_object_relations")
1647 layout.menu("VIEW3D_MT_object_constraints")
1648 layout.menu("VIEW3D_MT_object_track")
1649 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
1653 layout.operator("object.shade_smooth")
1654 layout.operator("object.shade_flat")
1658 layout.menu("VIEW3D_MT_object_animation")
1659 layout.menu("VIEW3D_MT_object_rigid_body")
1663 layout.menu("VIEW3D_MT_object_quick_effects")
1667 ob = context.active_object
1668 if ob and ob.type == 'GPENCIL' and context.gpencil_data:
1669 layout.operator_menu_enum("gpencil.convert", "type", text="Convert to")
1671 layout.operator_menu_enum("object.convert", "target")
1675 layout.menu("VIEW3D_MT_object_showhide")
1679 layout.operator_context = 'EXEC_DEFAULT'
1680 layout.operator("object.delete", text="Delete").use_global = False
1681 layout.operator("object.delete", text="Delete Global").use_global = True
1684 class VIEW3D_MT_object_animation(Menu):
1685 bl_label = "Animation"
1687 def draw(self, context):
1688 layout = self.layout
1690 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1691 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
1692 layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
1693 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1697 layout.operator("nla.bake", text="Bake Action...")
1700 class VIEW3D_MT_object_rigid_body(Menu):
1701 bl_label = "Rigid Body"
1703 def draw(self, context):
1704 layout = self.layout
1706 layout.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
1707 layout.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
1711 layout.operator("rigidbody.objects_remove", text="Remove")
1715 layout.operator("rigidbody.shape_change", text="Change Shape")
1716 layout.operator("rigidbody.mass_calculate", text="Calculate Mass")
1717 layout.operator("rigidbody.object_settings_copy", text="Copy from Active")
1718 layout.operator("object.visual_transform_apply", text="Apply Transformation")
1719 layout.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
1723 layout.operator("rigidbody.connect", text="Connect")
1726 class VIEW3D_MT_object_clear(Menu):
1729 def draw(self, context):
1730 layout = self.layout
1732 layout.operator("object.location_clear", text="Location").clear_delta = False
1733 layout.operator("object.rotation_clear", text="Rotation").clear_delta = False
1734 layout.operator("object.scale_clear", text="Scale").clear_delta = False
1738 layout.operator("object.origin_clear", text="Origin")
1741 class VIEW3D_MT_object_specials(Menu):
1742 bl_label = "Object Context Menu"
1744 def draw(self, context):
1746 layout = self.layout
1747 view = context.space_data
1749 obj = context.object
1750 is_eevee = context.scene.render.engine == 'BLENDER_EEVEE'
1752 selected_objects_len = len(context.selected_objects)
1754 # If nothing is selected
1755 # (disabled for now until it can be made more useful).
1757 if selected_objects_len == 0:
1759 layout.menu("VIEW3D_MT_add", text="Add")
1760 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1765 # If something is selected
1766 if obj is not None and obj.type in {'MESH', 'CURVE', 'SURFACE'}:
1767 layout.operator("object.shade_smooth", text="Shade Smooth")
1768 layout.operator("object.shade_flat", text="Shade Flat")
1774 elif obj.type == 'MESH':
1775 layout.operator_context = 'INVOKE_REGION_WIN'
1776 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1778 layout.operator_context = 'INVOKE_DEFAULT'
1779 # If more than one object is selected
1780 if selected_objects_len > 1:
1781 layout.operator("object.join")
1783 elif obj.type == 'CAMERA':
1784 layout.operator_context = 'INVOKE_REGION_WIN'
1786 if obj.data.type == 'PERSP':
1787 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
1788 props.data_path_iter = "selected_editable_objects"
1789 props.data_path_item = "data.lens"
1790 props.input_scale = 0.1
1791 if obj.data.lens_unit == 'MILLIMETERS':
1792 props.header_text = "Camera Lens Angle: %.1fmm"
1794 props.header_text = "Camera Lens Angle: %.1f\u00B0"
1797 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
1798 props.data_path_iter = "selected_editable_objects"
1799 props.data_path_item = "data.ortho_scale"
1800 props.input_scale = 0.01
1801 props.header_text = "Camera Lens Scale: %.3f"
1803 if not obj.data.dof_object:
1804 if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
1805 props = layout.operator("ui.eyedropper_depth", text="DOF Distance (Pick)")
1807 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
1808 props.data_path_iter = "selected_editable_objects"
1809 props.data_path_item = "data.dof_distance"
1810 props.input_scale = 0.02
1811 props.header_text = "DOF Distance: %.3f"
1813 elif obj.type in {'CURVE', 'FONT'}:
1814 layout.operator_context = 'INVOKE_REGION_WIN'
1816 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
1817 props.data_path_iter = "selected_editable_objects"
1818 props.data_path_item = "data.extrude"
1819 props.input_scale = 0.01
1820 props.header_text = "Extrude Size: %.3f"
1822 props = layout.operator("wm.context_modal_mouse", text="Width Size")
1823 props.data_path_iter = "selected_editable_objects"
1824 props.data_path_item = "data.offset"
1825 props.input_scale = 0.01
1826 props.header_text = "Width Size: %.3f"
1828 layout.operator("object.convert", text="Convert to Mesh").target = 'MESH'
1830 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1832 elif obj.type == 'GPENCIL':
1833 layout.operator("gpencil.convert", text="Convert to Path").type = 'PATH'
1834 layout.operator("gpencil.convert", text="Convert to Bezier Curves").type = 'CURVE'
1835 layout.operator("gpencil.convert", text="Convert to Mesh").type = 'POLY'
1837 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1839 elif obj.type == 'EMPTY':
1840 layout.operator_context = 'INVOKE_REGION_WIN'
1842 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
1843 props.data_path_iter = "selected_editable_objects"
1844 props.data_path_item = "empty_display_size"
1845 props.input_scale = 0.01
1846 props.header_text = "Empty Draw Size: %.3f"
1848 elif obj.type == 'LIGHT':
1851 layout.operator_context = 'INVOKE_REGION_WIN'
1853 emission_node = None
1855 for node in light.node_tree.nodes:
1856 if getattr(node, "type", None) == 'EMISSION':
1857 emission_node = node
1860 if is_eevee and not emission_node:
1861 props = layout.operator("wm.context_modal_mouse", text="Energy")
1862 props.data_path_iter = "selected_editable_objects"
1863 props.data_path_item = "data.energy"
1864 props.header_text = "Light Energy: %.3f"
1866 if emission_node is not None:
1867 props = layout.operator("wm.context_modal_mouse", text="Energy")
1868 props.data_path_iter = "selected_editable_objects"
1869 props.data_path_item = (
1871 ".nodes[\"" + emission_node.name + "\"]"
1872 ".inputs[\"Strength\"].default_value"
1874 props.header_text = "Light Energy: %.3f"
1875 props.input_scale = 0.1
1877 if light.type == 'AREA':
1878 props = layout.operator("wm.context_modal_mouse", text="Size X")
1879 props.data_path_iter = "selected_editable_objects"
1880 props.data_path_item = "data.size"
1881 props.header_text = "Light Size X: %.3f"
1883 if light.shape in {'RECTANGLE', 'ELLIPSE'}:
1884 props = layout.operator("wm.context_modal_mouse", text="Size Y")
1885 props.data_path_iter = "selected_editable_objects"
1886 props.data_path_item = "data.size_y"
1887 props.header_text = "Light Size Y: %.3f"
1889 elif light.type in {'SPOT', 'POINT', 'SUN'}:
1890 props = layout.operator("wm.context_modal_mouse", text="Radius")
1891 props.data_path_iter = "selected_editable_objects"
1892 props.data_path_item = "data.shadow_soft_size"
1893 props.header_text = "Light Radius: %.3f"
1895 if light.type == 'SPOT':
1898 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
1899 props.data_path_iter = "selected_editable_objects"
1900 props.data_path_item = "data.spot_size"
1901 props.input_scale = 0.01
1902 props.header_text = "Spot Size: %.2f"
1904 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
1905 props.data_path_iter = "selected_editable_objects"
1906 props.data_path_item = "data.spot_blend"
1907 props.input_scale = -0.01
1908 props.header_text = "Spot Blend: %.2f"
1912 layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1913 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1917 layout.operator("object.duplicate_move", icon='DUPLICATE')
1918 layout.operator("object.duplicate_move_linked")
1922 layout.menu("VIEW3D_MT_snap")
1923 layout.menu("VIEW3D_MT_object_parent")
1924 layout.operator_context = 'INVOKE_REGION_WIN'
1926 if view and view.local_view:
1927 layout.operator("view3d.localview_remove_from")
1929 layout.operator("object.move_to_collection")
1933 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1937 layout.operator_context = 'EXEC_DEFAULT'
1938 layout.operator("object.delete", text="Delete").use_global = False
1941 class VIEW3D_MT_object_shading(Menu):
1942 # XXX, this menu is a place to store shading operator in object mode
1943 bl_label = "Shading"
1945 def draw(self, context):
1946 layout = self.layout
1947 layout.operator("object.shade_smooth", text="Smooth")
1948 layout.operator("object.shade_flat", text="Flat")
1951 class VIEW3D_MT_object_apply(Menu):
1954 def draw(self, context):
1955 layout = self.layout
1957 props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
1958 props.location, props.rotation, props.scale = True, False, False
1960 props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
1961 props.location, props.rotation, props.scale = False, True, False
1963 props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
1964 props.location, props.rotation, props.scale = False, False, True
1965 props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
1966 props.location, props.rotation, props.scale = False, True, True
1971 "object.transforms_to_deltas",
1972 text="Location to Deltas",
1973 text_ctxt=i18n_contexts.default,
1976 "object.transforms_to_deltas",
1977 text="Rotation to Deltas",
1978 text_ctxt=i18n_contexts.default,
1981 "object.transforms_to_deltas",
1982 text="Scale to Deltas",
1983 text_ctxt=i18n_contexts.default,
1987 "object.transforms_to_deltas",
1988 text="All Transforms to Deltas",
1989 text_ctxt=i18n_contexts.default,
1991 layout.operator("object.anim_transforms_to_deltas")
1996 "object.visual_transform_apply",
1997 text="Visual Transform",
1998 text_ctxt=i18n_contexts.default,
2002 text="Visual Geometry to Mesh",
2003 text_ctxt=i18n_contexts.default,
2005 layout.operator("object.duplicates_make_real")
2008 class VIEW3D_MT_object_parent(Menu):
2011 def draw(self, context):
2012 layout = self.layout
2014 layout.operator_enum("object.parent_set", "type")
2018 layout.operator_enum("object.parent_clear", "type")
2021 class VIEW3D_MT_object_track(Menu):
2024 def draw(self, context):
2025 layout = self.layout
2027 layout.operator_enum("object.track_set", "type")
2031 layout.operator_enum("object.track_clear", "type")
2034 class VIEW3D_MT_object_collection(Menu):
2035 bl_label = "Collection"
2037 def draw(self, context):
2038 layout = self.layout
2040 layout.operator("collection.create")
2041 # layout.operator_menu_enum("collection.objects_remove", "collection") # BUGGY
2042 layout.operator("collection.objects_remove")
2043 layout.operator("collection.objects_remove_all")
2047 layout.operator("collection.objects_add_active")
2048 layout.operator("collection.objects_remove_active")
2051 class VIEW3D_MT_object_constraints(Menu):
2052 bl_label = "Constraints"
2054 def draw(self, context):
2055 layout = self.layout
2057 layout.operator("object.constraint_add_with_targets")
2058 layout.operator("object.constraints_copy")
2062 layout.operator("object.constraints_clear")
2065 class VIEW3D_MT_object_quick_effects(Menu):
2066 bl_label = "Quick Effects"
2068 def draw(self, context):
2069 layout = self.layout
2071 layout.operator("object.quick_fur")
2072 layout.operator("object.quick_explode")
2073 layout.operator("object.quick_smoke")
2074 layout.operator("object.quick_fluid")
2077 class VIEW3D_MT_object_showhide(Menu):
2078 bl_label = "Show/Hide"
2080 def draw(self, context):
2081 layout = self.layout
2083 layout.operator("object.hide_view_clear", text="Show Hidden")
2087 layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
2088 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
2091 class VIEW3D_MT_make_single_user(Menu):
2092 bl_label = "Make Single User"
2094 def draw(self, context):
2095 layout = self.layout
2097 props = layout.operator("object.make_single_user", text="Object")
2099 props.obdata = props.material = props.animation = False
2101 props = layout.operator("object.make_single_user", text="Object & Data")
2102 props.object = props.obdata = True
2103 props.material = props.animation = False
2105 props = layout.operator("object.make_single_user", text="Object & Data & Materials")
2106 props.object = props.obdata = props.material = True
2107 props.animation = False
2109 props = layout.operator("object.make_single_user", text="Materials")
2110 props.material = True
2111 props.object = props.obdata = props.animation = False
2113 props = layout.operator("object.make_single_user", text="Object Animation")
2114 props.animation = True
2115 props.object = props.obdata = props.material = False
2118 class VIEW3D_MT_make_links(Menu):
2119 bl_label = "Make Links"
2121 def draw(self, context):
2122 layout = self.layout
2123 operator_context_default = layout.operator_context
2125 if len(bpy.data.scenes) > 10:
2126 layout.operator_context = 'INVOKE_REGION_WIN'
2127 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
2129 layout.operator_context = 'EXEC_REGION_WIN'
2130 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene")
2134 layout.operator_context = operator_context_default
2136 layout.operator_enum("object.make_links_data", "type") # inline
2138 layout.operator("object.join_uvs") # stupid place to add this!
2141 class VIEW3D_MT_brush(Menu):
2144 def draw(self, context):
2145 layout = self.layout
2147 tool_settings = context.tool_settings
2148 settings = UnifiedPaintPanel.paint_settings(context)
2149 brush = getattr(settings, "brush", None)
2151 ups = tool_settings.unified_paint_settings
2152 layout.prop(ups, "use_unified_size", text="Unified Size")
2153 layout.prop(ups, "use_unified_strength", text="Unified Strength")
2154 if context.image_paint_object or context.vertex_paint_object:
2155 layout.prop(ups, "use_unified_color", text="Unified Color")
2158 # skip if no active brush
2160 layout.label(text="No Brushes currently available", icon='INFO')
2164 layout.menu("VIEW3D_MT_brush_paint_modes")
2167 if context.sculpt_object:
2168 layout.operator("brush.reset")
2169 layout.prop_menu_enum(brush, "sculpt_tool")
2170 elif context.image_paint_object:
2171 layout.prop_menu_enum(brush, "image_tool")
2172 elif context.vertex_paint_object:
2173 layout.prop_menu_enum(brush, "vertex_tool")
2174 elif context.weight_paint_object:
2175 layout.prop_menu_enum(brush, "weight_tool")
2177 # TODO: still missing a lot of brush options here
2180 if context.sculpt_object:
2182 sculpt_tool = brush.sculpt_tool
2185 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
2188 if sculpt_tool != 'GRAB':
2189 layout.prop_menu_enum(brush, "stroke_method")
2191 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
2192 layout.prop_menu_enum(brush, "direction")
2194 if sculpt_tool == 'LAYER':
2195 layout.prop(brush, "use_persistent")
2196 layout.operator("sculpt.set_persistent_base")
2199 class VIEW3D_MT_brush_paint_modes(Menu):
2200 bl_label = "Enabled Modes"
2202 def draw(self, context):
2203 layout = self.layout
2205 settings = UnifiedPaintPanel.paint_settings(context)
2206 brush = settings.brush
2208 layout.prop(brush, "use_paint_sculpt", text="Sculpt")
2209 layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
2210 layout.prop(brush, "use_paint_weight", text="Weight Paint")
2211 layout.prop(brush, "use_paint_image", text="Texture Paint")
2214 class VIEW3D_MT_paint_vertex(Menu):
2217 def draw(self, context):
2218 layout = self.layout
2220 layout.operator("paint.vertex_color_set")
2221 layout.operator("paint.vertex_color_smooth")
2222 layout.operator("paint.vertex_color_dirt")
2223 layout.operator("paint.vertex_color_from_weight")
2227 layout.operator("paint.vertex_color_invert", text="Invert")
2228 layout.operator("paint.vertex_color_levels", text="Levels")
2229 layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
2230 layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
2233 class VIEW3D_MT_hook(Menu):
2236 def draw(self, context):
2237 layout = self.layout
2238 layout.operator_context = 'EXEC_AREA'
2239 layout.operator("object.hook_add_newob")
2240 layout.operator("object.hook_add_selob").use_bone = False
2241 layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
2243 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
2246 layout.operator_menu_enum("object.hook_assign", "modifier")
2247 layout.operator_menu_enum("object.hook_remove", "modifier")
2251 layout.operator_menu_enum("object.hook_select", "modifier")
2252 layout.operator_menu_enum("object.hook_reset", "modifier")
2253 layout.operator_menu_enum("object.hook_recenter", "modifier")
2256 class VIEW3D_MT_vertex_group(Menu):
2257 bl_label = "Vertex Groups"
2259 def draw(self, context):
2260 layout = self.layout
2262 layout.operator_context = 'EXEC_AREA'
2263 layout.operator("object.vertex_group_assign_new")
2265 ob = context.active_object
2266 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
2267 if ob.vertex_groups.active:
2270 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
2272 "object.vertex_group_remove_from",
2273 text="Remove from Active Group",
2274 ).use_all_groups = False
2275 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
2277 if ob.vertex_groups.active:
2280 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
2281 layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
2282 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
2285 class VIEW3D_MT_paint_weight(Menu):
2286 bl_label = "Weights"
2289 def draw_generic(layout, is_editmode=False):
2293 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
2294 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
2298 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
2299 layout.operator("object.vertex_group_normalize", text="Normalize")
2303 layout.operator("object.vertex_group_mirror", text="Mirror")
2304 layout.operator("object.vertex_group_invert", text="Invert")
2305 layout.operator("object.vertex_group_clean", text="Clean")
2309 layout.operator("object.vertex_group_quantize", text="Quantize")
2310 layout.operator("object.vertex_group_levels", text="Levels")
2311 layout.operator("object.vertex_group_smooth", text="Smooth")
2314 props = layout.operator("object.data_transfer", text="Transfer Weights")
2315 props.use_reverse_transfer = True
2316 props.data_type = 'VGROUP_WEIGHTS'
2318 layout.operator("object.vertex_group_limit_total", text="Limit Total")
2319 layout.operator("object.vertex_group_fix", text="Fix Deforms")
2324 layout.operator("paint.weight_set")
2326 def draw(self, context):
2327 self.draw_generic(self.layout, is_editmode=False)
2330 class VIEW3D_MT_sculpt(Menu):
2333 def draw(self, context):
2334 layout = self.layout
2336 tool_settings = context.tool_settings
2337 sculpt = tool_settings.sculpt
2339 layout.prop(sculpt, "use_symmetry_x")
2340 layout.prop(sculpt, "use_symmetry_y")
2341 layout.prop(sculpt, "use_symmetry_z")
2345 layout.prop(sculpt, "lock_x")
2346 layout.prop(sculpt, "lock_y")
2347 layout.prop(sculpt, "lock_z")
2351 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
2352 layout.prop(sculpt, "show_low_resolution")
2353 layout.prop(sculpt, "show_brush")
2354 layout.prop(sculpt, "use_deform_only")
2355 layout.prop(sculpt, "show_diffuse_color")
2356 layout.prop(sculpt, "show_mask")
2359 class VIEW3D_MT_hide_mask(Menu):
2360 bl_label = "Hide/Mask"
2362 def draw(self, context):
2363 layout = self.layout
2365 props = layout.operator("paint.hide_show", text="Show All")
2366 props.action = 'SHOW'
2369 props = layout.operator("paint.hide_show", text="Hide Bounding Box")
2370 props.action = 'HIDE'
2371 props.area = 'INSIDE'
2373 props = layout.operator("paint.hide_show", text="Show Bounding Box")
2374 props.action = 'SHOW'
2375 props.area = 'INSIDE'
2377 props = layout.operator("paint.hide_show", text="Hide Masked")
2378 props.area = 'MASKED'
2379 props.action = 'HIDE'
2383 props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
2384 props.mode = 'INVERT'
2386 props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
2387 props.mode = 'VALUE'
2390 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
2391 props.mode = 'VALUE'
2394 props = layout.operator("view3d.select_box", text="Box Mask")
2395 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
2398 class VIEW3D_MT_particle(Menu):
2399 bl_label = "Particle"
2401 def draw(self, context):
2402 layout = self.layout
2403 tool_settings = context.tool_settings
2405 particle_edit = tool_settings.particle_edit
2407 layout.operator("particle.mirror")
2409 layout.operator("particle.remove_doubles")
2413 if particle_edit.select_mode == 'POINT':
2414 layout.operator("particle.subdivide")
2416 layout.operator("particle.unify_length")
2417 layout.operator("particle.rekey")
2418 layout.operator("particle.weight_set")
2422 layout.menu("VIEW3D_MT_particle_showhide")
2426 layout.operator("particle.delete")
2429 class VIEW3D_MT_particle_specials(Menu):
2430 bl_label = "Particle Context Menu"
2432 def draw(self, context):
2433 layout = self.layout
2434 tool_settings = context.tool_settings
2436 particle_edit = tool_settings.particle_edit
2438 layout.operator("particle.rekey")
2442 layout.operator("particle.delete")
2446 layout.operator("particle.remove_doubles")
2447 layout.operator("particle.unify_length")
2449 if particle_edit.select_mode == 'POINT':
2450 layout.operator("particle.subdivide")
2452 layout.operator("particle.weight_set")
2456 layout.operator("particle.mirror")
2458 if particle_edit.select_mode == 'POINT':
2461 layout.operator("particle.select_all", text="All").action = 'SELECT'
2462 layout.operator("particle.select_all", text="None").action = 'DESELECT'
2463 layout.operator("particle.select_all", text="Invert").action = 'INVERT'
2467 layout.operator("particle.select_roots")
2468 layout.operator("particle.select_tips")
2472 layout.operator("particle.select_random")
2476 layout.operator("particle.select_more")
2477 layout.operator("particle.select_less")
2481 layout.operator("particle.select_linked")
2484 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
2485 _operator_name = "particle"
2488 class VIEW3D_MT_pose(Menu):
2491 def draw(self, context):
2492 layout = self.layout
2494 layout.menu("VIEW3D_MT_transform_armature")
2496 layout.menu("VIEW3D_MT_pose_transform")
2497 layout.menu("VIEW3D_MT_pose_apply")
2499 layout.menu("VIEW3D_MT_snap")
2503 layout.menu("VIEW3D_MT_object_animation")
2507 layout.menu("VIEW3D_MT_pose_slide")
2508 layout.menu("VIEW3D_MT_pose_propagate")
2512 layout.operator("pose.copy", icon='COPYDOWN')
2513 layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2514 layout.operator("pose.paste", icon='PASTEFLIPDOWN', text="Paste Pose Flipped").flipped = True
2518 layout.menu("VIEW3D_MT_pose_library")
2519 layout.menu("VIEW3D_MT_pose_motion")
2520 layout.menu("VIEW3D_MT_pose_group")
2524 layout.menu("VIEW3D_MT_object_parent")
2525 layout.menu("VIEW3D_MT_pose_ik")
2526 layout.menu("VIEW3D_MT_pose_constraints")
2530 layout.operator_context = 'EXEC_AREA'
2531 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
2532 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
2533 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2535 layout.operator("pose.flip_names")
2537 layout.operator("pose.quaternions_flip")
2541 layout.operator_context = 'INVOKE_AREA'
2542 layout.operator("armature.armature_layers", text="Change Armature Layers...")
2543 layout.operator("pose.bone_layers", text="Change Bone Layers...")
2547 layout.menu("VIEW3D_MT_pose_showhide")
2548 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2551 class VIEW3D_MT_pose_transform(Menu):
2552 bl_label = "Clear Transform"
2554 def draw(self, context):
2555 layout = self.layout
2557 layout.operator("pose.transforms_clear", text="All")
2561 layout.operator("pose.loc_clear", text="Location")
2562 layout.operator("pose.rot_clear", text="Rotation")
2563 layout.operator("pose.scale_clear", text="Scale")
2567 layout.operator("pose.user_transforms_clear", text="Reset Unkeyed")
2570 class VIEW3D_MT_pose_slide(Menu):
2571 bl_label = "In-Betweens"
2573 def draw(self, context):
2574 layout = self.layout
2576 layout.operator("pose.push")
2577 layout.operator("pose.relax")
2578 layout.operator("pose.breakdown")
2581 class VIEW3D_MT_pose_propagate(Menu):
2582 bl_label = "Propagate"
2584 def draw(self, context):
2585 layout = self.layout
2587 layout.operator("pose.propagate").mode = 'WHILE_HELD'
2591 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2592 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2596 layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2600 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2603 class VIEW3D_MT_pose_library(Menu):
2604 bl_label = "Pose Library"
2606 def draw(self, context):
2607 layout = self.layout
2609 layout.operator("poselib.browse_interactive", text="Browse Poses...")
2613 layout.operator("poselib.pose_add", text="Add Pose...")
2614 layout.operator("poselib.pose_rename", text="Rename Pose...")
2615 layout.operator("poselib.pose_remove", text="Remove Pose...")
2618 class VIEW3D_MT_pose_motion(Menu):
2619 bl_label = "Motion Paths"
2621 def draw(self, context):
2622 layout = self.layout
2624 layout.operator("pose.paths_calculate", text="Calculate")
2625 layout.operator("pose.paths_clear", text="Clear")
2628 class VIEW3D_MT_pose_group(Menu):
2629 bl_label = "Bone Groups"
2631 def draw(self, context):
2632 layout = self.layout
2634 pose = context.active_object.pose
2636 layout.operator_context = 'EXEC_AREA'
2637 layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2639 if pose.bone_groups:
2640 active_group = pose.bone_groups.active_index + 1
2641 layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2645 # layout.operator_context = 'INVOKE_AREA'
2646 layout.operator("pose.group_unassign")
2647 layout.operator("pose.group_remove")
2650 class VIEW3D_MT_pose_ik(Menu):
2651 bl_label = "Inverse Kinematics"
2653 def draw(self, context):
2654 layout = self.layout
2656 layout.operator("pose.ik_add")
2657 layout.operator("pose.ik_clear")
2660 class VIEW3D_MT_pose_constraints(Menu):
2661 bl_label = "Constraints"
2663 def draw(self, context):
2664 layout = self.layout
2666 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2667 layout.operator("pose.constraints_copy")
2668 layout.operator("pose.constraints_clear")
2671 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2672 _operator_name = "pose"
2675 class VIEW3D_MT_pose_apply(Menu):
2678 def draw(self, context):
2679 layout = self.layout
2681 layout.operator("pose.armature_apply")
2682 layout.operator("pose.visual_transform_apply")
2686 props = layout.operator("object.assign_property_defaults")
2687 props.process_bones = True
2690 class VIEW3D_MT_pose_specials(Menu):
2691 bl_label = "Pose Context Menu"
2693 def draw(self, context):
2694 layout = self.layout
2696 layout.operator_context = 'INVOKE_REGION_WIN'
2698 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
2702 layout.operator("pose.copy", icon='COPYDOWN')
2703 layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2704 layout.operator("pose.paste", icon='PASTEFLIPDOWN', text="Paste X-Flipped Pose").flipped = True
2708 layout.operator("pose.paths_calculate", text="Calculate")
2709 layout.operator("pose.paths_clear", text="Clear")
2713 layout.operator("pose.push")
2714 layout.operator("pose.relax")
2715 layout.operator("pose.breakdown")
2719 layout.operator("pose.paths_calculate")
2720 layout.operator("pose.paths_clear")
2724 layout.operator("pose.hide").unselected = False
2725 layout.operator("pose.reveal")
2729 layout.operator("pose.user_transforms_clear")
2733 def draw(self, context):
2734 layout = self.layout
2739 "use_envelope_multiply",
2740 "use_inherit_rotation",
2741 "use_inherit_scale",
2744 if context.mode == 'EDIT_ARMATURE':
2745 bone_props = bpy.types.EditBone.bl_rna.properties
2746 data_path_iter = "selected_bones"
2748 options.append("lock")
2750 bone_props = bpy.types.Bone.bl_rna.properties
2751 data_path_iter = "selected_pose_bones"
2752 opt_suffix = "bone."
2755 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2756 text_ctxt=i18n_contexts.default)
2757 props.data_path_iter = data_path_iter
2758 props.data_path_item = opt_suffix + opt
2759 props.type = self.type
2762 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2763 bl_label = "Toggle Bone Options"
2767 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2768 bl_label = "Enable Bone Options"
2772 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2773 bl_label = "Disable Bone Options"
2777 # ********** Edit Menus, suffix from ob.type **********
2780 class VIEW3D_MT_edit_mesh(Menu):
2783 def draw(self, context):
2784 layout = self.layout
2786 with_bullet = bpy.app.build_options.bullet
2788 layout.menu("VIEW3D_MT_transform")
2789 layout.menu("VIEW3D_MT_mirror")
2790 layout.menu("VIEW3D_MT_snap")
2794 layout.operator("mesh.duplicate_move", text="Duplicate")
2795 layout.menu("VIEW3D_MT_edit_mesh_extrude")
2796 layout.operator("mesh.split")
2797 layout.operator("mesh.bisect")
2798 layout.operator("mesh.knife_project")
2801 layout.operator("mesh.convex_hull")
2805 layout.operator("mesh.symmetrize")
2806 layout.operator("mesh.symmetry_snap")
2810 layout.menu("VIEW3D_MT_edit_mesh_normals")
2811 layout.menu("VIEW3D_MT_edit_mesh_shading")
2812 layout.menu("VIEW3D_MT_edit_mesh_weights")
2813 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2817 layout.menu("VIEW3D_MT_edit_mesh_showhide")
2818 layout.operator_menu_enum("mesh.separate", "type")
2819 layout.menu("VIEW3D_MT_edit_mesh_clean")
2823 layout.menu("VIEW3D_MT_edit_mesh_delete")
2826 class VIEW3D_MT_edit_mesh_specials(Menu):
2829 def draw(self, context):
2831 def count_selected_items_for_objects_in_mode():
2832 selected_verts_len = 0
2833 selected_edges_len = 0
2834 selected_faces_len = 0
2835 for ob in context.objects_in_mode_unique_data:
2836 v, e, f = ob.data.count_selected_items()
2837 selected_verts_len += v
2838 selected_edges_len += e
2839 selected_faces_len += f
2840 return (selected_verts_len, selected_edges_len, selected_faces_len)
2842 is_vert_mode, is_edge_mode, is_face_mode = context.tool_settings.mesh_select_mode
2843 selected_verts_len, selected_edges_len, selected_faces_len = count_selected_items_for_objects_in_mode()
2845 del count_selected_items_for_objects_in_mode
2847 layout = self.layout
2849 layout.operator_context = 'INVOKE_REGION_WIN'
2851 # If nothing is selected
2852 # (disabled for now until it can be made more useful).
2854 # If nothing is selected
2855 if not (selected_verts_len or selected_edges_len or selected_faces_len):
2856 layout.menu("VIEW3D_MT_mesh_add", text="Add")
2861 # Else something is selected
2868 col.label(text="Vertex Context Menu", icon='VERTEXSEL')
2871 # Additive Operators
2872 col.operator("mesh.subdivide", text="Subdivide")
2876 col.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
2877 col.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True
2879 if selected_verts_len > 1:
2881 col.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
2882 col.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2883 col.operator("mesh.vert_connect", text="Connect Vertex Pairs")
2888 col.operator("transform.push_pull", text="Push/Pull")
2889 col.operator("transform.shrink_fatten", text="Shrink/Fatten")
2890 col.operator("transform.shear", text="Shear")
2891 col.operator("transform.vert_slide", text="Slide Vertices")
2892 col.operator("transform.vertex_random", text="Randomize Vertices")
2893 col.operator("mesh.vertices_smooth", text="Smooth Vertices")
2894 col.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian")
2898 col.menu("VIEW3D_MT_snap", text="Snap Vertices...")
2899 col.operator("transform.mirror", text="Mirror Vertices")
2904 if selected_verts_len > 1:
2905 col.operator("mesh.merge", text="Merge Vertices...")
2906 col.operator("mesh.remove_doubles", text="Remove Double Vertices")
2907 col.operator("mesh.dissolve_verts")
2908 col.operator("mesh.delete", text="Delete Vertices").type = 'VERT'
2911 render = context.scene.render
2914 col.label(text="Edge Context Menu", icon='EDGESEL')
2917 # Additive Operators
2918 col.operator("mesh.subdivide", text="Subdivide")
2922 col.operator("mesh.extrude_edges_move", text="Extrude Edges"),
2923 col.operator("mesh.bevel", text="Bevel Edges").vertex_only = False
2924 if selected_edges_len >= 2:
2925 col.operator("mesh.bridge_edge_loops")
2929 col.operator("mesh.loopcut_slide")
2930 col.operator("mesh.offset_edge_loops_slide")
2931 col.operator("mesh.knife_tool")
2932 col.operator("mesh.bisect")
2933 col.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops")
2938 col.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2939 col.operator("transform.edge_slide")
2940 col.operator("mesh.edge_split")
2945 col.operator("transform.edge_crease")
2946 col.operator("transform.edge_bevelweight")
2950 col.operator("mesh.mark_seam").clear = False
2951 col.operator("mesh.mark_seam", text="Clear Seam").clear = True
2955 col.operator("mesh.mark_sharp")
2956 col.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2958 if render.use_freestyle:
2961 col.operator("mesh.mark_freestyle_edge").clear = False
2962 col.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
2967 col.operator("mesh.unsubdivide")
2968 col.operator("mesh.dissolve_edges")
2969 col.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
2974 col.label(text="Face Context Menu", icon='FACESEL')
2977 # Additive Operators
2978 col.operator("mesh.subdivide", text="Subdivide")
2982 col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
2983 col.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
2984 col.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
2986 col.operator("mesh.inset"),
2987 col.operator("mesh.poke")
2989 if selected_faces_len >= 2:
2990 col.operator("mesh.bridge_edge_loops", text="Bridge Faces")
2995 col.menu("VIEW3D_MT_uv_map", text="UV Unwrap Faces...")
2999 props = col.operator("mesh.quads_convert_to_tris")
3000 props.quad_method = props.ngon_method = 'BEAUTY'
3001 col.operator("mesh.tris_convert_to_quads")
3005 col.operator("mesh.faces_shade_smooth")
3006 col.operator("mesh.faces_shade_flat")
3011 col.operator("mesh.unsubdivide")
3012 col.operator("mesh.dissolve_faces")
3013 col.operator("mesh.delete", text="Delete Faces").type = 'FACE'
3016 class VIEW3D_MT_edit_mesh_select_mode(Menu):
3017 bl_label = "Mesh Select Mode"
3019 def draw(self, context):
3020 layout = self.layout
3022 layout.operator_context = 'INVOKE_REGION_WIN'
3023 layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
3024 layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
3025 layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
3028 class VIEW3D_MT_edit_mesh_extrude(Menu):
3029 bl_label = "Extrude"
3032 'VERT': lambda layout:
3033 layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
3034 'EDGE': lambda layout:
3035 layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
3036 'REGION': lambda layout:
3037 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
3038 'REGION_VERT_NORMAL': lambda layout:
3039 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
3040 'FACE': lambda layout:
3041 layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
3045 def extrude_options(context):
3046 tool_settings = context.tool_settings
3047 select_mode = tool_settings.mesh_select_mode
3048 mesh = context.object.data
3051 if mesh.total_face_sel:
3052 menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
3053 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
3055 if mesh.total_vert_sel and select_mode[0]:
3058 # should never get here
3061 def draw(self, context):
3062 layout = self.layout
3063 layout.operator_context = 'INVOKE_REGION_WIN'
3065 for menu_id in self.extrude_options(context):
3066 self._extrude_funcs[menu_id](layout)
3069 class VIEW3D_MT_edit_mesh_vertices(Menu):
3072 def draw(self, context):
3073 layout = self.layout
3074 layout.operator_context = 'INVOKE_REGION_WIN'
3076 layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
3077 layout.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True
3081 layout.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
3082 layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
3083 layout.operator("mesh.vert_connect", text="Connect Vertex Pairs")
3087 props = layout.operator("mesh.rip_move", text="Rip Vertices")
3088 props.MESH_OT_rip.use_fill = False
3089 props = layout.operator("mesh.rip_move", text="Rip Vertices and Fill")
3090 props.MESH_OT_rip.use_fill = True
3091 layout.operator("mesh.rip_edge_move", text="Rip Vertices and Extend")
3095 layout.operator("transform.vert_slide", text="Slide Vertices")
3096 layout.operator("mesh.vertices_smooth", text="Smooth Vertices")
3100 layout.operator("mesh.blend_from_shape")
3101 layout.operator("mesh.shape_propagate_to_all", text="Propagate to Shapes")
3105 layout.operator("mesh.merge", text="Merge Vertices")
3106 layout.operator("mesh.remove_doubles", text="Remove Double Vertices")
3110 layout.menu("VIEW3D_MT_vertex_group")
3111 layout.menu("VIEW3D_MT_hook")
3115 layout.operator("object.vertex_parent_set")
3118 class VIEW3D_MT_edit_mesh_edges_data(Menu):
3119 bl_label = "Edge Data"
3121 def draw(self, context):
3122 layout = self.layout
3124 render = context.scene.render
3126 layout.operator_context = 'INVOKE_REGION_WIN'
3128 layout.operator("transform.edge_crease")
3129 layout.operator("transform.edge_bevelweight")
3133 layout.operator("mesh.mark_seam").clear = False
3134 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
3138 layout.operator("mesh.mark_sharp")
3139 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
3141 layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
3142 props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
3143 props.use_verts = True
3146 if render.use_freestyle:
3149 layout.operator("mesh.mark_freestyle_edge").clear = False
3150 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3153 class VIEW3D_MT_edit_mesh_edges(Menu):
3156 def draw(self, context):
3157 layout = self.layout
3159 with_freestyle = bpy.app.build_options.freestyle
3161 layout.operator_context = 'INVOKE_REGION_WIN'
3163 layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
3164 layout.operator("mesh.bevel", text="Bevel Edges").vertex_only = False
3165 layout.operator("mesh.bridge_edge_loops")
3169 layout.operator("mesh.subdivide")
3170 layout.operator("mesh.subdivide_edgering")
3171 layout.operator("mesh.unsubdivide")
3175 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
3176 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
3180 layout.operator("transform.edge_slide")
3181 layout.operator("mesh.edge_split")
3185 layout.operator("transform.edge_crease")
3186 layout.operator("transform.edge_bevelweight")
3190 layout.operator("mesh.mark_seam").clear = False
3191 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
3195 layout.operator("mesh.mark_sharp")
3196 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
3198 layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
3199 props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
3200 props.use_verts = True
3206 layout.operator("mesh.mark_freestyle_edge").clear = False
3207 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3210 class VIEW3D_MT_edit_mesh_faces_data(Menu):
3211 bl_label = "Face Data"
3213 def draw(self, context):
3214 layout = self.layout
3216 with_freestyle = bpy.app.build_options.freestyle
3218 layout.operator_context = 'INVOKE_REGION_WIN'
3220 layout.operator("mesh.colors_rotate")
3221 layout.operator("mesh.colors_reverse")
3225 layout.operator("mesh.uvs_rotate")
3226 layout.operator("mesh.uvs_reverse")
3231 layout.operator("mesh.mark_freestyle_face").clear = False
3232 layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
3235 class VIEW3D_MT_edit_mesh_faces(Menu):
3237 bl_idname = "VIEW3D_MT_edit_mesh_faces"
3239 def draw(self, context):
3240 layout = self.layout
3242 layout.operator_context = 'INVOKE_REGION_WIN'
3244 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
3245 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
3246 layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
3250 layout.operator("mesh.inset")
3251 layout.operator("mesh.poke")
3252 props = layout.operator("mesh.quads_convert_to_tris")
3253 props.quad_method = props.ngon_method = 'BEAUTY'
3254 layout.operator("mesh.tris_convert_to_quads")
3255 layout.operator("mesh.solidify", text="Solidify Faces")
3256 layout.operator("mesh.wireframe")
3260 layout.operator("mesh.fill")
3261 layout.operator("mesh.fill_grid")
3262 layout.operator("mesh.beautify_fill")
3266 layout.operator("mesh.intersect")
3267 layout.operator("mesh.intersect_boolean")
3271 layout.operator("mesh.face_split_by_edges")
3275 layout.operator("mesh.faces_shade_smooth")
3276 layout.operator("mesh.faces_shade_flat")
3280 layout.menu("VIEW3D_MT_edit_mesh_faces_data")
3283 class VIEW3D_MT_edit_mesh_normals(Menu):
3284 bl_label = "Normals"
3286 def draw(self, context):
3287 layout = self.layout
3289 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
3290 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
3294 layout.operator("mesh.flip_normals")
3295 layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
3297 layout.operator("transform.rotate_normal", text="Rotate Normal")
3298 layout.operator("mesh.point_normals", text="Point normals to target")
3300 layout.operator("mesh.merge_normals", text="Merge")
3301 layout.operator("mesh.split_normals", text="Split")
3303 layout.operator("mesh.average_normals", text="Average Normals")
3305 layout.label(text="Normal Vector")
3307 layout.operator("mesh.normals_tools", text="Copy").mode = 'COPY'
3308 layout.operator("mesh.normals_tools", text="Paste").mode = 'PASTE'
3310 layout.operator("mesh.normals_tools", text="Multiply").mode = 'MULTIPLY'
3311 layout.operator("mesh.normals_tools", text="Add").mode = 'ADD'
3313 layout.operator("mesh.normals_tools", text="Reset").mode = 'RESET'
3315 layout.operator("mesh.smoothen_normals", text="Smoothen")
3317 layout.label(text="Face Strength")
3318 layout.operator("mesh.mod_weighted_strength", text="Face Select", icon='FACESEL').set = False
3319 layout.operator("mesh.mod_weighted_strength", text="Set Strength", icon='ADD').set = True
3322 class VIEW3D_MT_edit_mesh_shading(Menu):
3323 bl_label = "Shading"
3325 def draw(self, context):
3326 layout = self.layout
3328 layout.operator("mesh.faces_shade_smooth", text="Smooth Faces")
3329 layout.operator("mesh.faces_shade_flat", text="Flat Faces")
3333 layout.operator("mesh.mark_sharp", text="Smooth Edges").clear = True
3334 layout.operator("mesh.mark_sharp", text="Sharp Edges")
3338 props = layout.operator("mesh.mark_sharp", text="Smooth Vertices")
3339 props.use_verts = True
3342 layout.operator("mesh.mark_sharp", text="Sharp Vertices").use_verts = True
3345 class VIEW3D_MT_edit_mesh_weights(Menu):
3346 bl_label = "Weights"
3348 def draw(self, context):
3349 VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True)
3352 class VIEW3D_MT_edit_mesh_clean(Menu):
3353 bl_label = "Clean Up"
3355 def draw(self, context):
3356 layout = self.layout
3358 layout.operator("mesh.delete_loose")
3362 layout.operator("mesh.decimate")
3363 layout.operator("mesh.dissolve_degenerate")
3364 layout.operator("mesh.dissolve_limited")
3365 layout.operator("mesh.face_make_planar")
3369 layout.operator("mesh.vert_connect_nonplanar")
3370 layout.operator("mesh.vert_connect_concave")
3371 layout.operator("mesh.remove_doubles")
3372 layout.operator("mesh.fill_holes")
3375 class VIEW3D_MT_edit_mesh_delete(Menu):
3378 def draw(self, context):
3379 layout = self.layout
3381 layout.operator_enum("mesh.delete", "type")
3385 layout.operator("mesh.dissolve_verts")
3386 layout.operator("mesh.dissolve_edges")
3387 layout.operator("mesh.dissolve_faces")
3391 layout.operator("mesh.dissolve_limited")
3395 layout.operator("mesh.edge_collapse")
3396 layout.operator("mesh.delete_edgeloop", text="Edge Loops")
3399 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
3400 _operator_name = "mesh"
3403 class VIEW3D_MT_edit_gpencil_delete(Menu):
3406 def draw(self, context):
3407 layout = self.layout
3409 layout.operator_enum("gpencil.delete", "type")
3413 layout.operator_enum("gpencil.dissolve", "type")
3417 layout.operator("gpencil.active_frames_delete_all")
3419 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
3422 def draw_curve(self, context):
3423 layout = self.layout
3425 layout.menu("VIEW3D_MT_transform")
3426 layout.menu("VIEW3D_MT_mirror")
3427 layout.menu("VIEW3D_MT_snap")
3431 layout.operator("curve.spin")
3432 layout.operator("curve.duplicate_move")
3436 layout.operator("curve.split")
3437 layout.operator("curve.separate")
3438 layout.operator("curve.cyclic_toggle")
3439 layout.operator_menu_enum("curve.spline_type_set", "type")
3443 layout.menu("VIEW3D_MT_edit_curve_showhide")
3444 layout.menu("VIEW3D_MT_edit_curve_clean")
3445 layout.menu("VIEW3D_MT_edit_curve_delete")
3448 class VIEW3D_MT_edit_curve(Menu):
3454 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
3455 bl_label = "Control Points"
3457 def draw(self, context):
3458 layout = self.layout
3460 edit_object = context.edit_object
3462 if edit_object.type in {'CURVE', 'SURFACE'}:
3463 layout.operator("curve.extrude_move")
3467 layout.operator("curve.make_segment")
3471 if edit_object.type == 'CURVE':
3472 layout.operator("transform.tilt")
3473 layout.operator("curve.tilt_clear")
3477 layout.operator_menu_enum("curve.handle_type_set", "type")
3478 layout.operator("curve.normals_make_consistent")
3482 layout.operator("curve.smooth")
3483 if edit_object.type == 'CURVE':
3484 layout.operator("curve.smooth_weight")
3485 layout.operator("curve.smooth_radius")
3486 layout.operator("curve.smooth_tilt")
3490 layout.menu("VIEW3D_MT_hook")
3494 layout.operator("object.vertex_parent_set")
3497 class VIEW3D_MT_edit_curve_segments(Menu):
3498 bl_label = "Segments"
3500 def draw(self, context):
3501 layout = self.layout
3503 layout.operator("curve.subdivide")
3504 layout.operator("curve.switch_direction")
3507 class VIEW3D_MT_edit_curve_clean(Menu):
3508 bl_label = "Clean Up"
3510 def draw(self, context):
3511 layout = self.layout
3513 layout.operator("curve.decimate")
3516 class VIEW3D_MT_edit_curve_specials(Menu):
3517 bl_label = "Curve Context Menu"
3519 def draw(self, context):
3520 # TODO(campbell): match mesh vertex menu.
3522 layout = self.layout
3524 layout.operator_context = 'INVOKE_DEFAULT'
3526 layout.operator("curve.subdivide")
3527 layout.operator("curve.switch_direction")
3531 layout.operator("curve.duplicate_move")
3532 layout.operator("curve.split")
3533 layout.operator("curve.cyclic_toggle")
3534 layout.operator_menu_enum("curve.spline_type_set", "type")
3538 layout.operator("curve.make_segment")
3542 layout.operator("transform.tilt")
3543 layout.operator("curve.tilt_clear")
3547 layout.operator_menu_enum("curve.handle_type_set", "type")
3548 layout.operator("curve.normals_make_consistent")
3552 layout.operator("curve.spline_weight_set")
3553 layout.operator("curve.radius_set")
3557 layout.menu("VIEW3D_MT_mirror")
3558 layout.menu("VIEW3D_MT_snap")