I made some improvements to the .svg helper in the Projucer. You can now drag / drop simple .svg files on to the window and it’ll find the first path or polygon and convert them into juce Paths. I also added a copy button to save you a few clicks.
This functionality would be super handy, but in all my svgs (exported from inkscape or affinity designer) the <path> elements are always within some <g> elements, so the call to getChildByName ("path") never succeeds. Shouldn’t it be changed to a recursive search?
Also, any particular reason there’s no builtin way to search recursively within an xml, like a recursive option to getChildByName()?
XmlElement* XmlElement::getChildByName (StringRef childName, bool recursive) const noexcept
{
jassert (! childName.isEmpty());
for (auto* child = firstChildElement.get(); child != nullptr; child = child->nextListItem)
{
if (child->hasTagName (childName))
return child;
if (recursive)
if (auto* found = child->getChildByName (childName, true))
return found;
}
return nullptr;
}