All my checkboxes and settings goes back to the deafult value when I am saving my Grashopper file. Is that normal? Can I avoid this?
How can I avoid this? Can you please help me with an example with SAVE and Restore State ?
two general approaches.
1. using save/restore state with a single global state.
The only thing to note about this strategy is that two things have to happen for the state to persist when you re-open the definition:
- the user must click “save settings” to trigger the state being saved into the
- the definition must also be saved for those settings to be serialized to the grasshopper file.
Setting_persistence_1.gh (12.3 KB)
2. Saved state with metahopper component decoupling
This is my preferred method. It’s a little more involved - it works on the principle of letting a grasshopper component (an item selector from human, a panel, a toggle, etc) be the “store” of the value - at document load it sets the initial value of the UI components, and then the value listener sets the components with metahopper. This also assumes that the grasshopper document is getting saved.
Setting_persistence_2.gh (14.2 KB)
Thank you very much for your examples.
Actually HUMAN IU is a greatly help for people who are building complicated GH definitions, but I think i requires different approach and thinking than just handling geometry. I guess lots of people asking you examples like me for different parts of HUMAN UI. Are you planning to publish all these examples? It would be great help for everyone who need HUMANI UI for their work!