0

Below is my script for setting up my object shading, but I am not able to set the mesh to shade smooth. I would like to do this in the most performant way.

import bpy
from math import math
    for obj in bpy.data.objects:
    if obj.type=='MESH':

        obj.data.use_auto_smooth = True  
        obj.data.auto_smooth_angle = radians(180)
        obj.use_smooth = True
        #obj.ops.mesh.faces_shade_smooth()`enter code here`

Marty Fouts
  • 33,070
  • 10
  • 35
  • 79
Zak Nelson
  • 861
  • 7
  • 17

1 Answers1

1

You can use this code to make it work:

import bpy
import math

for obj in bpy.data.objects: if obj.type=='MESH': obj.data.use_auto_smooth = True
obj.data.auto_smooth_angle = math.radians(180) mesh = obj.data for f in mesh.polygons: f.use_smooth = True

Yousuf Chaudhry
  • 2,783
  • 2
  • 12
  • 38
Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51