Created
January 20, 2016 20:09
-
-
Save anonymous/ff6341d652be7c8e2b20 to your computer and use it in GitHub Desktop.
shading menu for with objects and without objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PieRMB(Menu): | |
bl_idname = "pie.shadingview" | |
bl_label = "Viewport Shading " | |
def draw(self, context): | |
layout = self.layout | |
pie = layout.menu_pie() | |
obj = context.object | |
if not obj: | |
scene = context.scene | |
view = context.space_data | |
#4 - LEFT | |
f = pie.operator("wm.context_set_enum", icon='WIRE', text='Wires') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'WIREFRAME' | |
#6 - RIGHT | |
pie.operator("object.hide_view_clear", text="Show Object") | |
#2 - BOTTOM | |
box = pie.split().box().column() | |
row = box.row() | |
box.operator("OBJECT_OT_shade_smooth", text="Object Smooth") | |
row = box.row() | |
box.operator("OBJECT_OT_shade_flat", text="Object Flat") | |
box.separator() | |
box.operator("calculate.normal", text="Calculate Normals") | |
box.separator() | |
box.prop(view, "use_matcap") | |
box.template_icon_view(view, "matcap_icon") | |
#8 - TOP | |
f = pie.operator("wm.context_set_enum", icon='SMOOTH', text='Rendered') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'RENDERED' | |
#7 - TOP - LEFT | |
f = pie.operator("wm.context_set_enum", icon='SOLID', text='Solid') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'SOLID' | |
#9 - TOP - RIGHT | |
f = pie.operator("wm.context_set_enum", icon='MATERIAL', text='Material') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'MATERIAL' | |
#1 - BOTTOM - LEFT | |
pie.operator("object.hide_view_set", text="Hide Object Selected").unselected=False | |
#3 - BOTTOM - RIGHT | |
pie.operator("object.hide_view_set", text="Hide Object Unselected").unselected=True | |
else: | |
mesh = context.active_object.data | |
scene = context.scene | |
view = context.space_data | |
#4 - LEFT | |
f = pie.operator("wm.context_set_enum", icon='WIRE', text='Wires') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'WIREFRAME' | |
#6 - RIGHT | |
pie.operator("object.hide_view_clear", text="Show Object") | |
#2 - BOTTOM | |
box = pie.split().box().column() | |
row = box.row() | |
box.operator("OBJECT_OT_shade_smooth", text="Object Smooth") | |
row = box.row() | |
box.operator("OBJECT_OT_shade_flat", text="Object Flat") | |
box.separator() | |
box.operator("calculate.normal", text="Calculate Normals") | |
box.separator() | |
row = box.row() | |
row.prop(mesh, "use_auto_smooth") | |
row = box.row() | |
row.prop(mesh, "auto_smooth_angle", text="Angle") | |
box.separator() | |
box.prop(view, "use_matcap") | |
box.template_icon_view(view, "matcap_icon") | |
#8 - TOP | |
f = pie.operator("wm.context_set_enum", icon='SMOOTH', text='Rendered') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'RENDERED' | |
#7 - TOP - LEFT | |
f = pie.operator("wm.context_set_enum", icon='SOLID', text='Solid') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'SOLID' | |
#9 - TOP - RIGHT | |
f = pie.operator("wm.context_set_enum", icon='MATERIAL', text='Material') | |
f.data_path='space_data.viewport_shade' | |
f.value = 'MATERIAL' | |
#1 - BOTTOM - LEFT | |
pie.operator("object.hide_view_set", text="Hide Object Selected").unselected=False | |
#3 - BOTTOM - RIGHT | |
pie.operator("object.hide_view_set", text="Hide Object Unselected").unselected=True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment