I’m trying to create a scripted helper that always has it’s pivot at the bottom, and when I adjust the height it should beep the it’s base at the bottom while just scaling it upwards.
With the attached code it behaves correctly on creation, but when it’s created the pivot is in the center, and when the height is adjusted it scales it in both directions. I know my way around with maxscript, but I have to admit I don’t really understand how the steps creation really works, and setting properties on “delegate” and such.
Any chance someone could help me out on this?
plugin Helper HelperTest name:"HelperTest" classID:#(0x471114fe, 0x4e9fa290) category:"Standard" extends:dummy
(
parameters params rollout:helperMainUi
(
dummyRadius type:#float ui:ui_dummyRadius default:0.02
dummyHeight type:#float ui:ui_dummyHeight default:0.02
on dummyRadius set val do (delegate.boxsize.x = val; delegate.boxsize.y = val)
on dummyHeight set val do (delegate.boxsize.z = val)
)
-- Rollout
rollout helperMainUi "Properties" width:160 height:456
(
spinner ui_dummyRadius "Dummy Radius: " fieldWidth:58 type:#worldunits range:[0,1e9,0] align:#left offset:[0,0] tooltip:"X/Y"
spinner ui_dummyHeight "Dummy Height: " fieldWidth:60 type:#worldunits range:[0,1e9,0] align:#left offset:[0,-2] tooltip:"Z"
)
-- Specifies the way creating the helper works
-- https://forums.cgsociety.org/t/resize-dummy-modifier/1530867/3
tool create
(
local pos
on mousePoint click do case click of
(
1: pos = nodeTM.translation = gridPoint
2: pos = nodeTM.translation
3: #stop
)
on mouseMove click do case click of
(
2:
(
nodeTM.translation = pos
dummyRadius = abs griddist.x
)
3:
(
nodeTM.translation = pos + [0, 0, griddist.z*0.5]
dummyHeight = abs griddist.z
)
)
)
)


