Synfig .sif File Format Specification?


#1

Hi guys,

Is there any formal specification for the .sif (uncompressed .sifz) file format, or even something like an XML Schema Definition, so that I can potentially make plugins to read and write it from other applications?

Or am I just going to have to reverse-engineer it? :confused:


#2

There is nothing formally written than the source code that read and writes the sif(z) files.
Here they are:
github.com/synfig/synfig/blob/m … canvas.cpp
github.com/synfig/synfig/blob/m … canvas.cpp

Also, if the sif file defines a layer and miss one parameter, the default one is used. Default parameters values are in the constructors of the Layers definitions. See the source code for them:

Here: github.com/synfig/synfig/tree/m … src/synfig
And here: github.com/synfig/synfig/tree/m … rc/modules

You can have more information about the structure of the classes here:
download.tuxfamily.org/synfig/ap … Layer.html

Visiting the get_param_vocab member for each layer, you can see the name of each parameter used in the sif file. Layer vocabulary is accumulative so, for example, the vocabulary of the Star layer is the accumulation of its ancestors: Star<-Polygon<-Shape<-Layer_Composite<-Layer

I hope it helps.
-G


#3

I also have some code in github.com/nikitakit/svg2sif

So if you happen to be coding in python, maybe it would be possible to abstract the sif-related code into a shared library.


#4

Is looking at the code still the best way to figure how the sif files are specified?

I’d like to write a script that converts between lottie json into sif files but I need to know how sif files are structured to do so.


#5

Look directly at .sif files and be permissive…
The format changes regularly (soon Loopyness parameter will not appear anymore in Outline Layer for example)