Skip to content

Commit fdb09e3

Browse files
committed
Improve the categorization across many nodes
1 parent 2ec0ff3 commit fdb09e3

File tree

11 files changed

+41
-54
lines changed

11 files changed

+41
-54
lines changed

editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
467467
},
468468
DocumentNodeDefinition {
469469
identifier: "Load Image",
470-
category: "Network",
470+
category: "Web Request",
471471
node_template: NodeTemplate {
472472
document_node: DocumentNode {
473473
implementation: DocumentNodeImplementation::Network(NodeNetwork {
@@ -784,7 +784,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
784784
},
785785
DocumentNodeDefinition {
786786
identifier: "Noise Pattern",
787-
category: "Raster",
787+
category: "Raster: Pattern",
788788
node_template: NodeTemplate {
789789
document_node: DocumentNode {
790790
manual_composition: Some(concrete!(Context)),
@@ -837,7 +837,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
837837
},
838838
DocumentNodeDefinition {
839839
identifier: "Split Channels",
840-
category: "Raster",
840+
category: "Raster: Channels",
841841
node_template: NodeTemplate {
842842
document_node: DocumentNode {
843843
implementation: DocumentNodeImplementation::Network(NodeNetwork {
@@ -1823,7 +1823,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
18231823
},
18241824
DocumentNodeDefinition {
18251825
identifier: "Sample Points",
1826-
category: "Vector",
1826+
category: "Vector: Modifier",
18271827
node_template: NodeTemplate {
18281828
document_node: DocumentNode {
18291829
implementation: DocumentNodeImplementation::Network(NodeNetwork {
@@ -1975,7 +1975,7 @@ fn static_nodes() -> Vec<DocumentNodeDefinition> {
19751975
},
19761976
DocumentNodeDefinition {
19771977
identifier: "Scatter Points",
1978-
category: "Vector",
1978+
category: "Vector: Modifier",
19791979
node_template: NodeTemplate {
19801980
document_node: DocumentNode {
19811981
implementation: DocumentNodeImplementation::Network(NodeNetwork {

node-graph/gcore/src/graphic_element.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ async fn flatten_group(_: impl Ctx, group: GraphicGroupTable, fully_flatten: boo
421421
output
422422
}
423423

424-
#[node_macro::node(category("General"))]
424+
#[node_macro::node(category("Vector"))]
425425
async fn flatten_vector(_: impl Ctx, group: GraphicGroupTable) -> VectorDataTable {
426426
// TODO: Avoid mutable reference, instead return a new GraphicGroupTable?
427427
fn flatten_group(output_group_table: &mut VectorDataTable, current_group_table: GraphicGroupTable) {

node-graph/gcore/src/ops.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::Ctx;
2-
use crate::raster::BlendMode;
32
use crate::raster_types::{CPU, RasterDataTable};
43
use crate::registry::types::{Fraction, Percentage};
54
use crate::vector::style::GradientStops;
@@ -34,7 +33,7 @@ impl ValueProvider for MathNodeContext {
3433
}
3534

3635
/// Calculates a mathematical expression with input values "A" and "B"
37-
#[node_macro::node(category("General"), properties("math_properties"))]
36+
#[node_macro::node(category("Math: Arithmetic"), properties("math_properties"))]
3837
fn math<U: num_traits::float::Float>(
3938
_: impl Ctx,
4039
/// The value of "A" when calculating the expression
@@ -467,7 +466,7 @@ fn color_value(_: impl Ctx, _primary: (), #[default(Color::BLACK)] color: Option
467466
// }
468467

469468
/// Gets the color at the specified position along the gradient, given a position from 0 (left) to 1 (right).
470-
#[node_macro::node(category("General"))]
469+
#[node_macro::node(category("Color"))]
471470
fn sample_gradient(_: impl Ctx, _primary: (), gradient: GradientStops, position: Fraction) -> Color {
472471
let position = position.clamp(0., 1.);
473472
gradient.evaluate(position)
@@ -479,12 +478,6 @@ fn gradient_value(_: impl Ctx, _primary: (), gradient: GradientStops) -> Gradien
479478
gradient
480479
}
481480

482-
/// 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.
483-
#[node_macro::node(category("Value"))]
484-
fn blend_mode_value(_: impl Ctx, _primary: (), blend_mode: BlendMode) -> BlendMode {
485-
blend_mode
486-
}
487-
488481
/// Constructs a string value which may be set to any plain text.
489482
#[node_macro::node(category("Value"))]
490483
fn string_value(_: impl Ctx, _primary: (), string: String) -> String {

node-graph/gcore/src/raster/adjustments.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ fn luminance<T: Adjust<Color>>(
276276
input
277277
}
278278

279-
#[node_macro::node(category("Raster"))]
279+
#[node_macro::node(category("Raster: Channels"))]
280280
fn extract_channel<T: Adjust<Color>>(
281281
_: impl Ctx,
282282
#[implementations(
@@ -299,7 +299,7 @@ fn extract_channel<T: Adjust<Color>>(
299299
input
300300
}
301301

302-
#[node_macro::node(category("Raster"))]
302+
#[node_macro::node(category("Raster: Channels"))]
303303
fn make_opaque<T: Adjust<Color>>(
304304
_: impl Ctx,
305305
#[implementations(

node-graph/gcore/src/vector/vector_nodes.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ where
366366
result_table
367367
}
368368

369-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
369+
#[node_macro::node(category("Instancing"), path(graphene_core::vector))]
370370
async fn mirror<I: 'n + Send + Clone>(
371371
_: impl Ctx,
372372
#[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>)] instance: Instances<I>,
@@ -424,7 +424,7 @@ where
424424
result_table
425425
}
426426

427-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
427+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
428428
async fn round_corners(
429429
_: impl Ctx,
430430
source: VectorDataTable,
@@ -549,7 +549,7 @@ async fn round_corners(
549549
result_table
550550
}
551551

552-
#[node_macro::node(name("Merge by Distance"), category("Vector"), path(graphene_core::vector))]
552+
#[node_macro::node(name("Merge by Distance"), category("Vector: Modifier"), path(graphene_core::vector))]
553553
pub fn merge_by_distance(
554554
_: impl Ctx,
555555
vector_data: VectorDataTable,
@@ -694,7 +694,7 @@ pub fn merge_by_distance(
694694
result_table
695695
}
696696

697-
#[node_macro::node(category("Debug"), path(graphene_core::vector))]
697+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
698698
async fn box_warp(_: impl Ctx, vector_data: VectorDataTable, #[expose] rectangle: VectorDataTable) -> VectorDataTable {
699699
let Some((target, target_transform)) = rectangle.get(0).map(|rect| (rect.instance, rect.transform)) else {
700700
return vector_data;
@@ -783,7 +783,7 @@ fn bilinear_interpolate(t: DVec2, quad: &[DVec2; 4]) -> DVec2 {
783783
}
784784

785785
/// Automatically constructs tangents (Bézier handles) for anchor points in a vector path.
786-
#[node_macro::node(category("Vector"), name("Auto-Tangents"), path(graphene_core::vector))]
786+
#[node_macro::node(category("Vector: Modifier"), name("Auto-Tangents"), path(graphene_core::vector))]
787787
async fn auto_tangents(
788788
_: impl Ctx,
789789
source: VectorDataTable,
@@ -1018,7 +1018,7 @@ async fn auto_tangents(
10181018
// result_table
10191019
// }
10201020

1021-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1021+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
10221022
async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
10231023
let mut result_table = VectorDataTable::default();
10241024

@@ -1045,7 +1045,7 @@ async fn bounding_box(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTa
10451045
result_table
10461046
}
10471047

1048-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1048+
#[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
10491049
async fn dimensions(_: impl Ctx, vector_data: VectorDataTable) -> DVec2 {
10501050
vector_data
10511051
.instance_ref_iter()
@@ -1102,7 +1102,7 @@ async fn points_to_polyline(_: impl Ctx, mut points: VectorDataTable, #[default(
11021102
points
11031103
}
11041104

1105-
#[node_macro::node(category("Vector"), path(graphene_core::vector), properties("offset_path_properties"))]
1105+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector), properties("offset_path_properties"))]
11061106
async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, join: StrokeJoin, #[default(4.)] miter_limit: f64) -> VectorDataTable {
11071107
let mut result_table = VectorDataTable::default();
11081108

@@ -1146,7 +1146,7 @@ async fn offset_path(_: impl Ctx, vector_data: VectorDataTable, distance: f64, j
11461146
result_table
11471147
}
11481148

1149-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1149+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
11501150
async fn solidify_stroke(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
11511151
let mut result_table = VectorDataTable::default();
11521152

@@ -1314,7 +1314,7 @@ async fn sample_points(_: impl Ctx, vector_data: VectorDataTable, spacing: f64,
13141314
result_table
13151315
}
13161316

1317-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1317+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
13181318
async fn split_path(_: impl Ctx, mut vector_data: VectorDataTable, t_value: f64, parameterized_distance: bool, reverse: bool) -> VectorDataTable {
13191319
let euclidian = !parameterized_distance;
13201320

@@ -1355,7 +1355,7 @@ async fn split_path(_: impl Ctx, mut vector_data: VectorDataTable, t_value: f64,
13551355

13561356
/// Determines the position of a point on the path, given by its progress from 0 to 1 along the path.
13571357
/// 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.
1358-
#[node_macro::node(name("Position on Path"), category("Vector"), path(graphene_core::vector))]
1358+
#[node_macro::node(name("Position on Path"), category("Vector: Measure"), path(graphene_core::vector))]
13591359
async fn position_on_path(
13601360
_: impl Ctx,
13611361
/// The path to traverse.
@@ -1391,7 +1391,7 @@ async fn position_on_path(
13911391

13921392
/// Determines the angle of the tangent at a point on the path, given by its progress from 0 to 1 along the path.
13931393
/// 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.
1394-
#[node_macro::node(name("Tangent on Path"), category("Vector"), path(graphene_core::vector))]
1394+
#[node_macro::node(name("Tangent on Path"), category("Vector: Measure"), path(graphene_core::vector))]
13951395
async fn tangent_on_path(
13961396
_: impl Ctx,
13971397
/// The path to traverse.
@@ -1509,7 +1509,7 @@ async fn subpath_segment_lengths(_: impl Ctx, vector_data: VectorDataTable) -> V
15091509
.collect()
15101510
}
15111511

1512-
#[node_macro::node(name("Spline"), category("Vector"), path(graphene_core::vector))]
1512+
#[node_macro::node(name("Spline"), category("Vector: Modifier"), path(graphene_core::vector))]
15131513
async fn spline(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
15141514
let mut result_table = VectorDataTable::default();
15151515

@@ -1555,7 +1555,7 @@ async fn spline(_: impl Ctx, vector_data: VectorDataTable) -> VectorDataTable {
15551555
result_table
15561556
}
15571557

1558-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1558+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
15591559
async fn jitter_points(_: impl Ctx, vector_data: VectorDataTable, #[default(5.)] amount: f64, seed: SeedValue) -> VectorDataTable {
15601560
let mut result_table = VectorDataTable::default();
15611561

@@ -1608,7 +1608,7 @@ async fn jitter_points(_: impl Ctx, vector_data: VectorDataTable, #[default(5.)]
16081608
result_table
16091609
}
16101610

1611-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1611+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
16121612
async fn morph(_: impl Ctx, source: VectorDataTable, #[expose] target: VectorDataTable, #[default(0.5)] time: Fraction) -> VectorDataTable {
16131613
/// Subdivides the last segment of the bezpath to until it appends 'count' number of segments.
16141614
fn make_new_segments(bezpath: &mut BezPath, count: usize) {
@@ -1878,7 +1878,7 @@ fn bevel_algorithm(mut vector_data: VectorData, vector_data_transform: DAffine2,
18781878
vector_data
18791879
}
18801880

1881-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1881+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
18821882
fn bevel(_: impl Ctx, source: VectorDataTable, #[default(10.)] distance: Length) -> VectorDataTable {
18831883
let mut result_table = VectorDataTable::default();
18841884

@@ -1892,7 +1892,7 @@ fn bevel(_: impl Ctx, source: VectorDataTable, #[default(10.)] distance: Length)
18921892
result_table
18931893
}
18941894

1895-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1895+
#[node_macro::node(category("Vector: Modifier"), path(graphene_core::vector))]
18961896
fn close_path(_: impl Ctx, source: VectorDataTable) -> VectorDataTable {
18971897
let mut result_table = VectorDataTable::default();
18981898

@@ -1904,17 +1904,17 @@ fn close_path(_: impl Ctx, source: VectorDataTable) -> VectorDataTable {
19041904
result_table
19051905
}
19061906

1907-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1907+
#[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
19081908
fn point_inside(_: impl Ctx, source: VectorDataTable, point: DVec2) -> bool {
19091909
source.instance_iter().any(|instance| instance.instance.check_point_inside_shape(instance.transform, point))
19101910
}
19111911

1912-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1912+
#[node_macro::node(category("General"), path(graphene_core::vector))]
19131913
async fn count_elements<I>(_: impl Ctx, #[implementations(GraphicGroupTable, VectorDataTable, RasterDataTable<CPU>, RasterDataTable<GPU>)] source: Instances<I>) -> u64 {
19141914
source.instance_iter().count() as u64
19151915
}
19161916

1917-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1917+
#[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
19181918
async fn path_length(_: impl Ctx, source: VectorDataTable) -> f64 {
19191919
source
19201920
.instance_iter()
@@ -1932,7 +1932,7 @@ async fn path_length(_: impl Ctx, source: VectorDataTable) -> f64 {
19321932
.sum()
19331933
}
19341934

1935-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1935+
#[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
19361936
async fn area(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>) -> f64 {
19371937
let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context();
19381938
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<
19461946
.sum()
19471947
}
19481948

1949-
#[node_macro::node(category("Vector"), path(graphene_core::vector))]
1949+
#[node_macro::node(category("Vector: Measure"), path(graphene_core::vector))]
19501950
async fn centroid(ctx: impl Ctx + CloneVarArgs + ExtractAll, vector_data: impl Node<Context<'static>, Output = VectorDataTable>, centroid_type: CentroidType) -> DVec2 {
19511951
let new_ctx = OwnedContextImpl::from(ctx).with_footprint(Footprint::default()).into_context();
19521952
let vector_data = vector_data.eval(new_ctx).await;

node-graph/gstd/src/brush.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,9 @@ use graphene_core::raster_types::{CPU, Raster, RasterDataTable};
1212
use graphene_core::renderer::GraphicElementRendered;
1313
use graphene_core::transform::Transform;
1414
use graphene_core::value::ClonedNode;
15-
use graphene_core::vector::VectorDataTable;
1615
use graphene_core::vector::brush_stroke::{BrushStroke, BrushStyle};
1716
use graphene_core::{Ctx, GraphicElement, Node};
1817

19-
#[node_macro::node(category("Debug"))]
20-
fn vector_points(_: impl Ctx, vector_data: VectorDataTable) -> Vec<DVec2> {
21-
vector_data.instance_iter().flat_map(|element| element.instance.point_domain.positions().to_vec()).collect()
22-
}
23-
2418
#[derive(Clone, Copy, Debug, PartialEq)]
2519
pub struct BrushStampGenerator<P: Pixel + Alpha> {
2620
color: P,

node-graph/gstd/src/dehaze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use image::{DynamicImage, GenericImage, GenericImageView, GrayImage, ImageBuffer
66
use ndarray::{Array2, ArrayBase, Dim, OwnedRepr};
77
use std::cmp::{max, min};
88

9-
#[node_macro::node(category("Raster"))]
9+
#[node_macro::node(category("Raster: Filter"))]
1010
async fn dehaze(_: impl Ctx, image_frame: RasterDataTable<CPU>, strength: Percentage) -> RasterDataTable<CPU> {
1111
let mut result_table = RasterDataTable::default();
1212

node-graph/gstd/src/http.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use graphene_core::Ctx;
22

3-
#[node_macro::node(category("Network"))]
3+
#[node_macro::node(category("Web Request"))]
44
async fn get_request(_: impl Ctx, url: String) -> reqwest::Response {
55
reqwest::get(url).await.unwrap()
66
}
77

8-
#[node_macro::node(category("Network"))]
8+
#[node_macro::node(category("Web Request"))]
99
async fn post_request(_: impl Ctx, url: String, body: String) -> reqwest::Response {
1010
reqwest::Client::new().post(url).body(body).send().await.unwrap()
1111
}

node-graph/gstd/src/image_color_palette.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use graphene_core::raster_types::{CPU, RasterDataTable};
22
use graphene_core::{Color, Ctx};
33

4-
#[node_macro::node(category("Raster"))]
4+
#[node_macro::node(category("Color"))]
55
async fn image_color_palette(
66
_: impl Ctx,
77
image: RasterDataTable<CPU>,

node-graph/gstd/src/raster.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fn sample_image(ctx: impl ExtractFootprint + Clone + Send, image_frame: RasterDa
9191
result_table
9292
}
9393

94-
#[node_macro::node(category("Raster"))]
94+
#[node_macro::node(category("Raster: Channels"))]
9595
fn combine_channels(
9696
_: impl Ctx,
9797
_primary: (),
@@ -402,7 +402,7 @@ fn image_value(_: impl Ctx, _primary: (), image: RasterDataTable<CPU>) -> Raster
402402
// tiling: Tiling: bool,
403403
// }
404404

405-
#[node_macro::node(category("Raster"))]
405+
#[node_macro::node(category("Raster: Pattern"))]
406406
#[allow(clippy::too_many_arguments)]
407407
fn noise_pattern(
408408
ctx: impl ExtractFootprint + Ctx,
@@ -559,7 +559,7 @@ fn noise_pattern(
559559
result
560560
}
561561

562-
#[node_macro::node(category("Raster"))]
562+
#[node_macro::node(category("Raster: Pattern"))]
563563
fn mandelbrot(ctx: impl ExtractFootprint + Send) -> RasterDataTable<CPU> {
564564
let footprint = ctx.footprint();
565565
let viewport_bounds = footprint.viewport_bounds_in_local_space();

0 commit comments

Comments
 (0)