mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +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.
|
||||
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
|
||||
.upstream_flow_back_from_nodes(vec![layer.to_node()], &[], FlowType::UpstreamFlow)
|
||||
.skip(1)
|
||||
.upstream_flow_back_from_nodes(vec![walk_from], &[], FlowType::HorizontalFlow)
|
||||
.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)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user