diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 56652e03..8438caca 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -480,7 +480,7 @@ impl MessageHandler> for DocumentMessageHand // Set a random seed input responses.add(NodeGraphMessage::SetInputValue { node_id: *imaginate_node.last().unwrap(), - // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeType` in `document_node_type.rs` + // Needs to match the index of the seed parameter in `pub const IMAGINATE_NODE: DocumentNodeBlueprint` in `document_node_type.rs` input_index: 3, value: graph_craft::document::value::TaggedValue::F64(random_value), }); diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs index 53ddb462..8292d238 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler/document_node_types.rs @@ -95,7 +95,7 @@ impl NodeImplementation { /// Acts as a description for a [DocumentNode] before it gets instantiated as one. #[derive(Clone)] -pub struct DocumentNodeType { +pub struct DocumentNodeBlueprint { pub name: &'static str, pub category: &'static str, pub identifier: NodeImplementation, @@ -106,7 +106,7 @@ pub struct DocumentNodeType { pub manual_composition: Option, } -impl Default for DocumentNodeType { +impl Default for DocumentNodeBlueprint { fn default() -> Self { Self { name: Default::default(), @@ -123,14 +123,14 @@ impl Default for DocumentNodeType { // We use the once cell for lazy initialization to avoid the overhead of reconstructing the node list every time. // TODO: make document nodes not require a `'static` lifetime to avoid having to split the construction into const and non-const parts. -static DOCUMENT_NODE_TYPES: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(static_nodes); +static DOCUMENT_NODE_TYPES: once_cell::sync::Lazy> = once_cell::sync::Lazy::new(static_nodes); // TODO: Dynamic node library /// Defines the "signature" or "header file"-like metadata for the document nodes, but not the implementation (which is defined in the node registry). /// The document node is the instance while these are the "class" (or "blueprint"). -fn static_nodes() -> Vec { +fn static_nodes() -> Vec { vec![ - DocumentNodeType { + DocumentNodeBlueprint { name: "Boolean", category: "Inputs", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -139,7 +139,7 @@ fn static_nodes() -> Vec { properties: node_properties::boolean_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Number", category: "Inputs", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -148,7 +148,7 @@ fn static_nodes() -> Vec { properties: node_properties::number_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Color", category: "Inputs", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -157,7 +157,7 @@ fn static_nodes() -> Vec { properties: node_properties::color_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Identity", category: "Structural", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -170,7 +170,7 @@ fn static_nodes() -> Vec { properties: |_document_node, _node_id, _context| node_properties::string_properties("The identity node simply returns the input"), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Monitor", category: "Structural", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -183,7 +183,7 @@ fn static_nodes() -> Vec { properties: |_document_node, _node_id, _context| node_properties::string_properties("The Monitor node stores the value of its last evaluation"), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Layer", category: "General", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -247,7 +247,7 @@ fn static_nodes() -> Vec { properties: node_properties::layer_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Artboard", category: "General", identifier: NodeImplementation::proto("graphene_core::ConstructArtboardNode<_, _, _, _>"), @@ -262,7 +262,7 @@ fn static_nodes() -> Vec { properties: node_properties::artboard_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Input Frame", category: "Ignore", identifier: NodeImplementation::proto("graphene_core::ExtractImageFrame"), @@ -278,7 +278,7 @@ fn static_nodes() -> Vec { properties: node_properties::input_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Load Image", category: "Structural", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -323,7 +323,7 @@ fn static_nodes() -> Vec { properties: node_properties::load_image_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Create Canvas", category: "Structural", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -362,7 +362,7 @@ fn static_nodes() -> Vec { }], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Draw Canvas", category: "Structural", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -420,7 +420,7 @@ fn static_nodes() -> Vec { }], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Begin Scope", category: "Ignore", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -472,7 +472,7 @@ fn static_nodes() -> Vec { properties: |_document_node, _node_id, _context| node_properties::string_properties("Binds the input in a local scope as a variable"), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "End Scope", category: "Ignore", identifier: NodeImplementation::proto("graphene_core::memo::EndLetNode<_, _>"), @@ -495,7 +495,7 @@ fn static_nodes() -> Vec { properties: |_document_node, _node_id, _context| node_properties::string_properties("Consumes the scope opened by the Begin Scope node and evaluates the contained node network"), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Output", category: "Ignore", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -557,7 +557,7 @@ fn static_nodes() -> Vec { properties: node_properties::output_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Image Frame", category: "General", identifier: NodeImplementation::proto("graphene_std::raster::ImageFrameNode<_, _>"), @@ -569,7 +569,7 @@ fn static_nodes() -> Vec { properties: |_document_node, _node_id, _context| node_properties::string_properties("Creates an embedded image with the given transform"), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Pixel Noise", category: "General", identifier: NodeImplementation::proto("graphene_std::raster::PixelNoiseNode<_, _, _>"), @@ -583,7 +583,7 @@ fn static_nodes() -> Vec { properties: node_properties::pixel_noise_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Mask", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::raster::MaskImageNode<_, _, _>"), @@ -595,7 +595,7 @@ fn static_nodes() -> Vec { properties: node_properties::mask_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Insert Channel", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::raster::InsertChannelNode<_, _, _, _>"), @@ -608,7 +608,7 @@ fn static_nodes() -> Vec { properties: node_properties::insert_channel_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Combine Channels", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::raster::CombineChannelsNode"), @@ -625,7 +625,7 @@ fn static_nodes() -> Vec { }], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Blend", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::BlendNode<_, _, _, _>"), @@ -639,7 +639,7 @@ fn static_nodes() -> Vec { properties: node_properties::blend_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Levels", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::LevelsNode<_, _, _, _, _>"), @@ -679,7 +679,7 @@ fn static_nodes() -> Vec { properties: node_properties::levels_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Black & White", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::BlackAndWhiteNode<_, _, _, _, _, _, _>"), @@ -729,7 +729,7 @@ fn static_nodes() -> Vec { properties: node_properties::black_and_white_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Color Channel", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -738,7 +738,7 @@ fn static_nodes() -> Vec { properties: node_properties::color_channel_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Blend Mode", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -747,7 +747,7 @@ fn static_nodes() -> Vec { properties: node_properties::blend_mode_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Luminance", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::LuminanceNode<_>"), @@ -759,7 +759,7 @@ fn static_nodes() -> Vec { properties: node_properties::luminance_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Extract Channel", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ExtractChannelNode<_>"), @@ -771,7 +771,7 @@ fn static_nodes() -> Vec { properties: node_properties::extract_channel_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Extract Alpha", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ExtractAlphaNode<>"), @@ -779,7 +779,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Extract Opaque", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ExtractOpaqueNode<>"), @@ -787,7 +787,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Split Channels", category: "Image Adjustments", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -845,7 +845,7 @@ fn static_nodes() -> Vec { has_primary_output: false, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Brush", category: "Brush", identifier: NodeImplementation::proto("graphene_std::brush::BrushNode<_, _, _>"), @@ -861,7 +861,7 @@ fn static_nodes() -> Vec { }], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Extract Vector Points", category: "Brush", identifier: NodeImplementation::proto("graphene_std::brush::VectorPointsNode"), @@ -872,7 +872,7 @@ fn static_nodes() -> Vec { }], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Memoize", category: "Structural", identifier: NodeImplementation::proto("graphene_core::memo::MemoNode<_, _>"), @@ -881,7 +881,7 @@ fn static_nodes() -> Vec { manual_composition: Some(concrete!(())), ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Image", category: "Ignore", identifier: NodeImplementation::proto("graphene_core::ops::IdNode"), @@ -891,7 +891,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "Uniform", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -943,7 +943,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "Storage", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -995,7 +995,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "CreateOutputBuffer", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1053,7 +1053,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "CreateComputePass", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1121,7 +1121,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "CreatePipelineLayout", category: "Gpu", identifier: NodeImplementation::proto("gpu_executor::CreatePipelineLayoutNode<_, _, _, _>"), @@ -1155,7 +1155,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "ExecuteComputePipeline", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1207,7 +1207,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "ReadOutputBuffer", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1259,7 +1259,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "CreateGpuSurface", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1298,7 +1298,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "RenderTexture", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1352,7 +1352,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "UploadTexture", category: "Gpu", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -1404,7 +1404,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "GpuImage", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::executor::MapGpuSingleImageNode<_>"), @@ -1425,7 +1425,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "gpu")] - DocumentNodeType { + DocumentNodeBlueprint { name: "Blend (GPU)", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::executor::BlendGpuImageNode<_, _, _>"), @@ -1439,7 +1439,7 @@ fn static_nodes() -> Vec { properties: node_properties::blend_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Extract", category: "Macros", identifier: NodeImplementation::Extract, @@ -1452,7 +1452,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "quantization")] - DocumentNodeType { + DocumentNodeBlueprint { name: "Generate Quantization", category: "Quantization", identifier: NodeImplementation::proto("graphene_std::quantization::GenerateQuantizationNode<_, _>"), @@ -1478,7 +1478,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "quantization")] - DocumentNodeType { + DocumentNodeBlueprint { name: "Quantize Image", category: "Quantization", identifier: NodeImplementation::proto("graphene_core::quantization::QuantizeNode<_>"), @@ -1499,7 +1499,7 @@ fn static_nodes() -> Vec { ..Default::default() }, #[cfg(feature = "quantization")] - DocumentNodeType { + DocumentNodeBlueprint { name: "DeQuantize Image", category: "Quantization", identifier: NodeImplementation::proto("graphene_core::quantization::DeQuantizeNode<_>"), @@ -1519,7 +1519,7 @@ fn static_nodes() -> Vec { properties: node_properties::quantize_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Invert RGB", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::InvertRGBNode"), @@ -1527,7 +1527,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Image", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Hue/Saturation", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::HueSaturationNode<_, _, _>"), @@ -1541,7 +1541,7 @@ fn static_nodes() -> Vec { properties: node_properties::adjust_hsl_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Brightness/Contrast", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::BrightnessContrastNode<_, _, _>"), @@ -1555,7 +1555,7 @@ fn static_nodes() -> Vec { properties: node_properties::brightness_contrast_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Curves", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::CurvesNode<_>"), @@ -1567,7 +1567,7 @@ fn static_nodes() -> Vec { properties: node_properties::curves_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Threshold", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ThresholdNode<_, _, _>"), @@ -1581,7 +1581,7 @@ fn static_nodes() -> Vec { properties: node_properties::adjust_threshold_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Vibrance", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::VibranceNode<_>"), @@ -1593,7 +1593,7 @@ fn static_nodes() -> Vec { properties: node_properties::adjust_vibrance_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Channel Mixer", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ChannelMixerNode<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _>"), @@ -1628,7 +1628,7 @@ fn static_nodes() -> Vec { properties: node_properties::adjust_channel_mixer_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Selective Color", category: "Image Adjustments", identifier: NodeImplementation::proto( @@ -1690,7 +1690,7 @@ fn static_nodes() -> Vec { properties: node_properties::adjust_selective_color_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Opacity", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::OpacityNode<_>"), @@ -1702,7 +1702,7 @@ fn static_nodes() -> Vec { properties: node_properties::multiply_opacity, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Posterize", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::PosterizeNode<_>"), @@ -1714,7 +1714,7 @@ fn static_nodes() -> Vec { properties: node_properties::posterize_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Exposure", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::ExposureNode<_, _, _>"), @@ -1728,7 +1728,7 @@ fn static_nodes() -> Vec { properties: node_properties::exposure_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Add", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"), @@ -1740,7 +1740,7 @@ fn static_nodes() -> Vec { properties: node_properties::add_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Subtract", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::AddParameterNode<_>"), @@ -1752,7 +1752,7 @@ fn static_nodes() -> Vec { properties: node_properties::subtract_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Divide", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::DivideParameterNode<_>"), @@ -1764,7 +1764,7 @@ fn static_nodes() -> Vec { properties: node_properties::divide_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Multiply", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::MultiplyParameterNode<_>"), @@ -1776,7 +1776,7 @@ fn static_nodes() -> Vec { properties: node_properties::multiply_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Exponent", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::ExponentParameterNode<_>"), @@ -1788,7 +1788,7 @@ fn static_nodes() -> Vec { properties: node_properties::exponent_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Floor", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::FloorNode"), @@ -1797,7 +1797,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Ceil", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::CeilNode"), @@ -1806,7 +1806,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Round", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::RoundNode"), @@ -1815,7 +1815,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Absolute Value", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::AbsoluteNode"), @@ -1824,7 +1824,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Logarithm", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::LogParameterNode<_>"), @@ -1836,7 +1836,7 @@ fn static_nodes() -> Vec { properties: node_properties::log_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Natural Logarithm", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::NaturalLogNode"), @@ -1845,7 +1845,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Sine", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::SineNode"), @@ -1854,7 +1854,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Cosine", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::CosineNode"), @@ -1863,7 +1863,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Tangent", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::TangentNode"), @@ -1872,7 +1872,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Max", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::MaxParameterNode<_>"), @@ -1884,7 +1884,7 @@ fn static_nodes() -> Vec { properties: node_properties::max_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Min", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::MinParameterNode<_>"), @@ -1896,7 +1896,7 @@ fn static_nodes() -> Vec { properties: node_properties::min_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Equals", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::EqParameterNode<_>"), @@ -1908,7 +1908,7 @@ fn static_nodes() -> Vec { properties: node_properties::eq_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Modulo", category: "Math", identifier: NodeImplementation::proto("graphene_core::ops::ModuloParameterNode<_>"), @@ -1920,7 +1920,7 @@ fn static_nodes() -> Vec { properties: node_properties::modulo_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Log to Console", category: "Logic", identifier: NodeImplementation::proto("graphene_core::logic::LogToConsoleNode"), @@ -1929,7 +1929,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Or", category: "Logic", identifier: NodeImplementation::proto("graphene_core::logic::LogicOrNode<_>"), @@ -1941,7 +1941,7 @@ fn static_nodes() -> Vec { properties: node_properties::logic_operator_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "And", category: "Logic", identifier: NodeImplementation::proto("graphene_core::logic::LogicAndNode<_>"), @@ -1953,7 +1953,7 @@ fn static_nodes() -> Vec { properties: node_properties::logic_operator_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "XOR", category: "Logic", identifier: NodeImplementation::proto("graphene_core::logic::LogicXorNode<_>"), @@ -1965,7 +1965,7 @@ fn static_nodes() -> Vec { properties: node_properties::logic_operator_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Not", category: "Logic", identifier: NodeImplementation::proto("graphene_core::logic::LogicNotNode"), @@ -1975,7 +1975,7 @@ fn static_nodes() -> Vec { ..Default::default() }, (*IMAGINATE_NODE).clone(), - DocumentNodeType { + DocumentNodeBlueprint { name: "Circle", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::CircleGenerator<_>"), @@ -1984,7 +1984,7 @@ fn static_nodes() -> Vec { properties: node_properties::circle_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Ellipse", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::EllipseGenerator<_, _>"), @@ -1997,7 +1997,7 @@ fn static_nodes() -> Vec { properties: node_properties::ellipse_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Rectangle", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::RectangleGenerator<_, _>"), @@ -2010,7 +2010,7 @@ fn static_nodes() -> Vec { properties: node_properties::rectangle_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Regular Polygon", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::RegularPolygonGenerator<_, _>"), @@ -2023,7 +2023,7 @@ fn static_nodes() -> Vec { properties: node_properties::regular_polygon_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Star", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::StarGenerator<_, _, _>"), @@ -2037,7 +2037,7 @@ fn static_nodes() -> Vec { properties: node_properties::star_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Line", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::LineGenerator<_, _>"), @@ -2050,7 +2050,7 @@ fn static_nodes() -> Vec { properties: node_properties::line_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Spline", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::SplineGenerator<_>"), @@ -2062,7 +2062,7 @@ fn static_nodes() -> Vec { properties: node_properties::spline_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Shape", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::generator_nodes::PathGenerator<_>"), @@ -2073,7 +2073,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Sample", category: "Structural", identifier: NodeImplementation::proto("graphene_std::raster::SampleNode<_>"), @@ -2082,7 +2082,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Raster", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Mandelbrot", category: "Generators", identifier: NodeImplementation::proto("graphene_std::raster::MandelbrotNode"), @@ -2091,7 +2091,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Raster", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Cull", category: "Vector", identifier: NodeImplementation::proto("graphene_core::transform::CullNode<_>"), @@ -2100,7 +2100,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Vector", FrontendGraphDataType::Subpath)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Text", category: "Vector", identifier: NodeImplementation::proto("graphene_core::text::TextGenerator<_, _, _>"), @@ -2114,7 +2114,7 @@ fn static_nodes() -> Vec { properties: node_properties::node_section_font, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Transform", category: "Transform", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -2162,7 +2162,7 @@ fn static_nodes() -> Vec { properties: node_properties::transform_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "SetTransform", category: "Transform", identifier: NodeImplementation::proto("graphene_core::transform::SetTransformNode<_>"), @@ -2173,7 +2173,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Data", FrontendGraphDataType::Subpath)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Fill", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::SetFillNode<_, _, _, _, _, _, _>"), @@ -2191,7 +2191,7 @@ fn static_nodes() -> Vec { properties: node_properties::fill_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Stroke", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::SetStrokeNode<_, _, _, _, _, _, _>"), @@ -2209,7 +2209,7 @@ fn static_nodes() -> Vec { properties: node_properties::stroke_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Repeat", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::RepeatNode<_, _>"), @@ -2222,7 +2222,7 @@ fn static_nodes() -> Vec { properties: node_properties::repeat_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Bounding Box", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::BoundingBoxNode"), @@ -2231,7 +2231,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Circular Repeat", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::CircularRepeatNode<_, _, _>"), @@ -2245,7 +2245,7 @@ fn static_nodes() -> Vec { properties: node_properties::circular_repeat_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Resample Points", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::ResamplePoints<_>"), @@ -2257,7 +2257,7 @@ fn static_nodes() -> Vec { properties: node_properties::resample_points_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Spline from Points", category: "Vector", identifier: NodeImplementation::proto("graphene_core::vector::SplineFromPointsNode"), @@ -2266,7 +2266,7 @@ fn static_nodes() -> Vec { properties: node_properties::no_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Image Segmentation", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_std::image_segmentation::ImageSegmentationNode<_>"), @@ -2277,7 +2277,7 @@ fn static_nodes() -> Vec { outputs: vec![DocumentOutputType::new("Segments", FrontendGraphDataType::Raster)], ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Index", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::IndexNode<_>"), @@ -2290,7 +2290,7 @@ fn static_nodes() -> Vec { ..Default::default() }, // Applies the given color to each pixel of an image but maintains the alpha value - DocumentNodeType { + DocumentNodeBlueprint { name: "Color Fill", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::adjustments::ColorFillNode<_>"), @@ -2302,7 +2302,7 @@ fn static_nodes() -> Vec { properties: node_properties::color_fill_properties, ..Default::default() }, - DocumentNodeType { + DocumentNodeBlueprint { name: "Color Overlay", category: "Image Adjustments", identifier: NodeImplementation::proto("graphene_core::raster::adjustments::ColorOverlayNode<_, _, _>"), @@ -2319,7 +2319,7 @@ fn static_nodes() -> Vec { ] } -pub static IMAGINATE_NODE: Lazy = Lazy::new(|| DocumentNodeType { +pub static IMAGINATE_NODE: Lazy = Lazy::new(|| DocumentNodeBlueprint { name: "Imaginate", category: "Image Synthesis", identifier: NodeImplementation::DocumentNode(NodeNetwork { @@ -2397,7 +2397,7 @@ pub static IMAGINATE_NODE: Lazy = Lazy::new(|| DocumentNodeTyp ..Default::default() }); -pub fn resolve_document_node_type(name: &str) -> Option<&DocumentNodeType> { +pub fn resolve_document_node_type(name: &str) -> Option<&DocumentNodeBlueprint> { DOCUMENT_NODE_TYPES.iter().find(|node| node.name == name) } @@ -2409,7 +2409,7 @@ pub fn collect_node_types() -> Vec { .collect() } -impl DocumentNodeType { +impl DocumentNodeBlueprint { /// Generate a [`DocumentNodeImplementation`] from this node type, using a nested network. pub fn generate_implementation(&self) -> DocumentNodeImplementation { // let num_inputs = self.inputs.len(); @@ -2445,7 +2445,7 @@ impl DocumentNodeType { DocumentNodeImplementation::Network(inner_network) } - /// Converts the [DocumentNodeType] type to a [DocumentNode], based on the inputs from the graph (which must be the correct length) and the metadata + /// Converts the [DocumentNodeBlueprint] type to a [DocumentNode], based on the inputs from the graph (which must be the correct length) and the metadata pub fn to_document_node(&self, inputs: impl IntoIterator, metadata: graph_craft::document::DocumentNodeMetadata) -> DocumentNode { let inputs: Vec<_> = inputs.into_iter().collect(); assert_eq!(inputs.len(), self.inputs.len(), "Inputs passed from the graph must be equal to the number required"); @@ -2460,7 +2460,7 @@ impl DocumentNodeType { } } - /// Converts the [DocumentNodeType] type to a [DocumentNode], using the provided `input_override` and falling back to the default inputs. + /// Converts the [DocumentNodeBlueprint] type to a [DocumentNode], using the provided `input_override` and falling back to the default inputs. /// `input_override` does not have to be the correct length. pub fn to_document_node_default_inputs(&self, input_override: impl IntoIterator>, metadata: graph_craft::document::DocumentNodeMetadata) -> DocumentNode { let mut input_override = input_override.into_iter(); @@ -2468,7 +2468,7 @@ impl DocumentNodeType { self.to_document_node(inputs, metadata) } - /// Converts the [DocumentNodeType] type to a [DocumentNode], completly default + /// Converts the [DocumentNodeBlueprint] type to a [DocumentNode], completly default pub fn default_document_node(&self) -> DocumentNode { self.to_document_node(self.inputs.iter().map(|input| input.default.clone()), DocumentNodeMetadata::default()) } diff --git a/frontend/src/components/panels/LayerTree.svelte b/frontend/src/components/panels/LayerTree.svelte index 5ac91cf0..e18985cd 100644 --- a/frontend/src/components/panels/LayerTree.svelte +++ b/frontend/src/components/panels/LayerTree.svelte @@ -10,7 +10,6 @@ UpdateDocumentLayerDetails, UpdateDocumentLayerTreeStructureJs, UpdateLayerTreeOptionsLayout, - layerTypeData, } from "@graphite/wasm-communication/messages"; import LayoutCol from "@graphite/components/layout/LayoutCol.svelte"; @@ -282,7 +281,7 @@ const layerId = BigInt(item.layerId.toString()); path.push(layerId); - const mapping = layerCache.get([path[path.length-1]].toString()); + const mapping = layerCache.get([path[path.length - 1]].toString()); if (mapping) { mapping.layerType = item.children.length >= 1 ? "Folder" : "Layer"; mapping.path = new BigUint64Array(path); diff --git a/frontend/src/components/widgets/WidgetLayout.svelte b/frontend/src/components/widgets/WidgetLayout.svelte index deb6e992..dcd265ed 100644 --- a/frontend/src/components/widgets/WidgetLayout.svelte +++ b/frontend/src/components/widgets/WidgetLayout.svelte @@ -1,5 +1,5 @@