From 654f524e9722785fc034b6a91422d5efa7552af4 Mon Sep 17 00:00:00 2001 From: Kayh Date: Sun, 10 Mar 2024 16:58:31 -0400 Subject: [PATCH] add register_extensions feature --- bevy_gltf_kun/Cargo.toml | 3 ++- bevy_gltf_kun/src/import/gltf/loader.rs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bevy_gltf_kun/Cargo.toml b/bevy_gltf_kun/Cargo.toml index 23fae2a..9e37dd8 100644 --- a/bevy_gltf_kun/Cargo.toml +++ b/bevy_gltf_kun/Cargo.toml @@ -12,6 +12,7 @@ default = ["export", "import", "omi_physics"] export = [] import = [] omi_physics = ["dep:bevy_xpbd_3d", "gltf_kun/omi_physics_body"] +register_extensions = [] [lints.clippy] type_complexity = "allow" @@ -20,8 +21,8 @@ type_complexity = "allow" bevy = { version = "0.13.0", default-features = false, features = ["animation", "bevy_asset", "bevy_scene", "bevy_pbr"] } glam.workspace = true gltf_kun.workspace = true +image = "0.24.9" serde_json.workspace = true thiserror.workspace = true bevy_xpbd_3d = { version = "0.4.2", optional = true } -image = "0.24.9" diff --git a/bevy_gltf_kun/src/import/gltf/loader.rs b/bevy_gltf_kun/src/import/gltf/loader.rs index 5e6345a..342e47d 100644 --- a/bevy_gltf_kun/src/import/gltf/loader.rs +++ b/bevy_gltf_kun/src/import/gltf/loader.rs @@ -104,7 +104,14 @@ where } fn extensions(&self) -> &[&str] { - &["gltf"] + #[cfg(feature = "register_extensions")] + { + &["gltf"] + } + #[cfg(not(feature = "register_extensions"))] + { + &[] + } } } @@ -177,6 +184,13 @@ where } fn extensions(&self) -> &[&str] { - &["glb"] + #[cfg(feature = "register_extensions")] + { + &["glb"] + } + #[cfg(not(feature = "register_extensions"))] + { + &[] + } } }