fix(stardust): clone models on load

This commit is contained in:
Nova
2022-09-11 17:57:49 -04:00
parent 35ab8db37c
commit bb65da77c7

View File

@@ -16,10 +16,10 @@ use send_wrapper::SendWrapper;
use std::fmt::Error; use std::fmt::Error;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use stereokit::enums::RenderLayer;
use stereokit::lifecycle::DrawContext; use stereokit::lifecycle::DrawContext;
use stereokit::material::Material; use stereokit::material::Material;
use stereokit::model::Model as SKModel; use stereokit::model::Model as SKModel;
use stereokit::render::RenderLayer;
use stereokit::texture::Texture; use stereokit::texture::Texture;
use stereokit::StereoKit; use stereokit::StereoKit;
@@ -79,6 +79,8 @@ impl Model {
.get() .get()
.and_then(|path| SKModel::from_file(sk, path.as_path(), None)) .and_then(|path| SKModel::from_file(sk, path.as_path(), None))
.map(SendWrapper::new) .map(SendWrapper::new)
.as_ref()
.cloned()
.ok_or(Error) .ok_or(Error)
}) })
.ok(); .ok();