Blacksite/crates/editor/src/assets/thumbnails/sources/mod.rs
Rbanh 0553a85220
Some checks are pending
CI / Format, lint, test, build (push) Waiting to run
Build production-ready editor authoring workflows
2026-07-11 12:41:04 -04:00

34 lines
836 B
Rust

//! Model file sources for the thumbnail render studio.
mod fbx;
pub(crate) mod gltf;
pub use fbx::FbxThumbnailSource;
pub use gltf::{gltf_skinned_primitive_labels, GltfThumbnailSource};
use bevy::prelude::*;
/// Spawns untextured or scene-root preview content under `root` for the thumbnail studio.
pub trait ThumbnailModelSource: Send + Sync {
fn spawn_preview(
&self,
commands: &mut Commands,
meshes: &mut Assets<Mesh>,
materials: &mut Assets<StandardMaterial>,
root: Entity,
catalog_path: &str,
) -> bool;
}
pub fn source_for_extension(path: &str) -> Option<&'static dyn ThumbnailModelSource> {
if path.ends_with(".fbx") {
Some(&FbxThumbnailSource)
} else {
None
}
}
pub fn uses_scene_root(path: &str) -> bool {
!path.ends_with(".fbx")
}