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 #####
18 # Contributed to by: meta-androcto, JayDez, sim88, sam, lijenstina, mkb, wisaac, CoDEmanX #
22 from bpy
.types
import (
26 from bpy
.props
import (
31 from . edit_mesh
import *
34 class VIEW3D_MT_View_Menu(Menu
):
37 def draw(self
, context
):
39 view
= context
.space_data
41 layout
.menu("VIEW3D_MT_view_viewpoint")
42 layout
.menu("VIEW3D_MT_view_align")
43 layout
.menu("VIEW3D_MT_view_navigation")
44 layout
.menu("INFO_MT_area")
45 layout
.operator_context
= 'INVOKE_REGION_WIN'
46 layout
.menu("VIEW3D_MT_view_regions", text
="View Regions")
47 layout
.menu("VIEW3D_MT_Shade")
50 layout
.operator("view3d.view_selected", text
="Frame Selected").use_all_regions
= False
51 if view
.region_quadviews
:
52 layout
.operator("view3d.view_selected", text
="Frame Selected (Quad View)").use_all_regions
= True
53 layout
.operator("view3d.view_all").center
= False
56 layout
.operator("view3d.view_persportho", text
="Perspective/Orthographic")
57 layout
.menu("VIEW3D_MT_view_local")
60 layout
.operator("render.opengl", text
="Viewport Render Image", icon
='RENDER_STILL')
61 layout
.operator("render.opengl", text
="Viewport Render Animation", icon
='RENDER_ANIMATION').animation
= True
64 layout
.prop(view
, "show_region_toolbar")
65 layout
.prop(view
, "show_region_ui")
66 layout
.prop(view
, "show_region_tool_header")
67 layout
.prop(view
, "show_region_hud")
71 # Display Wire (Thanks to marvin.k.breuer) #
72 class VIEW3D_OT_Display_Wire_All(Operator
):
73 bl_label
= "Wire on All Objects"
74 bl_idname
= "view3d.display_wire_all"
75 bl_description
= "Enable/Disable Display Wire on All Objects"
78 def poll(cls
, context
):
79 return context
.active_object
is not None
81 def execute(self
, context
):
83 for obj
in bpy
.data
.objects
:
86 obj
.show_all_edges
= False
89 obj
.show_all_edges
= True
96 self
.report({'WARNING'},
97 "Wire on All Objects could not be completed for some objects")
102 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
103 class VIEW3D_MT_Shade(Menu
):
106 def draw(self
, context
):
109 # layout.prop(context.space_data, "viewport_shade", expand=True)
111 if context
.active_object
:
112 if(context
.mode
== 'EDIT_MESH'):
113 layout
.operator("MESH_OT_faces_shade_smooth", icon
='SHADING_RENDERED')
114 layout
.operator("MESH_OT_faces_shade_flat", icon
='SHADING_SOLID')
116 layout
.operator("OBJECT_OT_shade_smooth", icon
='SHADING_RENDERED')
117 layout
.operator("OBJECT_OT_shade_flat", icon
='SHADING_SOLID')
120 layout
.operator("view3d.display_wire_all", text
="Wire all", icon
='SHADING_WIRE')
122 # layout.prop(context.space_data, "use_matcap", icon="MATCAP_01")
124 # if context.space_data.use_matcap:
125 # row = layout.column(1)
128 # row.template_icon_view(context.space_data, "matcap_icon")
130 def menu_func(self
, context
):
131 self
.layout
.menu("VIEW3D_MT_Shade")
137 VIEW3D_OT_Display_Wire_All
,
142 # Register Classes & Hotkeys #
145 bpy
.utils
.register_class(cls
)
148 # Unregister Classes & Hotkeys #
151 for cls
in reversed(classes
):
152 bpy
.utils
.unregister_class(cls
)
154 if __name__
== "__main__":