[Closed] pickpoint inside a callback
Here’s a simplified version of what I’m trying to do. There’s a callback script monitorig selections and when certain object comes to focus it sticks to the mouse and moves along the surface of specified object. The pickpoint callback works when it is run separately from the selection callback, but when it’s run within it, max pretty much halts and doesn’t do anything untill escape is pressed.
---mousemovecallback function----
fn mou ai obj=
(
b=mapscreentoworldray mouse.pos
hitt=intersectray proj b
if hitt!=undefined then obj.pos=hitt.pos
)
---callback string---
n="obj=(getcurrentselection())[1]
p=finditem anchors obj
if p!=0 then
(
pickpoint mousemovecallback:#(mou, obj)
)"
callbacks.addScript #modPanelSelChanged n
I kinda ripped this out of context so there may be variables seemingly pointing nowhere, nevermind that. The only important thing is why the pickpoint wont work here. Even plainly pickpoint() has the same effect, not only mousemovecallback.
Is there any way around this? Or can someone think of alternative method of performing the task described earlier?
This thing started bugging me again this morning. back then I replaced that method with infinite while loop – pickobject – mousemovecallback combo, which works really nicely too, but the big issue with that is that it cannot handle area selections and is otherwise really clumsy with multiple nodes too.
Now it also seems that pretty much any process capable of temporarily halting maxscript execution like pickpoint, pickobject, mousetrack and mousetool, will stall max when run within a callback. First I thought the calback was triggering inside the script, but it also halts with empty mousetools.
Gonna try something with rollout timers next, althought that kind of feels like duct-taping the whole thing together