import bpy, math
R='/root/fal-author/le-mans-prototype-v1/'
bpy.ops.wm.open_mainfile(filepath=R+'source.blend')
o=bpy.data.objects['Body'];bpy.ops.object.select_all(action='DESELECT');o.select_set(True);bpy.context.view_layer.objects.active=o
try:bpy.ops.mesh.customdata_custom_splitnormals_clear()
except Exception as e:print(e)
bpy.ops.object.shade_smooth_by_angle(angle=math.radians(25),keep_sharp_edges=False)
s=bpy.context.scene;s.cycles.device='GPU';s.cycles.samples=16;s.render.resolution_x=1280;s.render.resolution_y=720;s.render.filepath=R+'normalfix.png'
p=bpy.context.preferences.addons['cycles'].preferences;p.compute_device_type='OPTIX';p.get_devices()
for d in p.devices:d.use=d.type!='CPU'
bpy.ops.render.render(write_still=True)
