Evil geniuses and world domination are 2 of our goals... we also like Dr Who

Fixing broken canvas references in Synfig

no comment

I have been working on synfig stage, and have logged the following bug on the Synfig forum, and in the bug tracker.

Synfig has a rather nifty mechanism for creating reference object – this is great if you want to create parts of a character, and re-use them throughout the life of the animation.   Creating a reference canvas is pretty simple, and the nice thing about it is that once the reference canvas is created, you can swap and change the referenced element from your model through a nice canvas picker.  Except that the feature is a bit broken.

Anyway – the trick to resolving this is to look for something like this :

<param name="canvas">
    <reference type="canvas" link=":robothead_sad"/>

and replace it with this :

<param name="canvas" use=":robothead_sad"/>

That’s all well and good – but how do you apply it in reality?  There’s conditional stuff going on – values that need to be copied from a to b – it could get very messy.  So I set about creating an XSLT file to transform the broken SIF file, into a potentially working SIF file.  The plan is to eventually add this functionality to Synfig Stage, or to add this to another tool, but as the fix is to run a style sheet against a broken SIF file it is possible to fix a borked SIF file using only the XSLT tools provided by the Operating System – if your operating system is Linux.

Loading a Broken SIF file into Synfig

And here’s a close up of that error message :

Synfig Error Close Up
To fix a SIF file – using the XSLT you can issue the command xsltproc :

xsltproc -o robot_fixed.sif Fix_Canvas_Style_Sheet.xsl robot_broken.sif
  • The -o parameter specifies the output file.
  • the style sheet – is of course the style sheet
  • and the last parameter is the broken file to fix.

Fixing a file



Fixed File now loads correctly

Comments are closed.