Open ImJimmi opened 5 months ago
This would go nicely with https://github.com/juce-framework/JUCE/pull/1333 to make constructing value trees even cleaner:
juce::ValueTree {"Root"}
.setProperty("foo", 10)
.setProperty("bar", 20)
.appendChild (juce::ValueTree {"Branch"}
.setProperty ("x", y)
.appendChild (juce::ValueTree {"Leaf"}))
.addChild (juce::ValueTree {"Branch"}, 0);
Currently, it's possible to daisy-chain property setters on a value tree:
This PR adds this behaviour to the child-adders as well, allowing a whole tree to be constructed this way:
This is useful when loading value-trees from places external to the current call site (.e.g loading state from XML) and then adding on any additional children (e.g. any state that shouldn't be persisted to a file).
It also allows for better const-ness as the tree doesn't need to be changed after initialisation: