ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
Shift + Drag Edge polygon creation with same ID as source polygon
Submitted by harumscarum on Fri, 2017-06-23 07:41
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
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 =
ifselection.count == 1 and classofselection[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)elsefalse
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
elseif keyboard.ShiftPressed and mouse.mode == 0 dotry(--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 doprint(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
)ifclassof 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
Comments
Ideas
I'd instead suggest posting to the 3ds Max Ideas, as a feature request.
Some of my scripts and MCGs :: 3ds Max SDK Intro for Scripters
`
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
Let me know how it works, and which MultiScatter properties should I add in next version.
Best,
Pixamoon