I ran into a problem serialising Drawables.
Say you write out with:
Drawable* d = someCode();
// ASSUME no images inside
ValueTree vt = d->createValueTree(0);
and read back with,
ValueTree vt = ValueTree::readFromStream(st);
Drawable* d = Drawable::createFromValueTree(vt, 0);
it doesn’t work. This is because the original Drawables did not contain valid component ids. Im not sure how these ids are meant to have been assigned. In my case i create the original Drawable from a SVG.
I can fix my problem by assigning arbitrary component IDs to the Drawable before any of this serialisation happens. Something like:
static void bindComponentID(Component* c, int& id)
// make up unique component ids
int n = c->getNumChildComponents();
for (int i = 0; i < n; ++i)
is ok to get around this locally.