MCPcopy Create free account
hub / github.com/PerroEngine/Perro / validate_node_refs

Function validate_node_refs

perro_source/core/perro_animation/src/anim_tree.rs:502–526  ·  view source on GitHub ↗
(node: &AnimationTreeGraphNode, keys: &HashSet<String>)

Source from the content-addressed store, hash-verified

500}
501
502fn validate_node_refs(node: &AnimationTreeGraphNode, keys: &HashSet<String>) -> Result<(), String> {
503 let check = |value: &str| {
504 if keys.contains(value) {
505 Ok(())
506 } else {
507 Err(format!("unknown animation tree ref `@{value}`"))
508 }
509 };
510 match &node.kind {
511 AnimationTreeNodeKind::Blend { inputs, .. } => {
512 for input in inputs.iter() {
513 check(input.as_ref())?;
514 }
515 Ok(())
516 }
517 AnimationTreeNodeKind::Add { base, inputs, .. } => {
518 check(base.as_ref())?;
519 for input in inputs.iter() {
520 check(input.as_ref())?;
521 }
522 Ok(())
523 }
524 AnimationTreeNodeKind::Invert { input, .. } => check(input.as_ref()),
525 }
526}
527
528#[cfg(test)]
529mod tests {

Callers 1

parseMethod · 0.85

Calls 3

containsMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected