| 834 | node.script_vars.as_ref(), |
| 835 | script_defs, |
| 836 | index, |
| 837 | ); |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | struct NodeRefValidationCtx<'a> { |
| 842 | project_dir: &'a Path, |
| 843 | file: &'a Path, |
| 844 | node_types: &'a HashMap<String, NodeType>, |
| 845 | report: &'a mut ValidationReport, |
| 846 | } |
| 847 | |
| 848 | fn validate_builtin_node_ref_fields( |
| 849 | ctx: &mut NodeRefValidationCtx<'_>, |
| 850 | node_name: &str, |
| 851 | data: &SceneNodeData, |
| 852 | ) { |
| 853 | for (field_name, value) in data.fields.iter() { |
| 854 | let Some(field) = perro_scene::scene_node_field(data.node_type, field_name.as_ref()) else { |
| 855 | continue; |
| 856 | }; |
| 857 | validate_scene_value_node_ref_hint( |
| 858 | ctx, |
| 859 | &format!("{node_name}.{}", field.name), |
| 860 | value, |
| 861 | &field.ty, |
| 862 | ); |
| 863 | } |
| 864 | if let Some(base) = data.base_ref() { |
| 865 | validate_builtin_node_ref_fields(ctx, node_name, base); |
| 866 | } |
| 867 | } |