PDA

View Full Version : Scripting a Custom Modifier


Codi
09-20-2007, 11:14 AM
Hi,

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
name:"CodMod"
classID:#(53527,53427)
extends:Edit_Poly
replaceUI:true
version:1
(
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
delegate.Commit()
)
)
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}' ???

Thanx

PiXeL_MoNKeY
09-20-2007, 04: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.

-Eric

Codi
09-20-2007, 06: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?

Thanks

CGTalk Moderation
09-20-2007, 06: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.