Replace "flip last" from TreeSloth with native components?


#1

Hello, I find myself using this component a lot: “Flip Last” and I wanted to replicate it using native components but I wasnt able to do it…

This is the description of the component:
Flip Last Matrix : Just like the flip matrix, except this can take in a tree with a deeper path structure. It identifies the last path index with unique values in it and flips that index number with the object count.

tree_sloth_early_bird01


#2

Not sure but:
Canvas%20at%2020%3B42%3B02
Source:
{A}(i)
{A;B}(i)
{A;B;C}(i)
{A;B;C;D}(i)
{A;B;C;D;E}(i)
Target:
{i}(A)
{A;i}(B)
{A;B;i}©
{A;B;C;i}(D)
{A;B;C;D;i}(E)


#3

Hey Dani,

Thank you, this seems to work, will it work for any kind of tree? Or I should keep adding up to F, G, H, etc?


#4

Yes, you must add more. But also remember to simplify the tree before passing it to the path mapper, so 5 levels should be enough.


(Andrew Heumann) #5

Here’s a fully native way to “flip last” that works for trees of arbitrary depth:

Flip Last.gh (15.6 KB)


#6

Awesome! Thank you Andrew.


(David Rutten) #7

As a general comment on moving plug-in components into standard GH2, when the time comes to start work on the GH2 component set, I’ll definitely start a public discussion for it. This will focus partially on what ideas I myself have, differences between GH1 and GH2, but also probably some discussion on stylesheets and standard naming/optionality/defaults and of course what useful components exist already as part of plug-ins.

I would very much like to have the consent of the original developer before ‘stealing’ their ideas, but we’ll cross those bridges when we get there. The good news is that when the time comes to make these decisions, it should be a heck of a lot easier to find, install and uninstall plugins via our package manager.