Hey folks, I'm a little stuck here. I'm trying to get a function to run while the view is changing. But I'm struggling to pass off anything to the function within the callback.
This won't work for instance:
fn theFun theModel =
(
print theVar.name as string
)
try (destroyDialog theScript) catch()
rollout theScript "The Script"
(
--Filter for pick buttons, makes sure user can only select geometry
fn meshFilter obj = superClassOf obj == GeometryClass
group "Random Group"
(
pickButton meshPick "Mesh Pick" width:140 height:30 filter:meshFilter autoDisplay:true
)
button theButton "BUTTON" width:140 height:30
--Combine button
on theButton pressed do
(
theModel = meshPick.object
callbacks.addScript #viewportChange "theFun theModel" id:#theViewCall
)
)
createDialog theScript 160 160
If I change "theFun theModel" to "callFun = theFun theModel" like I'd usually use it doesn't work either.
If I just call the function without the callback it works fine. This is the first time I've tried using callbacks so I'm probably just noobing it up here.
Thanks for reading.
Replies
If you put theFun inside the rollout you can just do: