Regarding the Global State On Rackspace callback function - is the function executed after the new rackspace has been activated and its respective widgets initialized, or, is it called prior to the new rackspace activation?
Where in this series of events does the callback function get executed?
- Exit old rackspace
- New rackspace activated
- New rackspace widgets initialized and synced
With some Print Statements in the scripts I get this
Deactivate current rackspace
Widget Changes (in new Rackspace)
Activate new Rackspace
On Rackspace (Gig Script)
So to reset Controls on the MIDI hardware
Put the code in each rackspace script in the on Deactivate callback.
This solution does work but it raises an interesting question with how to handle different MIDI devices that might be introduced through Rig Manager and selecting a different rig. Instead of sending MIDI control messages directly to the device (e.g. nanoKONTROL2) it might be better to send values to the widgets in the de-activated rackspace in the hope that those widgets are still in a state where they can send the CC message to the mapped device.
Just try and you will see
Yes - it works! So on the rackspace de-activate callback function I simply turn the button widget off. I also have set the button widget to use its default value on rackspace activation if the default button state is “on”.
Well… mostly works. On two back to back rackspaces with multiple variations each, sometimes the 4th button has an intermittent issue getting the correct lit state. Must be a timing issue because I haven’t found a consistent pattern.
If the ‘Sync’ feature works for your controller, then I’d definitely recommend just adding widgets in every rackspace, rather than chasing down issues with callback timings.
I’m leaning towards that solution. Someone suggested a feature for hidden widgets that could only be seen in edit mode. That would be ideal in this situation.
GP 4.5 is around the corner … stay tuned
The hidden widget feature works great in 4.5! This has solved all the problems with resetting the nanoKontrol2 button state when changing rackspaces. I have removed all the custom scripts.