Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: modifying waypoints for a group layer no longer modifies sibling layers #3312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mosasauridae
Copy link
Contributor

When a group layer is selected, the time track will show waypoints for child layers in the group. Modifying one of these waypoints (remove, move, or duplicate) was also pulling in waypoints of sibling layers of the group, not just child layers, if the sibling also happened to have a waypoint at the same time.

Reproduction steps:

  1. Create 2 circle layers, and animate the location of both circles so that both have waypoints on the same frame
  2. Put one of the circles into a group layer
  3. Select the group layer, and right click a waypoint in the time track. Note that it says "Remove 2 Waypoints", even though there's only one layer in the group
  4. Select Remove. Both circle layers are modified, even though only one of them is in the selected group.

I'm still a bit fuzzy on the relationship between canvases and group layers. I tested that waypoints for imported files still works, but I don't know if there's another way to create a canvas object that would need to be tested as well.

@rodolforg
Copy link
Contributor

rodolforg commented Jan 20, 2024

Nice bug catch!

I'm still a bit fuzzy on the relationship between canvases and group layers.

Group, Switch group and Filter group are all layers that show an encapsulated canvas (that has one or more stacked layers). Code-wise they are all derived from Layer_PasteCanvas. The encapsulated canvas is referred in their parameter "canvas".

About your code, I don't if it's preferred to inspect the canvas node (value_desc.get_layer()->get_param(value_desc.get_param_name()).get(synfig::Canvas::Handle());) or its layer owner as you proposed.

@mosasauridae
Copy link
Contributor Author

That makes sense. I'll try it with your suggestion, definitely seems like the logic is clearer if the canvas parameter is inspected instead of the layer itself.

@mosasauridae
Copy link
Contributor Author

About your code, I don't if it's preferred to inspect the canvas node (value_desc.get_layer()->get_param(value_desc.get_param_name()).get(synfig::Canvas::Handle());) or its layer owner as you proposed.

Both versions seemed to work for me at first so I did some more digging, and found something interesting - my first version with node = value_desc.get_layer() would have actually introduced a bug. If the group layer defines a non-zero Time Offset parameter, then passing in the layer rather than the canvas node causes synfig::waypoint_collect to search at the wrong time point, missing the waypoints that the user clicked (waypoint_collect has special logic for Layer_PasteCanvas to account for the offset, but that logic shouldn't run in this specific case).

I updated it to use the canvas node and did some testing with Time Offsets to make sure that was all still working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants