feat(resources): list of extensions to check

This commit is contained in:
Nova
2022-12-05 22:44:04 -05:00
parent 3598ffdbb1
commit b9baee7e5f
3 changed files with 35 additions and 16 deletions

View File

@@ -13,6 +13,7 @@ use send_wrapper::SendWrapper;
use serde::Deserialize;
use stardust_xr::schemas::flex::deserialize;
use stardust_xr::values::Transform;
use std::ffi::OsStr;
use std::fmt::Error;
use std::path::PathBuf;
use std::sync::Arc;
@@ -70,6 +71,7 @@ impl Model {
.base_resource_prefixes
.lock()
.clone(),
&[OsStr::new("glb"), OsStr::new("gltf")],
)
.ok_or_else(|| eyre!("Resource not found"))?,
);

View File

@@ -14,7 +14,7 @@ use prisma::{Flatten, Rgb, Rgba};
use send_wrapper::SendWrapper;
use serde::Deserialize;
use stardust_xr::{schemas::flex::deserialize, values::Transform};
use std::{path::PathBuf, sync::Arc};
use std::{ffi::OsStr, path::PathBuf, sync::Arc};
use stereokit::{
font::Font,
lifecycle::DrawContext,
@@ -66,8 +66,12 @@ impl Text {
let client = node.get_client().ok_or_else(|| eyre!("Client not found"))?;
let text = TEXT_REGISTRY.add(Text {
space: node.spatial.get().unwrap().clone(),
font_path: font_resource_id
.and_then(|res| res.get_file(&client.base_resource_prefixes.lock().clone())),
font_path: font_resource_id.and_then(|res| {
res.get_file(
&client.base_resource_prefixes.lock().clone(),
&[OsStr::new("ttf"), OsStr::new("otf")],
)
}),
style: OnceCell::new(),
data: Mutex::new(TextData {