Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addModifier $ (Edit_Normals ()) ui:on
- numNorms = $.Edit_Normals.GetNumNormals()
- numFaces = $.Edit_Normals.GetNumFaces()
- normalArray = #() --place to store temp info for each normal.
- --fill in normalArray with junk data.
- for i = 1 to numNorms do
- (
- append normalArray [0,0,0]
- )
- -- iterate through all the faces in the mesh. find out which normals belond to this face and then add the weighted value of the face normal to value already in normalArray
- for i = 1 to numFaces do
- (
- curFace = #{i}
- connectedNormals = #{}
- $.Edit_Normals.ConvertFaceSelection curFace connectedNormals --should now have a bit array of normals connected to current face.
- faceNormal = ( in coordsys local polyop.getFaceNormal $ i) * (polyop.getFaceArea $ i) --getweighted normal for current face.
- for j in connectedNormals do
- (
- normalArray[j] = normalArray[j]+faceNormal --add current face value to it.
- )
- )
- --normalize values in normaArray and apply to mesh.
- for i = 1 to numNorms do
- (
- $.Edit_Normals.SetNormalExplicit i
- normalArray[i] = normalize normalArray[i]
- in coordsys local $.Edit_Normals.SetNormal i normalArray[i]
- )
Add Comment
Please, Sign In to add comment