[Closed] Scripted SimpleObject – Create Tool Event Question
Hi,
I’ve been writing a SimpleObject plugin and I need to do some scene analysis while I’m creating instances in the scene.
My problem is when I stop the creation mode I need to stop some external functions as well.
What event handler should I use to let me know when the tool is stopped with a right click?
I’ve tried “on mouseAbort”, “on stop”, “on end” but none of this appears to work.
I’ve found a system variable mouse.inAbort but I wouldn’t know how to use it.
I paste a little test to show as an example:
plugin simpleObject TESTGeometry
name:"TESTGeometry"
category:"Standard Primitives"
classID:#(0x3c18dac7, 0x361d5900)
(
parameters main rollout:params
(
length type:#worldUnits default:(units.DecodeValue "1m")
width type:#worldUnits default:(units.DecodeValue "1m")
height type:#worldUnits default:(units.DecodeValue "10cm")
)
rollout params "Parameters"
(
)
on buildMesh do
(
baseBox = createInstance box length:length width:width height:height
mesh = baseBox.mesh
)
tool create
(
on mouseAbort arg do ( Print "Should print Abort" )
on Stop do ( Print "Should print Stop" )
on End do (print "Should print End")
--I NEED TO SEND AN "END CREATION MESSAGE"
on mousePoint click do
case click of
(
1: coordSys grid (nodeTM.translation = gridPoint)
2: #stop
)
on mouseMove click do
case click of
(
2: coordSys grid (nodeTM.translation = gridPoint)
)
)
)
Thanks a lot for any help
Thanks DenisT for the answer, maybe is my version of max, I’m coding in max 2010, I can’t get the response messages with stop or end, I only get the mouseAbort message if I cancel the creation of one instance but not when I stop the creation tool.