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 layout.separator_spacer()
251 # Collection Visibility
253 panel="VIEW3D_PT_collections",
260 panel="VIEW3D_PT_object_type_visibility",
261 icon_value=view.icon_from_show_object_viewport,
265 row = layout.row(align=True)
266 row.prop(overlay, "show_overlays", icon='OVERLAY', text="")
267 sub = row.row(align=True)
268 sub.active = overlay.show_overlays
269 sub.popover(panel="VIEW3D_PT_overlay")
272 row.active = (shading.type in {'WIREFRAME', 'SOLID'}) or object_mode in {'EDIT'}
274 if shading.type == 'WIREFRAME':
275 row.prop(shading, "show_xray_wireframe", text="", icon='XRAY')
277 row.prop(shading, "show_xray", text="", icon='XRAY')
279 row = layout.row(align=True)
280 row.prop(shading, "type", text="", expand=True)
281 sub = row.row(align=True)
282 # TODO, currently render shading type ignores mesh two-side, until it's supported
283 # show the shading popover which shows double-sided option.
285 # sub.enabled = shading.type != 'RENDERED'
286 sub.popover(panel="VIEW3D_PT_shading")
289 class VIEW3D_MT_editor_menus(Menu):
290 bl_space_type = 'VIEW3D_MT_editor_menus'
293 def draw(self, context):
295 obj = context.active_object
296 mode_string = context.mode
297 edit_object = context.edit_object
298 gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}
300 layout.menu("VIEW3D_MT_view")
304 if mode_string not in {'PAINT_GPENCIL', 'WEIGHT_GPENCIL'}:
305 layout.menu("VIEW3D_MT_select_gpencil")
306 elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
308 if mesh.use_paint_mask:
309 layout.menu("VIEW3D_MT_select_paint_mask")
310 elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
311 layout.menu("VIEW3D_MT_select_paint_mask_vertex")
312 elif mode_string != 'SCULPT':
313 layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
317 elif mode_string == 'OBJECT':
318 layout.menu("VIEW3D_MT_add", text="Add")
319 elif mode_string == 'EDIT_MESH':
320 layout.menu("VIEW3D_MT_mesh_add", text="Add")
321 elif mode_string == 'EDIT_CURVE':
322 layout.menu("VIEW3D_MT_curve_add", text="Add")
323 elif mode_string == 'EDIT_SURFACE':
324 layout.menu("VIEW3D_MT_surface_add", text="Add")
325 elif mode_string == 'EDIT_METABALL':
326 layout.menu("VIEW3D_MT_metaball_add", text="Add")
327 elif mode_string == 'EDIT_ARMATURE':
328 layout.menu("TOPBAR_MT_edit_armature_add", text="Add")
331 if obj and obj.mode == 'PAINT_GPENCIL':
332 layout.menu("VIEW3D_MT_paint_gpencil")
333 elif obj and obj.mode == 'EDIT_GPENCIL':
334 layout.menu("VIEW3D_MT_edit_gpencil")
335 elif obj and obj.mode == 'WEIGHT_GPENCIL':
336 layout.menu("VIEW3D_MT_weight_gpencil")
339 layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
341 if mode_string == 'EDIT_MESH':
342 layout.menu("VIEW3D_MT_edit_mesh_vertices")
343 layout.menu("VIEW3D_MT_edit_mesh_edges")
344 layout.menu("VIEW3D_MT_edit_mesh_faces")
345 layout.menu("VIEW3D_MT_uv_map", text="UV")
346 elif mode_string in {'EDIT_CURVE', 'EDIT_SURFACE'}:
347 layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
348 layout.menu("VIEW3D_MT_edit_curve_segments")
351 if mode_string != 'PAINT_TEXTURE':
352 layout.menu("VIEW3D_MT_%s" % mode_string.lower())
353 if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
354 layout.menu("VIEW3D_MT_brush")
355 if mode_string == 'SCULPT':
356 layout.menu("VIEW3D_MT_hide_mask")
358 layout.menu("VIEW3D_MT_object")
361 # ********** Menu **********
364 # ********** Utilities **********
368 bl_label = "Show/Hide"
371 def draw(self, context):
374 layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
375 layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
376 layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
379 # Standard transforms which apply to all cases
380 # NOTE: this doesn't seem to be able to be used directly
381 class VIEW3D_MT_transform_base(Menu):
382 bl_label = "Transform"
385 # TODO: get rid of the custom text strings?
386 def draw(self, context):
389 layout.operator("transform.tosphere", text="To Sphere")
390 layout.operator("transform.shear", text="Shear")
391 layout.operator("transform.bend", text="Bend")
392 layout.operator("transform.push_pull", text="Push/Pull")
394 if context.mode != 'OBJECT':
395 layout.operator("transform.vertex_warp", text="Warp")
396 layout.operator("transform.vertex_random", text="Randomize")
399 # Generic transform menu - geometry types
400 class VIEW3D_MT_transform(VIEW3D_MT_transform_base):
401 def draw(self, context):
403 VIEW3D_MT_transform_base.draw(self, context)
407 layout.operator("transform.shrink_fatten", text="Shrink Fatten")
411 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
412 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
415 # Object-specific extensions to Transform menu
416 class VIEW3D_MT_transform_object(VIEW3D_MT_transform_base):
417 def draw(self, context):
421 VIEW3D_MT_transform_base.draw(self, context)
423 # object-specific option follow...
426 layout.operator("transform.translate", text="Move Texture Space").texture_space = True
427 layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
431 layout.operator_context = 'EXEC_REGION_WIN'
432 # XXX see alignmenu() in edit.c of b2.4x to get this working
433 layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN'
437 layout.operator("object.randomize_transform")
438 layout.operator("object.align")
440 # TODO: there is a strange context bug here.
442 layout.operator_context = 'INVOKE_REGION_WIN'
443 layout.operator("object.transform_axis_target")
447 # Armature EditMode extensions to Transform menu
448 class VIEW3D_MT_transform_armature(VIEW3D_MT_transform_base):
449 def draw(self, context):
453 VIEW3D_MT_transform_base.draw(self, context)
455 # armature specific extensions follow...
457 if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'}:
458 if obj.data.display_type == 'BBONE':
461 layout.operator("transform.transform", text="Scale BBone").mode = 'BONE_SIZE'
462 elif obj.data.display_type == 'ENVELOPE':
465 layout.operator("transform.transform", text="Scale Envelope Distance").mode = 'BONE_SIZE'
466 layout.operator("transform.transform", text="Scale Radius").mode = 'BONE_ENVELOPE'
468 if context.edit_object and context.edit_object.type == 'ARMATURE':
471 layout.operator("armature.align")
474 class VIEW3D_MT_mirror(Menu):
477 def draw(self, context):
480 layout.operator("transform.mirror", text="Interactive Mirror")
484 layout.operator_context = 'INVOKE_REGION_WIN'
486 props = layout.operator("transform.mirror", text="X Global")
487 props.constraint_axis = (True, False, False)
488 props.constraint_orientation = 'GLOBAL'
489 props = layout.operator("transform.mirror", text="Y Global")
490 props.constraint_axis = (False, True, False)
491 props.constraint_orientation = 'GLOBAL'
492 props = layout.operator("transform.mirror", text="Z Global")
493 props.constraint_axis = (False, False, True)
494 props.constraint_orientation = 'GLOBAL'
496 if context.edit_object:
499 props = layout.operator("transform.mirror", text="X Local")
500 props.constraint_axis = (True, False, False)
501 props.constraint_orientation = 'LOCAL'
502 props = layout.operator("transform.mirror", text="Y Local")
503 props.constraint_axis = (False, True, False)
504 props.constraint_orientation = 'LOCAL'
505 props = layout.operator("transform.mirror", text="Z Local")
506 props.constraint_axis = (False, False, True)
507 props.constraint_orientation = 'LOCAL'
509 layout.operator("object.vertex_group_mirror")
512 class VIEW3D_MT_snap(Menu):
515 def draw(self, context):
518 layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
519 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor").use_offset = False
520 layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Keep Offset)").use_offset = True
521 layout.operator("view3d.snap_selected_to_active", text="Selection to Active")
525 layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
526 layout.operator("view3d.snap_cursor_to_center", text="Cursor to World Origin")
527 layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
528 layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
531 class VIEW3D_MT_uv_map(Menu):
532 bl_label = "UV Mapping"
534 def draw(self, context):
537 layout.operator("uv.unwrap")
539 layout.operator_context = 'INVOKE_DEFAULT'
540 layout.operator("uv.smart_project")
541 layout.operator("uv.lightmap_pack")
542 layout.operator("uv.follow_active_quads")
546 layout.operator_context = 'EXEC_REGION_WIN'
547 layout.operator("uv.cube_project")
548 layout.operator("uv.cylinder_project")
549 layout.operator("uv.sphere_project")
553 layout.operator_context = 'INVOKE_REGION_WIN'
554 layout.operator("uv.project_from_view").scale_to_bounds = False
555 layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
559 layout.operator("mesh.mark_seam").clear = False
560 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
564 layout.operator("uv.reset")
567 class VIEW3D_MT_edit_proportional(Menu):
568 bl_label = "Proportional Editing"
570 def draw(self, context):
573 layout.props_enum(tool_settings, "proportional_edit")
577 layout.label(text="Falloff:")
578 layout.props_enum(tool_settings, "proportional_edit_falloff")
581 # ********** View menus **********
584 class VIEW3D_MT_view(Menu):
587 def draw(self, context):
589 view = context.space_data
591 layout.operator("view3d.toolshelf", icon='MENU_PANEL')
592 layout.operator("view3d.properties", icon='MENU_PANEL')
596 layout.operator("view3d.view_selected", text="Frame Selected").use_all_regions = False
597 if view.region_quadviews:
598 layout.operator("view3d.view_selected", text="Frame Selected (Quad View)").use_all_regions = True
600 layout.operator("view3d.view_all", text="Frame All").center = False
601 layout.operator("view3d.view_persportho", text="Perspective/Orthographic")
602 layout.menu("VIEW3D_MT_view_local")
606 layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
609 layout.menu("VIEW3D_MT_view_viewpoint")
610 layout.menu("VIEW3D_MT_view_navigation")
611 layout.menu("VIEW3D_MT_view_align")
615 layout.operator_context = 'INVOKE_REGION_WIN'
616 layout.menu("VIEW3D_MT_view_borders", text="View Borders")
620 layout.operator("screen.animation_play", text="Play Animation")
624 layout.operator("render.opengl", icon='RENDER_STILL')
625 layout.operator("render.opengl", text="Viewport Render Animation", icon='RENDER_ANIMATION').animation = True
629 layout.menu("INFO_MT_area")
632 class VIEW3D_MT_view_local(Menu):
633 bl_label = "Local View"
635 def draw(self, context):
637 view = context.space_data
639 layout.operator("view3d.localview", text="Toggle Local View")
640 layout.operator("view3d.localview_remove_from")
643 class VIEW3D_MT_view_cameras(Menu):
646 def draw(self, context):
649 layout.operator("view3d.object_as_camera")
650 layout.operator("view3d.view_camera", text="Active Camera")
653 class VIEW3D_MT_view_viewpoint(Menu):
654 bl_label = "Viewpoint"
656 def draw(self, context):
659 layout.operator("view3d.view_camera", text="Camera")
663 layout.operator("view3d.view_axis", text="Top").type = 'TOP'
664 layout.operator("view3d.view_axis", text="Bottom").type = 'BOTTOM'
668 layout.operator("view3d.view_axis", text="Front").type = 'FRONT'
669 layout.operator("view3d.view_axis", text="Back").type = 'BACK'
673 layout.operator("view3d.view_axis", text="Right").type = 'RIGHT'
674 layout.operator("view3d.view_axis", text="Left").type = 'LEFT'
677 class VIEW3D_MT_view_navigation(Menu):
678 bl_label = "Navigation"
680 def draw(self, context):
684 layout.operator_enum("view3d.view_orbit", "type")
685 props = layout.operator("view3d.view_orbit", text="Orbit Opposite")
686 props.type = 'ORBITRIGHT'
691 layout.operator("view3d.view_roll", text="Roll Left").type = 'LEFT'
692 layout.operator("view3d.view_roll", text="Roll Right").type = 'RIGHT'
696 layout.operator_enum("view3d.view_pan", "type")
700 layout.operator("view3d.zoom", text="Zoom In").delta = 1
701 layout.operator("view3d.zoom", text="Zoom Out").delta = -1
702 layout.operator("view3d.zoom_border", text="Zoom Border...")
703 layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
707 layout.operator("view3d.fly")
708 layout.operator("view3d.walk")
711 class VIEW3D_MT_view_align(Menu):
712 bl_label = "Align View"
714 def draw(self, context):
717 layout.menu("VIEW3D_MT_view_align_selected")
721 layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
722 layout.operator("view3d.camera_to_view_selected", text="Align Active Camera to Selected")
726 layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
727 layout.operator("view3d.view_center_cursor")
731 layout.operator("view3d.view_lock_to_active")
732 layout.operator("view3d.view_lock_clear")
735 class VIEW3D_MT_view_align_selected(Menu):
736 bl_label = "Align View to Active"
738 def draw(self, context):
741 props = layout.operator("view3d.view_axis", text="Top")
742 props.align_active = True
745 props = layout.operator("view3d.view_axis", text="Bottom")
746 props.align_active = True
747 props.type = 'BOTTOM'
751 props = layout.operator("view3d.view_axis", text="Front")
752 props.align_active = True
755 props = layout.operator("view3d.view_axis", text="Back")
756 props.align_active = True
761 props = layout.operator("view3d.view_axis", text="Right")
762 props.align_active = True
765 props = layout.operator("view3d.view_axis", text="Left")
766 props.align_active = True
770 class VIEW3D_MT_view_borders(Menu):
771 bl_label = "View Borders"
773 def draw(self, context):
775 # layout.operator("view3d.clip_border", text="Clipping Border...")
776 layout.operator("view3d.render_border", text="Render Border...")
780 layout.operator("view3d.clear_render_border")
783 # ********** Select menus, suffix from context.mode **********
785 class VIEW3D_MT_select_object_more_less(Menu):
786 bl_label = "Select More/Less"
788 def draw(self, context):
793 layout.operator("object.select_more", text="More")
794 layout.operator("object.select_less", text="Less")
798 props = layout.operator("object.select_hierarchy", text="Parent")
800 props.direction = 'PARENT'
802 props = layout.operator("object.select_hierarchy", text="Child")
804 props.direction = 'CHILD'
808 props = layout.operator("object.select_hierarchy", text="Extend Parent")
810 props.direction = 'PARENT'
812 props = layout.operator("object.select_hierarchy", text="Extend Child")
814 props.direction = 'CHILD'
817 class VIEW3D_MT_select_object(Menu):
820 def draw(self, context):
823 layout.operator("object.select_all", text="All").action = 'SELECT'
824 layout.operator("object.select_all", text="None").action = 'DESELECT'
825 layout.operator("object.select_all", text="Invert").action = 'INVERT'
829 layout.operator("view3d.select_box")
830 layout.operator("view3d.select_circle")
834 layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
835 layout.operator("object.select_camera", text="Select Active Camera")
836 layout.operator("object.select_mirror", text="Mirror Selection")
837 layout.operator("object.select_random", text="Select Random")
841 layout.menu("VIEW3D_MT_select_object_more_less")
845 layout.operator_menu_enum("object.select_grouped", "type", text="Select Grouped")
846 layout.operator_menu_enum("object.select_linked", "type", text="Select Linked")
847 layout.operator("object.select_pattern", text="Select Pattern...")
850 class VIEW3D_MT_select_pose_more_less(Menu):
851 bl_label = "Select More/Less"
853 def draw(self, context):
858 props = layout.operator("pose.select_hierarchy", text="Parent")
860 props.direction = 'PARENT'
862 props = layout.operator("pose.select_hierarchy", text="Child")
864 props.direction = 'CHILD'
868 props = layout.operator("pose.select_hierarchy", text="Extend Parent")
870 props.direction = 'PARENT'
872 props = layout.operator("pose.select_hierarchy", text="Extend Child")
874 props.direction = 'CHILD'
877 class VIEW3D_MT_select_pose(Menu):
880 def draw(self, context):
883 layout.operator("pose.select_all", text="All").action = 'SELECT'
884 layout.operator("pose.select_all", text="None").action = 'DESELECT'
885 layout.operator("pose.select_all", text="Invert").action = 'INVERT'
889 layout.operator("view3d.select_box")
890 layout.operator("view3d.select_circle")
894 layout.operator("pose.select_mirror", text="Flip Active")
898 layout.operator("pose.select_constraint_target", text="Constraint Target")
899 layout.operator("pose.select_linked", text="Linked")
903 layout.menu("VIEW3D_MT_select_pose_more_less")
907 layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
908 layout.operator("object.select_pattern", text="Select Pattern...")
911 class VIEW3D_MT_select_particle(Menu):
914 def draw(self, context):
917 layout.operator("particle.select_all", text="All").action = 'SELECT'
918 layout.operator("particle.select_all", text="None").action = 'DESELECT'
919 layout.operator("particle.select_all", text="Invert").action = 'INVERT'
923 layout.operator("view3d.select_box")
924 layout.operator("view3d.select_circle")
928 layout.operator("particle.select_linked")
932 layout.operator("particle.select_more")
933 layout.operator("particle.select_less")
937 layout.operator("particle.select_random")
941 layout.operator("particle.select_roots", text="Roots")
942 layout.operator("particle.select_tips", text="Tips")
945 class VIEW3D_MT_edit_mesh_select_similar(Menu):
946 bl_label = "Select Similar"
948 def draw(self, context):
951 layout.operator_enum("mesh.select_similar", "type")
955 layout.operator("mesh.select_similar_region", text="Face Regions")
958 class VIEW3D_MT_edit_mesh_select_by_trait(Menu):
959 bl_label = "Select All by Trait"
961 def draw(self, context):
963 tool_settings = context.tool_settings
964 if tool_settings.mesh_select_mode[2] is False:
965 layout.operator("mesh.select_non_manifold", text="Non Manifold")
966 layout.operator("mesh.select_loose", text="Loose Geometry")
967 layout.operator("mesh.select_interior_faces", text="Interior Faces")
968 layout.operator("mesh.select_face_by_sides", text="Faces by Sides")
972 layout.operator("mesh.select_ungrouped", text="Ungrouped Verts")
975 class VIEW3D_MT_edit_mesh_select_more_less(Menu):
976 bl_label = "Select More/Less"
978 def draw(self, context):
981 layout.operator("mesh.select_more", text="More")
982 layout.operator("mesh.select_less", text="Less")
986 layout.operator("mesh.select_next_item", text="Next Active")
987 layout.operator("mesh.select_prev_item", text="Previous Active")
990 class VIEW3D_MT_edit_mesh_select_linked(Menu):
991 bl_label = "Select Linked"
993 def draw(self, context):
996 layout.operator("mesh.select_linked", text="Linked")
997 layout.operator("mesh.shortest_path_select", text="Shortest Path")
998 layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
1001 class VIEW3D_MT_edit_mesh_select_loops(Menu):
1002 bl_label = "Select Loops"
1004 def draw(self, context):
1005 layout = self.layout
1007 layout.operator("mesh.loop_multi_select", text="Edge Loops").ring = False
1008 layout.operator("mesh.loop_multi_select", text="Edge Rings").ring = True
1012 layout.operator("mesh.loop_to_region")
1013 layout.operator("mesh.region_to_loop")
1016 class VIEW3D_MT_select_edit_mesh(Menu):
1019 def draw(self, context):
1020 layout = self.layout
1023 layout.operator("mesh.select_all", text="All").action = 'SELECT'
1024 layout.operator("mesh.select_all", text="None").action = 'DESELECT'
1025 layout.operator("mesh.select_all", text="Invert").action = 'INVERT'
1029 layout.operator("view3d.select_box")
1030 layout.operator("view3d.select_circle")
1035 layout.operator("mesh.select_random", text="Select Random")
1036 layout.operator("mesh.select_nth")
1041 layout.operator("mesh.edges_select_sharp", text="Select Sharp Edges")
1046 layout.menu("VIEW3D_MT_edit_mesh_select_similar")
1050 layout.menu("VIEW3D_MT_edit_mesh_select_by_trait")
1054 layout.menu("VIEW3D_MT_edit_mesh_select_more_less")
1058 layout.menu("VIEW3D_MT_edit_mesh_select_loops")
1062 layout.menu("VIEW3D_MT_edit_mesh_select_linked")
1066 layout.operator("mesh.select_axis", text="Side of Active")
1067 layout.operator("mesh.select_mirror", text="Mirror Selection")
1070 class VIEW3D_MT_select_edit_curve(Menu):
1073 def draw(self, context):
1074 layout = self.layout
1076 layout.operator("curve.select_all", text="All").action = 'SELECT'
1077 layout.operator("curve.select_all", text="None").action = 'DESELECT'
1078 layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1082 layout.operator("view3d.select_box")
1083 layout.operator("view3d.select_circle")
1087 layout.operator("curve.select_random")
1088 layout.operator("curve.select_nth")
1089 layout.operator("curve.select_linked", text="Select Linked")
1090 layout.operator("curve.select_similar", text="Select Similar")
1094 layout.operator("curve.de_select_first")
1095 layout.operator("curve.de_select_last")
1096 layout.operator("curve.select_next")
1097 layout.operator("curve.select_previous")
1101 layout.operator("curve.select_more")
1102 layout.operator("curve.select_less")
1105 class VIEW3D_MT_select_edit_surface(Menu):
1108 def draw(self, context):
1109 layout = self.layout
1111 layout.operator("curve.select_all", text="All").action = 'SELECT'
1112 layout.operator("curve.select_all", text="None").action = 'DESELECT'
1113 layout.operator("curve.select_all", text="Invert").action = 'INVERT'
1117 layout.operator("view3d.select_box")
1118 layout.operator("view3d.select_circle")
1122 layout.operator("curve.select_random")
1123 layout.operator("curve.select_nth")
1124 layout.operator("curve.select_linked", text="Select Linked")
1125 layout.operator("curve.select_similar", text="Select Similar")
1129 layout.operator("curve.select_row")
1133 layout.operator("curve.select_more")
1134 layout.operator("curve.select_less")
1137 class VIEW3D_MT_select_edit_text(Menu):
1138 # intentional name mismatch
1139 # select menu for 3d-text doesn't make sense
1142 def draw(self, context):
1143 layout = self.layout
1145 layout.operator("font.text_cut", text="Cut")
1146 layout.operator("font.text_copy", text="Copy", icon='COPYDOWN')
1147 layout.operator("font.text_paste", text="Paste", icon='PASTEDOWN')
1151 layout.operator("font.text_paste_from_file")
1155 layout.operator("font.select_all")
1158 class VIEW3D_MT_select_edit_metaball(Menu):
1161 def draw(self, context):
1162 layout = self.layout
1164 layout.operator("mball.select_all", text="All").action = 'SELECT'
1165 layout.operator("mball.select_all", text="None").action = 'DESELECT'
1166 layout.operator("mball.select_all", text="Invert").action = 'INVERT'
1170 layout.operator("view3d.select_box")
1171 layout.operator("view3d.select_circle")
1175 layout.operator("mball.select_random_metaelems")
1179 layout.operator_menu_enum("mball.select_similar", "type", text="Similar")
1182 class VIEW3D_MT_select_edit_lattice(Menu):
1185 def draw(self, context):
1186 layout = self.layout
1188 layout.operator("lattice.select_all", text="All").action = 'SELECT'
1189 layout.operator("lattice.select_all", text="None").action = 'DESELECT'
1190 layout.operator("lattice.select_all", text="Invert").action = 'INVERT'
1194 layout.operator("view3d.select_box")
1195 layout.operator("view3d.select_circle")
1199 layout.operator("lattice.select_mirror")
1200 layout.operator("lattice.select_random")
1204 layout.operator("lattice.select_more")
1205 layout.operator("lattice.select_less")
1209 layout.operator("lattice.select_ungrouped", text="Ungrouped Verts")
1212 class VIEW3D_MT_select_edit_armature(Menu):
1215 def draw(self, context):
1216 layout = self.layout
1218 layout.operator("armature.select_all", text="All").action = 'SELECT'
1219 layout.operator("armature.select_all", text="None").action = 'DESELECT'
1220 layout.operator("armature.select_all", text="Invert").action = 'INVERT'
1224 layout.operator("view3d.select_box")
1225 layout.operator("view3d.select_circle")
1229 layout.operator("armature.select_mirror", text="Mirror").extend = False
1233 layout.operator("armature.select_more", text="More")
1234 layout.operator("armature.select_less", text="Less")
1238 props = layout.operator("armature.select_hierarchy", text="Parent")
1239 props.extend = False
1240 props.direction = 'PARENT'
1242 props = layout.operator("armature.select_hierarchy", text="Child")
1243 props.extend = False
1244 props.direction = 'CHILD'
1248 props = layout.operator("armature.select_hierarchy", text="Extend Parent")
1250 props.direction = 'PARENT'
1252 props = layout.operator("armature.select_hierarchy", text="Extend Child")
1254 props.direction = 'CHILD'
1256 layout.operator_menu_enum("armature.select_similar", "type", text="Similar")
1257 layout.operator("object.select_pattern", text="Select Pattern...")
1260 class VIEW3D_MT_select_gpencil(Menu):
1263 def draw(self, context):
1264 layout = self.layout
1266 layout.operator("gpencil.select_all", text="All").action = 'SELECT'
1267 layout.operator("gpencil.select_all", text="None").action = 'DESELECT'
1268 layout.operator("gpencil.select_all", text="Invert").action = 'INVERT'
1272 layout.operator("gpencil.select_box")
1273 layout.operator("gpencil.select_circle")
1277 layout.operator("gpencil.select_linked", text="Linked")
1278 layout.operator("gpencil.select_alternate")
1279 layout.operator_menu_enum("gpencil.select_grouped", "type", text="Grouped")
1283 layout.operator("gpencil.select_first")
1284 layout.operator("gpencil.select_last")
1288 layout.operator("gpencil.select_more")
1289 layout.operator("gpencil.select_less")
1292 class VIEW3D_MT_select_paint_mask(Menu):
1295 def draw(self, context):
1296 layout = self.layout
1298 layout.operator("paint.face_select_all", text="All").action = 'SELECT'
1299 layout.operator("paint.face_select_all", text="None").action = 'DESELECT'
1300 layout.operator("paint.face_select_all", text="Invert").action = 'INVERT'
1304 layout.operator("view3d.select_box")
1305 layout.operator("view3d.select_circle")
1309 layout.operator("paint.face_select_linked", text="Linked")
1312 class VIEW3D_MT_select_paint_mask_vertex(Menu):
1315 def draw(self, context):
1316 layout = self.layout
1318 layout.operator("paint.vert_select_all", text="All").action = 'SELECT'
1319 layout.operator("paint.vert_select_all", text="None").action = 'DESELECT'
1320 layout.operator("paint.vert_select_all", text="Invert").action = 'INVERT'
1324 layout.operator("view3d.select_box")
1325 layout.operator("view3d.select_circle")
1329 layout.operator("paint.vert_select_ungrouped", text="Ungrouped Verts")
1332 class VIEW3D_MT_angle_control(Menu):
1333 bl_label = "Angle Control"
1336 def poll(cls, context):
1337 settings = UnifiedPaintPanel.paint_settings(context)
1341 brush = settings.brush
1342 tex_slot = brush.texture_slot
1344 return tex_slot.has_texture_angle and tex_slot.has_texture_angle_source
1346 def draw(self, context):
1347 layout = self.layout
1349 settings = UnifiedPaintPanel.paint_settings(context)
1350 brush = settings.brush
1352 sculpt = (context.sculpt_object is not None)
1354 tex_slot = brush.texture_slot
1356 layout.prop(tex_slot, "use_rake", text="Rake")
1358 if brush.brush_capabilities.has_random_texture_angle and tex_slot.has_random_texture_angle:
1360 if brush.sculpt_capabilities.has_random_texture_angle:
1361 layout.prop(tex_slot, "use_random", text="Random")
1363 layout.prop(tex_slot, "use_random", text="Random")
1366 class VIEW3D_MT_mesh_add(Menu):
1367 bl_idname = "VIEW3D_MT_mesh_add"
1370 def draw(self, context):
1371 layout = self.layout
1373 layout.operator_context = 'INVOKE_REGION_WIN'
1375 layout.operator("mesh.primitive_plane_add", text="Plane", icon='MESH_PLANE')
1376 layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
1377 layout.operator("mesh.primitive_circle_add", text="Circle", icon='MESH_CIRCLE')
1378 layout.operator("mesh.primitive_uv_sphere_add", text="UV Sphere", icon='MESH_UVSPHERE')
1379 layout.operator("mesh.primitive_ico_sphere_add", text="Ico Sphere", icon='MESH_ICOSPHERE')
1380 layout.operator("mesh.primitive_cylinder_add", text="Cylinder", icon='MESH_CYLINDER')
1381 layout.operator("mesh.primitive_cone_add", text="Cone", icon='MESH_CONE')
1382 layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
1386 layout.operator("mesh.primitive_grid_add", text="Grid", icon='MESH_GRID')
1387 layout.operator("mesh.primitive_monkey_add", text="Monkey", icon='MESH_MONKEY')
1390 class VIEW3D_MT_curve_add(Menu):
1391 bl_idname = "VIEW3D_MT_curve_add"
1394 def draw(self, context):
1395 layout = self.layout
1397 layout.operator_context = 'INVOKE_REGION_WIN'
1399 layout.operator("curve.primitive_bezier_curve_add", text="Bezier", icon='CURVE_BEZCURVE')
1400 layout.operator("curve.primitive_bezier_circle_add", text="Circle", icon='CURVE_BEZCIRCLE')
1404 layout.operator("curve.primitive_nurbs_curve_add", text="Nurbs Curve", icon='CURVE_NCURVE')
1405 layout.operator("curve.primitive_nurbs_circle_add", text="Nurbs Circle", icon='CURVE_NCIRCLE')
1406 layout.operator("curve.primitive_nurbs_path_add", text="Path", icon='CURVE_PATH')
1409 class VIEW3D_MT_surface_add(Menu):
1410 bl_idname = "VIEW3D_MT_surface_add"
1411 bl_label = "Surface"
1413 def draw(self, context):
1414 layout = self.layout
1416 layout.operator_context = 'INVOKE_REGION_WIN'
1418 layout.operator("surface.primitive_nurbs_surface_curve_add", text="Nurbs Curve", icon='SURFACE_NCURVE')
1419 layout.operator("surface.primitive_nurbs_surface_circle_add", text="Nurbs Circle", icon='SURFACE_NCIRCLE')
1420 layout.operator("surface.primitive_nurbs_surface_surface_add", text="Nurbs Surface", icon='SURFACE_NSURFACE')
1421 layout.operator("surface.primitive_nurbs_surface_cylinder_add",
1422 text="Nurbs Cylinder", icon='SURFACE_NCYLINDER')
1423 layout.operator("surface.primitive_nurbs_surface_sphere_add", text="Nurbs Sphere", icon='SURFACE_NSPHERE')
1424 layout.operator("surface.primitive_nurbs_surface_torus_add", text="Nurbs Torus", icon='SURFACE_NTORUS')
1427 class VIEW3D_MT_metaball_add(Menu):
1428 bl_idname = "VIEW3D_MT_metaball_add"
1429 bl_label = "Metaball"
1431 def draw(self, context):
1432 layout = self.layout
1434 layout.operator_context = 'INVOKE_REGION_WIN'
1435 layout.operator_enum("object.metaball_add", "type")
1438 class TOPBAR_MT_edit_curve_add(Menu):
1439 bl_idname = "TOPBAR_MT_edit_curve_add"
1442 def draw(self, context):
1443 is_surf = context.active_object.type == 'SURFACE'
1445 layout = self.layout
1446 layout.operator_context = 'EXEC_REGION_WIN'
1449 VIEW3D_MT_surface_add.draw(self, context)
1451 VIEW3D_MT_curve_add.draw(self, context)
1454 class TOPBAR_MT_edit_armature_add(Menu):
1455 bl_idname = "TOPBAR_MT_edit_armature_add"
1456 bl_label = "Armature"
1458 def draw(self, context):
1459 layout = self.layout
1461 layout.operator_context = 'EXEC_REGION_WIN'
1462 layout.operator("armature.bone_primitive_add", text="Single Bone", icon='BONE_DATA')
1465 class VIEW3D_MT_armature_add(Menu):
1466 bl_idname = "VIEW3D_MT_armature_add"
1467 bl_label = "Armature"
1469 def draw(self, context):
1470 layout = self.layout
1472 layout.operator_context = 'EXEC_REGION_WIN'
1473 layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
1476 class VIEW3D_MT_light_add(Menu):
1477 bl_idname = "VIEW3D_MT_light_add"
1480 def draw(self, context):
1481 layout = self.layout
1483 layout.operator_context = 'INVOKE_REGION_WIN'
1484 layout.operator_enum("object.light_add", "type")
1487 class VIEW3D_MT_lightprobe_add(Menu):
1488 bl_idname = "VIEW3D_MT_lightprobe_add"
1489 bl_label = "Light Probe"
1491 def draw(self, context):
1492 layout = self.layout
1494 layout.operator_context = 'INVOKE_REGION_WIN'
1495 layout.operator_enum("object.lightprobe_add", "type")
1498 class VIEW3D_MT_camera_add(Menu):
1499 bl_idname = "VIEW3D_MT_camera_add"
1502 def draw(self, context):
1503 layout = self.layout
1504 layout.operator_context = 'EXEC_REGION_WIN'
1505 layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
1508 class VIEW3D_MT_add(Menu):
1511 def draw(self, context):
1512 layout = self.layout
1514 # note, don't use 'EXEC_SCREEN' or operators won't get the 'v3d' context.
1516 # Note: was EXEC_AREA, but this context does not have the 'rv3d', which prevents
1517 # "align_view" to work on first call (see [#32719]).
1518 layout.operator_context = 'EXEC_REGION_WIN'
1520 # layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
1521 layout.menu("VIEW3D_MT_mesh_add", icon='OUTLINER_OB_MESH')
1523 # layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
1524 layout.menu("VIEW3D_MT_curve_add", icon='OUTLINER_OB_CURVE')
1525 # layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
1526 layout.menu("VIEW3D_MT_surface_add", icon='OUTLINER_OB_SURFACE')
1527 layout.menu("VIEW3D_MT_metaball_add", text="Metaball", icon='OUTLINER_OB_META')
1528 layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
1529 layout.operator_menu_enum("object.gpencil_add", "type", text="Grease Pencil", icon='OUTLINER_OB_GREASEPENCIL')
1532 layout.menu("VIEW3D_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
1533 layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
1534 layout.operator_menu_enum("object.empty_add", "type", text="Empty", icon='OUTLINER_OB_EMPTY')
1535 layout.menu("VIEW3D_MT_image_add", text="Image", icon='OUTLINER_OB_IMAGE')
1539 layout.operator("object.speaker_add", text="Speaker", icon='OUTLINER_OB_SPEAKER')
1542 if VIEW3D_MT_camera_add.is_extended():
1543 layout.menu("VIEW3D_MT_camera_add", icon='OUTLINER_OB_CAMERA')
1545 VIEW3D_MT_camera_add.draw(self, context)
1547 layout.menu("VIEW3D_MT_light_add", icon='OUTLINER_OB_LIGHT')
1549 layout.menu("VIEW3D_MT_lightprobe_add", icon='OUTLINER_OB_LIGHTPROBE')
1552 layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_FORCE_FIELD')
1555 has_collections = bool(bpy.data.collections)
1556 col = layout.column()
1557 col.enabled = has_collections
1559 if not has_collections or len(bpy.data.collections) > 10:
1560 col.operator_context = 'INVOKE_REGION_WIN'
1562 "object.collection_instance_add",
1563 text="Collection Instance..." if has_collections else "No Collections to Instance",
1564 icon='OUTLINER_OB_GROUP_INSTANCE',
1567 col.operator_menu_enum(
1568 "object.collection_instance_add",
1570 text="Collection Instance",
1571 icon='OUTLINER_OB_GROUP_INSTANCE',
1575 class VIEW3D_MT_image_add(Menu):
1576 bl_label = "Add Image"
1578 def draw(self, context):
1579 layout = self.layout
1580 layout.operator("object.load_reference_image", text="Reference", icon='IMAGE_REFERENCE')
1581 layout.operator("object.load_background_image", text="Background", icon='IMAGE_BACKGROUND')
1584 class VIEW3D_MT_object_relations(Menu):
1585 bl_label = "Relations"
1587 def draw(self, context):
1588 layout = self.layout
1590 layout.operator("object.proxy_make", text="Make Proxy...")
1592 layout.operator("object.make_dupli_face")
1596 layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
1597 layout.menu("VIEW3D_MT_make_single_user")
1601 layout.operator("object.data_transfer")
1602 layout.operator("object.datalayout_transfer")
1605 class VIEW3D_MT_object(Menu):
1606 bl_context = "objectmode"
1609 def draw(self, context):
1610 layout = self.layout
1612 layout.menu("VIEW3D_MT_transform_object")
1613 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1614 layout.menu("VIEW3D_MT_mirror")
1615 layout.menu("VIEW3D_MT_object_clear")
1616 layout.menu("VIEW3D_MT_object_apply")
1617 layout.menu("VIEW3D_MT_snap")
1621 layout.operator("object.duplicate_move")
1622 layout.operator("object.duplicate_move_linked")
1623 layout.operator("object.join")
1627 layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1628 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1632 layout.menu("VIEW3D_MT_object_parent")
1633 layout.menu("VIEW3D_MT_object_collection")
1634 layout.menu("VIEW3D_MT_object_relations")
1635 layout.menu("VIEW3D_MT_object_constraints")
1636 layout.menu("VIEW3D_MT_object_track")
1637 layout.menu("VIEW3D_MT_make_links", text="Make Links...")
1641 layout.operator("object.shade_smooth")
1642 layout.operator("object.shade_flat")
1646 layout.menu("VIEW3D_MT_object_animation")
1647 layout.menu("VIEW3D_MT_object_rigid_body")
1651 layout.menu("VIEW3D_MT_object_quick_effects")
1655 layout.operator_menu_enum("object.convert", "target")
1659 layout.menu("VIEW3D_MT_object_showhide")
1663 layout.operator_context = 'EXEC_DEFAULT'
1664 layout.operator("object.delete", text="Delete").use_global = False
1665 layout.operator("object.delete", text="Delete Global").use_global = True
1668 class VIEW3D_MT_object_animation(Menu):
1669 bl_label = "Animation"
1671 def draw(self, context):
1672 layout = self.layout
1674 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1675 layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframes...")
1676 layout.operator("anim.keyframe_clear_v3d", text="Clear Keyframes...")
1677 layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
1681 layout.operator("nla.bake", text="Bake Action...")
1684 class VIEW3D_MT_object_rigid_body(Menu):
1685 bl_label = "Rigid Body"
1687 def draw(self, context):
1688 layout = self.layout
1690 layout.operator("rigidbody.objects_add", text="Add Active").type = 'ACTIVE'
1691 layout.operator("rigidbody.objects_add", text="Add Passive").type = 'PASSIVE'
1695 layout.operator("rigidbody.objects_remove", text="Remove")
1699 layout.operator("rigidbody.shape_change", text="Change Shape")
1700 layout.operator("rigidbody.mass_calculate", text="Calculate Mass")
1701 layout.operator("rigidbody.object_settings_copy", text="Copy from Active")
1702 layout.operator("object.visual_transform_apply", text="Apply Transformation")
1703 layout.operator("rigidbody.bake_to_keyframes", text="Bake To Keyframes")
1707 layout.operator("rigidbody.connect", text="Connect")
1710 class VIEW3D_MT_object_clear(Menu):
1713 def draw(self, context):
1714 layout = self.layout
1716 layout.operator("object.location_clear", text="Location").clear_delta = False
1717 layout.operator("object.rotation_clear", text="Rotation").clear_delta = False
1718 layout.operator("object.scale_clear", text="Scale").clear_delta = False
1722 layout.operator("object.origin_clear", text="Origin")
1725 class VIEW3D_MT_object_specials(Menu):
1726 bl_label = "Object Context Menu"
1728 def draw(self, context):
1730 layout = self.layout
1731 view = context.space_data
1733 obj = context.object
1734 is_eevee = context.scene.render.engine == 'BLENDER_EEVEE'
1736 selected_objects_len = len(context.selected_objects)
1738 # If nothing is selected
1739 # (disabled for now until it can be made more useful).
1741 if selected_objects_len == 0:
1743 layout.menu("VIEW3D_MT_add", text="Add")
1744 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1749 # If something is selected
1752 elif obj.type == 'MESH':
1754 layout.operator("object.shade_smooth", text="Shade Smooth")
1755 layout.operator("object.shade_flat", text="Shade Flat")
1759 layout.operator_context = 'INVOKE_REGION_WIN'
1760 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1762 layout.operator_context = 'INVOKE_DEFAULT'
1763 # If more than one object is selected
1764 if selected_objects_len > 1:
1765 layout.operator("object.join")
1767 elif obj.type == 'CAMERA':
1768 layout.operator_context = 'INVOKE_REGION_WIN'
1770 if obj.data.type == 'PERSP':
1771 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
1772 props.data_path_iter = "selected_editable_objects"
1773 props.data_path_item = "data.lens"
1774 props.input_scale = 0.1
1775 if obj.data.lens_unit == 'MILLIMETERS':
1776 props.header_text = "Camera Lens Angle: %.1fmm"
1778 props.header_text = "Camera Lens Angle: %.1f\u00B0"
1781 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
1782 props.data_path_iter = "selected_editable_objects"
1783 props.data_path_item = "data.ortho_scale"
1784 props.input_scale = 0.01
1785 props.header_text = "Camera Lens Scale: %.3f"
1787 if not obj.data.dof_object:
1788 if view and view.camera == obj and view.region_3d.view_perspective == 'CAMERA':
1789 props = layout.operator("ui.eyedropper_depth", text="DOF Distance (Pick)")
1791 props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
1792 props.data_path_iter = "selected_editable_objects"
1793 props.data_path_item = "data.dof_distance"
1794 props.input_scale = 0.02
1795 props.header_text = "DOF Distance: %.3f"
1797 elif obj.type in {'CURVE', 'FONT'}:
1798 layout.operator_context = 'INVOKE_REGION_WIN'
1800 props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
1801 props.data_path_iter = "selected_editable_objects"
1802 props.data_path_item = "data.extrude"
1803 props.input_scale = 0.01
1804 props.header_text = "Extrude Size: %.3f"
1806 props = layout.operator("wm.context_modal_mouse", text="Width Size")
1807 props.data_path_iter = "selected_editable_objects"
1808 props.data_path_item = "data.offset"
1809 props.input_scale = 0.01
1810 props.header_text = "Width Size: %.3f"
1812 layout.operator("object.convert", text="Convert to Mesh").target = 'MESH'
1814 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1816 elif obj.type == 'GPENCIL':
1817 layout.operator("gpencil.convert", text="Convert to Path").type = 'PATH'
1818 layout.operator("gpencil.convert", text="Convert to Bezier Curves").type = 'CURVE'
1819 layout.operator("gpencil.convert", text="Convert to Mesh").type = 'POLY'
1821 layout.operator_menu_enum("object.origin_set", text="Set Origin...", property="type")
1823 elif obj.type == 'EMPTY':
1824 layout.operator_context = 'INVOKE_REGION_WIN'
1826 props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
1827 props.data_path_iter = "selected_editable_objects"
1828 props.data_path_item = "empty_display_size"
1829 props.input_scale = 0.01
1830 props.header_text = "Empty Draw Size: %.3f"
1832 elif obj.type == 'LIGHT':
1835 layout.operator_context = 'INVOKE_REGION_WIN'
1837 emission_node = None
1839 for node in light.node_tree.nodes:
1840 if getattr(node, "type", None) == 'EMISSION':
1841 emission_node = node
1844 if is_eevee and not emission_node:
1845 props = layout.operator("wm.context_modal_mouse", text="Energy")
1846 props.data_path_iter = "selected_editable_objects"
1847 props.data_path_item = "data.energy"
1848 props.header_text = "Light Energy: %.3f"
1850 if emission_node is not None:
1851 props = layout.operator("wm.context_modal_mouse", text="Energy")
1852 props.data_path_iter = "selected_editable_objects"
1853 props.data_path_item = (
1855 ".nodes[\"" + emission_node.name + "\"]"
1856 ".inputs[\"Strength\"].default_value"
1858 props.header_text = "Light Energy: %.3f"
1859 props.input_scale = 0.1
1861 if light.type == 'AREA':
1862 props = layout.operator("wm.context_modal_mouse", text="Size X")
1863 props.data_path_iter = "selected_editable_objects"
1864 props.data_path_item = "data.size"
1865 props.header_text = "Light Size X: %.3f"
1867 if light.shape in {'RECTANGLE', 'ELLIPSE'}:
1868 props = layout.operator("wm.context_modal_mouse", text="Size Y")
1869 props.data_path_iter = "selected_editable_objects"
1870 props.data_path_item = "data.size_y"
1871 props.header_text = "Light Size Y: %.3f"
1873 elif light.type in {'SPOT', 'POINT', 'SUN'}:
1874 props = layout.operator("wm.context_modal_mouse", text="Radius")
1875 props.data_path_iter = "selected_editable_objects"
1876 props.data_path_item = "data.shadow_soft_size"
1877 props.header_text = "Light Radius: %.3f"
1879 if light.type == 'SPOT':
1882 props = layout.operator("wm.context_modal_mouse", text="Spot Size")
1883 props.data_path_iter = "selected_editable_objects"
1884 props.data_path_item = "data.spot_size"
1885 props.input_scale = 0.01
1886 props.header_text = "Spot Size: %.2f"
1888 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
1889 props.data_path_iter = "selected_editable_objects"
1890 props.data_path_item = "data.spot_blend"
1891 props.input_scale = -0.01
1892 props.header_text = "Spot Blend: %.2f"
1896 layout.operator("view3d.copybuffer", text="Copy Objects", icon='COPYDOWN')
1897 layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
1901 layout.operator("object.duplicate_move", icon='DUPLICATE')
1902 layout.operator("object.duplicate_move_linked")
1906 layout.menu("VIEW3D_MT_snap")
1907 layout.menu("VIEW3D_MT_object_parent")
1908 layout.operator_context = 'INVOKE_REGION_WIN'
1910 if view and view.local_view:
1911 layout.operator("view3d.localview_remove_from")
1913 layout.operator("object.move_to_collection")
1917 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
1921 layout.operator_context = 'EXEC_DEFAULT'
1922 layout.operator("object.delete", text="Delete").use_global = False
1925 class VIEW3D_MT_object_shading(Menu):
1926 # XXX, this menu is a place to store shading operator in object mode
1927 bl_label = "Shading"
1929 def draw(self, context):
1930 layout = self.layout
1931 layout.operator("object.shade_smooth", text="Smooth")
1932 layout.operator("object.shade_flat", text="Flat")
1935 class VIEW3D_MT_object_apply(Menu):
1938 def draw(self, context):
1939 layout = self.layout
1941 props = layout.operator("object.transform_apply", text="Location", text_ctxt=i18n_contexts.default)
1942 props.location, props.rotation, props.scale = True, False, False
1944 props = layout.operator("object.transform_apply", text="Rotation", text_ctxt=i18n_contexts.default)
1945 props.location, props.rotation, props.scale = False, True, False
1947 props = layout.operator("object.transform_apply", text="Scale", text_ctxt=i18n_contexts.default)
1948 props.location, props.rotation, props.scale = False, False, True
1949 props = layout.operator("object.transform_apply", text="Rotation & Scale", text_ctxt=i18n_contexts.default)
1950 props.location, props.rotation, props.scale = False, True, True
1955 "object.transforms_to_deltas",
1956 text="Location to Deltas",
1957 text_ctxt=i18n_contexts.default,
1960 "object.transforms_to_deltas",
1961 text="Rotation to Deltas",
1962 text_ctxt=i18n_contexts.default,
1965 "object.transforms_to_deltas",
1966 text="Scale to Deltas",
1967 text_ctxt=i18n_contexts.default,
1971 "object.transforms_to_deltas",
1972 text="All Transforms to Deltas",
1973 text_ctxt=i18n_contexts.default,
1975 layout.operator("object.anim_transforms_to_deltas")
1980 "object.visual_transform_apply",
1981 text="Visual Transform",
1982 text_ctxt=i18n_contexts.default,
1986 text="Visual Geometry to Mesh",
1987 text_ctxt=i18n_contexts.default,
1989 layout.operator("object.duplicates_make_real")
1992 class VIEW3D_MT_object_parent(Menu):
1995 def draw(self, context):
1996 layout = self.layout
1998 layout.operator_enum("object.parent_set", "type")
2002 layout.operator_enum("object.parent_clear", "type")
2005 class VIEW3D_MT_object_track(Menu):
2008 def draw(self, context):
2009 layout = self.layout
2011 layout.operator_enum("object.track_set", "type")
2015 layout.operator_enum("object.track_clear", "type")
2018 class VIEW3D_MT_object_collection(Menu):
2019 bl_label = "Collection"
2021 def draw(self, context):
2022 layout = self.layout
2024 layout.operator("collection.create")
2025 # layout.operator_menu_enum("collection.objects_remove", "collection") # BUGGY
2026 layout.operator("collection.objects_remove")
2027 layout.operator("collection.objects_remove_all")
2031 layout.operator("collection.objects_add_active")
2032 layout.operator("collection.objects_remove_active")
2035 class VIEW3D_MT_object_constraints(Menu):
2036 bl_label = "Constraints"
2038 def draw(self, context):
2039 layout = self.layout
2041 layout.operator("object.constraint_add_with_targets")
2042 layout.operator("object.constraints_copy")
2046 layout.operator("object.constraints_clear")
2049 class VIEW3D_MT_object_quick_effects(Menu):
2050 bl_label = "Quick Effects"
2052 def draw(self, context):
2053 layout = self.layout
2055 layout.operator("object.quick_fur")
2056 layout.operator("object.quick_explode")
2057 layout.operator("object.quick_smoke")
2058 layout.operator("object.quick_fluid")
2061 class VIEW3D_MT_object_showhide(Menu):
2062 bl_label = "Show/Hide"
2064 def draw(self, context):
2065 layout = self.layout
2067 layout.operator("object.hide_view_clear", text="Show Hidden")
2071 layout.operator("object.hide_view_set", text="Hide Selected").unselected = False
2072 layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
2075 class VIEW3D_MT_make_single_user(Menu):
2076 bl_label = "Make Single User"
2078 def draw(self, context):
2079 layout = self.layout
2081 props = layout.operator("object.make_single_user", text="Object")
2083 props.obdata = props.material = props.animation = False
2085 props = layout.operator("object.make_single_user", text="Object & Data")
2086 props.object = props.obdata = True
2087 props.material = props.animation = False
2089 props = layout.operator("object.make_single_user", text="Object & Data & Materials")
2090 props.object = props.obdata = props.material = True
2091 props.animation = False
2093 props = layout.operator("object.make_single_user", text="Materials")
2094 props.material = True
2095 props.object = props.obdata = props.animation = False
2097 props = layout.operator("object.make_single_user", text="Object Animation")
2098 props.animation = True
2099 props.object = props.obdata = props.material = False
2102 class VIEW3D_MT_make_links(Menu):
2103 bl_label = "Make Links"
2105 def draw(self, context):
2106 layout = self.layout
2107 operator_context_default = layout.operator_context
2109 if len(bpy.data.scenes) > 10:
2110 layout.operator_context = 'INVOKE_REGION_WIN'
2111 layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
2113 layout.operator_context = 'EXEC_REGION_WIN'
2114 layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene")
2118 layout.operator_context = operator_context_default
2120 layout.operator_enum("object.make_links_data", "type") # inline
2122 layout.operator("object.join_uvs") # stupid place to add this!
2125 class VIEW3D_MT_brush(Menu):
2128 def draw(self, context):
2129 layout = self.layout
2131 tool_settings = context.tool_settings
2132 settings = UnifiedPaintPanel.paint_settings(context)
2133 brush = getattr(settings, "brush", None)
2135 ups = tool_settings.unified_paint_settings
2136 layout.prop(ups, "use_unified_size", text="Unified Size")
2137 layout.prop(ups, "use_unified_strength", text="Unified Strength")
2138 if context.image_paint_object or context.vertex_paint_object:
2139 layout.prop(ups, "use_unified_color", text="Unified Color")
2142 # skip if no active brush
2144 layout.label(text="No Brushes currently available", icon='INFO')
2148 layout.menu("VIEW3D_MT_brush_paint_modes")
2151 if context.sculpt_object:
2152 layout.operator("brush.reset")
2153 layout.prop_menu_enum(brush, "sculpt_tool")
2154 elif context.image_paint_object:
2155 layout.prop_menu_enum(brush, "image_tool")
2156 elif context.vertex_paint_object:
2157 layout.prop_menu_enum(brush, "vertex_tool")
2158 elif context.weight_paint_object:
2159 layout.prop_menu_enum(brush, "weight_tool")
2161 # TODO: still missing a lot of brush options here
2164 if context.sculpt_object:
2166 sculpt_tool = brush.sculpt_tool
2169 layout.operator_menu_enum("brush.curve_preset", "shape", text="Curve Preset")
2172 if sculpt_tool != 'GRAB':
2173 layout.prop_menu_enum(brush, "stroke_method")
2175 if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
2176 layout.prop_menu_enum(brush, "direction")
2178 if sculpt_tool == 'LAYER':
2179 layout.prop(brush, "use_persistent")
2180 layout.operator("sculpt.set_persistent_base")
2183 class VIEW3D_MT_brush_paint_modes(Menu):
2184 bl_label = "Enabled Modes"
2186 def draw(self, context):
2187 layout = self.layout
2189 settings = UnifiedPaintPanel.paint_settings(context)
2190 brush = settings.brush
2192 layout.prop(brush, "use_paint_sculpt", text="Sculpt")
2193 layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
2194 layout.prop(brush, "use_paint_weight", text="Weight Paint")
2195 layout.prop(brush, "use_paint_image", text="Texture Paint")
2198 class VIEW3D_MT_paint_vertex(Menu):
2201 def draw(self, context):
2202 layout = self.layout
2204 layout.operator("paint.vertex_color_set")
2205 layout.operator("paint.vertex_color_smooth")
2206 layout.operator("paint.vertex_color_dirt")
2207 layout.operator("paint.vertex_color_from_weight")
2211 layout.operator("paint.vertex_color_invert", text="Invert")
2212 layout.operator("paint.vertex_color_levels", text="Levels")
2213 layout.operator("paint.vertex_color_hsv", text="Hue Saturation Value")
2214 layout.operator("paint.vertex_color_brightness_contrast", text="Bright/Contrast")
2217 class VIEW3D_MT_hook(Menu):
2220 def draw(self, context):
2221 layout = self.layout
2222 layout.operator_context = 'EXEC_AREA'
2223 layout.operator("object.hook_add_newob")
2224 layout.operator("object.hook_add_selob").use_bone = False
2225 layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
2227 if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
2230 layout.operator_menu_enum("object.hook_assign", "modifier")
2231 layout.operator_menu_enum("object.hook_remove", "modifier")
2235 layout.operator_menu_enum("object.hook_select", "modifier")
2236 layout.operator_menu_enum("object.hook_reset", "modifier")
2237 layout.operator_menu_enum("object.hook_recenter", "modifier")
2240 class VIEW3D_MT_vertex_group(Menu):
2241 bl_label = "Vertex Groups"
2243 def draw(self, context):
2244 layout = self.layout
2246 layout.operator_context = 'EXEC_AREA'
2247 layout.operator("object.vertex_group_assign_new")
2249 ob = context.active_object
2250 if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex):
2251 if ob.vertex_groups.active:
2254 layout.operator("object.vertex_group_assign", text="Assign to Active Group")
2256 "object.vertex_group_remove_from",
2257 text="Remove from Active Group",
2258 ).use_all_groups = False
2259 layout.operator("object.vertex_group_remove_from", text="Remove from All").use_all_groups = True
2261 if ob.vertex_groups.active:
2264 layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
2265 layout.operator("object.vertex_group_remove", text="Remove Active Group").all = False
2266 layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
2269 class VIEW3D_MT_paint_weight(Menu):
2270 bl_label = "Weights"
2273 def draw_generic(layout, is_editmode=False):
2277 layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
2278 layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
2282 layout.operator("object.vertex_group_normalize_all", text="Normalize All")
2283 layout.operator("object.vertex_group_normalize", text="Normalize")
2287 layout.operator("object.vertex_group_mirror", text="Mirror")
2288 layout.operator("object.vertex_group_invert", text="Invert")
2289 layout.operator("object.vertex_group_clean", text="Clean")
2293 layout.operator("object.vertex_group_quantize", text="Quantize")
2294 layout.operator("object.vertex_group_levels", text="Levels")
2295 layout.operator("object.vertex_group_smooth", text="Smooth")
2298 props = layout.operator("object.data_transfer", text="Transfer Weights")
2299 props.use_reverse_transfer = True
2300 props.data_type = 'VGROUP_WEIGHTS'
2302 layout.operator("object.vertex_group_limit_total", text="Limit Total")
2303 layout.operator("object.vertex_group_fix", text="Fix Deforms")
2308 layout.operator("paint.weight_set")
2310 def draw(self, context):
2311 self.draw_generic(self.layout, is_editmode=False)
2314 class VIEW3D_MT_sculpt(Menu):
2317 def draw(self, context):
2318 layout = self.layout
2320 tool_settings = context.tool_settings
2321 sculpt = tool_settings.sculpt
2323 layout.prop(sculpt, "use_symmetry_x")
2324 layout.prop(sculpt, "use_symmetry_y")
2325 layout.prop(sculpt, "use_symmetry_z")
2329 layout.prop(sculpt, "lock_x")
2330 layout.prop(sculpt, "lock_y")
2331 layout.prop(sculpt, "lock_z")
2335 layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
2336 layout.prop(sculpt, "show_low_resolution")
2337 layout.prop(sculpt, "show_brush")
2338 layout.prop(sculpt, "use_deform_only")
2339 layout.prop(sculpt, "show_diffuse_color")
2340 layout.prop(sculpt, "show_mask")
2343 class VIEW3D_MT_hide_mask(Menu):
2344 bl_label = "Hide/Mask"
2346 def draw(self, context):
2347 layout = self.layout
2349 props = layout.operator("paint.hide_show", text="Show All")
2350 props.action = 'SHOW'
2353 props = layout.operator("paint.hide_show", text="Hide Bounding Box")
2354 props.action = 'HIDE'
2355 props.area = 'INSIDE'
2357 props = layout.operator("paint.hide_show", text="Show Bounding Box")
2358 props.action = 'SHOW'
2359 props.area = 'INSIDE'
2361 props = layout.operator("paint.hide_show", text="Hide Masked")
2362 props.area = 'MASKED'
2363 props.action = 'HIDE'
2367 props = layout.operator("paint.mask_flood_fill", text="Invert Mask")
2368 props.mode = 'INVERT'
2370 props = layout.operator("paint.mask_flood_fill", text="Fill Mask")
2371 props.mode = 'VALUE'
2374 props = layout.operator("paint.mask_flood_fill", text="Clear Mask")
2375 props.mode = 'VALUE'
2378 props = layout.operator("view3d.select_box", text="Box Mask")
2379 props = layout.operator("paint.mask_lasso_gesture", text="Lasso Mask")
2382 class VIEW3D_MT_particle(Menu):
2383 bl_label = "Particle"
2385 def draw(self, context):
2386 layout = self.layout
2387 tool_settings = context.tool_settings
2389 particle_edit = tool_settings.particle_edit
2391 layout.operator("particle.mirror")
2393 layout.operator("particle.remove_doubles")
2397 if particle_edit.select_mode == 'POINT':
2398 layout.operator("particle.subdivide")
2400 layout.operator("particle.unify_length")
2401 layout.operator("particle.rekey")
2402 layout.operator("particle.weight_set")
2406 layout.menu("VIEW3D_MT_particle_showhide")
2410 layout.operator("particle.delete")
2413 class VIEW3D_MT_particle_specials(Menu):
2414 bl_label = "Particle Context Menu"
2416 def draw(self, context):
2417 layout = self.layout
2418 tool_settings = context.tool_settings
2420 particle_edit = tool_settings.particle_edit
2422 layout.operator("particle.rekey")
2426 layout.operator("particle.delete")
2430 layout.operator("particle.remove_doubles")
2431 layout.operator("particle.unify_length")
2433 if particle_edit.select_mode == 'POINT':
2434 layout.operator("particle.subdivide")
2436 layout.operator("particle.weight_set")
2440 layout.operator("particle.mirror")
2442 if particle_edit.select_mode == 'POINT':
2445 layout.operator("particle.select_all", text="All").action = 'SELECT'
2446 layout.operator("particle.select_all", text="None").action = 'DESELECT'
2447 layout.operator("particle.select_all", text="Invert").action = 'INVERT'
2451 layout.operator("particle.select_roots")
2452 layout.operator("particle.select_tips")
2456 layout.operator("particle.select_random")
2460 layout.operator("particle.select_more")
2461 layout.operator("particle.select_less")
2465 layout.operator("particle.select_linked")
2468 class VIEW3D_MT_particle_showhide(ShowHideMenu, Menu):
2469 _operator_name = "particle"
2472 class VIEW3D_MT_pose(Menu):
2475 def draw(self, context):
2476 layout = self.layout
2478 layout.menu("VIEW3D_MT_transform_armature")
2480 layout.menu("VIEW3D_MT_pose_transform")
2481 layout.menu("VIEW3D_MT_pose_apply")
2483 layout.menu("VIEW3D_MT_snap")
2487 layout.menu("VIEW3D_MT_object_animation")
2491 layout.menu("VIEW3D_MT_pose_slide")
2492 layout.menu("VIEW3D_MT_pose_propagate")
2496 layout.operator("pose.copy", icon='COPYDOWN')
2497 layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2498 layout.operator("pose.paste", icon='PASTEFLIPDOWN', text="Paste Pose Flipped").flipped = True
2502 layout.menu("VIEW3D_MT_pose_library")
2503 layout.menu("VIEW3D_MT_pose_motion")
2504 layout.menu("VIEW3D_MT_pose_group")
2508 layout.menu("VIEW3D_MT_object_parent")
2509 layout.menu("VIEW3D_MT_pose_ik")
2510 layout.menu("VIEW3D_MT_pose_constraints")
2514 layout.operator_context = 'EXEC_AREA'
2515 layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
2516 layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
2517 layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
2519 layout.operator("pose.flip_names")
2521 layout.operator("pose.quaternions_flip")
2525 layout.operator_context = 'INVOKE_AREA'
2526 layout.operator("armature.armature_layers", text="Change Armature Layers...")
2527 layout.operator("pose.bone_layers", text="Change Bone Layers...")
2531 layout.menu("VIEW3D_MT_pose_showhide")
2532 layout.menu("VIEW3D_MT_bone_options_toggle", text="Bone Settings")
2535 class VIEW3D_MT_pose_transform(Menu):
2536 bl_label = "Clear Transform"
2538 def draw(self, context):
2539 layout = self.layout
2541 layout.operator("pose.transforms_clear", text="All")
2545 layout.operator("pose.loc_clear", text="Location")
2546 layout.operator("pose.rot_clear", text="Rotation")
2547 layout.operator("pose.scale_clear", text="Scale")
2551 layout.operator("pose.user_transforms_clear", text="Reset Unkeyed")
2554 class VIEW3D_MT_pose_slide(Menu):
2555 bl_label = "In-Betweens"
2557 def draw(self, context):
2558 layout = self.layout
2560 layout.operator("pose.push")
2561 layout.operator("pose.relax")
2562 layout.operator("pose.breakdown")
2565 class VIEW3D_MT_pose_propagate(Menu):
2566 bl_label = "Propagate"
2568 def draw(self, context):
2569 layout = self.layout
2571 layout.operator("pose.propagate").mode = 'WHILE_HELD'
2575 layout.operator("pose.propagate", text="To Next Keyframe").mode = 'NEXT_KEY'
2576 layout.operator("pose.propagate", text="To Last Keyframe (Make Cyclic)").mode = 'LAST_KEY'
2580 layout.operator("pose.propagate", text="On Selected Keyframes").mode = 'SELECTED_KEYS'
2584 layout.operator("pose.propagate", text="On Selected Markers").mode = 'SELECTED_MARKERS'
2587 class VIEW3D_MT_pose_library(Menu):
2588 bl_label = "Pose Library"
2590 def draw(self, context):
2591 layout = self.layout
2593 layout.operator("poselib.browse_interactive", text="Browse Poses...")
2597 layout.operator("poselib.pose_add", text="Add Pose...")
2598 layout.operator("poselib.pose_rename", text="Rename Pose...")
2599 layout.operator("poselib.pose_remove", text="Remove Pose...")
2602 class VIEW3D_MT_pose_motion(Menu):
2603 bl_label = "Motion Paths"
2605 def draw(self, context):
2606 layout = self.layout
2608 layout.operator("pose.paths_calculate", text="Calculate")
2609 layout.operator("pose.paths_clear", text="Clear")
2612 class VIEW3D_MT_pose_group(Menu):
2613 bl_label = "Bone Groups"
2615 def draw(self, context):
2616 layout = self.layout
2618 pose = context.active_object.pose
2620 layout.operator_context = 'EXEC_AREA'
2621 layout.operator("pose.group_assign", text="Assign to New Group").type = 0
2623 if pose.bone_groups:
2624 active_group = pose.bone_groups.active_index + 1
2625 layout.operator("pose.group_assign", text="Assign to Group").type = active_group
2629 # layout.operator_context = 'INVOKE_AREA'
2630 layout.operator("pose.group_unassign")
2631 layout.operator("pose.group_remove")
2634 class VIEW3D_MT_pose_ik(Menu):
2635 bl_label = "Inverse Kinematics"
2637 def draw(self, context):
2638 layout = self.layout
2640 layout.operator("pose.ik_add")
2641 layout.operator("pose.ik_clear")
2644 class VIEW3D_MT_pose_constraints(Menu):
2645 bl_label = "Constraints"
2647 def draw(self, context):
2648 layout = self.layout
2650 layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
2651 layout.operator("pose.constraints_copy")
2652 layout.operator("pose.constraints_clear")
2655 class VIEW3D_MT_pose_showhide(ShowHideMenu, Menu):
2656 _operator_name = "pose"
2659 class VIEW3D_MT_pose_apply(Menu):
2662 def draw(self, context):
2663 layout = self.layout
2665 layout.operator("pose.armature_apply")
2666 layout.operator("pose.visual_transform_apply")
2670 props = layout.operator("object.assign_property_defaults")
2671 props.process_bones = True
2674 class VIEW3D_MT_pose_specials(Menu):
2675 bl_label = "Pose Context Menu"
2677 def draw(self, context):
2678 layout = self.layout
2680 layout.operator_context = 'INVOKE_REGION_WIN'
2682 layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
2686 layout.operator("pose.copy", icon='COPYDOWN')
2687 layout.operator("pose.paste", icon='PASTEDOWN').flipped = False
2688 layout.operator("pose.paste", icon='PASTEFLIPDOWN', text="Paste X-Flipped Pose").flipped = True
2692 layout.operator("pose.paths_calculate", text="Calculate")
2693 layout.operator("pose.paths_clear", text="Clear")
2697 layout.operator("pose.push")
2698 layout.operator("pose.relax")
2699 layout.operator("pose.breakdown")
2703 layout.operator("pose.paths_calculate")
2704 layout.operator("pose.paths_clear")
2708 layout.operator("pose.hide").unselected = False
2709 layout.operator("pose.reveal")
2713 layout.operator("pose.user_transforms_clear")
2717 def draw(self, context):
2718 layout = self.layout
2723 "use_envelope_multiply",
2724 "use_inherit_rotation",
2725 "use_inherit_scale",
2728 if context.mode == 'EDIT_ARMATURE':
2729 bone_props = bpy.types.EditBone.bl_rna.properties
2730 data_path_iter = "selected_bones"
2732 options.append("lock")
2734 bone_props = bpy.types.Bone.bl_rna.properties
2735 data_path_iter = "selected_pose_bones"
2736 opt_suffix = "bone."
2739 props = layout.operator("wm.context_collection_boolean_set", text=bone_props[opt].name,
2740 text_ctxt=i18n_contexts.default)
2741 props.data_path_iter = data_path_iter
2742 props.data_path_item = opt_suffix + opt
2743 props.type = self.type
2746 class VIEW3D_MT_bone_options_toggle(Menu, BoneOptions):
2747 bl_label = "Toggle Bone Options"
2751 class VIEW3D_MT_bone_options_enable(Menu, BoneOptions):
2752 bl_label = "Enable Bone Options"
2756 class VIEW3D_MT_bone_options_disable(Menu, BoneOptions):
2757 bl_label = "Disable Bone Options"
2761 # ********** Edit Menus, suffix from ob.type **********
2764 class VIEW3D_MT_edit_mesh(Menu):
2767 def draw(self, context):
2768 layout = self.layout
2770 with_bullet = bpy.app.build_options.bullet
2772 layout.menu("VIEW3D_MT_transform")
2773 layout.menu("VIEW3D_MT_mirror")
2774 layout.menu("VIEW3D_MT_snap")
2778 layout.operator("mesh.duplicate_move", text="Duplicate")
2779 layout.menu("VIEW3D_MT_edit_mesh_extrude")
2780 layout.operator("mesh.split")
2781 layout.operator("mesh.bisect")
2782 layout.operator("mesh.knife_project")
2785 layout.operator("mesh.convex_hull")
2789 layout.operator("mesh.symmetrize")
2790 layout.operator("mesh.symmetry_snap")
2794 layout.menu("VIEW3D_MT_edit_mesh_normals")
2795 layout.menu("VIEW3D_MT_edit_mesh_shading")
2796 layout.menu("VIEW3D_MT_edit_mesh_weights")
2797 layout.operator_menu_enum("mesh.sort_elements", "type", text="Sort Elements...")
2801 layout.menu("VIEW3D_MT_edit_mesh_showhide")
2802 layout.operator_menu_enum("mesh.separate", "type")
2803 layout.menu("VIEW3D_MT_edit_mesh_clean")
2807 layout.menu("VIEW3D_MT_edit_mesh_delete")
2810 class VIEW3D_MT_edit_mesh_specials(Menu):
2813 def draw(self, context):
2815 def count_selected_items_for_objects_in_mode():
2816 selected_verts_len = 0
2817 selected_edges_len = 0
2818 selected_faces_len = 0
2819 for ob in context.objects_in_mode_unique_data:
2820 v, e, f = ob.data.count_selected_items()
2821 selected_verts_len += v
2822 selected_edges_len += e
2823 selected_faces_len += f
2824 return (selected_verts_len, selected_edges_len, selected_faces_len)
2826 is_vert_mode, is_edge_mode, is_face_mode = context.tool_settings.mesh_select_mode
2827 selected_verts_len, selected_edges_len, selected_faces_len = count_selected_items_for_objects_in_mode()
2829 del count_selected_items_for_objects_in_mode
2831 layout = self.layout
2833 layout.operator_context = 'INVOKE_REGION_WIN'
2835 # If nothing is selected
2836 # (disabled for now until it can be made more useful).
2838 # If nothing is selected
2839 if not (selected_verts_len or selected_edges_len or selected_faces_len):
2840 layout.menu("VIEW3D_MT_mesh_add", text="Add")
2845 # Else something is selected
2852 col.label(text="Vertex Context Menu", icon='VERTEXSEL')
2855 # Additive Operators
2856 col.operator("mesh.subdivide", text="Subdivide")
2860 col.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
2861 col.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True
2863 if selected_verts_len > 1:
2865 col.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
2866 col.operator("mesh.vert_connect_path", text="Connect Vertex Path")
2867 col.operator("mesh.vert_connect", text="Connect Vertex Pairs")
2872 col.operator("transform.push_pull", text="Push/Pull")
2873 col.operator("transform.shrink_fatten", text="Shrink/Fatten")
2874 col.operator("transform.shear", text="Shear")
2875 col.operator("transform.vert_slide", text="Slide Vertices")
2876 col.operator("transform.vertex_random", text="Randomize Vertices")
2877 col.operator("mesh.vertices_smooth", text="Smooth Vertices")
2878 col.operator("mesh.vertices_smooth_laplacian", text="Smooth Laplacian")
2882 col.menu("VIEW3D_MT_snap", text="Snap Vertices...")
2883 col.operator("transform.mirror", text="Mirror Vertices")
2888 if selected_verts_len > 1:
2889 col.operator("mesh.merge", text="Merge Vertices...")
2890 col.operator("mesh.remove_doubles", text="Remove Double Vertices")
2891 col.operator("mesh.dissolve_verts")
2892 col.operator("mesh.delete", text="Delete Vertices").type = 'VERT'
2895 render = context.scene.render
2898 col.label(text="Edge Context Menu", icon='EDGESEL')
2901 # Additive Operators
2902 col.operator("mesh.subdivide", text="Subdivide")
2906 col.operator("mesh.extrude_edges_move", text="Extrude Edges"),
2907 col.operator("mesh.bevel", text="Bevel Edges").vertex_only = False
2908 if selected_edges_len >= 2:
2909 col.operator("mesh.bridge_edge_loops")
2913 col.operator("mesh.loopcut_slide")
2914 col.operator("mesh.offset_edge_loops_slide")
2915 col.operator("mesh.knife_tool")
2916 col.operator("mesh.bisect")
2917 col.operator("mesh.bridge_edge_loops", text="Bridge Edge Loops")
2922 col.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
2923 col.operator("transform.edge_slide")
2924 col.operator("mesh.edge_split")
2929 col.operator("transform.edge_crease")
2930 col.operator("transform.edge_bevelweight")
2934 col.operator("mesh.mark_seam").clear = False
2935 col.operator("mesh.mark_seam", text="Clear Seam").clear = True
2939 col.operator("mesh.mark_sharp")
2940 col.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
2942 if render.use_freestyle:
2945 col.operator("mesh.mark_freestyle_edge").clear = False
2946 col.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
2951 col.operator("mesh.unsubdivide")
2952 col.operator("mesh.dissolve_edges")
2953 col.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
2958 col.label(text="Face Context Menu", icon='FACESEL')
2961 # Additive Operators
2962 col.operator("mesh.subdivide", text="Subdivide")
2966 col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
2967 col.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
2968 col.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
2970 col.operator("mesh.inset"),
2971 col.operator("mesh.poke")
2973 if selected_faces_len >= 2:
2974 col.operator("mesh.bridge_edge_loops", text="Bridge Faces")
2979 col.menu("VIEW3D_MT_uv_map", text="UV Unwrap Faces...")
2983 props = col.operator("mesh.quads_convert_to_tris")
2984 props.quad_method = props.ngon_method = 'BEAUTY'
2985 col.operator("mesh.tris_convert_to_quads")
2989 col.operator("mesh.faces_shade_smooth")
2990 col.operator("mesh.faces_shade_flat")
2995 col.operator("mesh.unsubdivide")
2996 col.operator("mesh.dissolve_faces")
2997 col.operator("mesh.delete", text="Delete Faces").type = 'FACE'
3000 class VIEW3D_MT_edit_mesh_select_mode(Menu):
3001 bl_label = "Mesh Select Mode"
3003 def draw(self, context):
3004 layout = self.layout
3006 layout.operator_context = 'INVOKE_REGION_WIN'
3007 layout.operator("mesh.select_mode", text="Vertex", icon='VERTEXSEL').type = 'VERT'
3008 layout.operator("mesh.select_mode", text="Edge", icon='EDGESEL').type = 'EDGE'
3009 layout.operator("mesh.select_mode", text="Face", icon='FACESEL').type = 'FACE'
3012 class VIEW3D_MT_edit_mesh_extrude(Menu):
3013 bl_label = "Extrude"
3016 'VERT': lambda layout:
3017 layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
3018 'EDGE': lambda layout:
3019 layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
3020 'REGION': lambda layout:
3021 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
3022 'REGION_VERT_NORMAL': lambda layout:
3023 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
3024 'FACE': lambda layout:
3025 layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
3029 def extrude_options(context):
3030 tool_settings = context.tool_settings
3031 select_mode = tool_settings.mesh_select_mode
3032 mesh = context.object.data
3035 if mesh.total_face_sel:
3036 menu += ['REGION', 'REGION_VERT_NORMAL', 'FACE']
3037 if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
3039 if mesh.total_vert_sel and select_mode[0]:
3042 # should never get here
3045 def draw(self, context):
3046 layout = self.layout
3047 layout.operator_context = 'INVOKE_REGION_WIN'
3049 for menu_id in self.extrude_options(context):
3050 self._extrude_funcs[menu_id](layout)
3053 class VIEW3D_MT_edit_mesh_vertices(Menu):
3056 def draw(self, context):
3057 layout = self.layout
3058 layout.operator_context = 'INVOKE_REGION_WIN'
3060 layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
3061 layout.operator("mesh.bevel", text="Bevel Vertices").vertex_only = True
3065 layout.operator("mesh.edge_face_add", text="New Edge/Face from Vertices")
3066 layout.operator("mesh.vert_connect_path", text="Connect Vertex Path")
3067 layout.operator("mesh.vert_connect", text="Connect Vertex Pairs")
3071 props = layout.operator("mesh.rip_move", text="Rip Vertices")
3072 props.MESH_OT_rip.use_fill = False
3073 props = layout.operator("mesh.rip_move", text="Rip Vertices and Fill")
3074 props.MESH_OT_rip.use_fill = True
3075 layout.operator("mesh.rip_edge_move", text="Rip Vertices and Extend")
3079 layout.operator("transform.vert_slide", text="Slide Vertices")
3080 layout.operator("mesh.vertices_smooth", text="Smooth Vertices")
3084 layout.operator("mesh.blend_from_shape")
3085 layout.operator("mesh.shape_propagate_to_all", text="Propagate to Shapes")
3089 layout.operator("mesh.merge", text="Merge Vertices")
3090 layout.operator("mesh.remove_doubles", text="Remove Double Vertices")
3094 layout.menu("VIEW3D_MT_vertex_group")
3095 layout.menu("VIEW3D_MT_hook")
3099 layout.operator("object.vertex_parent_set")
3102 class VIEW3D_MT_edit_mesh_edges_data(Menu):
3103 bl_label = "Edge Data"
3105 def draw(self, context):
3106 layout = self.layout
3108 render = context.scene.render
3110 layout.operator_context = 'INVOKE_REGION_WIN'
3112 layout.operator("transform.edge_crease")
3113 layout.operator("transform.edge_bevelweight")
3117 layout.operator("mesh.mark_seam").clear = False
3118 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
3122 layout.operator("mesh.mark_sharp")
3123 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
3125 layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
3126 props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
3127 props.use_verts = True
3130 if render.use_freestyle:
3133 layout.operator("mesh.mark_freestyle_edge").clear = False
3134 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3137 class VIEW3D_MT_edit_mesh_edges(Menu):
3140 def draw(self, context):
3141 layout = self.layout
3143 with_freestyle = bpy.app.build_options.freestyle
3145 layout.operator_context = 'INVOKE_REGION_WIN'
3147 layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
3148 layout.operator("mesh.bevel", text="Bevel Edges").vertex_only = False
3149 layout.operator("mesh.bridge_edge_loops")
3153 layout.operator("mesh.subdivide")
3154 layout.operator("mesh.subdivide_edgering")
3155 layout.operator("mesh.unsubdivide")
3159 layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False
3160 layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True
3164 layout.operator("transform.edge_slide")
3165 layout.operator("mesh.edge_split")
3169 layout.operator("transform.edge_crease")
3170 layout.operator("transform.edge_bevelweight")
3174 layout.operator("mesh.mark_seam").clear = False
3175 layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
3179 layout.operator("mesh.mark_sharp")
3180 layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
3182 layout.operator("mesh.mark_sharp", text="Mark Sharp from Vertices").use_verts = True
3183 props = layout.operator("mesh.mark_sharp", text="Clear Sharp from Vertices")
3184 props.use_verts = True
3190 layout.operator("mesh.mark_freestyle_edge").clear = False
3191 layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True
3194 class VIEW3D_MT_edit_mesh_faces_data(Menu):
3195 bl_label = "Face Data"
3197 def draw(self, context):
3198 layout = self.layout
3200 with_freestyle = bpy.app.build_options.freestyle
3202 layout.operator_context = 'INVOKE_REGION_WIN'
3204 layout.operator("mesh.colors_rotate")
3205 layout.operator("mesh.colors_reverse")
3209 layout.operator("mesh.uvs_rotate")
3210 layout.operator("mesh.uvs_reverse")
3215 layout.operator("mesh.mark_freestyle_face").clear = False
3216 layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True
3219 class VIEW3D_MT_edit_mesh_faces(Menu):
3221 bl_idname = "VIEW3D_MT_edit_mesh_faces"
3223 def draw(self, context):
3224 layout = self.layout
3226 layout.operator_context = 'INVOKE_REGION_WIN'
3228 layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
3229 layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
3230 layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
3234 layout.operator("mesh.inset")
3235 layout.operator("mesh.poke")
3236 props = layout.operator("mesh.quads_convert_to_tris")
3237 props.quad_method = props.ngon_method = 'BEAUTY'
3238 layout.operator("mesh.tris_convert_to_quads")
3239 layout.operator("mesh.solidify", text="Solidify Faces")
3240 layout.operator("mesh.wireframe")
3244 layout.operator("mesh.fill")
3245 layout.operator("mesh.fill_grid")
3246 layout.operator("mesh.beautify_fill")
3250 layout.operator("mesh.intersect")
3251 layout.operator("mesh.intersect_boolean")
3255 layout.operator("mesh.face_split_by_edges")
3259 layout.operator("mesh.faces_shade_smooth")
3260 layout.operator("mesh.faces_shade_flat")
3264 layout.menu("VIEW3D_MT_edit_mesh_faces_data")
3267 class VIEW3D_MT_edit_mesh_normals(Menu):
3268 bl_label = "Normals"
3270 def draw(self, context):
3271 layout = self.layout
3273 layout.operator("mesh.normals_make_consistent", text="Recalculate Outside").inside = False
3274 layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
3278 layout.operator("mesh.flip_normals")
3279 layout.operator("mesh.set_normals_from_faces", text="Set From Faces")
3281 layout.operator("transform.rotate_normal", text="Rotate Normal")
3282 layout.operator("mesh.point_normals", text="Point normals to target")
3284 layout.operator("mesh.merge_normals", text="Merge")
3285 layout.operator("mesh.split_normals", text="Split")
3287 layout.operator("mesh.average_normals", text="Average Normals")
3289 layout.label(text="Normal Vector")
3291 layout.operator("mesh.normals_tools", text="Copy").mode = 'COPY'
3292 layout.operator("mesh.normals_tools", text="Paste").mode = 'PASTE'
3294 layout.operator("mesh.normals_tools", text="Multiply").mode = 'MULTIPLY'
3295 layout.operator("mesh.normals_tools", text="Add").mode = 'ADD'
3297 layout.operator("mesh.normals_tools", text="Reset").mode = 'RESET'
3299 layout.operator("mesh.smoothen_normals", text="Smoothen")
3301 layout.label(text="Face Strength")
3302 layout.operator("mesh.mod_weighted_strength", text="Face Select", icon='FACESEL').set = False
3303 layout.operator("mesh.mod_weighted_strength", text="Set Strength", icon='ADD').set = True
3306 class VIEW3D_MT_edit_mesh_shading(Menu):
3307 bl_label = "Shading"
3309 def draw(self, context):
3310 layout = self.layout
3312 layout.operator("mesh.faces_shade_smooth", text="Smooth Faces")
3313 layout.operator("mesh.faces_shade_flat", text="Flat Faces")
3317 layout.operator("mesh.mark_sharp", text="Smooth Edges").clear = True
3318 layout.operator("mesh.mark_sharp", text="Sharp Edges")
3322 props = layout.operator("mesh.mark_sharp", text="Smooth Vertices")
3323 props.use_verts = True
3326 layout.operator("mesh.mark_sharp", text="Sharp Vertices").use_verts = True
3329 class VIEW3D_MT_edit_mesh_weights(Menu):
3330 bl_label = "Weights"
3332 def draw(self, context):
3333 VIEW3D_MT_paint_weight.draw_generic(self.layout, is_editmode=True)
3336 class VIEW3D_MT_edit_mesh_clean(Menu):
3337 bl_label = "Clean Up"
3339 def draw(self, context):
3340 layout = self.layout
3342 layout.operator("mesh.delete_loose")
3346 layout.operator("mesh.decimate")
3347 layout.operator("mesh.dissolve_degenerate")
3348 layout.operator("mesh.dissolve_limited")
3349 layout.operator("mesh.face_make_planar")
3353 layout.operator("mesh.vert_connect_nonplanar")
3354 layout.operator("mesh.vert_connect_concave")
3355 layout.operator("mesh.remove_doubles")
3356 layout.operator("mesh.fill_holes")
3359 class VIEW3D_MT_edit_mesh_delete(Menu):
3362 def draw(self, context):
3363 layout = self.layout
3365 layout.operator_enum("mesh.delete", "type")
3369 layout.operator("mesh.dissolve_verts")
3370 layout.operator("mesh.dissolve_edges")
3371 layout.operator("mesh.dissolve_faces")
3375 layout.operator("mesh.dissolve_limited")
3379 layout.operator("mesh.edge_collapse")
3380 layout.operator("mesh.delete_edgeloop", text="Edge Loops")
3383 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
3384 _operator_name = "mesh"
3387 class VIEW3D_MT_edit_gpencil_delete(Menu):
3390 def draw(self, context):
3391 layout = self.layout
3393 layout.operator_enum("gpencil.delete", "type")
3397 layout.operator_enum("gpencil.dissolve", "type")
3401 layout.operator("gpencil.active_frames_delete_all")
3403 # draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
3406 def draw_curve(self, context):
3407 layout = self.layout
3409 layout.menu("VIEW3D_MT_transform")
3410 layout.menu("VIEW3D_MT_mirror")
3411 layout.menu("VIEW3D_MT_snap")
3415 layout.operator("curve.spin")
3416 layout.operator("curve.duplicate_move")
3420 layout.operator("curve.split")
3421 layout.operator("curve.separate")
3422 layout.operator("curve.cyclic_toggle")
3423 layout.operator_menu_enum("curve.spline_type_set", "type")
3427 layout.menu("VIEW3D_MT_edit_curve_showhide")
3428 layout.menu("VIEW3D_MT_edit_curve_clean")
3429 layout.menu("VIEW3D_MT_edit_curve_delete")
3432 class VIEW3D_MT_edit_curve(Menu):
3438 class VIEW3D_MT_edit_curve_ctrlpoints(Menu):
3439 bl_label = "Control Points"
3441 def draw(self, context):
3442 layout = self.layout
3444 edit_object = context.edit_object
3446 if edit_object.type in {'CURVE', 'SURFACE'}:
3447 layout.operator("curve.extrude_move")
3451 layout.operator("curve.make_segment")
3455 if edit_object.type == 'CURVE':
3456 layout.operator("transform.tilt")
3457 layout.operator("curve.tilt_clear")
3461 layout.operator_menu_enum("curve.handle_type_set", "type")
3462 layout.operator("curve.normals_make_consistent")
3466 layout.operator("curve.smooth")
3467 if edit_object.type == 'CURVE':
3468 layout.operator("curve.smooth_weight")
3469 layout.operator("curve.smooth_radius")
3470 layout.operator("curve.smooth_tilt")
3474 layout.menu("VIEW3D_MT_hook")
3478 layout.operator("object.vertex_parent_set")
3481 class VIEW3D_MT_edit_curve_segments(Menu):
3482 bl_label = "Segments"
3484 def draw(self, context):
3485 layout = self.layout
3487 layout.operator("curve.subdivide")
3488 layout.operator("curve.switch_direction")
3491 class VIEW3D_MT_edit_curve_clean(Menu):
3492 bl_label = "Clean Up"
3494 def draw(self, context):
3495 layout = self.layout
3497 layout.operator("curve.decimate")
3500 class VIEW3D_MT_edit_curve_specials(Menu):
3501 bl_label = "Curve Context Menu"
3503 def draw(self, context):
3504 # TODO(campbell): match mesh vertex menu.
3506 layout = self.layout
3508 layout.operator_context = 'INVOKE_DEFAULT'
3510 layout.operator("curve.subdivide")
3511 layout.operator("curve.switch_direction")
3515 layout.operator("curve.duplicate_move")
3516 layout.operator("curve.split")
3517 layout.operator("curve.cyclic_toggle")
3518 layout.operator_menu_enum("curve.spline_type_set", "type")
3522 layout.operator("curve.make_segment")
3526 layout.operator("transform.tilt")
3527 layout.operator("curve.tilt_clear")
3531 layout.operator_menu_enum("curve.handle_type_set", "type")
3532 layout.operator("curve.normals_make_consistent")
3536 layout.operator("curve.spline_weight_set")
3537 layout.operator("curve.radius_set")
3541 layout.menu("VIEW3D_MT_mirror")
3542 layout.menu("VIEW3D_MT_snap")
3546 layout.operator("curve.decimate")
3547 layout.operator("curve.delete", text="Delete Point").type = 'VERT'
3548 layout.operator("curve.delete", text="Delete Segment").type = 'SEGMENT'
3549 layout.operator("curve.dissolve_verts")
3552 class VIEW3D_MT_edit_curve_delete(Menu):
3555 def draw(self, context):
3556 layout = self.layout