Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Boolean operations node

Open Keavon opened this issue 2 years ago • 4 comments

The legacy boolean operations were unstable, and are no longer compatible with the migration of vector data to nodes (#1065) so they had to be removed. But they're very important in the artist's workflow, so re-adding them as a node is high priority.

In order of importance, this should:

  • [ ] Either use web-sys to call Paper.js, or finish the attempted Paper.js Rust port in this branch
  • [ ] Introduce a vector operations node operating on vector data in the graph
  • [ ] Hook up the boolean buttons in the Select tool's options bar so they take the selected vector layers and combine them into one graph set up so they feed into the boolean operations node

Each of these would be suitable for a single or separate PRs depending on the author's approach.

Keavon avatar Mar 26 '23 00:03 Keavon

I know an old thread in Paper.js which is all about the robustness of their Booleans. They eventually implemented it pretty good. Thread: https://github.com/paperjs/paper.js/issues/761 Tests (A LOT!): https://github.com/paperjs/paper.js/blob/master/test/tests/Path_Boolean.js

be5invis avatar Jun 13 '23 22:06 be5invis

Thanks for the links @be5invis! I did actually attempt a (partially-complete) port of the paper.js logic: https://github.com/GraphiteEditor/Graphite/tree/paperjs-boolean-ops However I got stuck once it started depending on other files within their library. Any help porting this by a community member would be amazing and very helpful to us. Thanks!

Keavon avatar Jun 14 '23 15:06 Keavon

One more idea: instead of porting paper.js, we could do a Rust -> JS -> Rust call to use it as an actual JS library (just doing data type conversion before and after).

Keavon avatar Sep 09 '23 20:09 Keavon

Throwing in PathKit (Skia's WASM interface) for reference: https://skia.org/docs/user/modules/pathkit/#makefromoppathone-pathtwo-op

forresto avatar Oct 15 '23 18:10 forresto

I see you went with calls to Paper.js... https://github.com/GraphiteEditor/Graphite/pull/1759/files#diff-be0d7c77db82f95796c8fe3ccc8e86a6c0ac1a1b15f12767a279d74ca45ff643 👍

forresto avatar May 28 '24 06:05 forresto