mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-05 17:28:12 +08:00
Unify the gradient chain lookup used by the stops and attribute reads (#4223)
This commit is contained in:
@@ -283,9 +283,11 @@ pub fn gradient_chain_target_input(layer: LayerNodeIdentifier, network_interface
|
|||||||
|
|
||||||
/// Try to find a "Gradient Value" node that is connected to a "Fill" node, or to a layer directly.
|
/// Try to find a "Gradient Value" node that is connected to a "Fill" node, or to a layer directly.
|
||||||
pub fn get_upstream_gradient_value_node_id(layer: LayerNodeIdentifier, network_interface: &NodeNetworkInterface) -> Option<NodeId> {
|
pub fn get_upstream_gradient_value_node_id(layer: LayerNodeIdentifier, network_interface: &NodeNetworkInterface) -> Option<NodeId> {
|
||||||
|
let target_input = gradient_chain_target_input(layer, network_interface);
|
||||||
|
let walk_from = network_interface.upstream_output_connector(&target_input, &[])?.node_id()?;
|
||||||
|
|
||||||
network_interface
|
network_interface
|
||||||
.upstream_flow_back_from_nodes(vec![layer.to_node()], &[], FlowType::UpstreamFlow)
|
.upstream_flow_back_from_nodes(vec![walk_from], &[], FlowType::HorizontalFlow)
|
||||||
.skip(1)
|
|
||||||
.take_while(|node_id| !network_interface.is_layer(node_id, &[]))
|
.take_while(|node_id| !network_interface.is_layer(node_id, &[]))
|
||||||
.find(|node_id| network_interface.reference(node_id, &[]).as_ref() == Some(&DefinitionIdentifier::ProtoNode(graphene_std::math_nodes::gradient_value::IDENTIFIER)))
|
.find(|node_id| network_interface.reference(node_id, &[]).as_ref() == Some(&DefinitionIdentifier::ProtoNode(graphene_std::math_nodes::gradient_value::IDENTIFIER)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user