Commit graph

202 commits

Author SHA1 Message Date
Keavon Chambers
d40fb6caad
Add boolean operations (#1759) 2024-05-25 22:02:00 -07:00
0HyperCube
c80de41d28
Always update source node in borrow tree (#1758) 2024-05-25 21:35:53 -07:00
Elbert Ronnie
5a1c171fc3
Add Area and Centroid nodes (#1749)
* initial attempt for area node

* allow node preview for more types

* make AreaNode sync and add CentroidNode

* cargo fmt

* preview of DVec2

* make the nodes async again

* use segment domain instead of region domain

* modify the check for linearity

* create a limit for area in centroid calculation

* cargo fmt

* reverse unnecessary changes

* add threshold to area calculation too.

* handle zero area edge case

* add todo comment

* implement 1D centroid and use it as fallback

* formatting floats to skip last zero

* add Centroid Type radio button to Centroid Node

* rename docs to use area and perimeter centroid

* add web demos for perimeter centroid

* add tests for perimeter centroid

* add fallback to use average of points

* Fix for broken area

* missing fixes

* Code review and rename Perimeter Centroid to Length Centroid

* Use dummy footprint in Area and Centroid nodes

* add doc and todo to clarify when `is_linear` fails

* use epsilon instead of zero

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2024-05-22 13:11:11 -07:00
Keavon Chambers
de84e39c4e Improve backwards compatability robustness of serde-based document format 2024-05-08 17:45:31 -07:00
Keavon Chambers
244c8ad10a Enable Merge nodes to take vector data inputs from the bottom, not just left
Known bug: click targets aren't calculated for bottom input vector data.
2024-05-07 16:41:44 -07:00
adamgerhant
8d83fa7079
Generalize layers as merge nodes to enable adjustment layers (#1712)
* WIP, backward traversal issues

* Fix some tool issues

* Remove debugging

* Change some indices

* WIP: new artboard node

* WIP: add artboard node

* WIP: Artboard node and create_artboard

* WIP: Artboard node implementation complete

* WIP: Artboards input for output node

* Complete Artboard node

* Generalize LayerNodeIdentifier,  monitor_nodes support for Artboard node, adjust ResizeArtboard/ClearArtboards, move alias validation to Rust

* Fix misaligned artboard click targets

* Generalize/clarify create_layer and insert_between

* non-negative dimensions for resize_artboard

* Show artboards in layer panel

* Generalize create_layer for layer output node

* Generalize delete_layer/delete_artboard to NodeGraphMessage::DeleteNodes. Fixed upstream flow Iter

* remove old primary_input function

* Vertical node visuals, remove is_layer function, rename Layer node to Merge node, toggle display as layer

exposed_value_count type fix

Vertical node visuals, remove is_layer function, rename Layer node to Merge node, toggle display as layer

* Fix demo artwork

* Layer display context menu

* Automatically select artboard, fix warnings

* Improvements to context menu and layer invariant enforcement

* Remove display_as_layer and update load_structure

* Improve load_structure to show more layers, improve FlowIter, improve layer naming, layer rearrangement validation.

* Clean up demo artwork using generalized layers

* Improve design of Layers panel and graph nodes

* MoveSelectedLayersTo rewrite to support generalized layer nodes

* Include artboards in deepest_common_ancestor, fix resize_artboard/delete_artboard, sync artboard tool to layer panel

* MoveSelectedLayersTo adjustments

* Sync non layer node visibility with metadata

* Include non layer nodes when moving/creating layer

* Fix group layers and get_post_node_with_index

* Include non layer nodes in UngroupSelectedLayers

* GroupSelected for all selected nodes, UnGroupSelected position adjustments

* Add grouping for layers in different folders

* Fix hidden layers

* Prevent node from connecting to itself, fix undo automatic node insertion,

* Fix undo CreateEmptyFolder, fix grouping nested layer nodes

* Formatting

* Remove test and check if node is layer from network

* Fix undo group layers

* Check off roadmap

* MoveUpstreamSiblingsToChild adjustments

* Replace tabs with spaces, remove mut from argument

* Final code review pass

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-30 23:03:42 -07:00
Keavon Chambers
72ba4ddfe4 Add rotation to Repeat node 2024-04-26 15:06:36 -07:00
Karthik Prakash
3019cc7253
Add alpha to Extract Channel node and remove Extract Alpha node (#1731)
* add `TaggedValue::RedGreenBlueAlpha`

* add alpha to `ExtractChannelNode`

* remove `ExtractAlphaNode` from `Split Channels`

* remove `ExtractAlphaNode`
2024-04-17 15:44:14 -07:00
Karthik Prakash
438c45eb80
Add corner rounding to the Rectangle node (#1648)
* add skeleton implementation

* add corner rounding

* fix crash when `border_radius` is zero

* rename `Border Radius` to `Corner Radius`

* add clamped property

* add `TaggedValue::F64Array4`

* add frontend support for individual corner rounding

* added individual corner rounding

* fix rebase

* change default values when switching rounding type

* fix crash caused by negative scale

* remove `Any` trait

* add `Message::Batched`

* fix stale property bug

* add smarter clamping for individual rounding

* Rearrange widgets in properties panel

* update individual clamping algorithm

* add better variable names

* make variable names clearer

* Final code cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-04-06 05:09:55 +00:00
Keavon Chambers
27f9e3f00e
Move node visibility flag from NodeNetwork to DocumentNode (#1708)
* protonode -> proto node

* Move node visibility flag from NodeNetwork to DocumentNode

* Add serde default for new field

* Logic improvements
2024-03-27 05:17:08 -07:00
Keavon Chambers
0a9bd41be1
Code cleanup and refactoring to enhance consistency (#1695)
- Move message handler payload data into structs
- Organize the file structure used by `editor/src/messages/portfolio/document` `/node_graph` and `/graph_operation`
- Make derive attributes use `serde::Serialize, serde::Deserialize` consistently instead of `use serde::{Deserialize, Serialize};` imports
- Various other code cleanup and refactoring
2024-03-20 21:28:51 -07:00
Roshan P
2263b0ab89
New node: Solidify Stroke (#1650)
* added struct and registered fill from stroke node. not functional yet.

* properly registered new node

* finished fill-from-stroke feature. works on both closed and open shapes. supports line caps and line joins.

* fixed import issues and miter limit handling

* fix outline function. use both subpaths for solid shapes now

* code quality improvements

* use radius instead of diameter, functionality not yet working for shapes as transform is not properly applied before calculating new shapes.

* Updated to follow new VectorData structure. Fully functional.

* fix repeat node

* remove comment

* add a test, remove unused code.
2024-03-11 17:19:29 -07:00
Keavon Chambers
fd54cda445 Rename NodeNetwork inputs/outputs to imports/exports 2024-03-11 00:13:01 -07:00
0HyperCube
218e9675fd
Attribute-based vector format refactor (#1624)
* Initial vector format structure

* Click targets

* Code review pass

* Remove subpaths from vector data

* Morph node & vector node tests

* Insignificant change

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-03-09 10:27:30 -08:00
Keavon Chambers
a02b162e30
Consolidate and rename Graphene data types, and add many comments (#1620)
* Document ProtoNodeInput

* More comments

* Comment improvements

* Comment and split ProtoNodeInput::NodeLambda from ProtoNodeInput::Node

* Combine NodeImplementation into DocumentNodeImplementation

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2024-02-20 17:53:04 -08:00
0HyperCube
229b5dbb20
Use f64 not f32 throughout graph; add Vector2 value node (#1618)
* Use doubles in graph

* Format .graphite files onto one line

* Rename new node to Vector2

* No primary input

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-18 22:16:37 +00:00
0HyperCube
6f6fb3bcd4
Upgrade several Rust dependencies (#1613)
`specta` from Hypercube's fork commit to latest upstream commit
`wasm-bindgen` 0.2.87 -> 0.2.91
`spirv-std` from 0.9 to not-yet-merged commit in https://github.com/EmbarkStudios/rust-gpu/pull/1115
`wgpu` 0.17 -> 0.19
`winit` 0.28.6 -> 0.29
`vello` and `vello_svg` from latest upstream commit to not-yet-merged commit in https://github.com/linebender/vello/pull/427
`resvg` 0.36.0 -> 0.39
`glam` 0.24 -> 0.25
`rustybuzz` 0.8.0 -> 0.10.0
`js-sys` and `web-sys` 0.3.55 -> 0.3.67
`usvg` 0.36.0 -> 0.39
`spirv` 0.2.0 -> 0.3

* Update a couple of dependencies

* More test fixing…

* Use upstream Specta instead of fork

* Update comments in Cargo.toml

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-17 15:02:41 -08:00
Keavon Chambers
7e5069f638 Copy to Points node: Add "Random Scale Bias" parameter 2024-02-05 05:31:28 -08:00
Dennis Kobert
349ec5da72
Add MemoizeImpure node and cache image base64 in graph (#1595)
* Cache base64 representation of images when converting to graphic group

* Fix build

* Fix build again

* Actually fix it this time

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-02-03 23:16:03 +01:00
Keavon Chambers
8fa46ba63a
Copy to Points node: add scale/rotation randomization parameters (#1592)
* WIP, transforms broken with rot/scale

* Transform around bounding box centre

* Add units and tooltips

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2024-02-01 12:20:35 -08:00
Keavon Chambers
6b6accfb91
Add Poisson-disk sampling node and Bezier-rs 0.4 release (#1586)
* Add Poisson-disk sampling node and Bezier-rs 0.4 release

* Additional optimizations

* More performance optimizations with help from 0Hypercube

* Add comments
2024-01-28 02:25:46 -08:00
0HyperCube
484acbcde3
New node: Morph (#1576)
* Add morph node

* Range slider time parameter, better lerping

* Lerp more fill and stroke parameters

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-01-13 23:35:40 -08:00
Keavon Chambers
121c1d2b9d
Sample Points node: employ caching and deduplication (#1546)
Sample Points node: split out expensive computation so it can be deduped
2024-01-06 16:07:45 -08:00
Keavon Chambers
b3e4caec1a Rename 'Resample Points' to 'Sample Points' 2024-01-05 05:24:16 -08:00
Dennis Kobert
6bfb2bf344
Change number inputs to be f32 instead of f64 for most nodes (#1543) 2024-01-05 13:13:26 +00:00
Keavon Chambers
ed82c5f20f Copy to Points node: add Start/Stop Offset and Adaptive Spacing parameters 2024-01-03 06:11:42 -08:00
0HyperCube
4c64df038f
Copy to Points node: add support for groups (#1541)
Copy to points by group
2024-01-03 04:21:10 -08:00
Dennis Kobert
0e49388312
Make CopyToPoints node resolution aware (#1536)
* Make CopyToPoints node resolution aware

* Add unfinished code review as todo comment

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-30 11:56:50 +00:00
0HyperCube
947a131a4b
Add graph type error diagnostics to the UI (#1535)
* Fontend input types

* Fix index of errors / types

* Bug fixes, styling improvements, and code review

* Improvements to the error box

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-29 08:38:45 +00:00
Keavon Chambers
34f952bad1
Convert u64 IDs to newtypes (#1532) 2023-12-22 03:24:13 -08:00
Keavon Chambers
7bfe0ce55b
Retire layer paths used throughout the code (#1531)
* Part 1

* Part 2

* Part 3

* Part 4

* Part 5

* Part 6

* Part 7

* Part 8
2023-12-21 19:32:46 -08:00
Keavon Chambers
92203f3576
Remove the whole document-legacy crate (#1524)
Remove the whole document-legacy crate

Closes #1520
2023-12-20 05:45:54 -08:00
Keavon Chambers
9e06e70aa2 New node: Copy to Points (#1513)
* New node: Copy to Points

* Remove dead code
2023-12-17 04:17:17 -08:00
Keavon Chambers
9f0ea35d9b New node: Noise Pattern (#1518)
Add the Noise Pattern node

Closes #1517
2023-12-17 02:06:25 -08:00
Keavon Chambers
83af879a7c
Fix the Imaginate node from crashing (#1512)
* Allow generic node input for type inference

* Make imaginate resolution picking depend on the image resolution instead of the transform

* Remove dead code

* Fix console spam after crash

* Fix crash when disconnecting Imaginate node input

* Update Imaginate tool tooltip

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-12-12 22:39:33 -08:00
0HyperCube
33845707db
Support for previewing the layer node (#1496) 2023-12-09 15:54:37 -08:00
Henry Barreto
cbda811480
Add the Image Color Palette node (#1311)
* Add image color palette node

* Add max size of palette

* Code review cleanup

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-09 15:21:41 -08:00
Keavon Chambers
e459e599b4 Wrap opacity/blend_mode in alpha_blending struct for graphic elements 2023-12-08 22:42:45 -08:00
Keavon Chambers
10f2fa92e5 Eliminate GraphicElementData wrapper around GraphicElement 2023-12-08 20:22:37 -08:00
Keavon Chambers
c5ed54cbd2 Rename several node graph structs/fields 2023-12-08 15:30:00 -08:00
Keavon Chambers
d082b15abb Improve naming of several proto nodes 2023-12-08 15:29:46 -08:00
Keavon Chambers
60a9c27bf1
Add viewing/editing layer names, add Blend Mode node, and clean up Layer node (#1489) 2023-12-07 15:10:47 -08:00
Dennis Kobert
d2450b4d61
Refactor Graphite dependency management (#1455)
* Refactor Graphite dependency management

* Remove deprecated future executor

* Code review nits

* Remove unused dependencies

* Update dependencies and make compile with all features

* Replace use of future_executor with wasm-bindgen-futures

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-04 12:39:55 +01:00
Dennis Kobert
b7fe38cf31
Fix how transforms work with footprints and remove a redundant transforms field (#1484)
* Prune unused thumbnails in node graph executor

* Fix transform downcasting failure for GraphicElementData

* Remove more warnings

* Revert upstream transform calculation change

* Use footprint to calculate layer transforms

* Fix artboards

* Move artwork with artboard

* Remove Keavon's warnings

* Prevent misordered FrontendMessages failing to reach JS handlers

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-12-03 14:17:28 -08:00
0HyperCube
b2ca643e6e
Fix transforms, Brush tool, and G/R/S (#1473)
* Transform fixes

* Fix the desert artwork

* Change artboard icon

* Better handling when transforming brush strokes

* Code review pass

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-11-26 20:54:06 -08:00
0HyperCube
8a1cf3ad5d Migrate demo artwork and fix all failing CI tests (#1459)
* Initial work on fixing tests

* Fix formatting

* Remove dead code to satisfy rustc warnings

* Insert into an artboard

* Load updated artwork in editor

* Remove popup when importing image

* Fix up demo art

* Change transform app[lication method

* Reduce number of enums called BlendMode

* Finalize the demo artwork upgrade

* Code review pass

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-11-19 23:06:21 -08:00
Dennis Kobert
81519601ae
Store Input for Monitor Nodes (#1454)
* Add input storage to monitor_node

* Return input via serialize function
2023-11-14 21:17:50 +01:00
0HyperCube
e0ac073805
Improve previewing node data (#1446)
* Improve preview

* Improve contrast

* Restructure in order to duplicate code

* Code review nits

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-11-04 02:52:26 -07:00
0HyperCube
ceb2f4c13f
Add more details to Graphene concept documentation (#1437)
* Start improving node system docs

* Add note on debugging

* Explain testing protonodes

* Code review comments

* Review pass

* Further improve explanation of manual_compostion

* Fix explanation of ComposeNode graph rewriting

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-27 19:21:15 -07:00
Keavon Chambers
bafde43145 Add comments to help explain Graphene concepts 2023-10-24 22:26:08 -07:00