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

Function asset_kind_for_path

perro_editor/res/scripts/scene/editor_nodes.rs:862–894  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

860pub fn asset_node_template(
861 path: &str,
862 glb_mesh_index: usize,
863 _glb_mat_index: usize,
864) -> Option<(&'static str, Option<(&'static str, String)>)> {
865 if path.ends_with(".rs") {
866 return Some(("Node", Some(("script", path.to_string()))));
867 }
868 if path.ends_with(".scn") {
869 return Some(("Node", Some(("root_of", path.to_string()))));
870 }
871 if path.ends_with(".panim") {
872 return Some(("AnimationPlayer", Some(("animation", path.to_string()))));
873 }
874 if path.ends_with(".panimtree") {
875 return Some(("AnimationTree", Some(("tree", path.to_string()))));
876 }
877 if path.ends_with(".glb") || path.ends_with(".gltf") {
878 return Some((
879 "MeshInstance3D",
880 Some(("mesh", format!("{path}:mesh[{glb_mesh_index}]"))),
881 ));
882 }
883 if path.ends_with(".pmesh") || path.ends_with(".obj") || path.ends_with(".fbx") {
884 return Some(("MeshInstance3D", Some(("mesh", path.to_string()))));
885 }
886 if path.ends_with(".pmat") {
887 return Some(("MeshInstance3D", Some(("material", path.to_string()))));
888 }
889 if path.ends_with(".ppart") {
890 return Some(("ParticleEmitter3D", Some(("profile", path.to_string()))));
891 }
892 if path.ends_with(".ptileset") {
893 return Some(("TileMap2D", Some(("tileset", path.to_string()))));
894 }
895 if path.ends_with(".pskel") || path.ends_with(".pskel2d") {
896 return Some(("Skeleton2D", Some(("skeleton", path.to_string()))));
897 }

Callers 1

asset_binding_for_nodeFunction · 0.85

Calls 1

kind_labelFunction · 0.85

Tested by

no test coverage detected