The problem with the internet is that everyone thinks they’re an expert. That would be fine, if everyone actually was an expert, but the truth is that only I am an expert, so it’s just frustrating.
To give a simple example, someone wrote in to say that they were “promised” references to the
Chronicles of Narnia in Part 14 of this series, and that Part 15 failed to deliver on that “promise”. Nothing could be further from the truth. This is a perfect example of someone thinking they know what they’re talking about when they clearly don’t.
If you go back and read Part 15, you will plainly see that the entire article is all one giant Chronicles of Narnia reference, but because I am actually an expert on the series (unlike the erroneous commenter), I chose to reference something subtle that only other experts would understand. As devotees of the Chronicles know, one of the primary villains in the later books is the snail-mage Shellius Grubb, who often uses his magical powers to entrap the minds of his enemies into long daydreams about things that are completely unrelated to Narnia. This was precisely how I constructed Part 15 of Witness Wednesday, and if you were a true fan of the Narnia books — not those horrific movie adaptations — you would have seen this immediately.
But in addition to being an expert, I am also a professional, so I do not let amateur comments like this deter me from the important task of making subtle long-form references to outdated
World War II allegories. So without further ado, here is one of the many famous speeches
Prince Caspian used to address his people during the myriad national holidays celebrated in Narnia:
“Ladies and gentlemen of Narnia, loyal subjects, let me tell you about the time when the lion was being a real dick and he locked me inside the wardrobe, and I had to escape by adding hierarchical group display to
The Witness editor’s Lister Panel…”
The original Lister Panel didn’t actually display groups of things at all. It was strictly a flat, linear list of entities. So when I updated the Lister Panel to have scrolling displays and filtering options and other fancinesses, it seemed like a good time to add basic hierarchical listing support to bring it more in line with what artists use in packages like
3DSMAX and
Maya.
The Witness’s entity model already included hierarchically nested groups, there just wasn’t any way to ever see them in a standard “tree view”-style list.
To show items in a tree view, obviously you have to traverse them depth-first, because for each item at a certain level of the tree, you don’t list the next item at its level until you’ve listed all of its “children”, and all of its children’s children, and so on. This is the classic case for a simple recursive function, assuming you know that the depth of the tree and the size of the stack aren’t onerous: