@@ -172,51 +172,62 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageContext<'_>> for
172172 network_interface. move_layer_to_stack ( layer, parent, insert_index, & [ ] ) ;
173173 responses. add ( NodeGraphMessage :: RunDocumentGraph ) ;
174174 }
175- GraphOperationMessage :: NewBlendShapesLayer {
175+ GraphOperationMessage :: NewInterpolationLayer {
176176 id,
177- blend_path_id ,
177+ control_path_id ,
178178 parent,
179179 insert_index,
180- count ,
180+ blend_count ,
181181 } => {
182182 let mut modify_inputs = ModifyInputsContext :: new ( network_interface, responses) ;
183183 let layer = modify_inputs. create_layer ( id) ;
184- let blend_shapes_node_id = modify_inputs. insert_blend_shapes_data ( layer, count as f64 ) ;
185- let blend_path_layer = modify_inputs. create_layer ( blend_path_id) ;
186- let path_node_id = modify_inputs. insert_blend_path_data ( blend_path_layer) ;
184+
185+ // Insert the main chain node (Blend Shapes or Morph) depending on whether a blend count is provided
186+ let ( chain_node_id, layer_alias, path_alias) = if let Some ( count) = blend_count {
187+ ( modify_inputs. insert_blend_shapes_data ( layer, count as f64 ) , "Blend Shape" , "Blend Path" )
188+ } else {
189+ ( modify_inputs. insert_morph_data ( layer) , "Morph" , "Morph Path" )
190+ } ;
191+
192+ // Create the control path layer (Path → Auto-Tangents → Origins to Polyline)
193+ let control_path_layer = modify_inputs. create_layer ( control_path_id) ;
194+ let path_node_id = modify_inputs. insert_control_path_data ( control_path_layer) ;
187195
188196 network_interface. move_layer_to_stack ( layer, parent, insert_index, & [ ] ) ;
189- network_interface. move_layer_to_stack ( blend_path_layer , parent, insert_index + 1 , & [ ] ) ;
197+ network_interface. move_layer_to_stack ( control_path_layer , parent, insert_index + 1 , & [ ] ) ;
190198
191- // Connect the Path node's output to the Blend Shapes node's Path parameter input (input 4).
199+ // Connect the Path node's output to the chain node's path parameter input (input 4 for both Morph and Blend Shapes ).
192200 // Done after move_layer_to_stack so chain nodes have correct positions when converted to absolute.
193- network_interface. set_input ( & InputConnector :: node ( blend_shapes_node_id , 4 ) , NodeInput :: node ( path_node_id, 0 ) , & [ ] ) ;
201+ network_interface. set_input ( & InputConnector :: node ( chain_node_id , 4 ) , NodeInput :: node ( path_node_id, 0 ) , & [ ] ) ;
194202
195203 responses. add ( NodeGraphMessage :: SetDisplayNameImpl {
196204 node_id : id,
197- alias : "Blend Shape" . to_string ( ) ,
205+ alias : layer_alias . to_string ( ) ,
198206 } ) ;
199207 responses. add ( NodeGraphMessage :: SetDisplayNameImpl {
200- node_id : blend_path_id ,
201- alias : "Blend Path" . to_string ( ) ,
208+ node_id : control_path_id ,
209+ alias : path_alias . to_string ( ) ,
202210 } ) ;
203211 }
204- GraphOperationMessage :: ConnectBlendPathToChildren { blend_shape_id, blend_path_id } => {
205- // Find the Blend Shapes node (first in chain of the Blend Shape layer)
206- let Some ( OutputConnector :: Node { node_id : chain_node, .. } ) = network_interface. upstream_output_connector ( & InputConnector :: node ( blend_shape_id, 1 ) , & [ ] ) else {
207- log:: error!( "Could not find Blend Shapes chain node for layer {blend_shape_id}" ) ;
212+ GraphOperationMessage :: ConnectInterpolationControlPathToChildren {
213+ interpolation_layer_id,
214+ control_path_id,
215+ } => {
216+ // Find the chain node (Morph or Blend Shapes, first in chain of the layer)
217+ let Some ( OutputConnector :: Node { node_id : chain_node, .. } ) = network_interface. upstream_output_connector ( & InputConnector :: node ( interpolation_layer_id, 1 ) , & [ ] ) else {
218+ log:: error!( "Could not find chain node for layer {interpolation_layer_id}" ) ;
208219 return ;
209220 } ;
210221
211- // Get what feeds into the Blend Shapes node's primary input (the children stack)
222+ // Get what feeds into the chain node's primary input (the children stack)
212223 let Some ( OutputConnector :: Node { node_id : children_id, output_index } ) = network_interface. upstream_output_connector ( & InputConnector :: node ( chain_node, 0 ) , & [ ] ) else {
213- log:: error!( "Could not find children stack feeding Blend Shapes node {chain_node}" ) ;
224+ log:: error!( "Could not find children stack feeding chain node {chain_node}" ) ;
214225 return ;
215226 } ;
216227
217- // Find the deepest node in the Blend Path layer's chain (Origins to Polyline)
228+ // Find the deepest node in the control path layer's chain (Origins to Polyline)
218229 let mut deepest_chain_node = None ;
219- let mut current_connector = InputConnector :: node ( blend_path_id , 1 ) ;
230+ let mut current_connector = InputConnector :: node ( control_path_id , 1 ) ;
220231 while let Some ( OutputConnector :: Node { node_id, .. } ) = network_interface. upstream_output_connector ( & current_connector, & [ ] ) {
221232 deepest_chain_node = Some ( node_id) ;
222233 current_connector = InputConnector :: node ( node_id, 0 ) ;
@@ -225,25 +236,13 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageContext<'_>> for
225236 // Connect children to the deepest chain node's input 0 (or the layer's input 1 if no chain)
226237 let target_connector = match deepest_chain_node {
227238 Some ( node_id) => InputConnector :: node ( node_id, 0 ) ,
228- None => InputConnector :: node ( blend_path_id , 1 ) ,
239+ None => InputConnector :: node ( control_path_id , 1 ) ,
229240 } ;
230241 network_interface. set_input ( & target_connector, NodeInput :: node ( children_id, output_index) , & [ ] ) ;
231242
232243 // Shift the child stack (topmost child only, the rest follow) down 3 and left 10
233244 network_interface. shift_node ( & children_id, IVec2 :: new ( -10 , 3 ) , & [ ] ) ;
234245 }
235- GraphOperationMessage :: NewMorphLayer { id, parent, insert_index } => {
236- let mut modify_inputs = ModifyInputsContext :: new ( network_interface, responses) ;
237- let layer = modify_inputs. create_layer ( id) ;
238- modify_inputs. insert_morph_data ( layer) ;
239- network_interface. move_layer_to_stack ( layer, parent, insert_index, & [ ] ) ;
240-
241- responses. add ( NodeGraphMessage :: SetDisplayNameImpl {
242- node_id : id,
243- alias : "Morph" . to_string ( ) ,
244- } ) ;
245- responses. add ( NodeGraphMessage :: RunDocumentGraph ) ;
246- }
247246 GraphOperationMessage :: NewBooleanOperationLayer { id, operation, parent, insert_index } => {
248247 let mut modify_inputs = ModifyInputsContext :: new ( network_interface, responses) ;
249248 let layer = modify_inputs. create_layer ( id) ;
0 commit comments