LuRenJia
05-04-2007 20:04:52
hi guys.
i wrote the max script to "ResetPivot and ResetXForm " all of the geometry in a scene. i found it's useful, maybe someone need it too.
i wrote the max script to "ResetPivot and ResetXForm " all of the geometry in a scene. i found it's useful, maybe someone need it too.
fn isNormalFliped pt1 pt2 =
(
for i = 1 to pt1.count do
if (length (pt1[i] - pt2[i])) > 0.0001 then return true
return false
)
fn doResetXForm obj =
(
if obj == undefined or ((classOf obj != Editable_Mesh) and (classOf obj != Editable_Poly)) then return ok
local oldNormal = #()
for i=1 to obj.numFaces do
oldNormal[i] = getFaceNormal obj i
ResetPivot obj
ResetXForm obj
local newNormal = #()
for i=1 to obj.numFaces do
newNormal[i] = getFaceNormal obj i
if(isNormalFliped oldNormal newNormal) then
meshOp.flipNormals obj #{1..obj.numFaces}
update obj
)
for ent in geometry do
doResetXForm ent
messageBox "done!"