So you are in the right place! ![]()
This is a really good selection feature to start coding. It will be very useful for the artist work flow to have that action available.
It looks reasonable but I would add one extra functionality although it would imply more work. It would be great that the dialog offers an initial connection of the vertexes to the user so it is only needed to press the accept button. It would reduce the working time.
Also, linking or not should be optional.
It is not easy to make a summary here of such complex tasks. I would try to start assuming that you have little knowledge of the code structure:
There are three main components on Synfig:
ETL: Extended template library
synfig-core: the core of the renderer and the storage of data for synfig. Independent of user interface, provides a command line interface to be used in a terminal.
synfig-studio: It has two components as well: gui and synfigapp. Gui holds all the graphical user interface components for the Synfig Studio application and synfigapp holds all the interface between the gui and the synfig-core. (it is now really full true because synfig-studio uses synfig-core components directly in many cases but well)
To perform the feature you need to learn to:
- Add a new action
- Create dialogs and show and hide them.
- Create a Layer, Create a canvas with that layer and render it to a surface.
- Based on the layers of the canvas, create some kind of marks (old ducks name) to show where the vertexes are.
- Show the surface and the marks on the dialogue (I strongly recommend to use Cairo)
- Handle the mouse inputs to select the vertexes in the right order.
- Perform the creation of the new layer and insert it on the document canvas layer stack.
- Link the vertexes from the new layer with the existing ones
Too many brick pieces to put all together but the result would be very pleased!
Tips:
For actions: Actions are all derived classes and they are stored at synfig-studio/src/synfigapp/actions. All they have the same structure: has a vocabulary, expects some values passed on with its corresponding tags, does som work before currently execute the action and finally perform the action. Many of them are undoable so the undo has to be defined too by storing the previous values.
For dialogs you can learn just reading how some other dialogs are managed.
For Layer creation just find the layer class you want to create and call its constructor. There are many examples on the code, specially on the actions to insert a layer on the layer stack.
For canvas and render it to a surface you can take a look to the Navigator or the Preview dialogs.
For the marks on the layer to show the vertexes position, you might want to follow a similar structure than the Duckamatic>Workarea classes have, doing a specialization of them. It possibly would need duplication of many variables but on contrary you can reuse many of the code. Alternatively you should create your own class to hold and manage those selectable widgets on the drawing area. Possibly this is the most innovative task to do. The same comments go for the mouse handling here.
For perform the new layer creation and insert it on the canvas stack I think that if you reach this point it would be easy ![]()
For linking the new included vertexes to the other layers you will do use of the current actions ValueDescLink and its derivatives.
Additional tips:
I assume you’re coding under Mac or Linux so it would be great to have some tools around:
Git: learn to use the simpler git commands. There are good git interfaces for all platforms
github: open an account at github and fork the repository.
build environment: before start coding, be sure that you can build without any issue in your platform.
IDE: we don’t have an official IDE to use in any platform but people are happy with Anjuta or Geany under Linux and Xcode under Mac. Always need to use the build scripts to rebuild the code once modified.
Try to make when possible atomic commits with the minimum significance modifications each time keeping the code always possible to build. It would help a lot to further debug by bisection method.
Try to keep same style of coding than the current one.
Finally, synfig-devl mailing list is a good place for off line and properly stored threads for discussion or help request on development.
Good luck!!!
-G