I exported a model by .obj into blender and all the normals are flipped. Does anybody have a script to fix this without editing each object individually, or is there a button somewhere that I’m unaware of?
Thanky very mmuch:RocknRoll:
Well, there’s an API function for it . . .
from Blender import *
# Don't run in edit mode
changed = []
for obj in Object.Get():
if obj.getType() == "Mesh":
mesh = obj.getData(False, True)
if mesh not in changed:
changed.append(mesh)
mesh.sel = 1 # select everything, recalcNormals only works on selected
mesh.recalcNormals(0) # 0 = outside, 1 = inside
mesh.calcNormals() # Recalcs vertex normals -- not sure if needed
mesh.sel = 0 # Unselect everything in editmode
Except . . . this dosn’t work, it gives me a “Runtime: Can’t find object for mesh” error, which is why I built it around an object loop, but that didn’t help. That really looks like it should work though. Meh.
I dont know of any script, but you could join all the objects together (ctrl + J) and then recalculate normals on the mesh as a whole, of course the downside is that all your objects are joined together… Hope that helps.
then you could just press p at edit mode and separate loose parts.
… yes Ctrl-J / Ctrl-N and then also when you export to obj all objects, loose parts, or and material regions will be seperated. May still be something of a downside there …
yeah,
select all objects (with one primary selection) ctrl-j ->editmode: ctrl-n, ctrl-p is a pretty quick way of fixing the problem as long as you have solids.