I have a question about the GetGroups component of Metahopper.
It is a fundamental component of my scripts, but unfortunately I think it has a bad fault, because every time a new group is created, switch the value into the “nickname list”.
This actually has nothing to do with Get Groups or with metahopper - it is the nature of the item selector component. When the input list changes, it keeps the same index selected, but this does not guarantee that the same item will remain selected. To be 100% safe, manually enter the name of the group into a panel (e.g. don’t use the item selector at all).
However, there is also a way to prevent this issue without sacrificing the convenience of the “get groups”/“item selector” workflow, although it may seem counter-intuitive: just “reverse” the nicknames output.
When you do this, new groups will be added to the end of the list rather than to the beginning, so that the index of your previously selected item will not change.
The only caveat with this approach is that if you go messing around with the draw order, (send to back, bring to front, etc) the order may change in unexpected ways… it appears that Grasshopper uses one global ordering for all objects on the canvas - draw order = order in which objects are retrieved when accessed by the api = order in which components execute (beyond other dependency-based logic) etc. However as long as you leave draw order of your groups alone, this trick should fix the issue you’re facing.