Commit Graph

1291 Commits

Author SHA1 Message Date
0HyperCube 2feef62f23
Fix the Eyedropper tool (#1440)
* Fix eyedropper

* Remove dead code

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-25 17:18:15 +01:00
0HyperCube 54745e210a
Fix the Path tool's smooth/sharp buttons (#1439)
* Fix select tool smooth button

* Nit

* Fix behavior when zero points are selected but the shape is active

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-25 09:26:24 +01:00
Keavon Chambers c4bea2b400 Clean up code for optional node inputs/outputs
This removes the unused Split Channels node's primary output
2023-10-24 22:26:34 -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
Keavon Chambers 1bab2affdb Remove dead code from overlay graph view state tracking 2023-10-24 21:09:02 -07:00
0HyperCube 6ff958d6ae
Create node by dragging link into empty space (#1438)
* Create node by dragging into empty space

* Prevent add menu when disconnecting a link

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-10-24 13:22:41 -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
Rob Bertram 67edac4aca
Move DeleteLayer to come before SelectionChanged on DeletedSelectedLayers (#1417)
* ignore render subpaths overlays if layer no longer exists

* make selection change event added after delete layers

---------

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
2023-10-18 18:32:10 +01: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 e1cdb2242d Lay Groundwork for Rust-based SVG rasterization (#1422)
* Add functions for constructing a usvg tree

* Actually encode the image in the usvg tree

* Implement path translation

* Render document using resvg
2023-10-17 11:02:07 -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 239ca698e5 Fix navigate and rulers 2023-10-17 11:02:06 -07:00
0hypercube b52f831b21 Fix artboard tool and remove old artboard code 2023-10-17 11:02:06 -07:00
0hypercube 9a39c4a0cc Fix gradient tool 2023-10-17 11:02:06 -07:00
0hypercube 6173662a40 Fix freehand and spline tool 2023-10-17 11:02:06 -07:00
hypercube 76d7b6256d Fix positioning of new layer nodes after rebase 2023-10-17 11:02:06 -07:00
hypercube 40aab0332a Fix eyedropper tool 2023-10-17 11:02:06 -07:00
hypercube 0d6bec837b Fix path tool 2023-10-17 11:02:06 -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
0hypercube fc6cee372a Fix warnings introduced by artboard nodes 2023-10-17 11:01:10 -07:00
0hypercube f50909b887 Use GraphIdentifier instead of option 2023-10-17 11:01:10 -07:00
0hypercube 5b61a30c2a Fix artboard thumbnails 2023-10-17 11:01:10 -07:00
Vlad Rakhmanin b2397b06c6
Fix crash when a cycle is introduced into the graph (#1427)
* Changing return of topological_sort to Result and propagating error

* Simplifying "compile()" method, adding "expect()" to tests.

* Removing Result type from "map_gpu()"

* Reverting to assertion and removing unnecessary returns
2023-09-30 10:07:29 +00:00
Dennis Kobert 7e3469fa3f
Update `graphene-cli` and fix no-std compilation for `graphene-core` (#1428)
* Initialize wgpu executor from graphene cli

* Make `graphene-core` `no-std` complient again

* Implemnt image similarity calculation

* Add nan checks

* Make image comparison optional

* Feature gate quantization to reduce the number of warnings
2023-09-30 11:20:17 +02:00
Vlad Rakhmanin b9027883a8
Make 'Close All Documents' not confirm if all open documents are already saved (#1423)
* Adding blank PortfolioMessage to close docs

* Connected new PortfolioMessage to Menu Bar

* Adding functionality to new PortfolioMessage

* Amending outdated tests in color.rs
2023-09-21 14:02:18 -07:00
mobile-bungalow 9667e5173b
Allow toggling smooth/sharp angle from the path tool options bar (#1415)
* menu in option

* smoothing controls work

* fixed type error

* fix flipping behavior

* silence warning

* consolidate selection state

* update positions options

* blinking logic fixed, smoothing logic implemented

* fixed arbitrary looping when flipping from sharp to smooth

* remove warning

* Tidying up

* refactor manipulator smoothing code, remove bitflags, rename

* Make the point smooth/sharp support mixed better

* Code review tweaks

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-09-11 17:36:08 -07:00
Keavon Chambers 88bdf9580f Make RadioInput accept optional selected_index 2023-09-11 15:40:05 -07:00
mobile-bungalow b29acbd784
Rework navigation tool hints and navigation shortcuts (#1419)
* Added Pan,Tilt,Zoom to View menu + Tilt shortcut changes

* formating

* fixed menus, added action for when dispatch happens from menu

* set key mappings to spec

* fix labels for navigation tool

* fix some spacing

* add action that locks spacebar for navigation when using it as a modifier so the node overlay does not toggle

* escape from the node-graph-overlay, set toggle to ctrl+space, fix demo art

* move all transform state into an enum

* rename confusing flag

* fix demo art and tests

---------

Co-authored-by: Ezbaze <rybitwamateusz3@gmail.com>
2023-09-10 23:42:27 +01:00
Prikshit Gautam ad9ccaa800
Add 'select all points' method to ShapeState struct (#1386)
* Added select all points method to ShapeState struct

* Map select_all_points functions to shortcut

* Make SelectAllPoints action relevant in the current context only

* Refactor select_all_points to only select anchors

* Fix(editor): enable selected point update after selection change via clicking
2023-09-04 19:35:43 -07:00
Keavon Chambers 56f20f2e6d Remove history step creation from Select tool box selection 2023-09-02 15:26:04 -07:00
Keavon Chambers 839040c6a3
Rename the Value node to Number (#1412)
* Rename the Value node to Number

* Fix test

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2023-09-02 22:11:03 +00:00
0HyperCube 579723ae3e
Fix deleting the Path node in "Just a Potted Cactus" demo art (#1413)
Fix cactus again
2023-09-02 14:54:23 -07:00
0HyperCube fe8e1da8ed
Fix deleting the shape node (#1411) 2023-09-02 12:16:38 +01: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
Dhruv 81a7c2dfcf
Reconnect links when deleting a node (#1405)
* fix: avoid deleting inner network's input nodes

* [wip]feat: set primary input on node deletion

- set input's input value to deleted node's primary input

* fix: check deleting node's output is used by other node(s)

* feat: enable conditionally reconnecting input

- user can press a key to avoid reconnecting nodes during deletion

* refactor: improve and restructure code

- make code quality improvements
- add NodeGraphHandlerData struct to replace big tuple

* fix: avoid deleting inner network's input nodes

* [wip]feat: set primary input on node deletion

- set input's input value to deleted node's primary input

* fix: check deleting node's output is used by other node(s)

* feat: enable conditionally reconnecting input

- user can press a key to avoid reconnecting nodes during deletion

* refactor: improve and restructure code

- make code quality improvements
- add NodeGraphHandlerData struct to replace big tuple

* Remove unnecessary recursion

* Code review cleanup

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-09-02 08:32:37 +00:00
Keavon Chambers ee1a228bfd Fix regression blocking inputs in the graph 2023-09-02 00:19:03 -07:00
Keavon Chambers b30488bbb7
Add support for handling MMB/RMB double click inputs (#1407)
* Add support for handling MMB/RMB double click inputs

* Add todo comment

* Enforce types

---------

Co-authored-by: 0hypercube <0hypercube@gmail.com>
2023-09-01 14:57:03 -07:00
Keavon Chambers a112ab27cf
Dialog redesign and content revamp (#1409)
* Revamp the content and design of dialogs

* Add the Licenses dialog
2023-09-01 01:58:20 -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
mobile-bungalow 48fdaddc37
Add Path tool options for editing X/Y point coordinates (#1404)
* implement path point selector in toolbar

* Transform point to art board space

* fix handle adjustment space

* remove unused branches

* tidy comments

* make function names more descriptive, add guards, fix comments

* add auxillary message for layout update

* change trace to warn, remove unneccessary messages, fix rustfmt

* rustfmt

* support handles

* style and dimensions corrections

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-29 21:41:01 -07:00
Keavon Chambers 5944186870 Add !build command for core team to create build links 2023-08-29 19:37:21 -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
0HyperCube e77782aadb
Remove console spam (#1400)
* Remove console spam

* CSS Style

* Slight cleanup

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
2023-08-27 16:12:32 -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 9d27bf49cf Fix demo art shape node (#1401) 2023-08-26 18:43:27 +00:00