Commit Graph

52 Commits

Author SHA1 Message Date
Keavon Chambers
8fe8896c4a Fix graph scrolling bug from #1021
And replicate those changes to the Svelte version.
2023-03-03 02:28:52 -08:00
Dennis Kobert
9dcabc053b Introduce scopes (#1053)
* Implement let binding

* Add lambda inputs

* Fix tests

* Fix proto network formatting

* Generate a template Scoped network by default

* Add comment to explain the lambda parameter

* Move binding wrapping out of the template

* Fix errors cause by image frames
2023-03-02 17:13:28 +01:00
Alexandru Ică
ebd31d07f0 Make use of ImageFrame in the node system more extensively (#1055) (#1062)
Make the node system use ImageFrame more extensively (#1055)
2023-03-02 15:55:10 +02:00
isiko
6b36f3fcab Add "Blend" node (#1024)
* Add Blend node

* Add more implementations

Currently, known buggy implementations:
* Color Burn
* Saturation

Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented.

* Add more implementations

Currently, known incorrect implementations:
* Color Burn
* Saturation

Not yet Tested:
* Linear Burn
* Linear Dodge
* Vivid Light
* Linear Light
* Pin Light
* Hard Mix
* Subtract
* Divide

Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented.

* Cleanup

* Removed Unused Code
* Fixed Clamping Issue
* Fixed Inverted Opacity
* Moved Opacity Calculation from individual  Blend Functions into 'blend_node' function

* Fix 'Color Burn' blend mode

Currently, known incorrect implementations:
* Saturation

Not yet Tested:
* Linear Burn
* Darker Color
* Linear Dodge
* Lighter Color
* Vivid Light
* Linear Light
* Pin Light
* Hard Mix
* Subtract
* Divide

Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented.

* Fix 'Saturation' blend mode

Currently, known incorrect implementations:
* None :D

Not yet Tested:
* Linear Burn
* Darker Color
* Linear Dodge
* Lighter Color
* Vivid Light
* Linear Light
* Pin Light
* Hard Mix
* Subtract
* Divide

Opacity is currently achieved by linear interpolation, this will be changed as soon as all filters are implemented.

* Final Cleanups

* Add proper Inputs

* cargo fmt

* Add test for doubling number

* Display implementation for ProtoNetwork

* Switch top and bottom

* Add input types for blend image node

* Fix test

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-02-23 12:55:32 +01:00
Dennis Kobert
6f371d784d Add type checking to the node graph (#1025)
* Implement type inference

Add type hints to node trait

Add type annotation infrastructure

Refactor type ascription infrastructure

Run cargo fix

Insert infer types stub

Remove types from node identifier

* Implement covariance

* Disable rejection of generic inputs + parameters

* Fix lints

* Extend type checking to cover Network inputs

* Implement generic specialization

* Relax covariance rules

* Fix type annotations for TypErasedComposeNode

* Fix type checking errors

* Keep connection information during node resolution
* Fix TypeDescriptor PartialEq implementation

* Apply review suggestions

* Add documentation to type inference

* Add Imaginate node to document node types

* Fix whitespace in macros

* Add types to imaginate node

* Fix type declaration for imaginate node + add console logging

* Use fully qualified type names as fallback during comparison

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-15 14:31:30 -08:00
0HyperCube
e14618b234 Update Imaginate to output bitmap data to the graph via Image Frame node (#1001)
* Multiple node outputs

* Add new nodes

* gcore use std by default to allow for testing

* Allow multiple node outputs

* Multiple outputs to frontend

* Add ImageFrameNode to node registry

* Minor cleanup

* Basic transform implementation

* Add some logging to image encoding

* Fix ImageFrameNode

* Add transform input to Imaginate node (#1014)

* Add transform input to imaginate node

* Force the resolution to be edited with no transform

* Add transform to imaginate generation

* Fix compilation

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>

* Add labels to node outputs

* Fix seed; disable mask when transform is disconnected; add Imaginate tooltips

* Rename 'Input Multiple' node to 'Input'

* Code review

* Replicate to Svelte

* Show only the primary input chain in the Properties panel

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-11 00:56:31 -08:00
Dennis Kobert
b06b5b6ee6 Image adjustment nodes restructure (#1013)
* Add macro for creation of Map image nodes

* Move nodes to adjustments module

* Add Saturation and Lightness to hue shift node

* Fix raster node macro

* Add Threshold Node

* Convert all adjustment nodes to new format

* Start implementing vibrance node

* Remove package-lock.json

* Code review

---------

Co-authored-by: isiko404 <isihd.ko@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-02-08 16:17:09 -08:00
Dennis Kobert
004e87ca3e Incremental compilation and stable node IDs (#977)
* Generate stable node ids

* checkpoint

* Implement borrow tree

* Add eval function on borrow tree

* Refactor Node trait to fix lifetime issues

* Compiler infinite loop

* Impl compose pair

* Transition to double lifetime on trait

* Change node trait to use a generic arg for the input

* Start adapting node_macro

* Migrate more nodes to new macro

* Fix raster tests

* Port vector nodes

* Make Node trait object safe

* Fix FlatMapResultNode

* Translate most of gstd

* Fix DowncastBothNode

* Refactor node trait once again to allow for HRTB for type erased nodes

* Start working on type erased nodes

* Try getting DowncastBothNode to work

* Introduce Upcasting node + work on BorrowTree

* Make enough 'static to get the code to compile

* Transition DynamicExecutor to use borrow tree

* Make Compose Node use HRTB's

* Fix MapResultNode

* Disable blur test

* Add workaround for Composing type erased nodes

* Convert more nodes in the node_registry

* Convert more of the node_registry

* Add update tree fn and hook up to frontend

* Fix blur node

* Implement CacheNode

* Make frontend use graph compiler

* Fix document_node_types type declaration for most nodes

* Remove unused imports

* Move comment down

* Reuse nodes via borrow tree

* Deprecate trait based value in favor of TaggedValue

* Remove unsafe code in buffer creation

* Fix blur node

* Fix stable node id generation

* Fix types for Image adjustment document nodes

* Fix Imaginate Node

* Remove unused imports

* Remove log

* Fix off by one error

* Remove macro generated imaginate node entry

* Create parameterized add node

* Fix test case

* Remove link from layer_panel.rs

* Fix formatting
2023-02-07 20:06:24 +01:00
Keavon Chambers
6eafeaaecc Apply lints and cleanup to Rust code 2023-01-29 03:01:57 -08:00
Keavon Chambers
cc7ec9409d Clean up imports and warnings in Rust code 2023-01-13 13:14:49 -08:00
Dennis Kobert
bf39a1dbe0 Implement the Gaussian Blur node (#933) 2022-12-31 17:30:22 -08:00
Dennis Kobert
8968e531a3 Quantization node (#887)
Add basic quantization node
2022-12-31 17:30:22 -08:00
Dennis Kobert
a492e7a4bb Restructure GPU compilation execution pipeline (#903)
* Restructure gpu compilation execution pipeline

* Add compilation server/client infrastructure

* Add wgpu executor
2022-12-31 02:52:04 +01:00
Keavon Chambers
5c6679ab98 Rename the legacy Graphene crate to document-legacy (#899)
* Rename /graphene to /document-legacy

* Update names in code
2022-12-22 02:12:05 -08:00
0HyperCube
55d5dbaf52 Better downcast panics (#898) 2022-12-22 09:27:55 +00:00
0HyperCube
7a752b93f9 Make Imaginate into a node (#878)
* Simplify document node input defenitions

* Remove imaginate layer

* Imaginate node properties

* Fix serde feature gate

* Add Proc Macro for Protonode implementation

* Fix incorrect type

* Add cargo.toml metadata

* Send imaginate params to frontend

* Fix image_creativity range

* Finish imaginate implementation

* Fix the imaginate draw tool

* Remove node-graph/rpco-macro

* Cargo fmt

* Fix missing workspace member

* Changes to the resolution

* Add checkbox for Imaginate auto resolution; improve Properties panel layouts

And fix bugs in panel resizing

* Implement the Rescale button

* Reorder imports

* Update Rust deps

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-12-20 14:51:38 -08:00
TrueDoctor
f1b7abede7 Bundle Graphite using Tauri (#873)
* Setup tauri component for graphite editor

Integrate graphite into tauri app

Split interpreted-executor out of graph-craft

* Add gpu execution node

* General Cleanup
2022-12-11 12:46:55 -08:00
0HyperCube
cb3cb991e3 Fix inability to expose the Add node's parameter (#877)
* Fix add node

* Simplify document node input defenitions
2022-12-10 20:39:54 -08:00
TrueDoctor
6cc364b029 Implement node graph gpu execution via vulkano and rust gpu (#870)
* Add Executor abstraction

* Resolve inputs for proto nodes by adding compose nodes

* Add infrastructure for compiling gpu code

* Integrate nodegraph gpu execution into graph-crafter

* Extract graphene core path from env vars

* Make Color struct usable for gpu code
2022-12-05 12:56:36 +01:00
Keavon Chambers
951c4b665f Improve naming of nodes and 'add' menu styling 2022-12-03 23:29:55 -08:00
0HyperCube
f9d772070b Add some additional image effect nodes (#869)
* Move the Subpath type to graphene-std

* Add the transform subpath node

* Delete selected nodes

* Inserting node list on right click

* Add several bitmap manipulator nodes

* Convert add node to use f64

* Add posterize node

* Rename names randomly

* Fix naming

* Exposure node

* Fix typo

* Adjust exposure node range

* Comment out vector nodes

* Adjust exposure range again

* Posterise as ints

* Rename input

* Use >= in the to hsl function
2022-12-03 14:29:45 -08:00
0HyperCube
47e2275e55 Add secondary inputs to nodes UI (#863)
* Add secondary inputs to UI

* Fix add node

* Dragging nodes

* Add ParameterExposeButton component

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-11-22 09:36:19 -08:00
0HyperCube
6cd0dbdcd0 Node graph improvements (#855)
* Selecting multiple nodes

* Improve logs

* Log bad types in dyn any

* Add (broken) node links

* New topological sort

* Fix reorder ids function

* Input and output node

* Add nodes that operate on images

* Fixups

* Show node parameters together with layer properties

* New nodes don't crash editor

* Fix tests

* Node positions backend

* Generate node graph on value change

* Add expose input message

* Fix tests

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-11-17 15:36:23 -08:00
TrueDoctor
a65ac7ddfd Node graph dynamic execution (#824)
Restructure document node implementation

* Implement topological sort

* Enforce the usage of type annotations

* Add complete test case
2022-10-25 15:45:42 -07:00
0hypercube
1a4a0db7e8 Add some raster protonodes 2022-10-26 00:37:05 +02:00
TrueDoctor
2873c8fb00 Relax borrow stack lifetimes (#823)
Relax lifetimes for borrow_stack
2022-10-25 15:35:30 -07:00
TrueDoctor
097899611f Implement node registry (#822) 2022-10-25 15:32:50 -07:00
TrueDoctor
06acd45a81 Rework DynAnyNode design to work with the borrow stack (#796) 2022-10-15 03:02:58 +02:00
0hypercube
99d92ef887 Some initial testing on dynamic nodes and composition
* Test use of borrow stack
2022-10-15 02:45:02 +02:00
TrueDoctor
e3237b2c4e Implement the initial Document Nodes system (#795)
* Add testcase for flattening graph

* Implement equality for Values

* Implement input resolution
2022-10-15 02:02:50 +02:00
0HyperCube
7ca45c25e1 Use .then() instead of .after() for sequencing nodes (#760)
* Add .then() for sequencing nodes

* Remove all uses af after

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2022-08-28 12:52:46 -07:00
Keavon Chambers
7848391f6e Clean up MenuList types and fix many Vue and Clippy warnings
Also remove hard-coded-in-Vue Graphite logo in the menu bar in favor of a Rust definition.
2022-08-26 00:10:41 -07:00
Dennis
d566ba852d Impl DynNode 2022-08-23 14:02:50 -07:00
Keavon Chambers
5531fc690f Add grayscale sample image for its node graph test 2022-08-23 14:00:17 -07:00
Dennis
ce9e02f36d Make node trait consume self 2022-08-23 14:00:17 -07:00
Dennis
fa0b896825 Implement image loding test 2022-08-23 14:00:17 -07:00
Dennis
6b45927a60 Reintroduce input for the node trait
# Conflicts:
#	node-graph/gcore/src/raster.rs
2022-08-23 14:00:17 -07:00
Dennis
83ff548596 Add raster module to graphene_core 2022-08-05 17:43:49 -07:00
Dennis
9e1f4eb46d Add license information for node_graph crates 2022-08-04 11:47:38 +02:00
Keavon Chambers
0c7870c5b0 Fix formatting of previous commit 2022-08-04 00:18:42 -07:00
Dennis
5e9545322e Bump dyn-any version + format code 2022-08-04 09:08:48 +02:00
Dennis
30af1ba8db Integrate dyn-any into the main graphite repo 2022-08-04 09:05:19 +02:00
Dennis
4fd0042f9b Temporarily remove pretty printing for token streams 2022-08-02 11:53:35 +02:00
Dennis
089a3f5684 Compile node graph description to GPU code 2022-08-01 23:44:25 -07:00
Dennis
09f550bcd4 Don't force nodes to store references to other nodes 2022-08-01 23:44:22 -07:00
Dennis
aa5e6f43f6 Add GPU support for node graph 2022-08-01 23:44:18 -07:00
Dennis
bfe21cb179 Implement borrow stack for node graph 2022-08-01 23:44:16 -07:00
Dennis
1ae1fd5704 Make graphene_core no_std 2022-08-01 23:44:14 -07:00
Dennis
119e865007 Restructure node graph proxy architecture 2022-08-01 23:44:13 -07:00
Dennis
6349edfeb3 Replace GAT with lifetime on trait in node graph 2022-08-01 23:44:11 -07:00