Help Required in understanding the synfig-studio code

Hello,
Came across synfig about a month ago. Went through the tutorials and liked the concept of the software. Wanted to contribute so forked the repo and build the program locally. I was able to successfully setup the environment in the Netbeans IDE. I also went through the list of issues and thought that issue related to UI (synfig-studio) would be a good start. I went through the basics of gtkmm and tried to go through the synfig-studio code, but had a hard time understanding it. Visited the wiki pages but could’nt really get the help I wanted. Is their any other source for understanding code structure or going through the whole code is the only way.
PS - I also read the tutorial “Adding a render progress bar” and “adding a new dock window” but it does not give a broader view.

Hi and welcome here :slight_smile:
“Flee while there is still time”

Lack of documentation for the source code is a huge problem.
The most up-to-date effort can be found here: https://synfig-docs-dev.readthedocs.io/en/latest/
To make short, you have 3 big layers: ETL, synfig-core and synfig-studio.
The document, in memory or in file, is a XML structure with all the parameters which are interpreted and rendered by the core, and studio is just the GUI modifying and displaying this structure.
Once you define the waypoints in the time(line), each value of parameter is interpolated for each layer in the order of depth of the layer tree, with their blending mode…
The render process draws image by image on a pixbuff surface in memory and they are exported to the final format.

The source code tree reflects the organisation of the code, some can be (almost) ignored, some other can be modified without to fear too much.

Some modifications have already broken some parts of code because Synfig is quite tightly coupled with GTKMM and some other libs.
In-depth knowledge of the code require several months of constant observation and even after several years of headache I still don’t know it by heart :stuck_out_tongue:
That’s why I did tutorials explaining my little modifications, it lets a trace of the reason to edit specific file.

But… don’t give up :slight_smile:

3 Likes

Are you used to GTK and gtkmm?
If so, you could start with the third item of this request:

When you double-click a waypoint in the Timetrack Panel (or right-click it and select “Edit”), a Waypoint Editor dialog appears. No matter what its interpolation is (Constant, Clamped, Linear, TCB, etc), that dialog always display TCB parameter fields. It only should be seen if it is set to TCB interpolation :wink:

What do you think? Not directly Synfig, but a GTKmm stuff for starting.

And here’s is how Synfig Studio files are organized:

  • synfig-studio : everything :stuck_out_tongue:
    • brushes : brushes files :smiley:
    • build-tools : script for updating About dialog
    • config : I don’t know
    • docs : documentation files
    • images : synfig image files for Studio graphics like icons
    • m4 : autotools files (for studio building)
    • plugins : …
    • po : translation/localization files
    • sounds : audio files used by Studio
    • src : the chaos code!!!
      • brushlib : library for brush handling
      • gui : the REAL chaos :wink: I’ll list here only some folders:
        • cellrenderer : custom cell renderer for parameter data in Parameter panel
        • dialogs : …
        • docks : the GUI docks that are part of Studio workspace
        • states : these are workarea states (better known as tools like Move, Rectangle, Spline (bline), Ink, etc)
        • widgets : custom widgets used by Synfig Studio (like vector and time widgets)
      • synfigapp : library that contains all actions that handle GUI <-> core library stuff: things that user do-undo-redo are here!
    • ui : Glade files for (some) dialog layouts

I hope it helps a bit.

3 Likes

Additional tool that may be useful :slight_smile:
Sourcetrail is now free and open-source :wink:

It could also be useful for illustrations in developper’s documentation project and find some errors (refered as fatal errors while generating information, like missing include files).

Sourcetrail is a free and open-source cross-platform source explorer that helps you get productive on unfamiliar source code.

1 Like

Incredible!

Sadly it doesn’t seem to provide an online database.
Together with sourcecode documentation (that doxygen one, once more complete) would be ultimate.