Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Idea by Makkon
- --Original Maya Python script by Fingus
- --Maxscript by Noors
- --http://polycount.com/discussion/160770/normals-from-edgeloop-s-script-for-those-lovely-edge-decals/p1
- --works only with editable Poly. Select an edge loop and run.
- (
- fn vertNeighbors obj vert vertLoop =
- (
- connectedEdges = polyop.getEdgesUsingVert obj #{vert}
- connectedVerts = polyop.getVertsUsingEdge obj connectedEdges
- neighbors = connectedVerts - vertLoop
- return neighbors
- )
- sel = selection as array
- for obj in sel where classof obj == Editable_Poly do
- (
- --get selected edgeloop
- edgeLoop = polyop.getEdgeSelection obj
- --get verticles in the edge loop
- vertLoop_bit = polyop.getVertsUsingEdge obj edgeLoop
- vertLoop = vertLoop_bit as array
- --set edit normals modifier
- max modify mode
- modi = Edit_Normals ()
- addmodifier obj modi
- --soften mesh
- normCount = modi.GetNumNormals()
- modi.SetSelection #{1..normCount}
- modi.Unify()
- --force redraw to register the unify, idno :/
- max create mode
- max modify mode
- --
- modi.MakeExplicit()
- --cache methods
- _convert = modi.ConvertVertexSelection
- _getNorm = modi.Getnormal
- _setNorm = modi.Setnormal
- for v in vertLoop do
- (
- --get normal of a loop vertex
- vert = #{v}
- normID = #{}
- _convert &vert &normID
- norm = _getNorm (normID as array)[1]
- --get neighbors vertices
- neighbors = vertNeighbors obj v vertLoop_bit
- --get their normals
- nNormIDs = #{}
- _convert &neighbors &nNormIDs
- nNormIDs = nNormIDs as array
- for id in nNormIDs do _setNorm id norm
- )
- modi.EditNormalsMod.SetSelection #{}
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement