need script which will improve polygon creation by Shift + Drag Edge
by default new polygon gets ID=1, is there any way to assign source polygon ID to a new one when dragging its Edge and hold Shift button
Forum topic · Scripts Wanted
Shift + Drag Edge polygon creation with same ID as source polygon
By harumscarum · 2017-06-23
Description
Comments (2)
Ideas
Swordslayer · 2017-06-25
I'd instead suggest posting to the 3ds Max Ideas, as a feature request.
`
pixamoon · 2017-06-26
Here is first test
It's rollout with timer - checking if new faces are created with Shift
One thing is - first need you need to release mouse button and nest Shift - if you release Shift first it will not apply ID's
try(destroyDialog ::CloneFaceWithID)catch()
::dialogPos
rollout CloneFaceWithID "Clone Face with ID" (
checkbutton bn_On "On" checked:true
timer tm interval:200
local lastSelEdges = #()
local lastEdgeFaces = #()
local lastAllFacesCount = 0
fn CheckEditPoly &selEdgesArr &EdgeFaces &AllFacesCount =
if selection.count == 1 and classof selection[1] == Editable_Poly and subObjectLevel == 2 then (
selEdgesArr = polyop.getEdgeSelection selection[1]
EdgeFaces = for i in selEdgesArr where (a = polyop.getEdgeFaces selection[1] i).count == 1 collect a[1]
AllFacesCount = polyop.getNumFaces selection[1]
true
)
else
false
fn resetLocals = (
lastSelEdges = #()
lastEdgeFaces = #()
lastAllFacesCount = 0
)
on CloneFaceWithID open do (resetLocals(); tm.active = bn_On.state)
on bn_On changed e do (resetLocals(); tm.active = e)
on tm tick do (
if lastSelEdges.count == 0 or lastAllFacesCount == 0 then
CheckEditPoly &lastSelEdges &lastEdgeFaces &lastAllFacesCount
else
if keyboard.ShiftPressed and mouse.mode == 0 do try( --viewport.activeViewport
local SelEdges
local EdgeFaces
local AllFacesCount
local checkOK = CheckEditPoly &SelEdges &EdgeFaces &AllFacesCount
if checkOK and AllFacesCount > LastAllFacesCount do (
for i in lastSelEdges do (
local tmpArr = polyop.getEdgeFaces selection[1] i
if tmpArr.count == 2 then
local ID = 0
for f in tmpArr where findItem lastEdgeFaces f > 0 do (ID = polyop.getFaceMatID selection[1] f; exit)
if ID > 0 then polyop.setFaceMatID selection[1] (tmpArr as BitArray) ID
for f in tmpArr do print (polyop.getFaceMatID selection[1] f)
)
)
lastSelEdges = deepCopy (SelEdges as array)
lastEdgeFaces = deepCopy (EdgeFaces as array)
lastAllFacesCount = AllFacesCount
)catch(print (getCurrentException()))
)
on CloneFaceWithID close do dialogPos = getDialogPos CloneFaceWithID
)
if classof dialogPos != Point2 then createDialog CloneFaceWithID else createDialog CloneFaceWithID pos:dialogPos
Let me know how it works, and which MultiScatter properties should I add in next version.
Best,
Pixamoon
Attachments
- editable_poly_-_clonedfacewithid_v0.10.ms — editable_poly_-_clonedfacewithid_v0.10.ms2.1 KB