We all know how sometimes juggling with datatrees might be tricky, particularly for new users.
Here I’m sharing a pretty trivial but efficient method I’m using since some years:
using a c# list of generic objects, we can handle it as a single object.
This can actually cut down a level (or more) in the complexity of your datatree, letting you manage it easier.
The same way “Groups” already works, but not limited to geometry data.
Notice how with a single “Reverse” option I reversed the order of the branches in the final datatree.
With components only, you can group data as long strings separated by a ‘;’ for instance. I would see this functionally the same. Grouping and ungrouping happens with Join and Split text. Although only for data representable as text.
Metahopper’s Wrap List and Unwrap List do this exact thing just fyi. I use it all the time, its a lifesaver for many many cases. A native component for this in GH2 should be included!
I didn’t know that, thank you @Kyuubimode !
I actually avoid using plugins because i need my code to work everywhere also when users don’t have enough permissions etc etc…
Out of curiosity, does Metahopper’s Wrap List and Unwrap List component show preview?
Also, I was thinking of creating a single “Transform” component, to let an user apply a single transformation to a whole “wrapped list” or “group” (to any geometry there is), recursively if needed, if groups are nested. Does Metahopper already have something similar?
You say this and yet there is only one set of components to Metahopper I use regularly (setting the domain of a slider), and two that I have used on occassion (snippets and disabling sections of my script with a toggle). The rest of the plug-in is gobbldy-gook to me. I’m not here to disagree with you. Maybe you can enlighten me what all else Metahopper can do?
Grasshopper2 features the Tuple type, which is supposed to be an improvement upon the Grasshopper1 Group type. Tuples can contain any type of value, they are not limited to geometric types. Also each item in a tuple can be named, and when transformed, geometric values inside a tuple are affected as you would expect.
On paper it sounds very similar to what @maje90 has done, but I suspect there are subtle differences. There’s also a lot of overhead that wouldn’t be necessary if twigs could just be treated as individual values.
There’s probably good reasons despite tuples to add support for twigs-as-single-values, but it is very meta.
There is a lot of stuff here that helps you operate on the Meta-Level which is sometimes the only option. Stuff like Hide/Show Object Preview is quite cool, but the Enable/Disable Object along with Heteroptera’s Stream/Freeze Gate has saved me a bunch of times. I don’t have to follow a non-conventional boolean toggle system from different plugin developers when I can just Enable/Disable the component via this method. Some devs keep results after a boolean toggle is set to false, some don’t and its a hassle to figure out what method the dev choose to implement.
Stuff like setting group colors and scribble colors is also fun, but I have found myself not needing it much now as I cluster my definitions more and more.
Wrap & Unwrap List was something I discovered newly and it has drastically reduced the amount of components I need when juggling data trees, its a truly invaluable component. Setting the Domain of a Slider is also something I use a lot.
There is also the ‘Launch Bottleneck Navigator’ on the task bar which helps you see which components are taking the most time. The Group Toggle component is also very handy for complex definitions which need groups to be turned on and off.
I agree there is a lot of stuff here that’s of no use to me, but the core things I do use - its invaluable. Its also nice to know that there are components to get any sort of data from a component (like param properties, warning messages, etc) if I ever require it in the future.
There could be a component that does it that way. Note that each tuple element is named, so there would have to be a second output which contains the list of names. But yeah, if there were components like that it would be even closer to what the scripts at the top of this posts do.