Improvements for svg tool in ProJucer


#1

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.

Code is here, can you merge it in? https://github.com/FigBug/JUCE/commit/3543f4b66262dbfdd7992f6cdd02b76a1df92d2e


#2

Sounds cool, thanks! Will take a look…


#3

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;
    }