16
$\begingroup$

I know that I can click on the smooth / flat shading buttons in the Tool Shelf panel when I am in object mode.

What I would like to know, is where can I find out if an object has smooth or flat shading on it without having to go and click the buttons to see the difference?

smooth flat shading animation

$\endgroup$

4 Answers 4

26
$\begingroup$

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
$\endgroup$
1
  • $\begingroup$ How to apply this to a baked fluid mesh? Each frame has different polygons. There must be a way to apply it to the base object without addressing each individual polygons. $\endgroup$
    – stackzz
    Commented Aug 31, 2021 at 8:56
0
$\begingroup$

For the simpler case of applying smooth or flat shading across a whole mesh in Object Mode (as per Neil's question) right-clicking the smooth & flat buttons in the toolbox provides for easy creation of 2 distinct shortcuts. Since these are not toggles, there is little prospect of confusion if the shortcuts are properly memorized... Smooth shading applied to an already smooth-shaded mesh will create no change so the shortcuts function as absolute identifiers.

$\endgroup$
0
$\begingroup$

I had a need to identify which of 200 odd meshes in my scene had smooth shading and what value autosmooth(if used)

Running the following produced a list of all the details of all the meshes.

import bpy, math 

def is_smooth(polys): 
    smoothed=False 
    for poly in polys: 
        if not smoothed: 
            smoothed = poly.use_smooth 
    return smoothed 

for mesh in bpy.data.objects.data.meshes: 
    print(mesh.name, is_smooth(mesh.polygons), mesh.use_auto_smooth) 
    print("{:8.4f}".format(math.degrees(mesh.auto_smooth_angle)) ) 
$\endgroup$
0
$\begingroup$

Two ways to set object smooth/flat shading

  1. Use menu: Tab key to enter Edit Mode, then mesh/faces Ctrl + F to apply shade-smooth.

enter image description here

  1. Use the panel: Tab key to enter Edit Mode, then in tool-shelf, Shading/UVs > Faces, choose Smooth.

enter image description here

Two ways to do the same thing, use vertex normal instead of face normal.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .