Files
Graphite/editor/src/messages/tool/tool_message.rs
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

147 lines
2.8 KiB
Rust

use super::utility_types::ToolType;
use crate::messages::prelude::*;
use graphene_core::raster::color::Color;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, Tool)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum ToolMessage {
// Sub-messages
#[remain::unsorted]
#[child]
TransformLayer(TransformLayerMessage),
#[remain::unsorted]
#[child]
Select(SelectToolMessage),
#[remain::unsorted]
#[child]
Artboard(ArtboardToolMessage),
#[remain::unsorted]
#[child]
Navigate(NavigateToolMessage),
#[remain::unsorted]
#[child]
Eyedropper(EyedropperToolMessage),
#[remain::unsorted]
#[child]
Fill(FillToolMessage),
#[remain::unsorted]
#[child]
Gradient(GradientToolMessage),
#[remain::unsorted]
#[child]
Path(PathToolMessage),
#[remain::unsorted]
#[child]
Pen(PenToolMessage),
#[remain::unsorted]
#[child]
Freehand(FreehandToolMessage),
#[remain::unsorted]
#[child]
Spline(SplineToolMessage),
#[remain::unsorted]
#[child]
Line(LineToolMessage),
#[remain::unsorted]
#[child]
Rectangle(RectangleToolMessage),
#[remain::unsorted]
#[child]
Ellipse(EllipseToolMessage),
#[remain::unsorted]
#[child]
Shape(ShapeToolMessage),
#[remain::unsorted]
#[child]
Text(TextToolMessage),
#[remain::unsorted]
#[child]
Brush(BrushToolMessage),
// #[remain::unsorted]
// #[child]
// Heal(HealToolMessage),
// #[remain::unsorted]
// #[child]
// Clone(CloneToolMessage),
// #[remain::unsorted]
// #[child]
// Patch(PatchToolMessage),
// #[remain::unsorted]
// #[child]
// Relight(RelightToolMessage),
// #[remain::unsorted]
// #[child]
// Detail(DetailToolMessage),
#[remain::unsorted]
#[child]
Imaginate(ImaginateToolMessage),
#[remain::unsorted]
#[child]
NodeGraphFrame(NodeGraphFrameToolMessage),
// Messages
#[remain::unsorted]
ActivateToolSelect,
#[remain::unsorted]
ActivateToolArtboard,
#[remain::unsorted]
ActivateToolNavigate,
#[remain::unsorted]
ActivateToolEyedropper,
#[remain::unsorted]
ActivateToolText,
#[remain::unsorted]
ActivateToolFill,
#[remain::unsorted]
ActivateToolGradient,
#[remain::unsorted]
ActivateToolPath,
#[remain::unsorted]
ActivateToolPen,
#[remain::unsorted]
ActivateToolFreehand,
#[remain::unsorted]
ActivateToolSpline,
#[remain::unsorted]
ActivateToolLine,
#[remain::unsorted]
ActivateToolRectangle,
#[remain::unsorted]
ActivateToolEllipse,
#[remain::unsorted]
ActivateToolShape,
#[remain::unsorted]
ActivateToolBrush,
#[remain::unsorted]
ActivateToolImaginate,
#[remain::unsorted]
ActivateToolNodeGraphFrame,
ActivateTool {
tool_type: ToolType,
},
DeactivateTools,
InitTools,
RefreshToolOptions,
ResetColors,
SelectPrimaryColor {
color: Color,
},
SelectRandomPrimaryColor,
SelectSecondaryColor {
color: Color,
},
SwapColors,
UpdateCursor,
UpdateHints,
}