mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 02:18:11 +08:00
Adopt master's list length name for the element count node
This commit is contained in:
@@ -356,7 +356,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
|||||||
},
|
},
|
||||||
// 1: Count Elements (number of subpaths)
|
// 1: Count Elements (number of subpaths)
|
||||||
NodeTemplate {
|
NodeTemplate {
|
||||||
implementation: NodeTemplateImplementation::ProtoNode(vector::count_elements::IDENTIFIER),
|
implementation: NodeTemplateImplementation::ProtoNode(vector::list_length::IDENTIFIER),
|
||||||
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
inputs: vec![NodeInput::node(NodeId(0), 0)],
|
||||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(2, 2)),
|
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(2, 2)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
|||||||
aliases: &["graphene_core::vector::ClosePathNode"],
|
aliases: &["graphene_core::vector::ClosePathNode"],
|
||||||
},
|
},
|
||||||
NodeReplacement {
|
NodeReplacement {
|
||||||
node: graphene_std::vector::count_elements::IDENTIFIER,
|
node: graphene_std::vector::list_length::IDENTIFIER,
|
||||||
aliases: &["graphene_core::vector::CountElementsNode"],
|
aliases: &["graphene_core::vector::CountElementsNode"],
|
||||||
},
|
},
|
||||||
NodeReplacement {
|
NodeReplacement {
|
||||||
@@ -2484,7 +2484,7 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create List Length node: counts content `List` items → N
|
// Create List Length node: counts content `List` items → N
|
||||||
let Some(list_length_def) = resolve_document_node_type(&DefinitionIdentifier::ProtoNode(graphene_std::vector::count_elements::IDENTIFIER)) else {
|
let Some(list_length_def) = resolve_document_node_type(&DefinitionIdentifier::ProtoNode(graphene_std::vector::list_length::IDENTIFIER)) else {
|
||||||
log::error!("Could not get list_length node from definition when upgrading morph");
|
log::error!("Could not get list_length node from definition when upgrading morph");
|
||||||
document.network_interface.set_input(&InputConnector::node_at_index(*node_id, 1), old_inputs[1].clone(), network_path);
|
document.network_interface.set_input(&InputConnector::node_at_index(*node_id, 1), old_inputs[1].clone(), network_path);
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
@@ -3735,7 +3735,7 @@ fn point_inside(_: impl Ctx, source: IList<Vector>, point: DVec2) -> bool {
|
|||||||
// TODO: Return u32, u64, or usize instead of f64 after #1621 is resolved and has allowed us to implement automatic type conversion in the node graph for nodes with generic type inputs.
|
// TODO: Return u32, u64, or usize instead of f64 after #1621 is resolved and has allowed us to implement automatic type conversion in the node graph for nodes with generic type inputs.
|
||||||
// TODO: (Currently automatic type conversion only works for concrete types, via the Graphene preprocessor and not the full Graphene type system.)
|
// TODO: (Currently automatic type conversion only works for concrete types, via the Graphene preprocessor and not the full Graphene type system.)
|
||||||
#[node_macro::node(category("General"), path(graphene_core::vector))]
|
#[node_macro::node(category("General"), path(graphene_core::vector))]
|
||||||
fn count_elements<T: Clone + Send + Sync + CacheHash + 'static>(_: impl Ctx, #[implementations(Graphic, Artboard, Vector, Raster<CPU>, Color, Gradient, String)] content: IList<T>) -> f64 {
|
fn list_length<T: Clone + Send + Sync + CacheHash + 'static>(_: impl Ctx, #[implementations(Graphic, Artboard, Vector, Raster<CPU>, Color, Gradient, String)] content: IList<T>) -> f64 {
|
||||||
content.len() as f64
|
content.len() as f64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user