The smooth/flat shading option is only applied per face and not per object. So there isn't a way of viewing the shading status of an object.
When you click 'Smooth' or 'Flat' shading while in object mode you are simply telling blender to smooth each individual face. You could go into edit mode and set smooth or flat shading on a selection of faces instead of the whole object, meaning: the object would have both smooth and flat shading.
You could create a python script which loops through the faces of an object and sees whether the majority are smooth or flat shaded by accessing the use_smooth
property of a polygon (face) and seeing whether it is True
or False
.
You can access the use_smooth
property via Mesh.polygons
on a given object:
# test the first polygon of a certain mesh
>>> bpy.data.objects['ObjectName'].data.polygons[0].use_smooth
>>> True
# set the shading of all polygons to flat
for poly in bpy.context.object.data.polygons:
poly.use_smooth = False