-
-
Save zeffii/6a12c5432d9ea41e9eb2 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 | |
obj = context.object | |
pie = layout.menu_pie() | |
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() | |
if obj: | |
mesh = obj.data | |
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