@@ -535,10 +535,10 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
535535 inputs: vec![ NodeInput :: import( generic!( T ) , 4 ) , NodeInput :: node( NodeId ( 8 ) , 0 ) ] ,
536536 ..Default :: default ( )
537537 } ,
538- // 11: Switch (closed → count, open → count - 1 as denominator)
538+ // 11: Switch (closed → count, open → max( count - 1, 1) as denominator)
539539 DocumentNode {
540540 implementation: DocumentNodeImplementation :: ProtoNode ( logic:: switch:: IDENTIFIER ) ,
541- inputs: vec![ NodeInput :: node( NodeId ( 10 ) , 0 ) , NodeInput :: node( NodeId ( 17 ) , 0 ) , NodeInput :: node( NodeId ( 5 ) , 0 ) ] ,
541+ inputs: vec![ NodeInput :: node( NodeId ( 10 ) , 0 ) , NodeInput :: node( NodeId ( 17 ) , 0 ) , NodeInput :: node( NodeId ( 18 ) , 0 ) ] ,
542542 ..Default :: default ( )
543543 } ,
544544 // 12: Divide (local_index / denominator = within-subpath fraction)
@@ -583,6 +583,12 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
583583 inputs: vec![ NodeInput :: node( NodeId ( 3 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 1. ) , false ) ] ,
584584 ..Default :: default ( )
585585 } ,
586+ // 18: Max (clamp open-path denominator to at least 1 to avoid division by zero when count = 1)
587+ DocumentNode {
588+ implementation: DocumentNodeImplementation :: ProtoNode ( math_nodes:: max:: IDENTIFIER ) ,
589+ inputs: vec![ NodeInput :: node( NodeId ( 5 ) , 0 ) , NodeInput :: value( TaggedValue :: F64 ( 1. ) , false ) ] ,
590+ ..Default :: default ( )
591+ } ,
586592 ]
587593 . into_iter( )
588594 . enumerate( )
@@ -703,7 +709,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
703709 // 11: Switch (denominator)
704710 DocumentNodeMetadata {
705711 persistent_metadata: DocumentNodePersistentMetadata {
706- node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 23 , 12 ) ) ,
712+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 30 , 12 ) ) ,
707713 ..Default :: default ( )
708714 } ,
709715 ..Default :: default ( )
@@ -756,6 +762,14 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
756762 } ,
757763 ..Default :: default ( )
758764 } ,
765+ // 18: Max (clamp open-path denominator)
766+ DocumentNodeMetadata {
767+ persistent_metadata: DocumentNodePersistentMetadata {
768+ node_type_metadata: NodeTypePersistentMetadata :: node( IVec2 :: new( 23 , 14 ) ) ,
769+ ..Default :: default ( )
770+ } ,
771+ ..Default :: default ( )
772+ } ,
759773 ]
760774 . into_iter( )
761775 . enumerate( )
0 commit comments