mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Replace the 'Vec2 to Point' node with automatic conversion machinery (#4236)
* Replace the 'Vec2 to Point' node with an 'As Vector' node and automatic conversion * Accept a Vec2 as content for the Wrap Graphic node * Rename the type-assertion nodes from 'To' to 'As' * Fix the Transform node reversing a Vec2 input's direction * Fix text migration bug
This commit is contained in:
@@ -787,9 +787,9 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
inputs: vec![NodeInput::node(NodeId(1), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
// 3: Vec2 to Point
|
||||
// 3: As Vector (auto-converts the decomposed translation into a single-anchor List<Vector>)
|
||||
DocumentNode {
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector_nodes::vec_2_to_point::IDENTIFIER),
|
||||
implementation: DocumentNodeImplementation::ProtoNode(vector::as_vector::IDENTIFIER),
|
||||
inputs: vec![NodeInput::node(NodeId(2), 0)],
|
||||
..Default::default()
|
||||
},
|
||||
@@ -858,7 +858,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
// 3: Vec2 to Point
|
||||
// 3: As Vector
|
||||
DocumentNodeMetadata {
|
||||
persistent_metadata: DocumentNodePersistentMetadata {
|
||||
node_type_metadata: NodeTypePersistentMetadata::node(IVec2::new(21, 1)),
|
||||
|
||||
@@ -404,16 +404,16 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
aliases: &["graphene_math_nodes::TangentInverseNode", "graphene_core::ops::TangentInverseNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::math_nodes::to_f_64::IDENTIFIER,
|
||||
aliases: &["graphene_math_nodes::ToF64Node", "graphene_core::ops::ToF64Node"],
|
||||
node: graphene_std::math_nodes::as_f_64::IDENTIFIER,
|
||||
aliases: &["graphene_math_nodes::ToF64Node", "graphene_core::ops::ToF64Node", "math_nodes::ToF64Node"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::math_nodes::to_u_32::IDENTIFIER,
|
||||
node: graphene_std::math_nodes::as_u_32::IDENTIFIER,
|
||||
aliases: &["graphene_math_nodes::ToU32Node", "graphene_core::ops::ToU32Node", "math_nodes::ToU32Node"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::math_nodes::to_u_64::IDENTIFIER,
|
||||
aliases: &["graphene_math_nodes::ToU64Node", "graphene_core::ops::ToU64Node"],
|
||||
node: graphene_std::math_nodes::as_u_64::IDENTIFIER,
|
||||
aliases: &["graphene_math_nodes::ToU64Node", "graphene_core::ops::ToU64Node", "math_nodes::ToU64Node"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::math_nodes::vec_2_value::IDENTIFIER,
|
||||
@@ -676,8 +676,8 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
aliases: &["graphene_core::logic::SwitchNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::text_nodes::to_string::IDENTIFIER,
|
||||
aliases: &["graphene_core::logic::ToStringNode"],
|
||||
node: graphene_std::text_nodes::as_string::IDENTIFIER,
|
||||
aliases: &["graphene_core::logic::ToStringNode", "text_nodes::ToStringNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::text_nodes::json::query_json::IDENTIFIER,
|
||||
@@ -958,11 +958,12 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
||||
aliases: &["graphene_core::vector::TangentOnPathNode"],
|
||||
},
|
||||
NodeReplacement {
|
||||
node: graphene_std::vector::vec_2_to_point::IDENTIFIER,
|
||||
node: graphene_std::vector::as_vector::IDENTIFIER,
|
||||
aliases: &[
|
||||
"graphene_core::vector::vector_nodes::PositionToPointNode",
|
||||
"graphene_core::vector::PositionToPointNode",
|
||||
"graphene_core::vector::Vec2ToPointNode",
|
||||
"core_types::vector::Vec2ToPointNode",
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -1574,6 +1575,8 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
|
||||
for i in 10..=12 {
|
||||
document.network_interface.set_input(&InputConnector::node(*node_id, i), old_inputs[i - 2].clone(), network_path);
|
||||
}
|
||||
|
||||
inputs_count = 13;
|
||||
}
|
||||
|
||||
// Upgrade Sine, Cosine, and Tangent nodes to include a boolean input for whether the output should be in radians, which was previously the only option but is now not the default
|
||||
|
||||
Reference in New Issue
Block a user