Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn growToVacantVerts=
- (
- clearListener()
- for vert in (getVertSelection theObj as array) do --for each currently selected vert check
- (
- if (findItem vacantArr vert != 0) do --if this is a vacant vert then:
- (
- deleteItem vacantArr (findItem vacantArr vert) --remove the vert from the vacantArr, every vert ultimately is either set as a nonVacant or a tip vert
- polyop.setVertSelection theObj vert --select the current vert
- initBitArr = #{vert}
- theObj.EditablePoly.GrowSelection() --grow the selection and subtract the current vert
- neighboursArr = ((getVertSelection $) - initBitArr) as array --select the neigbouring verts
- for n in neighboursArr do
- (
- if (findItem vacantArr n != 0) do --if a valid neigbouring vert is available to be moved into
- (
- appendIfUnique nonVacantArr vert --then the current vert is now a nonVacant vert and cannot be a tip vert")
- appendIfUnique validArr vert --we'll add the current vert to the validArr which we'll then grow off of next
- )
- )
- )
- )
- polyop.setVertSelection $ (validArr as bitArray)
- theObj.EditablePoly.GrowSelection()
- tmpArr = polyop.getVertSelection $ as array
- polyop.setVertSelection $ (tmpArr as bitArray - nonVacantArr as bitArray)
- validArr=#() --reset the arr for the next round
- --print some info:
- /*("--\n" + nonVacantArr.count as string + " non-vacancies\n" + \
- vacantArr.count as string + " Vacant Verts still untouched\n" + \
- (polyop.getVertSelection $ as array).count as string + " selected")*/
- )
- --
- theObj = $
- polyop.CollapseDeadStructs $
- vacantArr = #{1..(polyop.getNumVerts theObj)} as array
- nonVacantArr=#()
- validArr=#()
- closestVert
- theDist = 10000.0
- for i = 1 to polyop.getNumVerts theObj do
- (
- a = (polyop.getVerts $ i)[1].z
- b = $.min.z
- if (a-b) < theDist do
- (
- theDist = a-b
- closestVert = i
- )
- )
- select theObj
- max modify mode
- subobjectLevel = 1
- polyop.setVertSelection theObj closestVert
- --
- while vacantArr.count > 0 do with undo off with redraw off
- (
- growToVacantVerts()
- if keyboard.escPressed do
- (
- print "You pressed escape"
- exit
- )
- )
- try(polyop.setVertSelection $ (remainingArr = #{1..(polyop.getNumVerts theObj)} - (nonVacantArr as bitArray)))catch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement