Commit graph

174 commits

Author SHA1 Message Date
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
Keavon Chambers
ee08938bb0 Rename 'Grayscale' node to 'Black & White' 2023-10-24 21:22:22 -07:00
0HyperCube
b8906f344e
Migrate the Text tool to the document graph (#1435)
* Update text tool to document graph

* Fix selection issue

* Log graph reruns and text node evals

* Hash to set node

* Fix let node crash

* Fix loading document with fonts

* Allow pressing enter to edit

* Cleanup

* Code review nits

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-24 12:55:13 -07:00
Yuri Astrakhan
3d4e3a74e5
A few minor lints and docs (#1436)
* A few minor lints and docs

* Added required packages to compile on Debian-style linux
* Inlined some format args, and removed some `&` in args (they cause about 6% slowdown that compiler cannot inline)
* a few spelling mistakes

* fix fmt
2023-10-18 23:33:10 -07:00
0HyperCube
5827e989dc Migrate the Select tool to the document graph (#1433)
* function for accessing document metadata

* Better select tool

* Fix render

* Fix transforms

* Fix loading saved documents

* Populate graph UI when loading autosave

* Multiple transform nodes

* Fix deep select

* Graph tooltips

* Fix flip axis icon

* Show disabled widgets

* Stop select tool from selecting artboards

* Disable (not hide) the pivot widget; remove Deep/Shallow select for now

* Code review changes

* Fix pivot position with select tool

* Fix incorrectly selected layers when shift clicking

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-17 11:09:32 -07:00
Dennis Kobert
34f2d61257 New node: Mandelbrot (#1421)
* Implement Mandelbrot node

* Make mandelbrot monochrome

* Remove log statements
2023-10-17 11:02:07 -07:00
Dennis Kobert
833f41bccb Insert pasted images as layers in document graph (#1418)
Changes:

Graph is evaluated on every viewport change
move all navigation logic into the viewport
reduce the number of js roundtrips
add canvas rendering
enable image pasting
various cleanups
Fix cache nodes being reset every evaluation
2023-10-17 11:02:07 -07:00
Dennis Kobert
d82f133514 Lay groundwork for adaptive resolution system (#1395)
* Make transform node accept footprint as input and pass it along to its input

use f32 instead of f64 and add default to document node definition

* Add cull node

* Fix types for Transform and Cull Nodes

* Add render config struct

* Add Render Node skeleton

* Add Render Node to node_registry

* Make types macro use macro hygiene

* Place Render Node as output

* Start making DownresNode footprint aware

* Correctly calculate footprint in Transform Node

* Add cropping and resizing to downres node

* Fix Output node declaration

* Fix image transform

* Fix Vector Data rendering

* Add concept of ImageRenderMode

* Take base image size into account when calculating the final image size

* Supply viewport transform to the node graph

* Start adapting document graph to resolution agnosticism

* Make document node short circuting not shift the input index

* Apply clippy lints
2023-10-17 11:02:07 -07:00
0hypercube
4cd72edb64 Initial work migrating vector layers to document graph
* Fix pen tool (except overlays)
* Thumbnail of only the layer and not the composite
* Fix occasional transform breakages
* Constrain size of thumbnail
* Insert new layers at the top
* Broken layer tree
* Fix crash when drawing
* Reduce calls to send graph
* Reduce calls to updating properties
* Store cached transforms upon the document
* Fix missing node UI updates
* Fix fill tool and clean up imports and indentation
* Error on overide existing layer
* Fix pen tool (partially)
* Fix some lints
2023-10-17 11:02:06 -07:00
Dhruv
a2db95d18b New node: Color Overlay (#1391)
* [wip]feat: implement Color Overlay node's base logic

* [wip]feat: attempt implementing node

* feat: implement naive node logic
- this needs to accommodate coloring the image

* [wip]feat: attempt implementing ColorFillNode

* fix: color fill node implementation path

* Simplify document node definition

* [wip]feat: implement ColorFillNode

- correct the node implementation logic
-[wip]use node in Color Overlay node network

* Remove secondary image input

* chore: perform cleanup and minor optimization

- rename ColorFillNode node to Color Fill
- remove unneeded clone method call

* refactor: optimize node logic and hide optional params

* fix: color fill implementation
- fix broken color fill implementation logic
- add alpha multiplication data to the image

* Fix colour overlay node

* Blend mode

* chore: remove unused import

* Debug logging for overlay

* Use premultiplied alpha

* Comment out logging

* Code review nits

* Remove color debug logging

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-09-02 02:28:05 -07:00
Chase
5acb2cff06
New nodes: Resample Points, Spline from Points (#1226)
* Create node (no implementation)

* Resampling - WIP

* use bezier::from_linear_dvec2

* Use from anchors instead of Bezier

* Tidy up anchor collection & subpath creation

* Add Spline from Points node (not implemented)

* Add spline from points node implementation

* Update resampling

* Update minimum density 0.01 -> 1.0

* Add a way to create a custom vector network

* Add spline from points node to spline tool

* Fix crash when no points

* Add anchor method to subpath

* Exact start and end point

* Fix compile errors from rebase

* Fix spline tool

* Rename 'Density' to 'Spacing'

* Fix transforms

* Only close subpaths with >1 anchor

* Fix compile

* Fix compile error

* Fix from points with many subpaths

* Fix new_cubic_spline crash with one point

* Rename to resample as polyline

* Fix div zero

* Fix missing file

* Fix resample

* Rename to resample points

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-30 05:21:39 -07:00
isiko
3419e739af
New nodes: Logical boolean operations (OR, AND, XOR, NOT) (#1399)
* Add Boolean Operations Nodes

Adds OR AND XOR and NOT operators

* Fix operand naming

Inputs to the 'Min' 'Max' 'Equality' and boolean operations nodes were
previously named 'First' and 'Second' and are now called 'Operand A' and
'Operand B'

* Rename Equality to Equals

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-29 23:55:14 -07:00
Prikshit Gautam
fb1922b49d
Clean up and suppress Clippy warnings (#1402)
* fix: clear and suppress clippy warnings

* Simplification

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 16:56:53 -07:00
Ezbaze
226b96260c
New nodes: shape/curve primitives (#1389)
* Add new Primitive Shape/Curve Nodes

* Elipse Node and Debug

* N-input Spline node

* Debuging

* Debug

* fmt

* remov debug

* Changes from code review

* Debug: Empty Spline Input

* Changes from code review

* Fix spelling of ellipse

* Rename polygon to regular polygon

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 14:22:09 -07:00
0HyperCube
b881385e3b
Update wasm-bindgen, syn and wgpu (#1398) 2023-08-23 14:53:56 +00:00
isiko
a566331f1c
New node: Pixel Noise (#1267)
Add Pixel Noise Node

Currently only White Noise is implemented, but the Code is written so that other's can be added easily
2023-08-19 11:30:03 -07:00
isiko
7558088727
Add more advanced math nodes (#1383)
Added nodes for the following operations:

* Floor
* Ceil
* Round
* Absolute Value
* Logarithm
* Natural Logarithm
* sin
* cos
* tan
2023-08-14 13:43:17 +00:00
nat-rix
dc4b16aead
Curves image adjustment node (#1214)
* Create ValueMapperNode and use it for brightness/contrast

* move spline code into seperate module

* Add GenerateCurvesNode

* add a `LuminanceMut`-trait
* add `lerp` to `Channel`

* Add frontend code to handle the curves widget's inputs

* Rename spline module to curve

* Make messages in CurveInput pass

* Improve curves widget design and fix sizing issue

* Implement proper bezier handling

* Use bezier_rs's intersections function instead of own cubic root solver

* Debounce CurveInput events and change how debouncer works

the first event issued to the debouncer was unneccessarily delayed.
Instead now the debouncer fires it instantaneously but blocks events
that come in until a timeout was reached.

* Make curve editing more user friendly

* Change code to use project terminology

* sample -> manipulator group or manipulator
* marker -> handle

* Fix small documentation mistake in bezier-rs

* Add find_tvalues_for_x function to bezier-rs

also integrate the function into curves node

* Add tests for find_tvalues_for_x in bezier-rs

* Fix formatting

* Revert BrightnessContrastNode changes

* Frontend cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-13 01:07:11 -07:00
isiko
2377240d07 Add more math nodes (#1378)
* Adds Max, Min and Equal Nodes

* Add LogToConsoleNode

Logs the data given as the input to the browser console and returns it
as the output
2023-08-11 12:26:13 -07:00
isiko
77e5ec9d4f
Add bounding box node (#1376)
* Add bounding box node

Generates a rectangle based on the bounding box of the input vector data

* Remove redundant <>

* Fix formatting

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-08 18:44:14 +02:00
isiko
f57fa2e7c9
Add Circular Repeat Node (#1373)
* Add Circular Repeat Node

Repeats a given set of Vector Data in a circular pattern a specified
amount of times.

* Remove debug statement from RepeatNode
2023-08-08 16:13:44 +00:00
Ezbaze
5c08248681
Additional Input and Math Nodes (#1369)
* Add Input Nodes and additional Math Nodes

* Add add node to node registry

* Update node-graph/gcore/src/ops.rs

Co-authored-by: Dennis Kobert <dennis@kobert.dev>

* Fix Color Input Node

Wrong input type

* Remove non Parameter variants

* Remove non Parameter variants

* Remove non Parameter variants

* Apply suggestions from code review

* mod to modulo

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-08-08 17:31:50 +02:00
Dennis Kobert
388d51deac
Add Vector Repeat Node (#1371)
* Implement skeleton for repeat node

* Implemen RepeatNode
2023-08-07 14:59:58 +02:00
Dennis Kobert
3262f637d1
Decrease graph compilation time significantly (#1368)
* Decrease compilation time significantly

* Refactor reorder_ids method to improve performance
2023-08-06 21:36:44 +02:00
Dhruv
50b67bf6f6
Fix Text Tool Overwriting Existing Text on Editing Text Layer (#1356)
fix: text edit overwriting existing text
2023-08-03 17:08:49 +01:00
0HyperCube
08f9be6aaf Artboard nodes (#1328)
* Create artboard nodes

* Update node when resizing artboard

* Render clipped artboards

* More stable feature

* Do not render old artboards

* Fix some issues with transforms

* Fix crash when drawing rectangle

* Format

* Allow renaming document from Properties panel

* Adjust artboard label styling

* Fix document graph refresh so artboards show up

* Make "Clear Artboards" coming soon

* Fix displaying an infinite canvas

* Show document name in node graph options bar

* info!() to debug!()

* Fix Properties panel not being cleared when all docs closed

* Remove dead code

* Remove debug logs added in this branch

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-27 07:35:17 +01:00
0HyperCube
80cc5bee73 Fix clippy lints (#1327)
* Fix clippy lints

* Update formatting

* Remove unsafe send impls

* New type for Rc<NodeContainer>
2023-07-19 16:38:23 +01:00
Dennis Kobert
4c9daadb01 Move Imaginate cache into the node 2023-07-14 16:40:56 +02:00
Dennis Kobert
d52ea18a1f Fix Imaginate node types to prevent an immediate crash 2023-07-14 15:28:54 +02:00