Fix error in rigify property generation
[blender-addons.git] / space_view3d_spacebar_menu / view_menus.py
blob84a69eb4fc53666270ab78b568472eda7cc492bf
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 #
21 import bpy
22 from bpy.types import (
23 Operator,
24 Menu,
26 from bpy.props import (
27 BoolProperty,
28 StringProperty,
31 from . edit_mesh import *
33 # View Menu's #
34 class VIEW3D_MT_View_Menu(Menu):
35 bl_label = "View"
37 def draw(self, context):
38 layout = self.layout
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")
48 layout.separator()
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
54 layout.separator()
56 layout.operator("view3d.view_persportho", text="Perspective/Orthographic")
57 layout.menu("VIEW3D_MT_view_local")
58 layout.separator()
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
62 layout.separator()
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"
77 @classmethod
78 def poll(cls, context):
79 return context.active_object is not None
81 def execute(self, context):
82 is_error = False
83 for obj in bpy.data.objects:
84 try:
85 if obj.show_wire:
86 obj.show_all_edges = False
87 obj.show_wire = False
88 else:
89 obj.show_all_edges = True
90 obj.show_wire = True
91 except:
92 is_error = True
93 pass
95 if is_error:
96 self.report({'WARNING'},
97 "Wire on All Objects could not be completed for some objects")
99 return {'FINISHED'}
102 # Matcap and AO, Wire all and X-Ray entries thanks to marvin.k.breuer
103 class VIEW3D_MT_Shade(Menu):
104 bl_label = "Shade"
106 def draw(self, context):
107 layout = self.layout
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')
115 else:
116 layout.operator("OBJECT_OT_shade_smooth", icon='SHADING_RENDERED')
117 layout.operator("OBJECT_OT_shade_flat", icon='SHADING_SOLID')
119 layout.separator()
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)
126 # row.scale_y = 0.3
127 # row.scale_x = 0.5
128 # row.template_icon_view(context.space_data, "matcap_icon")
130 def menu_func(self, context):
131 self.layout.menu("VIEW3D_MT_Shade")
133 # List The Classes #
135 classes = (
136 VIEW3D_MT_Shade,
137 VIEW3D_OT_Display_Wire_All,
138 VIEW3D_MT_View_Menu
142 # Register Classes & Hotkeys #
143 def register():
144 for cls in classes:
145 bpy.utils.register_class(cls)
148 # Unregister Classes & Hotkeys #
149 def unregister():
151 for cls in reversed(classes):
152 bpy.utils.unregister_class(cls)
154 if __name__ == "__main__":
155 register()