Struct EntityRecord
pub struct EntityRecord {
pub name: String,
pub transform: Transform,
pub renderable: Option<RenderableAsset>,
pub scripts: Vec<ScriptAttachment>,
pub camera: Option<CameraComponent>,
}Expand description
SceneFile/EntityRecord/RenderableAsset/RenderableKind live in libdqg::scene_file
so the standalone runtime player crate can deserialize the exact same scene format without
depending on this (egui/rfd-heavy) editor crate — see the export/compile implementation plan.
Fields§
§name: String§transform: Transform§renderable: Option<RenderableAsset>§scripts: Vec<ScriptAttachment>§camera: Option<CameraComponent>Implementations§
§impl EntityRecord
impl EntityRecord
pub fn spawn_into(
self,
world: &mut World,
renderer: Option<&Renderer<'_>>,
base_dir: &Path,
) -> (Entity, Option<RenderableAsset>)
pub fn spawn_into( self, world: &mut World, renderer: Option<&Renderer<'_>>, base_dir: &Path, ) -> (Entity, Option<RenderableAsset>)
Spawns this record into world: creates the entity with its saved name/transform, loads
its renderable (if any, resolved against base_dir — an editor project’s root, or an
exported game’s res/ directory) via RenderableAsset::load, and copies over its
scripts/camera components verbatim (starting the scripts is a separate step — see
crate::scripting::ScriptRuntime::start_all_scripts). A renderable load failure is
reported to stderr and leaves the entity without one, rather than failing the whole spawn.
Returns the spawned entity plus the RenderableAsset if one loaded successfully — the
editor’s asset-tracking map needs it back for re-saving; other callers can ignore it.
Trait Implementations§
§impl<'de> Deserialize<'de> for EntityRecord
impl<'de> Deserialize<'de> for EntityRecord
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EntityRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EntityRecord, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for EntityRecord
impl Serialize for EntityRecord
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for EntityRecord
impl RefUnwindSafe for EntityRecord
impl Send for EntityRecord
impl Sync for EntityRecord
impl Unpin for EntityRecord
impl UnsafeUnpin for EntityRecord
impl UnwindSafe for EntityRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more