Improve the categorization across many nodes

This commit is contained in:
Keavon Chambers 2025-06-23 18:52:05 -07:00
parent 2ec0ff38f3
commit fdb09e334b
11 changed files with 41 additions and 54 deletions

View file

@ -467,7 +467,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
}, },
DocumentNodeDefinition { DocumentNodeDefinition {
identifier: "Load Image", identifier: "Load Image",
category: "Network", category: "Web Request",
node_template: NodeTemplate { node_template: NodeTemplate {
document_node: DocumentNode { document_node: DocumentNode {
implementation: DocumentNodeImplementation::Network(NodeNetwork { implementation: DocumentNodeImplementation::Network(NodeNetwork {
@ -784,7 +784,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
}, },
DocumentNodeDefinition { DocumentNodeDefinition {
identifier: "Noise Pattern", identifier: "Noise Pattern",
category: "Raster", category: "Raster: Pattern",
node_template: NodeTemplate { node_template: NodeTemplate {
document_node: DocumentNode { document_node: DocumentNode {
manual_composition: Some(concrete!(Context)), manual_composition: Some(concrete!(Context)),
@ -837,7 +837,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
}, },
DocumentNodeDefinition { DocumentNodeDefinition {
identifier: "Split Channels", identifier: "Split Channels",
category: "Raster", category: "Raster: Channels",
node_template: NodeTemplate { node_template: NodeTemplate {
document_node: DocumentNode { document_node: DocumentNode {
implementation: DocumentNodeImplementation::Network(NodeNetwork { implementation: DocumentNodeImplementation::Network(NodeNetwork {
@ -1823,7 +1823,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
}, },
DocumentNodeDefinition { DocumentNodeDefinition {
identifier: "Sample Points", identifier: "Sample Points",
category: "Vector", category: "Vector: Modifier",
node_template: NodeTemplate { node_template: NodeTemplate {
document_node: DocumentNode { document_node: DocumentNode {
implementation: DocumentNodeImplementation::Network(NodeNetwork { implementation: DocumentNodeImplementation::Network(NodeNetwork {
@ -1975,7 +1975,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
}, },
DocumentNodeDefinition { DocumentNodeDefinition {
identifier: "Scatter Points", identifier: "Scatter Points",
category: "Vector", category: "Vector: Modifier",
node_template: NodeTemplate { node_template: NodeTemplate {
document_node: DocumentNode { document_node: DocumentNode {
implementation: DocumentNodeImplementation::Network(NodeNetwork { implementation: DocumentNodeImplementation::Network(NodeNetwork {

View file

@ -421,7 +421,7 @@ async fn flatten_group(_: impl Ctx, group: GraphicGroupTable, fully_flatten: boo
output output
} }
#[node_macro::node(category("General"))] #[node_macro::node(category("Vector"))]
async fn flatten_vector(_: impl Ctx, group: GraphicGroupTable) -> VectorDataTable { async fn flatten_vector(_: impl Ctx, group: GraphicGroupTable) -> VectorDataTable {
// TODO: Avoid mutable reference, instead return a new GraphicGroupTable? // TODO: Avoid mutable reference, instead return a new GraphicGroupTable?
fn flatten_group(output_group_table: &mut VectorDataTable, current_group_table: GraphicGroupTable) { fn flatten_group(output_group_table: &mut VectorDataTable, current_group_table: GraphicGroupTable) {

View file

@ -1,5 +1,4 @@
use crate::Ctx; use crate::Ctx;
use crate::raster::BlendMode;
use crate::raster_types::{CPU, RasterDataTable}; use crate::raster_types::{CPU, RasterDataTable};
use crate::registry::types::{Fraction, Percentage}; use crate::registry::types::{Fraction, Percentage};
use crate::vector::style::GradientStops; use crate::vector::style::GradientStops;
@ -34,7 +33,7 @@ impl ValueProvider for MathNodeContext {
} }
/// Calculates a mathematical expression with input values "A" and "B" /// Calculates a mathematical expression with input values "A" and "B"
#[node_macro::node(category("General"), properties("math_properties"))] #[node_macro::node(category("Math: Arithmetic"), properties("math_properties"))]
fn math<U: num_traits::float::Float>( fn math<U: num_traits::float::Float>(
_: impl Ctx, _: impl Ctx,
/// The value of "A" when calculating the expression /// The value of "A" when calculating the expression
@ -467,7 +466,7 @@ fn color_value(_: impl Ctx, _primary: (), #[default(Color::BLACK)] color: Option
// } // }
/// Gets the color at the specified position along the gradient, given a position from 0 (left) to 1 (right). /// Gets the color at the specified position along the gradient, given a position from 0 (left) to 1 (right).
#[node_macro::node(category("General"))] #[node_macro::node(category("Color"))]
fn sample_gradient(_: impl Ctx, _primary: (), gradient: GradientStops, position: Fraction) -> Color { fn sample_gradient(_: impl Ctx, _primary: (), gradient: GradientStops, position: Fraction) -> Color {
let position = position.clamp(0., 1.); let position = position.clamp(0., 1.);
gradient.evaluate(position) gradient.evaluate(position)
@ -479,12 +478,6 @@ fn gradient_value(_: impl Ctx, _primary: (), gradient: GradientStops) -> Gradien
gradient gradient
} }
/// Constructs a blend mode choice value which may be set to any of the available blend modes in order to tell another node which blending operation to use.
#[node_macro::node(category("Value"))]
fn blend_mode_value(_: impl Ctx, _primary: (), blend_mode: BlendMode) -> BlendMode {
blend_mode
}
/// Constructs a string value which may be set to any plain text. /// Constructs a string value which may be set to any plain text.
#[node_macro::node(category("Value"))] #[node_macro::node(category("Value"))]
fn string_value(_: impl Ctx, _primary: (), string: String) -> String { fn string_value(_: impl Ctx, _primary: (), string: String) -> String {

View file

@ -276,7 +276,7 @@ fn luminance<T: Adjust<Color>>(
input input
} }
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Channels"))]
fn extract_channel<T: Adjust<Color>>( fn extract_channel<T: Adjust<Color>>(
_: impl Ctx, _: impl Ctx,
#[implementations( #[implementations(
@ -299,7 +299,7 @@ fn extract_channel<T: Adjust<Color>>(
input input
} }
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Channels"))]
fn make_opaque<T: Adjust<Color>>( fn make_opaque<T: Adjust<Color>>(
_: impl Ctx, _: impl Ctx,
#[implementations( #[implementations(

View file

@ -366,7 +366,7 @@ where
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Instancing"), path(graphene_core::vector))]
async fn mirror<I: 'n + Send + Clone>( async fn mirror<I: 'n + Send + Clone>(
_: impl Ctx, _: impl Ctx,
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>)] instance: Instances<I>, #[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>)] instance: Instances<I>,
@ -424,7 +424,7 @@ where
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn round_corners( async fn round_corners(
_: impl Ctx, _: impl Ctx,
source: VectorDataTable, source: VectorDataTable,
@ -549,7 +549,7 @@ async fn round_corners(
result_table result_table
} }
#[node_macro::node(name("Merge by Distance"), category("Vector"), path(graphene_core::vector))] #[node_macro::node(name("Merge by Distance"), category("Vector: Modifier"), path(graphene_core::vector))]
pub fn merge_by_distance( pub fn merge_by_distance(
_: impl Ctx, _: impl Ctx,
vector_data: VectorDataTable, vector_data: VectorDataTable,
@ -694,7 +694,7 @@ pub fn merge_by_distance(
result_table result_table
} }
#[node_macro::node(category("Debug"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn box_warp(_: impl Ctx, vector_data: VectorDataTable, #[expose] rectangle: VectorDataTable) -> VectorDataTable { async fn box_warp(_: impl Ctx, vector_data: VectorDataTable, #[expose] rectangle: VectorDataTable) -> VectorDataTable {
let Some((target, target_transform)) = rectangle.get(0).map(|rect| (rect.instance, rect.transform)) else { let Some((target, target_transform)) = rectangle.get(0).map(|rect| (rect.instance, rect.transform)) else {
return vector_data; return vector_data;
@ -783,7 +783,7 @@ fn bilinear_interpolate(t: DVec2, quad: &[DVec2; 4]) -> DVec2 {
} }
/// Automatically constructs tangents (Bézier handles) for anchor points in a vector path. /// Automatically constructs tangents (Bézier handles) for anchor points in a vector path.
#[node_macro::node(category("Vector"), name("Auto-Tangents"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), name("Auto-Tangents"), path(graphene_core::vector))]
async fn auto_tangents( async fn auto_tangents(
_: impl Ctx, _: impl Ctx,
source: VectorDataTable, source: VectorDataTable,
@ -1018,7 +1018,7 @@ async fn auto_tangents(
// result_table // result_table
// } // }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable { async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1045,7 +1045,7 @@ async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTa
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
async fn dimensions(_: impl Ctx, vector_data: VectorDataTable) -> DVec2 { async fn dimensions(_: impl Ctx, vector_data: VectorDataTable) -> DVec2 {
vector_data vector_data
.instance_ref_iter() .instance_ref_iter()
@ -1102,7 +1102,7 @@ async fn points_to_polyline(_: impl Ctx, mut points: VectorDataTable, #[default(
points points
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector), properties("offset_path_properties"))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector), properties("offset_path_properties"))]
async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, join: StrokeJoin, #[default(4.)] miter_limit: f64) -> VectorDataTable { async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, join: StrokeJoin, #[default(4.)] miter_limit: f64) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1146,7 +1146,7 @@ async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, j
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn solidify_stroke(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable { async fn solidify_stroke(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1314,7 +1314,7 @@ async fn sample_points(_: impl Ctx, vector_data: VectorDataTable, spacing: f64,
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn split_path(_: impl Ctx, mut vector_data: VectorDataTable, t_value: f64, parameterized_distance: bool, reverse: bool) -> VectorDataTable { async fn split_path(_: impl Ctx, mut vector_data: VectorDataTable, t_value: f64, parameterized_distance: bool, reverse: bool) -> VectorDataTable {
let euclidian = !parameterized_distance; let euclidian = !parameterized_distance;
@ -1355,7 +1355,7 @@ async fn split_path(_: impl Ctx, mut vector_data: VectorDataTable, t_value: f64,
/// Determines the position of a point on the path, given by its progress from 0 to 1 along the path. /// Determines the position of a point on the path, given by its progress from 0 to 1 along the path.
/// If multiple subpaths make up the path, the whole number part of the progress value selects the subpath and the decimal part determines the position along it. /// If multiple subpaths make up the path, the whole number part of the progress value selects the subpath and the decimal part determines the position along it.
#[node_macro::node(name("Position on Path"), category("Vector"), path(graphene_core::vector))] #[node_macro::node(name("Position on Path"), category("Vector: Measure"), path(graphene_core::vector))]
async fn position_on_path( async fn position_on_path(
_: impl Ctx, _: impl Ctx,
/// The path to traverse. /// The path to traverse.
@ -1391,7 +1391,7 @@ async fn position_on_path(
/// Determines the angle of the tangent at a point on the path, given by its progress from 0 to 1 along the path. /// Determines the angle of the tangent at a point on the path, given by its progress from 0 to 1 along the path.
/// If multiple subpaths make up the path, the whole number part of the progress value selects the subpath and the decimal part determines the position along it. /// If multiple subpaths make up the path, the whole number part of the progress value selects the subpath and the decimal part determines the position along it.
#[node_macro::node(name("Tangent on Path"), category("Vector"), path(graphene_core::vector))] #[node_macro::node(name("Tangent on Path"), category("Vector: Measure"), path(graphene_core::vector))]
async fn tangent_on_path( async fn tangent_on_path(
_: impl Ctx, _: impl Ctx,
/// The path to traverse. /// The path to traverse.
@ -1509,7 +1509,7 @@ async fn subpath_segment_lengths(_: impl Ctx, vector_data: VectorDataTable) -> V
.collect() .collect()
} }
#[node_macro::node(name("Spline"), category("Vector"), path(graphene_core::vector))] #[node_macro::node(name("Spline"), category("Vector: Modifier"), path(graphene_core::vector))]
async fn spline(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable { async fn spline(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1555,7 +1555,7 @@ async fn spline(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn jitter_points(_: impl Ctx, vector_data: VectorDataTable, #[default(5.)] amount: f64, seed: SeedValue) -> VectorDataTable { async fn jitter_points(_: impl Ctx, vector_data: VectorDataTable, #[default(5.)] amount: f64, seed: SeedValue) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1608,7 +1608,7 @@ async fn jitter_points(_: impl Ctx, vector_data: VectorDataTable, #[default(5.)]
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
async fn morph(_: impl Ctx, source: VectorDataTable, #[expose] target: VectorDataTable, #[default(0.5)] time: Fraction) -> VectorDataTable { async fn morph(_: impl Ctx, source: VectorDataTable, #[expose] target: VectorDataTable, #[default(0.5)] time: Fraction) -> VectorDataTable {
/// Subdivides the last segment of the bezpath to until it appends 'count' number of segments. /// Subdivides the last segment of the bezpath to until it appends 'count' number of segments.
fn make_new_segments(bezpath: &mut BezPath, count: usize) { fn make_new_segments(bezpath: &mut BezPath, count: usize) {
@ -1878,7 +1878,7 @@ fn bevel_algorithm(mut vector_data: VectorData, vector_data_transform: DAffine2,
vector_data vector_data
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn bevel(_: impl Ctx, source: VectorDataTable, #[default(10.)] distance: Length) -> VectorDataTable { fn bevel(_: impl Ctx, source: VectorDataTable, #[default(10.)] distance: Length) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1892,7 +1892,7 @@ fn bevel(_: impl Ctx, source: VectorDataTable, #[default(10.)] distance: Length)
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
fn close_path(_: impl Ctx, source: VectorDataTable) -> VectorDataTable { fn close_path(_: impl Ctx, source: VectorDataTable) -> VectorDataTable {
let mut result_table = VectorDataTable::default(); let mut result_table = VectorDataTable::default();
@ -1904,17 +1904,17 @@ fn close_path(_: impl Ctx, source: VectorDataTable) -> VectorDataTable {
result_table result_table
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
fn point_inside(_: impl Ctx, source: VectorDataTable, point: DVec2) -> bool { fn point_inside(_: impl Ctx, source: VectorDataTable, point: DVec2) -> bool {
source.instance_iter().any(|instance| instance.instance.check_point_inside_shape(instance.transform, point)) source.instance_iter().any(|instance| instance.instance.check_point_inside_shape(instance.transform, point))
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("General"), path(graphene_core::vector))]
async fn count_elements<I>(_: impl Ctx, #[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>, RasterDataTable<GPU>)] source: Instances<I>) -> u64 { async fn count_elements<I>(_: impl Ctx, #[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>, RasterDataTable<GPU>)] source: Instances<I>) -> u64 {
source.instance_iter().count() as u64 source.instance_iter().count() as u64
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
async fn path_length(_: impl Ctx, source: VectorDataTable) -> f64 { async fn path_length(_: impl Ctx, source: VectorDataTable) -> f64 {
source source
.instance_iter() .instance_iter()
@ -1932,7 +1932,7 @@ async fn path_length(_: impl Ctx, source: VectorDataTable) -> f64 {
.sum() .sum()
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
async fn area(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>) -> f64 { async fn area(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>) -> f64 {
let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context(); let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context();
let vector_data = vector_data.eval(new_ctx).await; let vector_data = vector_data.eval(new_ctx).await;
@ -1946,7 +1946,7 @@ async fn area(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<
.sum() .sum()
} }
#[node_macro::node(category("Vector"), path(graphene_core::vector))] #[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
async fn centroid(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>, centroid_type: CentroidType) -> DVec2 { async fn centroid(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>, centroid_type: CentroidType) -> DVec2 {
let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context(); let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context();
let vector_data = vector_data.eval(new_ctx).await; let vector_data = vector_data.eval(new_ctx).await;

View file

@ -12,15 +12,9 @@ use graphene_core::raster_types::{CPU, Raster, RasterDataTable};
use graphene_core::renderer::GraphicElementRendered; use graphene_core::renderer::GraphicElementRendered;
use graphene_core::transform::Transform; use graphene_core::transform::Transform;
use graphene_core::value::ClonedNode; use graphene_core::value::ClonedNode;
use graphene_core::vector::VectorDataTable;
use graphene_core::vector::brush_stroke::{BrushStroke, BrushStyle}; use graphene_core::vector::brush_stroke::{BrushStroke, BrushStyle};
use graphene_core::{Ctx, GraphicElement, Node}; use graphene_core::{Ctx, GraphicElement, Node};
#[node_macro::node(category("Debug"))]
fn vector_points(_: impl Ctx, vector_data: VectorDataTable) -> Vec<DVec2> {
vector_data.instance_iter().flat_map(|element| element.instance.point_domain.positions().to_vec()).collect()
}
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
pub struct BrushStampGenerator<P: Pixel + Alpha> { pub struct BrushStampGenerator<P: Pixel + Alpha> {
color: P, color: P,

View file

@ -6,7 +6,7 @@ use image::{DynamicImage, GenericImage, GenericImageView, GrayImage, ImageBuffer
use ndarray::{Array2, ArrayBase, Dim, OwnedRepr}; use ndarray::{Array2, ArrayBase, Dim, OwnedRepr};
use std::cmp::{max, min}; use std::cmp::{max, min};
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Filter"))]
async fn dehaze(_: impl Ctx, image_frame: RasterDataTable<CPU>, strength: Percentage) -> RasterDataTable<CPU> { async fn dehaze(_: impl Ctx, image_frame: RasterDataTable<CPU>, strength: Percentage) -> RasterDataTable<CPU> {
let mut result_table = RasterDataTable::default(); let mut result_table = RasterDataTable::default();

View file

@ -1,11 +1,11 @@
use graphene_core::Ctx; use graphene_core::Ctx;
#[node_macro::node(category("Network"))] #[node_macro::node(category("Web Request"))]
async fn get_request(_: impl Ctx, url: String) -> reqwest::Response { async fn get_request(_: impl Ctx, url: String) -> reqwest::Response {
reqwest::get(url).await.unwrap() reqwest::get(url).await.unwrap()
} }
#[node_macro::node(category("Network"))] #[node_macro::node(category("Web Request"))]
async fn post_request(_: impl Ctx, url: String, body: String) -> reqwest::Response { async fn post_request(_: impl Ctx, url: String, body: String) -> reqwest::Response {
reqwest::Client::new().post(url).body(body).send().await.unwrap() reqwest::Client::new().post(url).body(body).send().await.unwrap()
} }

View file

@ -1,7 +1,7 @@
use graphene_core::raster_types::{CPU, RasterDataTable}; use graphene_core::raster_types::{CPU, RasterDataTable};
use graphene_core::{Color, Ctx}; use graphene_core::{Color, Ctx};
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Color"))]
async fn image_color_palette( async fn image_color_palette(
_: impl Ctx, _: impl Ctx,
image: RasterDataTable<CPU>, image: RasterDataTable<CPU>,

View file

@ -91,7 +91,7 @@ fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: RasterDa
result_table result_table
} }
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Channels"))]
fn combine_channels( fn combine_channels(
_: impl Ctx, _: impl Ctx,
_primary: (), _primary: (),
@ -402,7 +402,7 @@ fn image_value(_: impl Ctx, _primary: (), image: RasterDataTable<CPU>) -> Raster
// tiling: Tiling: bool, // tiling: Tiling: bool,
// } // }
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Pattern"))]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn noise_pattern( fn noise_pattern(
ctx: impl ExtractFootprint + Ctx, ctx: impl ExtractFootprint + Ctx,
@ -559,7 +559,7 @@ fn noise_pattern(
result result
} }
#[node_macro::node(category("Raster"))] #[node_macro::node(category("Raster: Pattern"))]
fn mandelbrot(ctx: impl ExtractFootprint + Send) -> RasterDataTable<CPU> { fn mandelbrot(ctx: impl ExtractFootprint + Send) -> RasterDataTable<CPU> {
let footprint = ctx.footprint(); let footprint = ctx.footprint();
let viewport_bounds = footprint.viewport_bounds_in_local_space(); let viewport_bounds = footprint.viewport_bounds_in_local_space();

View file

@ -60,7 +60,7 @@ async fn create_surface<'a: 'n>(_: impl Ctx, editor: &'a WasmEditorApi) -> Arc<W
// } // }
// } // }
#[node_macro::node(category("Network"))] #[node_macro::node(category("Web Request"))]
async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")] editor: &'a WasmEditorApi, #[name("URL")] url: String) -> Arc<[u8]> { async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")] editor: &'a WasmEditorApi, #[name("URL")] url: String) -> Arc<[u8]> {
let Some(api) = editor.application_io.as_ref() else { let Some(api) = editor.application_io.as_ref() else {
return Arc::from(include_bytes!("../../graph-craft/src/null.png").to_vec()); return Arc::from(include_bytes!("../../graph-craft/src/null.png").to_vec());
@ -75,7 +75,7 @@ async fn load_resource<'a: 'n>(_: impl Ctx, _primary: (), #[scope("editor-api")]
data data
} }
#[node_macro::node(category("Network"))] #[node_macro::node(category("Web Request"))]
fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> RasterDataTable<CPU> { fn decode_image(_: impl Ctx, data: Arc<[u8]>) -> RasterDataTable<CPU> {
let Some(image) = image::load_from_memory(data.as_ref()).ok() else { let Some(image) = image::load_from_memory(data.as_ref()).ok() else {
return RasterDataTable::default(); return RasterDataTable::default();