6
$\begingroup$

I am cleaning up a large file imported from another program with 500+ objects. All of these objects have Custom split normals that need to be cleared, and then Auto Smooth turned on. I know I can make changes to all selected objects at once by holding down Alt while changing a value or checking a box. However, this does not seem to work for pushing buttons, which is what you need to do to Clear Custom Split Normals Data.

Any ideas on how to do it to all my objects at once?

$\endgroup$
1
  • $\begingroup$ Does selecting them all and then going to <Space> > Clear Custom Split Normals Data work, or does that only work for the active object? $\endgroup$
    – SilverWolf
    Commented Sep 6, 2017 at 15:17

4 Answers 4

23
$\begingroup$
import bpy

selection = bpy.context.selected_objects

for o in selection:
    bpy.context.view_layer.objects.active = o
    bpy.ops.mesh.customdata_custom_splitnormals_clear()

This is the new code as the coding has changed a bit in 2.8

$\endgroup$
1
  • $\begingroup$ Thank you for this code, it helped me, it is bad the alt+click on the button to remove custom split doesn't work like all other part of blender where alt+changing value or clicking does it on selected meshes. $\endgroup$ Commented Jul 20, 2022 at 12:31
6
$\begingroup$

Just stumbled upon the same problem. Here's the code. Select the mesh objects you want and run it. It'll think a bit if you have a ton of objects, because of make each of the objects active. May be someone knows the way to avoid that, but this one works.

import bpy

selection = bpy.context.selected_objects

for o in selection:
    bpy.context.scene.objects.active = o
    bpy.ops.mesh.customdata_custom_splitnormals_clear()
$\endgroup$
0
0
$\begingroup$

I am trying to modify a OBJ import script to custom split normals automatically. I believe this is the place to do it.

ob = bpy.data.objects.new(me.name, me)
new_objects.append(ob)

However, I only get errors when I try to do stuff like ob = bpy.ops.mesh.customdata_custom_splitnormals_clear() Can anybody help me?

$\endgroup$
1
  • $\begingroup$ Please post this as a new question. Posting it as an answer to a related question will not give it better visibility. You can learn more about asking questions here. $\endgroup$
    – Mr A
    Commented Dec 18, 2023 at 22:25
-1
$\begingroup$

There. I have a workaround for that: Select all objects. Ctrl + J to join. then hit " Clear custom split Normals data ", then go Edit mode, Mesh - Separate - By loose parts. That's all.

$\endgroup$
1
  • 4
    $\begingroup$ Your solution would work, but is a bad workaround. You'll loose all your individual object names when joining meshes. $\endgroup$ Commented Sep 11, 2019 at 6:57

You must log in to answer this question.

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