| 801 | doc: &SceneDoc, |
| 802 | index: &ScriptDoctorIndex, |
| 803 | report: &mut ValidationReport, |
| 804 | ) { |
| 805 | let node_types = doc |
| 806 | .scene |
| 807 | .nodes |
| 808 | .iter() |
| 809 | .map(|node| { |
| 810 | ( |
| 811 | doc.scene.key_name_or_id(node.key).to_string(), |
| 812 | node.data.node_type, |
| 813 | ) |
| 814 | }) |
| 815 | .collect::<HashMap<_, _>>(); |
| 816 | for node in doc.scene.nodes.iter() { |
| 817 | let node_name = doc.scene.key_name_or_id(node.key).to_string(); |
| 818 | let script_defs = node |
| 819 | .script |
| 820 | .as_deref() |
| 821 | .and_then(|raw| resolve_script_virtual_ref_path(project_dir, file, raw)) |
| 822 | .and_then(|path| index.script_state_field_defs.get(&path)); |
| 823 | let mut ctx = NodeRefValidationCtx { |
| 824 | project_dir, |
| 825 | file, |
| 826 | node_types: &node_types, |
| 827 | report, |
| 828 | }; |
| 829 | validate_builtin_node_ref_fields(&mut ctx, &node_name, &node.data); |
| 830 | validate_script_var_node_ref_fields( |
| 831 | &mut ctx, |
| 832 | &node_name, |
| 833 | node.script.as_deref(), |
| 834 | node.script_vars.as_ref(), |
| 835 | script_defs, |
| 836 | index, |
| 837 | ); |