Unify the gradient chain lookup used by the stops and attribute reads (#4223)

This commit is contained in:
YohYamasaki
2026-06-11 07:36:43 +02:00
committed by GitHub
parent 97324cd852
commit 26a0b901d4

View File

@@ -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)))
}