I’m trying to put a shape widget as an overlay on top of a pad widget (I find the Off pad to be too bright and try to darken it with a shape), so I want the shape to show when the pad is Off, and disappear when the pad is On . However I can’t figure out how to invert the Shape transparency. Can it be done?
Just hiding/unhiding the shape? I think this could be achieved by GPScript and SetWidgetHideOn Presentation()?! Not on my GP Mac right now…
Definitely an interesting idea! If only I knew how to script…
As an example, here’s a small gig file with a basic script to hide/unhide the shape widget when another widget is pressed. You can find the script in Window > Current Rackspace Script Editor.
Hide.gig (40.1 KB)
Works like a charm, thanks!
As already mentioned, I don’t understand much of scripting. Hence, I fail to add a second pad and shape with the same functionality. Could you point me in the right direction?
I’ve added pad2 and shape2 below, but then what?
Var
shape1, shape2 : Widget
pad1, pad2 : Widget
On WidgetValueChanged(newValue : double) from pad1
If newValue > 0 then
SetWidgetHideOnPresentation(shape1, true)
Else SetWidgetHideOnPresentation(shape1, false)
End
End
then
On WidgetValueChanged(newValue : double) from pad2
If newValue > 0 then
SetWidgetHideOnPresentation(shape2, true)
Else
SetWidgetHideOnPresentation(shape2, false)
End
End
Success!
I thought I should add pad2 and shape2 into those few rows in the original script. But I just repeat the rows for pad2 and shape2. Got it.
Thanks!
What I wanted to achieve:
Cool!
There’s a variation on this approach that I use that can be slightly more flexible depending on how you want to use it.
You can change the transparency of a Shape or Text Label widget by changing the value of the widget. So setting the value of it to zero is effectively the same as hiding it. Changing value just gives you a little more flexibility because it doesn’t have to be binary.
Var
shape1 : Widget
pad1 : Widget
On WidgetValueChanged(newValue : double) from pad1
If newValue > 0 then
SetWidgetValue(shape1, 0.1)
Else SetWidgetValue(shape1, 0.8)
End
End
Other than that, I generally use Text Label widgets instead of Shape widgets. For all practical purposes the Shape widgets are just less-flexible versions of the Text Label widgets (at least I’m not aware of anything you can do with a Shape widget you can’t do with a Text Label widget).
I sometimes want to store additional information in a widget, so one thing you can do with a Text Label widget that you can’t do with a Shape widget is put whatever information you want in the “Label” field and set the text color alpha to zero. That makes the information available to the GP Script (or extension API), but the user can’t see it.