The script works perfect
class ObjectShading(bpy.types.Panel):
bl_label = "Shading"
bl_idname = "ObjectShading"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_category = "Claas"
def draw(self, context):
layout = self.layout
obj = context.object
mesh = obj.data
row = layout.row()
row.label(text="AutoEdgeBreak:")
row = layout.row()
row.prop(mesh, "use_auto_smooth", text="BreakEdge")
row.active = mesh.use_auto_smooth and not mesh.has_custom_normals
row.prop(mesh, "auto_smooth_angle", text="Angle")
row = layout.row()
row.label(text="ManualSmooth:")
row = layout.row()
row.operator("object.shade_smooth", text="Smooth", icon="SMOOTHCURVE")
row.operator("object.shade_flat", text="Sharp", icon="LINCURVE")
row = layout.row()
row.prop(obj, "draw_type", text="Draw Type")
row = layout.row()
row.prop(obj, "show_wire", text="Wire")
row.prop(obj, "show_transparent", text="Transparency")
row.prop(obj, "show_x_ray", text="X-Ray")
row = layout.row()
#row.prop(mat, "alpha")
split = layout.split()
But when I add the following value definition no buttons are drawn
def draw(self, context):
layout = self.layout
obj = context.object
mesh = obj.data
mat = context.material
cmat = mat.cycles
What I try to do is to add an alpha value slider so I can set transparency for display and value in one area.
row.prop(mat, "alpha")