PDA

View Full Version : Scripted Plug-in question


MatanH
12-18-2007, 04:19 PM
hi,
I'm currently working on a simpleMod plug-in and when I'm trying
to use any event handlers other then the required map event and the create event
I get no respond? Is it possible to add some event handlers like:
on <spinner> changed <arg> do <expr>

or does the simple modifier blocks them?
thanks, Matan.

vScourge
12-18-2007, 09:02 PM
Make sure your event handler is inside the scope of the rollout. If you mistakenly put it outside the rollout, it won't complain but also won't work.

This is particularly easy to do if you used the "SaddleDeform" example from the MXS help file as a starting point. The only event handler explicitly listed is at the modifier level. If you added yours next to that one it wouldn't work.

Incorrect (out of scope, handler won't work):


plugin simpleMod saddle
name:"SaddleDeform"
classID:#(685325,452281)
version:1
(
parameters main rollout:params (
amount type:#integer ui:amtSpin default:20
)

rollout params "Saddle Parameters" (
spinner amtSpin "Amount: " type:#integer range:[0,1000,20]
spinner testSpin "Test:" type:#integer
)

on map i p do (
p.z += amount * sin((p.x * 22.5/extent.x) * (p.y * 22.5/extent.y))
p
)

on testSpin changed arg do (
format "spin value: %\n" arg
)
)


Correct:


plugin simpleMod saddle
name:"SaddleDeform"
classID:#(685325,452281)
version:1
(
parameters main rollout:params (
amount type:#integer ui:amtSpin default:20
)

rollout params "Saddle Parameters" (
spinner amtSpin "Amount: " type:#integer range:[0,1000,20]
spinner testSpin "Test:" type:#integer

on testSpin changed arg do (
format "spin value: %\n" arg
)
)

on map i p do (
p.z += amount * sin((p.x * 22.5/extent.x) * (p.y * 22.5/extent.y))
p
)
)

MatanH
12-18-2007, 09:21 PM
Thanks allot Adam,
I haven't tested it yet, but it sounds like a sure thing :thumbsup:

Matan.

CGTalk Moderation
12-18-2007, 09:21 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.