1 # SPDX-FileCopyrightText: 2019-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.types
import (
10 from bpy
.props
import (
15 from . edit_mesh
import *
18 class VIEW3D_MT_View_Menu(Menu
):
21 def draw(self
, context
):
23 view
= context
.space_data
25 layout
.menu("VIEW3D_MT_view_viewpoint")
26 layout
.menu("VIEW3D_MT_view_align")
27 layout
.menu("VIEW3D_MT_view_navigation")
28 layout
.menu("INFO_MT_area")
29 layout
.operator_context
= 'INVOKE_REGION_WIN'
30 layout
.menu("VIEW3D_MT_view_regions", text
="View Regions")
31 layout
.menu("VIEW3D_MT_Shade")
34 layout
.operator("view3d.view_selected", text
="Frame Selected").use_all_regions
= False
35 if view
.region_quadviews
:
36 layout
.operator("view3d.view_selected", text
="Frame Selected (Quad View)").use_all_regions
= True
37 layout
.operator("view3d.view_all").center
= False
40 layout
.operator("view3d.view_persportho", text
="Perspective/Orthographic")
41 layout
.menu("VIEW3D_MT_view_local")
44 layout
.operator("render.opengl", text
="Viewport Render Image", icon
='RENDER_STILL')
45 layout
.operator("render.opengl", text
="Viewport Render Animation", icon
='RENDER_ANIMATION').animation
= True
48 layout
.prop(view
, "show_region_toolbar")
49 layout
.prop(view
, "show_region_ui")
50 layout
.prop(view
, "show_region_tool_header")
51 layout
.prop(view
, "show_region_hud")
55 # Display Wire (Thanks to marvin.k.breuer) #
56 class VIEW3D_OT_Display_Wire_All(Operator
):
57 bl_label
= "Wire on All Objects"
58 bl_idname
= "view3d.display_wire_all"
59 bl_description
= "Enable/Disable Display Wire on All Objects"
62 def poll(cls
, context
):
63 return context
.active_object
is not None
65 def execute(self
, context
):
67 for obj
in bpy
.data
.objects
:
70 obj
.show_all_edges
= False
73 obj
.show_all_edges
= True
80 self
.report({'WARNING'},
81 "Wire on All Objects could not be completed for some objects")
86 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
87 class VIEW3D_MT_Shade(Menu
):
90 def draw(self
, context
):
93 # layout.prop(context.space_data, "viewport_shade", expand=True)
95 if context
.active_object
:
96 if(context
.mode
== 'EDIT_MESH'):
97 layout
.operator("MESH_OT_faces_shade_smooth", icon
='SHADING_RENDERED')
98 layout
.operator("MESH_OT_faces_shade_flat", icon
='SHADING_SOLID')
100 layout
.operator("OBJECT_OT_shade_smooth", icon
='SHADING_RENDERED')
101 layout
.operator("OBJECT_OT_shade_flat", icon
='SHADING_SOLID')
104 layout
.operator("view3d.display_wire_all", text
="Wire all", icon
='SHADING_WIRE')
106 # layout.prop(context.space_data, "use_matcap", icon="MATCAP_01")
108 # if context.space_data.use_matcap:
109 # row = layout.column(1)
112 # row.template_icon_view(context.space_data, "matcap_icon")
114 def menu_func(self
, context
):
115 self
.layout
.menu("VIEW3D_MT_Shade")
121 VIEW3D_OT_Display_Wire_All
,
126 # Register Classes & Hotkeys #
129 bpy
.utils
.register_class(cls
)
132 # Unregister Classes & Hotkeys #
135 for cls
in reversed(classes
):
136 bpy
.utils
.unregister_class(cls
)
138 if __name__
== "__main__":