Commit graph

1136 commits

Author SHA1 Message Date
Christopher Mendoza
3f7d484398 Select tool's shallowest behavior improvements and refactoring (#1108)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-28 18:23:14 -07:00
Bruce Mitchener
5c7dabf70e Remove unused Kurbo deps from editor and node-graph/gstd (#1335)
deps: Remove kurbo deps from editor, node-graph/gstd.

Co-authored-by: Bruce Mitchener <bruce.mitchener@configura.com>
2023-07-29 07:21:36 +07:00
Dennis Kobert
59420cb5dd Exclude transform from Imaginate hash (#1326) 2023-07-29 02:20:04 +02:00
Keavon Chambers
9d425db5a4 Rename "Layer Tree" panel to "Layers" 2023-07-28 17:00:06 -07:00
Shouvik Ghosh
6d2ae02c19 Hide snapping overlays when snapping to a point (#1260)
Hide snap points/lines if we snap to a point
2023-07-29 05:25:34 +05:30
Bruce Mitchener
3ed4af4ca6 Update GitHub Actions CI action versions (#1336)
ci: Update GitHub-supplied actions.

These are generating warnings in the GitHub Actions UI as they
are being forced to use a more current node.

Co-authored-by: Bruce Mitchener <bruce.mitchener@configura.com>
2023-07-29 06:36:32 +07:00
Dennis Kobert
a49d96ed37 Embed git commit hash in the document file (#1325)
* Embed git commit hash in the document file

* Bump version in test document file

* Fixes

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-28 22:52:26 +02:00
Dhruv
8bdc64bb8b Fix Transform node missing its Rotation slider (#1337)
* fix: transform node missing rotation slider

* chore: move variable's value in-line
2023-07-29 01:14:29 +05:30
Dennis Kobert
74d2ed9786 Clear wasm-bindgen cache before compilation (#1334)
Clear wasm-bindgen cache before compilation
2023-07-28 08:35:53 +02:00
Dennis Kobert
1d08959bf8 Bump wasm-pack version (#1333) 2023-07-28 02:53:45 +02: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
Dhruv
ad0dc3276e Show disabled menu bar entries with no active document (#1332)
Making the change as advised. This change will allow the user to see all possible submenus without being able to use them if there is no active document.
This somewhat reverts the behaviour of one previous PR.
2023-07-27 11:26:37 +05:30
0HyperCube
acb46bc1d3 Fix missing popover text (#1329) 2023-07-19 22:04:48 +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
Dhruv
743803ce04 Add Snapping Options to the Snap Dropdown Menu (#1321)
* [wip]feat: add snapping options

* [wip]fix: use svelte component for optionsWidget

* fix: use apt PopoverButton types

* refactor: minor formatting improvements

* Fix popover layout

* [wip]feat: attempt implementing CheckboxInputData struct

* fix: use correct Checkbox struct 's default method

* fix: revert adding CheckboxInputData struct

- This reverts commit 2a481887fc.

* feat: use checkboxes for snapping options

* feat: add label to dropdown checkbox elements

* fix: separate Snap dropdown menu elements
- move each element into separate row

* [wip]feat: modularize snapping states
- maintain individual snapping states for document

* fix: snapping checkboxes' behavior
- checkboxes now update internal snapping state

* refactor: update snap states individually
- this prevents out-of-sync states
- enables reusing existing snap state object

* feat: snap to boxes and nodes conditionally

* [wip]feat: attempt to invert checkbox on update
- attempt implementing mutable WidgetCallback struct
- attempt using above struct to invert checkbox state on update

* Fix widget diffing

* refactor: remove unused code

* feat: align checkboxes consistently with labels

* feat: use separators to stylize snapping menu
- removes need for custom CSS and label property
- ensures consistency across the application

* refactor: remove unneeded css

---------

Co-authored-by: hypercube <0hypercube@gmail.com>, TrueDoctor <dennis@kobert.dev>
2023-07-15 15:07:18 +05:30
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
Prikshit Gautam
aaf28ba7b7 Added primary output option in DocumentNodeType (#1275)
* Added primary output option in DocumentNodeType

* Changed position of primary output field

* Changed position of primary output field in type definition

* Update editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs

* Add missing default implementations to gpu nodes

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-07-05 13:06:28 +05:30
Dennis Kobert
3c2d371173 Graphene CLI + quantization research (#1320)
* Implement skeleton for graphene-cli

* Configure gpu surface on non wasm32 targets

* Create window with full hd size

* Create window using the graphen-cli

* Use window size for surface creation

* Reuse surface configuration

* Reduce window size for native applications to 800x600

* Add compute pipeline test

* Poll wgpu execution externally

* Remove cache node after texture upload

* Add profiling instructions

* Add more debug markers

* Evaluate extract node before flattening the network

* Reenable hue saturation node for compilation

* Make hue saturation node work on the gpu + make f32 default for user inputs

* Add version of test files without caching

* Only dispatch each workgroup not pixel

* ICE

* Add quantization to gpu code

* Fix quantization

* Load images at graph runtime

* Fix quantization calculation

* Feature gate quantization

* Use git version of autoquant

* Add license to `graphene-cli`

* Fix graphene-cli test case

* Ignore tests on non unix platforms

* Fix flattening test
2023-07-04 17:04:09 +02:00
Senne Hofman
61c5dd1f88 Dragging selected folder now drags all children (#1279) 2023-07-04 16:50:31 +02:00
Leonard Pauli
84343f2abe Add Polygon/Star toggle to Shape tool (#1215)
* #1212: added checkbox to toggle star for ngon shape

* Switch from checkbox to radio input

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-07-04 16:29:38 +02:00
Dhruv
92e10b6610 Add Box Selection to Path Tool (#1316)
* [WIP]feat: add bounding box to path tool

* feat: draw bounding box for path tool
- register Enter key for finalizing bounding box position
-  add (WIP)func to select all in bounding box area
- add hint data for new state

* fix: re-render shape overlays after selection

* fix: maintain existing point selection with Shift key

* feat: add Shift key support for Enter Key state

* fix: set apt name for Enter state's keybind

* refactor: remove unnecessary code

* refactor: correct hints and remove unneeded code
- correct DrawingBox state's footer hints
- remove PathToolData's quad and bbox methods

* refactor: remove duplicate mouse position vectors
2023-07-02 13:03:51 +05:30
Dhruv
9c2520111d Minor Tooling and UI Improvements (#1314)
* [wip]fix: disable fill and gradient tools on bmp images
- aims to fix #1161

* [wip]fix: disable gradient tool for bmp images

* fix: disable gradient tool for bitmap images
- fixes https://github.com/GraphiteEditor/Graphite/issues/1161

* [wip]fix: disable menu bar elements if no open document

* [WIP]feat: render certain menubar elements if document is open

* fix: conditional menu bar rendering fixes
- update menu bar on certain document actions
- fix menu bar order on rendering all elements

* refactor: change conditional menu elements property
- use existing 'disabled' property

* feat: render menu dropdown items conditionally

* fix: revert formatter whitespace changes

* refactor: improve variable naming and message usage
- name menu bar bool flag better
- use SendLayout message and remove unneeded calls
2023-06-24 01:49:00 +05:30
Samyat Gautam
173398ad55 Improve 'add node' menu (#1312)
* improved node adding list with dropdowns and scrolling

* changed arrow icon from default details arrow

* made 'add node' menu appear above mouse when clicking at bottom of nodegraph. Searching automatically opens the dropdowns you need. Set fixed 'add node' menu size

* updated code style to be more clear

* undo mistake changes

---------

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
2023-06-23 14:01:39 -04:00
Dhruv
b937a64c37 Conditionally enable align and pivot buttons (#1313)
* feat: conditionally enable align buttons
- enable select tool align buttons if selected layer count > 1

* wip: conditionally render pivot button

* [wip] feat: conditionally enable select tools' pivot button

* fix: prevent repeated UI updates on layer selection
- set bool flag to false after first UI update
2023-06-17 23:00:33 +05:30
Dennis Kobert
40ec52b395 Node macro lambda parameters (#1309)
* Implement parsing of impl Node<I, …> syntax for the macro

* Extend node macro to allow specifying lambda nodes
2023-06-09 16:43:46 +02:00
Alexandru Ică
a5f890289b WebGPU: Switch from rgba8unorm to bgra8unorm to support MacOS (#1306)
* WebGPU: Switch from `rgba8unorm` to `bgra8unorm` to support MacOS

This is a known issue in the Dawn bug database: https://bugs.chromium.org/p/chromium/issues/detail?id=1298618

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

* Undo the modification to `shader.wgsl`

Apparently I didn't need to modify the order of the channels in
the shader.

Signed-off-by: Ică Alexandru-Gabriel <alexandru@seyhanlee.com>
2023-06-09 15:48:30 +03: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
0HyperCube
a1c70c4d90 Update node guide (#1305) 2023-06-08 18:19:10 +01:00
Rotteegher
a92f1ecab0 Fix zoom with scroll preference reset to default correctly (#1304) 2023-06-08 15:50:19 +00:00
Dennis Kobert
5b6db0a762 Add document nodes for gpu pipeline nodes (#1292)
* Add document nodes for gpu pipeline nodes

* Load existing frame instead of clearing it

* Feature gate gpu imports
2023-06-08 10:13:19 +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
Orson Peters
0c93a62d55 Add blit caching and blend modes to Brush tool (#1268)
Added blit caching.

Added bulk memory target feature.

Added brush texture caching.

Removed dead format call.

Fix brush_texture_cache crashing on serialization.
2023-06-07 12:24:21 +02:00
Prikshit Gautam
70fcb35444 Remove warnings from build and satisfied clippy (#1288)
* Prefixed unused functions with underscore

* Applied clippy lints

* Fixed some warnings and removed some `allow` statements
2023-06-07 14:46:47 +05:30
isiko
054acd3cc9 Fix Levels Node (#1289)
The Levels Node was previously outputing channel values out side the range of 0..1, this should be fixed now
2023-06-06 13:09:46 +02:00
isiko
820a2672b8 Add the Extract Opaque node (#1276)
* Add 'Extract Opaqueue Node'

* Fix node

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-06-04 21:51:42 +02:00
Dennis Kobert
2887ba2aa4 Add logging for bezier-rs web demos (#1286) 2023-06-04 12:29:00 +02:00
0HyperCube
abd8e7fab6 Fix Pen tool race condition when drawing handles fast, and stuck overlays (#1283)
* Fix pen tool with async

* Fix overlays staying too long

* Perhaps fix the transform issue

* Fix compile error

* Formatting

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-06-04 04:51:07 +01:00
0HyperCube
4d1c5fc8bf Minimum viewport scale cover when zooming (#1282)
* Minimum viewport scale cover

* Update const name
2023-06-03 21:35:19 +01:00
Dennis Kobert
26473a8002 Restructure node graph execution to be safer (#1277)
* Reorganize file structure

* Remove all unsafe code

* Add testcase for debugging ub

* Convert into proper test with fail condition

* General cleanup

* Fix tests

* Add feature guard for deallocation

* Use raw pointer for storing values to avoid violating aliasing rules

* Add comment explaining the disabling of simd128

* Fix brush node

* Fix formatting
2023-06-03 01:18:44 +02:00
Orson Peters
5558deba5e Brush blend modes and erase/restore (#1261)
* Made blit node numerically stable.

* Added blend mode parameter to brush strokes.

* Fixed difference blend mode.

* Added erase/restore blend modes.

* Added blend mode and draw mode widgets.

* Added comment explaining the ImageFrame.transform.

* Initial blit/blend version.

* Working version of erase/restore.

* Improved inlining for blend functions.

* Dsiable the blend mode selector in erase/draw mode.

* Fixed incorrect bounds calculation.

* Use factor instead of percentage for opacity

* Rearrange options bar widgets

* Tidy up blend modes

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-06-02 21:59:55 +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
259dcdc628 Use canvas as target for raster rendering (#1256)
* Implement ApplicationIo

* Simplify output duplication logic

* Fix let node initialization for ExtractImageFrame

* Async macros

* Use manual node registry impl

* Fix canvas insertion into the dom
2023-05-30 20:12:59 +02:00
Alexandru Ică
57415b948b Add the first basic version of the GPU blend node (#1243)
* Implement Gpu Blend node

* Remove duplicate shader input

* Fix formatting

---------

Co-authored-by: Dennis Kobert <dennis@kobert.dev>
2023-05-28 11:34:09 +03:00
Dennis Kobert
9da83d3280 Implement basic request caching for compilation server (#1253)
* Implement basic request caching for compilation server

* Fix formatting
2023-05-28 00:52:10 +02:00
Dennis Kobert
6289d92e02 Increase WGPU limits to what's supported by the adapter (#1251)
* Increase Wgpu limits

* Fix compilation of shaders

* Unbreak debug options
2023-05-28 00:23:47 +02:00
Orson Peters
7148b199ec Make Brush tool use per-stroke options and improve its performance (#1242)
* Laid groundwork for per-stroke brush parameters.

* Added new spacing parameter.

* Added back interpolation, using spacing parameter.

* Move bounding box code into core.

* Initial working prototype of per-stroke styles.

* Removed now useless brush node properties.

* Made default spacing 50% for performance comparison.

* Quick and dirty prototype for BlitNode copied from blend.

* Fixed error after rebase.

* Optimized the blitting loop.

* Pretty big optimization for into_flat_u8.

* Insert brush node for images

* Fix starting position transform

* UX polish

* Code review nits

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-05-27 22:55:49 +02:00
Dennis Kobert
0586d52f3a Implement experimental WebGPU support (#1238)
* Web gpu execution MVP

Ready infrastructure for wgpu experimentation

Start implementing simple gpu test case

Fix Extract Node not working with nested networks

Convert inputs for extracted node to network inputs

Fix missing cors headers

Feature gate gcore to make it once again no-std compatible

Add skeleton structure gpu shader

Work on gpu node graph output saving

Fix Get and Set nodes

Fix storage nodes

Fix shader construction errors -> spirv errors

Add unsafe version

Add once cell node

Web gpu execution MVP
2023-05-27 19:27:46 +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
Keavon Chambers
5c7211cb30 Fix bezier-rs interactive demos page build system 2023-05-26 17:14:31 -07:00