It doesn’t support all the features in the format but it’s enough to be usable.
Kind of interesting that using my scripts to convert svg to lottie and from lottie to synfig for certain things gives a better result than synfig’s built in svg importer.
In the past I’ve used boost::python to embed scripts in my applications, it has a smart system to link C++ classes and objects to the python scripts allowing for communication between the python script and the C++ app.
For importing files, probably the best option though is just to have the script to generate the sif xml as a string or a temporary file.
Linking the plugin with an open file dialog shouldn’t be too hard as long as there’s a way to add metadata to the plugin that tells which file extensions it can load.
In perfect case it would be nice to have some GUI settings for import/export (i.e for Lottie export we might want some options at some point).
In simplest implementation it is possible to write a synfig-core module in C++ (like mod_svg linked above), which calls a Python script. For having GUI options it will require to add code into synfig-studio, which actually interferes with a concept of “module in synfig-core”.
So, it’s best to think how to organize import/export (conversion) routines in synfig-studio (synfig-core doesn’t needs it anyway).
btw, does the sif file format support specifying bezier tangents in cartesian coordinates?
Currently I’m converting them from cartesian (the way they are stored in lottie) to polar, but that creates some artefacts on animated regions, when the value from one waypoint is close to 180 degrees and the value on the next waypoint becomes -180, making that tangent spin around like crazy.
So, as part of the same project, I made a script that allows to convert between the file formats my framework supports.
I can now make a direct comparison between loading svg into synfig.
From the same SVG file, on the left is the file as imported by synfig, on the right my conversion script
Colors are a bit different, I think the default importer assumes I have a gamma of 2.2, while my converter keeps RGB values the same, so it works with a gamma near 1.
I also tried with inkscape’s sif export but it causes inkscape to crash and the generated sif file is invalid (some issue about a blurred layer).
Some issues I’ve found with synfig’s built-in SVG importer:
ellipses are missing, and paths using ellipse arcs are broken
I assume this is because synfig doesn’t properly convert ellipses to bezier
some paths have the wrong bezier tangents
some lines have the wrong width
inkscape layer names aren’t preserved (not part of SVG proper but a bit unfortunate)
Another update, I’ve added support for approximating easing values.
I also have experimented with inkscape extensions, looks like for import/export they have an XML which defines the UI for a dialog where you can define extra options for the file format, then passes them to a script on the command line, for both import and export the script is given a file name on the command line and outputs the result to stdout.
This thread is about importing lottie into synfig, looks like you’re having issues with the export instead?
Lottie export is being discussed here: GSOC-2019::Export Animation for Web