Strange behavior with Panel Exec in Arcball Cam palette

I have a scenario in which I would like to have the option to toggle Auto Rotate on for the palette Arcball Cam. Since there is already a keyboardinDAT, I add this expression to the callbacks:

if key == 'r' and state == True:
    parent.ArcBall.par.Autorotate = not parent.ArcBall.par.Autorotate

This successfully accomplishes what I want, toggling the CustomPar that is ultimately driving a paramExec. The problem is, although nothing errors out and everything appears to behave as expected, auto rotate will no longer function when toggled off and on via python from within the KeyboardinDAT callbacks. If i further break it out into text dats and run them as scripts, it performs properly, but as soon as I execute those from within the keyboardinDAT callbacks, it breaks as well. Am I crazy?

Linked is an example with easily reproduce-able behavior. give the panel object a spin, toggle the Auto Rotate parameter on and off and see that it behaves as expected. now run scriptOff and scriptOn, see that those also produce the desired effect. Finally run these scripts by hovering over the arcball and clicking ‘r’ to toggle Rotate, and see that this is no longer working.

Hey @drmbt - I think you’ve actually uncovered an expression optimization issue (shot in the dark here).

panelexec2 has an expression pointing to the parent’s Autorotate parameter. This looks like it can get stuck not updating. So the whileOff function never gets called. Force cooking that panel execute when you’ve toggled the parameter to True seems to resolve the issue.

That’s a really strange one. Definitely seems like a bug

Thanks Matthew! adding

op(‘panelexec2’).cook()

to the keyboardinDAT seemed to do the trick! Its kind of terrifying that an exec wouldn’t be cooking when you’d expect it to.