McNeel,
What has happened with this behavior of the Toggle component?
2018
Some regression of functionality
McNeel,
What has happened with this behavior of the Toggle component?
2018
Some regression of functionality
Any ideas? Am I missing something?
I canāt remember that far back, but I imagine the component was split into two; Toggle and Button. Also the newer components can have values other than true
and false
associated with either state.
But can we get the option to single click toggle the booleans,
because the button is doing as follows:
I want the behavior:
Same as if the button is left down. Think of it as one TV when TVs still had buttons on them
, to toggle Mute, the button stayed pressed down while muted then when pressed it came up again.
Currently the only way to implement that is using script
I remember the plug-in firefly had a āstateā component that did something like that. Iām not sure this is the best way to do it, but this is a quick/dirty solution that mimics the state component from firefly, (and I think the behavior you are describing?)
"""Provides a scripting component.
Inputs:
x: boolean button
y: value to use in modf function, (in this case, change state based
on how many times the button is pressed. input of 2 will always yield 0 or 1 result)
Output:
a: saved state
b: number of times button has been pressed"""
__author__ = "chanley"
__version__ = "2018.08.22"
import scriptcontext as sc
import math
if not sc.sticky.get('foostate'):
sc.sticky['foostate'] = True
if not sc.sticky.get('foocounter'):
sc.sticky['foocounter'] = 0
if x:
sc.sticky['foocounter'] +=1
b = sc.sticky['foocounter']
a = math.fmod(b, y)
BooleanStateModulus.gh (5.7 KB)
Thanks @chanley,
What I do now is using variation of this:
But why the need to do that with scripting components?. Why not having it right there as a config of the button itself. It should not be that much coding to do it.
agreed, it would be nice to have includedā¦butā¦as you said, itās not that much coding to add the āfeatureā yourself!
The place where I found that type of feature the most valuable was when connecting external hardware/controllers into a GH def. Likeā¦attaching a hardware button through some type of OSC listener, (mandrill was one, there are others Iām sure), and using the button to trigger something. It was one solution to dealing with a press and release event of a button, when we really only wanted the āpressā event.
I got some stuff from here to play around with from here:
While funā¦I kind of abandoned the exploration of it⦠I got it to work fine with GH, (turning knobs/sliders/buttons/etcā¦), but I wasnāt able to find a terribly meaningful use for it in my daily workflow.
::end sidetrack commentary.
I believe this is not so difficult to be included in GH1 as it existed before (check the original post)
Unless, of course GH1 development is frozen, but I havenāt heard about that.
I intend to use it for toggling inputs, much faster than if I have to double click all the time. This could also start new iterations. One of my recent (and the reason I created this one), a button creating new guids, if it was just button no script behind it, PRESS = generate new GUID, RELEASE, generating another GUID, really annoying because I wanted only one, not two.
This is continuation of my previous threads where I am always discouraged to change component gui, by adding a button, like if itās some kind of heresy
Unless, of course GH1 development is frozen, but I havenāt heard about that.
Just go to the link I sent and read the second sentence
" Grasshopper1 is now included in Rhino6+ and it is unlikely that, save for a few critical bug-fixes, any new features will be added to it. So even though Grasshopper2 isnāt yet available as a WIP product, any discussion about future functionality can be had here."
Donāt think difficulty is an issue, more about priority. Either way, canāt hurt to document the request in the appropriate place. Or donāt
Fair enough.
I see. Also, my statement of ānot terribly usefulā was intended towards the hardware knobs/sliders, not the actual functionality you were discussing.
One last thingā¦(again, not exactly what you want, but maybe close enough), would be a value list. Set the value list type to āvalue sequenceā, and only have two values, (False-0, True-1).
:: hanley out
value list thing is not a new idea/suggestionā¦as shown in the link that was posted in your other āwishā threadā¦
Could you share the code and process you set for using Palette Gear? Thanks
sureā¦but I must admit, I canāt vouch for the reliability of this in any type of production environment.
The setup is as follows: (you will need mandrill, https://www.food4rhino.com/app/mandrill-midi-realtime-bridge-grasshopper)
1 - Start up/Configure Palette app
GH Connect.zip (508 Bytes) (this is the palette gear profile).
2 - open the mandrill executable and start the midi listener.
You only start the First Controller
3 - Launch Rhino/GH and configure your GH def:
This example is super simple. The slider controls the radius of the circle, and the button switches between planes.
mandrill_PaletteGearExample2.gh (18.8 KB)
Awesome! Thanks! I will test it out!
Andrew
It works. Thanks for the help.
Theo
Got it to work! Thanks for showing the setup and sharing the files. It took a little research to figure out how to set up a Windows Environment Variable for GHMandrill, but once I got that set up it worked great.
I found that to get the Pallet button to work a true/false required the Pallet setup to be āC - 0ā, not āC - 1ā or āC# - 2ā .
Thanks again!
Andrew
This is very useful to use with Python scripts, i add a little change
import scriptcontext as sc
import math
if not sc.sticky.get('foostate'):
sc.sticky['foostate'] = True
if not sc.sticky.get('foocounter'):
sc.sticky['foocounter'] = 0
if x:
if sc.sticky['foocounter'] == 0:
sc.sticky['foocounter'] +=1
elif sc.sticky['foocounter'] == 1:
sc.sticky['foocounter'] -=1
a = sc.sticky['foocounter']
I set my 3Dconnexion middle mouse button to execute a double click.
Hello, I have a new setup now, and canāt remember the value set for the Windows Environment Variable for GHMandrill, any advice?