feat: [GSoC'26] Initial MVP for 2D Free-Form Deformation Layer - #3724
ahmedfathy0-0 wants to merge 83 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new Free-Form Deformation layer to the Synfig core, allowing for mesh-based distortions via a grid of control points. The changes include the layer implementation, header, and integration into the build system. A review comment points out that the grid initialization in the constructor is hardcoded to 3x3, which creates a tight coupling with default parameters and could lead to bugs if those defaults are changed.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 367 |
| Duplication | 49 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
… smoothness controls
…ing grid resizing
…rs and context fitting
…calculation to include paste canvas layers
|
Latest Updates:
|
|
Hello @ahmedfathy0-0 , the pictures look good. I will try it out and start reviewing it soon.:) hopefully by tonight. |
- Switched from Ear-Clipping to Bowyer-Watson Delaunay triangulation in `Layer_FreeFormDeform::triangulate`. - Removed deprecated helper methods (`is_ccw`, `point_in_triangle`, `is_ear`) from `Layer_FreeFormDeform`. - Updated `StateFFD_Context` to remove forced sequential bezier perimeter connections during mesh drawing. - The Custom Mesh tool now naturally draws the Convex Hull and optimal internal mesh connectivity automatically.
- When a user selects 'Free-Form Deformation' from the 'New Layer > Distortions' menu, instead of creating a raw layer without the tool context, Synfig will now seamlessly switch the active toolbox tool to the 'FFD Tool'.
- Reinstated the logic that automatically wraps a selected Switch layer in a new Group when an FFD layer is created. - Moved this logic from CanvasView::add_layer into StateFFD_Context::on_make_ffd_pressed() so it works natively with the FFD Tool after a Custom Mesh or Grid is built.
- Integrated Choice 2 (Corner Pin method) as requested by the user. - Automatically computes the global context bounds and injects the 4 extreme corners into both the source and deformed point lists during prepare_mesh(). - This naturally forces the Delaunay triangulation to generate a mesh that covers the entire canvas. - Prevents the Straight blend mode from clipping the unaffected background areas, while seamlessly replacing the deformed portions without ghosting artifacts.
…undary and mesh mask
|
now the custom mesh of free form deformation is implemented. 2026-06-08.12-03-49.mp4the next comment will be about the implementation description |
|
Wow, this is exactly what I've been searching for for a long time. All my previous attempts to create a mesh like this had failed. This is incredible. Synfig can finally have a mesh that can be controlled much like a BLine. I hope to build a Smart Mesh system in the future, similar to Smart Bones in Moho. Thank you so much for your hard work and for sharing this amazing idea. |
When the FFD layer is set to Custom Mesh mode, the 'Reset Grid' button is now visible and functions to reset the deformed mesh points back to their original un-deformed positions (by copying source_points over to grid_points). Previously, it would attempt to compute a standard bounding-box grid, corrupting the custom mesh.
…on label based on mesh mode
…nd rename edge length slider to mesh strength
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 2675 |
| Duplication | 322 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
…y redraws and rebuilds
… state and improve mesh preview consistency
… boundary points during triangulation
…up in state_ffd mesh editing
mohamedAdhamc
left a comment
There was a problem hiding this comment.
Just a quick intitial review.
…mouse movement" This reverts commit dd57352.
14e3a98 to
6261128
Compare
…tealing" This reverts commit fa59c37.
… StateFFD destructor
6261128 to
5abd43a
Compare
…atic method and improve mesh rendering robustness
…ary tent generation and including null-duck safety checks.
This PR implements the complete 2D Free-Form Deformation (FFD) GSoC project. It introduces a powerful new distortion layer that allows artists to warp artwork using customizable 2D grids or automatically fitted custom triangle meshes.
Resolves #3792
What's Included:
Core FFD Features
Layer_FreeFormDeform: A new layer type to handle high-performance, timeline-keyframeable mesh deformations.Smoothnessparameter).Grid Mode
Custom Mesh Mode