discussion on a possible alignment feature


#1

Hello,

I’m thinking about trying to add an “align” feature to Synfig, if needed, but first need to understand want you want/expect.
If anyone else is-/plans to- coding this, please let me know via this forum, no need to do it twice.

For reference:

  1. Need?
    First question: is such a feature needed? We have the alternative options of snaping to a grid and snaping to an infinite number of guides, both vertical and horizontal. These function work great, they may simply need more visibility. Maybe a feature to add guides at the position of an existing (position and vertex) duck from its contextual menu would be better. See attached screenshot “align ducksOrBox” where guide snapping was used to align the origin ducks of a star and an outline.

  2. reference point for align: box or ducks?
    In Inkscape (and most graphics editors) the alignment takes as reference the outer box of a graphic element (herein called “box”). While this concept of a box is natural to most of users, it seems absent from Synfig so far. Our typical points of reference are “ducks”. The position and vertex ducks seem like the only ones which “location” has any significance, and could therefore be used as reference points for alignment. See eg the above screenshot showing the outer box of a feathered advanced outline

  3. feather and other filters that modify the object shape: consider or discard?
    Any effects that modifies the shape of an object (eg twirl in the “twirl breaks box” screenshot) will cripple the box-based alignment. Do we care? Do we have a way to compute the “visible outer box” of an object, or is it then up to the user to do it manually?

  4. move the object or the duck?
    Finally: do you prefer “align” to move the whole object (even if you take a single duck as reference point), or only the selected ducks (eg for stretching an outline to the left to touch another object)? The second option is the way the current “snap” function works, makes sense to me because it is more versatile and matches better the current Synfig “culture”. This second option may be less newbie-friendly though for you need to understand how ducks work to use it… but it seems easy enough to learn.

My personal preference would be, for now:

  • add “add guide here” function to the contextual menu of position and vertex ducks, because it just makes sense.
  • trying to add ducks-based alignment, moving the selected ducks only, discarding any effect that modifies the shape… but as we cannot select ducks in 2 different objects at the same time I don’t see how to get this done for now.

Let me know what you think.
Berteh.
align-ducksOrBox.sifz (1.63 KB)


Align and Distribute
#2

Each layer has (when possible) a bound_box member function that gives the outer rectangle of its output render. The multiple layer selection simply adds that bounding box using a union calculation to get the greater bounding box that fits for all the selected layers. So the box exists but as it includes the layer effects, it differs in most of the cases from the ducks bounding box.

When you select more than one layer at the same time (CTRL click) you can select multiple ducks for multiple layers at the same time.

The problem is that when you select multiple ducks they are passed as a unsorted list to the action handler, it means that you don’t know which duck is the last one selected or over which duck the user is doing the action invocation. When you want to align one duck to other there should be one way to distinguish the aligned duck(s) from the alignment duck(s). It might be done in to stages: 1) Select ducks and push to the alignment stack and 2) select again the ducks to align and then call the corresponding align action.

Looking to the Action:ValueDescLink code would help you a lot to understand how the ducks data is passed to the action system and how to treat it to distinguish one kind of duck form other. Other actions are good to look at.

Given a duck it is possible to access to its corresponding layer and to any of its parent hierarchy just doing some checking and proper casting. That’s the way how the actions are candidates to the current selections.

Remember that we should perform actions using always the action system in a reusable way (use multiple instances of atomic actions) so if possible, the undo of the action is always available.

-G


#3

An alignment and spacing panel would be a huge help to people creating artwork in Synfig itself rather than via another tool like Inkscape.

If an alignment panel proves too difficult or too much work, what I would find very helpful as a quick stop-gap would be to have a way of snapping guides to ducks. That way, I could pull a guide onto a duck, and then drag the other ducks onto that guide to get all the ducks into alignment. That may prove a bit quicker to do!


#4

DaveJ +1


#5

Did anything ever come of these discussions?


#6

no. no result as far as I know: the task turned out too difficult for my poor C++/gtk coding skills and lack of time available. sorry.
B.