I am having trouble with a script I’m working on. It is a menu script. I have an “if” statement that checks whether or not the active objects shade is flat, if it is, it will give the user the option to change it to smooth.
Here is the code:
def draw(self, context): self = self.layout obj = bpy.context.active_object self.operator("mesh.primitive_cube_add",icon= "MESH_CUBE") self.operator("mesh.primitive_uv_sphere_add",icon= "MESH_UVSPHERE") self.operator("mesh.primitive_plane_add",icon= "MESH_PLANE") if obj.shade_flat: self.operator("object.shade_smooth")
when I run the script, it gives me the error saying that “object has no attribute shade_flat”. I am pretty new to python, though I know some c++ and some c#.