XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Scripting a Custom Modifier

09-20-2007, 10:14 AM

I'm trying to make a modifier to do certain edit poly operations to a selected object (inset x units, extrude y units, and so on ....), at the moment all I have is this:

plugin modifier CodMod
parameters main rollout:params
amount type:#integer ui:amtSpin default:20
on amount set val do (
delegate.SetSelection #Face #{1}
delegate.SetOperation #Inset
delegate.insetType = 1
delegate.insetAmount = val
rollout params "Parameters"
spinner amtSpin "Amount: " type:#integer range:[0,1000,20]

I cant manage to get it to work, I apply the modifier on top of the object but it refuses to apply the operation ... is this the propper way to achieve the functionality I want?

BTW wich would be a good method to select all the faces in line 'delegate.SetSelection #Face #{1}' ???


09-20-2007, 03:44 PM
Do you want to select all faces on the object?
faceBit = (for faceCnt in 1 to (delegate.getnumfaces()) collect faceCnt) as bitarray
delegate.setselection #face faceBit
Do you want to use the existing stack selection?
delegate.usestackselection = true
Or do you want select something else all together?

Ok, it appears something is broken as it is using the stack selection no matter what.


09-20-2007, 05:38 PM
Yup, the facebit trick you pointed out is exactly what I needed :)

The next problem is that I would like to interactively see the changes of various edit poly operations, say I'd like to see how the mesh would look like after applying certain amount of inset, some extrude and some modifications more ... If I dont make the commit after the first operation I cant do the next, but if I make the commit then the mesh will be messed up the first time I try to change it. Is it possible to do?


CGTalk Moderation
09-20-2007, 05:38 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.