Hello , Im new to maxscript and iv'e been doing some practice scripting basics to better understand it.
Ok, here it is.I'm trying to add a mousepoint handler to my script. The problem I'm having, is that im not sure where the placement for the event to go in and how to structure it. Any suggestion or guidance would be appreciated, Thanks.
global myFloater
(
try
closeRolloutFloater myFloater
catch()
myfloater = newRolloutFloater "My Rock" 200 300
rollout myRollout "Rock Pro"
(
global myBox
group "Rocksize"
(
spinner spnLen "Length: " range:[1.0, 10.0, 1.0] type:#worldunits
spinner spnWid "Width: " range:[1.0, 10.0, 1.0] type:#worldunits
spinner spnHei "Height: " range:[1.0, 10.0, 1.0] type:#worldunits
)
button createRock "MakeRock"
on createRock pressed do
(
sL = spnLen.value
sW = spnWid.value
sH = spnHei.value
myBox = box length:sL width:sW height:sH pos:worldPoint lengthsegs:5 widthsegs:5 heightsegs:5
myBox.name = uniqueName "Rock_"
select myBox
for i in selection do i.pivot = i.center
addModifier myBox (spherify())
addModifier myBox (turbosmooth())
myBox.spherify.percent = 100
)
tool create
(
local myBox
on mousePoint clickno do
if clickno == 1 then myBox = myBox pos:worldPoint else #stop
on mouseMove clickno do myBox.pos = worldPoint
)
)
)
addrollout myRollout myfloater
Comments (2)
Comment policy
Thanks Anubis for your help. I appreciate you giving me the two options for the script to work. And pickpoint v1 would work for me for my pos and adding an undefined for in case the user aborts. Thanks again this was really helpful.
cheers.
Just take this as quick reply... if you need a mouse tool only for the start pos point you can use pickPoint(). The mouse tool named "create" likely is preserved for plugins, so I rename it to "createRock", and add the tool as local to the rollout (but it can be outside of the rollout as well).