Commit graph

33 commits

Author SHA1 Message Date
Keavon Chambers
e759e62291 Comment out all remaining active Imaginate code 2025-04-12 17:32:24 -07:00
nznznz42
c5454af48b
New node: Dehaze (#1882)
* feat: Implemented Dehaze Node

* Update Cargo.toml

* Remove unecessary image conversions

* Code review

* Further fixes

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-09-24 20:44:48 -07:00
Dennis Kobert
e352c7fa71
Refactor the node macro and simply most of the node implementations (#1942)
* Add support structure for new node macro to gcore

* Fix compile issues and code generation

* Implement new node_fn macro

* Implement property translation

* Fix NodeIO type generation

* Start translating math nodes

* Move node implementation to outer scope to allow usage of local imports

* Add expose attribute to allow controlling the parameter exposure

* Add rust analyzer support for #[implementations] attribute

* Migrate logic nodes

* Handle where clause properly

* Implement argument ident pattern preservation

* Implement adjustment layer mapping

* Fix node registry types

* Fix module paths

* Improve demo artwork comptibility

* Improve macro error reporting

* Fix handling of impl node implementations

* Fix nodeio type computation

* Fix opacity node and graph type resolution

* Fix loading of demo artworks

* Fix eslint

* Fix typo in macro test

* Remove node definitions for Adjustment Nodes

* Fix type alias property generation and make adjustments footprint aware

* Convert vector nodes

* Implement path overrides

* Fix stroke node

* Fix painted dreams

* Implement experimental type level specialization

* Fix poisson disk sampling -> all demo artworks should work again

* Port text node + make node macro more robust by implementing lifetime substitution

* Fix vector node tests

* Fix red dress demo + ci

* Fix clippy warnings

* Code review

* Fix primary input issues

* Improve math nodes and audit others

* Set no_properties when no automatic properties are derived

* Port vector generator nodes (could not derive all definitions yet)

* Various QA changes and add min/max/mode_range to number parameters

* Add min and max for f64 and u32

* Convert gpu nodes and clean up unused nodes

* Partially port transform node

* Allow implementations on call arg

* Port path modify node

* Start porting graphic element nodes

* Transform nodes in graphic_element.rs

* Port brush node

* Port nodes in wasm_executior

* Rename node macro

* Fix formatting

* Fix Mandelbrot node

* Formatting

* Fix Load Image and Load Resource nodes, add scope input to node macro

* Remove unnecessary underscores

* Begin attemping to make nodes resolution-aware

* Infer a generic manual compositon type on generic call arg

* Various fixes and work towards merging

* Final changes for merge!

* Fix tests, probably

* More free line removals!

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-09-20 03:50:30 -07:00
adamgerhant
6d74abb4de
Node network subgraph editing (#1750)
* Breadcrumb visualization, nested network consistency, create definitions for Merge internal nodes

* Add index to network inputs, remove imports usage from flatten network

* Replace NodeOutput with NodeInput::Node

* Fully remove imports field, remove unnecessary identity nodes, move Output node to encapsulating network

* Replace previous_outputs with root_node, fix adding artboard/layer to empty network

* Import/Export UI nodes

* Display input/output types dynamically from compiled network

* Add LayerNodeIdentifer::ROOT_PARENT

* Prevent .to_node() on ROOT_PARENT

* Separate NodeGraphMessage and GraphOperationMessage

* General bug fixes with nested networks

* Change layer color, various bug fixes and improvements

* Fix disconnect and set node input for proto nodes and UI export node

* Dashed line to export for previewed node

* Fix deleting proto nodes and nodes that feed into export

* Allow modifications to nodes outside of nested network

* Get network from Node Id parameter

* Change root_node to previous_root_node

* Get TaggedValue from proto node implementation type when disconnecting

* Improve preview functionality and state

* Artboard position and delete children fix

* Name inputs/outputs based on DocumentNodeDefinition or type, fix new artboard/layer insertion

* replace "Link" with "Wire", adjust previewing

* Various bug fixes and improvements

* Modify Sample and Poisson-Disk points, fix incorrect input index and deleting currently viewed node

* Open demo artwork

* Fix opening already upgraded documents and refactor FrontendGraphDataType usages

* Fix deleting within network and other bugs

* Get default node input from compiled network when copying, fix previews, tests, demo artwork

* Code cleanup

* Hide EditorApi and add a comment describing unresolved Import node input types

* Code review

* Replace placeholder ROOT_PARENT NodeId with std::u64::MAX

* Breadcrumb padding

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2024-06-02 08:01:56 +00:00
Keavon Chambers
d40fb6caad
Add boolean operations (#1759) 2024-05-25 22:02:00 -07: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
nat-rix
f76b850b9c Fix Imaginate by porting its JS roundtrip code to graph-based async execution in Rust (#1250)
* Create asynchronous rust imaginate node

* Make a first imaginate request via rust

* Implement parsing of imaginate API result image

* Stop refresh timer from affecting imaginate progress requests

* Add cargo-about clarification for rustls-webpki

* Delete imaginate.ts and all uses of its functions

* Add imaginate img2img feature

* Fix imaginate random seed button

* Fix imaginate ui inferring non-custom resolutions

* Fix the imaginate progress indicator

* Remove ImaginatePreferences from being compiled into node graph

* Regenerate imaginate only when hitting button

* Add ability to terminate imaginate requests

* Add imaginate server check feature

* Do not compile wasm_bindgen bindings in graphite_editor for tests

* Address some review suggestions

- move wasm futures dependency in editor to the future-executor crate
- guard wasm-bindgen in editor behind a `wasm` feature flag
- dont make seed number input a slider
- remove poll_server_check from process_message function beginning
- guard wasm related code behind `cfg(target_arch = "wasm32")` instead
  of `cfg(test)`
- Call the imaginate idle states "Ready" and "Done" instead of "Nothing
  to do"
- Call the imaginate uploading state "Uploading Image" instead of
  "Uploading Input Image"
- Remove the EvalSyncNode

* Fix imaginate host name being restored between graphite instances

also change the progress status texts a bit.

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-06-09 09:03:15 +02:00
Dennis Kobert
45b04f4eb9 Lay groundwork for directly rendering to the canvas without a cpu roundrip (#1291)
* Add Texture handle type

* Add Texture View to shader inputs

* Implement basic rendering pipeline

* Render first texture using render pipeline

* Fix output color space

* Precompute the rendering pipeline

* Move gpu context creation to editor api

* Port gpu-executor nodes to node registry

* Fix canvas nodes and make code compile for non wasm targets

* Pin wasm-bindgen version

* Disable miri temoporarily for better ci times

* Fix formatting

* Remove unsafe block

* Bump wasm-pack version

* Bump wasm-bindgen version

* Add gpu feature guard for push node

* Make Into node async
2023-06-07 17:13:21 +02:00
Dennis Kobert
4e1bfddcd8 Remove unsafe code and clean up the code base in general (#1263)
* Remove unsafe code

* Make node graph test syncronous

* Add miri step to ci

* Remove unsafe from node graph evaluation

* Replace operation pseudo_hash with hash based on discriminant

* Fix test

* Move memo module to core and make it safe

* Fix formatting

* Remove unused stuff from gstd

* Use safe casting for creating key variants

* Fix memo node types

* Fix ref node

* "fix" ub

* Use correct input types for ExtractImageFrame

* Fix types for async nodes

* Fix missing implementation

* Manually override output type for async nodes

* Fix types for EditorApi

* Fix output type for WasmSurfaceHandle

* Remove unused miri.yml

* Fix incorrect type for cache node
2023-06-02 11:05:32 +02:00
Dennis Kobert
4bd9fbd073 Make the dynamic node graph execution asynchronous (#1218)
* Make node graph execution async

Make node macro generate async node implementations

Start propagating async through the node system

Async checkpoint

Make Any<'i> Send + Sync

Determine node io type using panic node

Fix types for raster_node macro

Finish porting node registry?

Fix lifetime errors

Remove Send + Sync requirements and start making node construction async

Async MVP

Fix tests

Clippy fix

* Fix nodes

* Simplify lifetims for node macro + make node macro more modular

* Reenable more nodes

* Fix pasting images

* Remove http test from brush node

* Fix output type for cache node

* Fix types for let scope

* Fix formatting
2023-05-27 11:48:57 +02:00
Alexandru Ică
b626d39035 Add the image segmentation node (#1122)
* Add image segmentation node

This is a node which receives as input:
- An image.
- A mask, which consists of colors that define the image segments.

Each unique color in the mask defines an area where a segmen resides.
The node generates a `Vec<ImageFrame>` where the length of the result
is the number of unique colors in the mask.

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Add the Index node for image segments

Since the output of the image segmentation node is a `Vec<ImageFrame>`,
we want a way to access the segments individually. The Index node receives
a `Vec<ImageFrame>` as input and an index, and returns the image found
at that index in the vec.

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Integrate the image segmentation and index nodes into the editor

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Initialize the input of the index node with an empty image frame

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Don't expose the parameter for the index node

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Don't crash the editor when the number of segments exceeds the accepted limit

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Print a warning in the console when the number of segments exceeds the accepted limit

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Add a few more checks so that the editor doesn't crash on invalid input

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Replace the tagged value for the index node

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>

* Fix merge conflicts

---------

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-04-16 14:51:33 +03:00
Dennis Kobert
589ff9a2d3 Implement the Brush tool (#1099)
* Implement Brush Node

* Add color Input

* Add VectorPointsNode

* Add Erase Node

* Adapt compilation infrastructure to allow non Image Frame inputs

* Remove debug output from TransformNode

* Fix transform calculation

* Fix Blending by making the brush texture use associated alpha

* Code improvements and UX polish

* Rename Opacity to Flow

* Add erase option to brush node + fix freehand tool

* Fix crash

* Revert erase implementation

* Fix flattening id calculation

* Fix some transformation issues

* Fix changing the pivot location

* Fix vector data modify bounds

* Minor fn name cleanup

* Fix some tests

* Fix tests

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: hypercube <0hypercube@gmail.com>
2023-04-11 10:35:21 +02:00
Dennis Kobert
74bfd630a9 Quantization node (#887)
Add basic quantization node
2022-12-31 18:30:35 +01:00
TrueDoctor
7d8f94462a 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-07 12:49:34 +01:00
TrueDoctor
57a1f653e1 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
0HyperCube
eb9848365f 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 22:29:45 +00:00
TrueDoctor
4ec600957c Node graph dynamic execution (#824)
Restructure document node implementation

* Implement topological sort

* Enforce the usage of type annotations

* Add complete test case
2022-10-26 00:45:42 +02:00
Dennis
71f12db1e6 Impl DynNode 2022-08-22 17:18:26 +02:00
Dennis
bdad7aca47 Make node trait consume self 2022-08-19 18:58:17 +02:00
Dennis
12b33da083 Implement image loding test 2022-08-13 19:15:48 +02:00
Dennis
ef08c27e9c Reintroduce input for the node trait
# Conflicts:
#	node-graph/gcore/src/raster.rs
2022-08-10 13:05:57 +02:00
Dennis
1ed7562b90 Add raster module to graphene_core 2022-08-04 12:34:05 +02:00
Dennis
78f07439db Add license information for node_graph crates 2022-08-04 11:47:38 +02:00
Keavon Chambers
0c2dbd411b Fix formatting of previous commit 2022-08-04 00:18:42 -07:00
Dennis
d09f023618 Bump dyn-any version + format code 2022-08-04 09:08:48 +02:00
Dennis
e84b9bd5bd Compile node graph description to GPU code 2022-06-08 09:52:58 +02:00
Dennis
a2703c0fb1 Don't force nodes to store references to other nodes 2022-06-05 15:25:07 +02:00
Dennis
f6e4dbf3e3 Add GPU support for node graph 2022-04-24 11:58:31 +02:00
Dennis
49c171b419 Implement borrow stack for node graph 2022-04-22 19:58:13 +02:00
Dennis
09deee0c4d Make graphene_core no_std 2022-04-22 15:15:39 +02:00
Dennis
cb337fd338 Replace GAT with lifetime on trait in node graph 2022-04-03 10:44:02 +02:00
Dennis
3243b80cf2 Try and fail to make nodes object-safe in node graph 2022-04-02 20:50:53 +02:00
Dennis
800fb4dbc1 Restructure node graph project layout 2022-04-02 14:50:00 +02:00