Hello there! I am having trouble figuring out how to toggle the global rackspace view using a MIDI CC (apart from clicking or using ctrl-g). I have tried making a script using the function ShowGlobalRackspace (show : boolean) but keep getting error messages. Any support would be greatly appreciated!
Are we supposed to guess the error message?
Let me see what the errors could beā¦
I had deleted my (pitiful) attempt so didnāt have the error messages on hand, was hoping there would be a simple solution. Here is the scriptlet:
var
GlobalToggle : Discrete Parameter āGlobalā, āLocalā = āGlobalāOn ParameterValueChanged matching GlobalToggle
ShowGlobalRackspace (show : boolean)
End
and here is the error:
Scriptlet (Scriptlet) - - Syntax Error in āMainā: Line 5, Col 5: Unexpected or unrecognized token: āShowGlobalRackspaceā
Mismatched input āShowGlobalRackspaceā expecting End
Test with something like that:
ShowGlobalRackspace (GlobalToggle == āGlobalā)
I realized that I think I need to ādeclareā (not sure if thatās the right word) the showglobalrackspace function at the beginning, now I have been able to compile it without errors at least. But using GlobalToggle == āGlobalā the script is not doing anything when the parameter is changed:
var
GlobalToggle : Discrete Parameter āGlobalā, āLocalā = āGlobalā
function ShowGlobalRackspace (show : boolean)
EndOn ParameterValueChanged matching GlobalToggle
ShowGlobalRackspace (GlobalToggle == āGlobalā)
End
I doubt it whether ShowGlobalRackspace is available in scriptlets, as they are in fact plugins, so like normal plugins they have little consciousness of there environments.
Furthermore beware of the double quotes when copying: Webpages tend to display fancy ones (the first upside down). These do not compile
"<- these quotes are the right ones ->"
@Frank1119 is absolutely right - in a scriptlet itās not allowed use the ShowGlobalRackspace() function, AND youād have to use the correct quotation marks!
So youād have to use a rackspace script to achieve this goalā¦ but you can use the global rackspace itself, so the script and the widget would be needed only once in one sngle place (global rackspace)!
Place a button widget on the global rackspace panel and give it a handle (for my script i used ābtn_toggleā):
Then open the global rackspace script editor and use this code (donāt forget to compile):
var
btn_toggle : widget
On WidgetValueChanged (bval : double) from btn_toggle
If bval >0.6 then
ShowGlobalRackspace(true)
Else
ShowGlobalRackspace(false)
end
End
If you learn a MIDI controller to the button, you will be able to switch the global rackspace on and off from any place.
Thank you so much for this extremely generous reply, I really appreciate it! I will give it a try as soon as I get back to my PC.
Oh, indeed, this doesnāt help.
Then perhaps replacing this:
by this:
ShowGlobalRackspace( bval > 0.6 )
Maybe some hysteresis?
On WidgetValueChanged (bval : double) from btn_toggle
If bval > 0.6 then
ShowGlobalRackspace(true)
end
If bval < 0.4 then
ShowGlobalRackspace(false)
end
End
But the need for this depends on the physical controller: for a switch type you donāt need it, for a slider you might when you slide rather slow.
I guess Iāll never get used to using this short formā¦ but of course this will work.
Besides that it definitely results in a shorter source code, has this any impact on computing speed or such?
@Frank1119 not a bad ideaā¦ if using a slider, my code would be a bit ālopsidedā.
If in a loop, probably, but not here on a single button press.
There is also a function to get the previous widget value (something like GetWidgetPreviousValue(w : Widget)
).
Put an Else between those two If statements. No point in testing bval twice.
Technically yesā¦.no jump instructions are necessary.
Hello! I am just getting back to this now, and the script has compiled successfully and is working somewhat, but it is not behaving as expected. If I am in the panel view, the script toggles the global rackspace panel popping up on top of the local rackspace panel. Otherwise, the script does not toggle the global rackspace view in the same way that the button/hotkey does. And if I press it too rapidly it crashes GP. I think I will just stick to those and give up the experiment, seems more of a hassle than itās worth.
Yes, that function called ShowGlobalRackspace is actually to show/hide the panel, not to switch to the actual global rackspace.
Iām not aware of a script function to do what you want.
Do you have a crash report? What computer and OS are you running?