From 26a0b901d44de94b36c4c5bec136540e3826db19 Mon Sep 17 00:00:00 2001 From: YohYamasaki <74522538+YohYamasaki@users.noreply.github.com> Date: Thu, 11 Jun 2026 07:36:43 +0200 Subject: [PATCH] Unify the gradient chain lookup used by the stops and attribute reads (#4223) --- .../tool/common_functionality/graph_modification_utils.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs index 709f3fa1da..266564c713 100644 --- a/editor/src/messages/tool/common_functionality/graph_modification_utils.rs +++ b/editor/src/messages/tool/common_functionality/graph_modification_utils.rs @@ -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 { + 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))) }