SuperDex Physics C++ API
Loading...
Searching...
No Matches
superdex::prefab::PrefabReference Struct Reference

Reference to another prefab (scene or actor) for prefab nesting. More...

#include <mochi_prefab.h>

Public Member Functions

bool operator== (PrefabReference const &) const =default

Public Attributes

std::optional< DynamicString > comment = std::nullopt
 Optional serialized comment.
DynamicString name {}
 Name of the nested prefab instance.
DynamicString path {}
 Path to the nested prefab file.
PrefabHandle prefab {}
 Handle to the loaded nested prefab.
Quaternion rotation {}
 Rotation quaternion [x, y, z, w] of the nested prefab in the parent's local space.
real scale = 1_r
 Uniform scale of the nested prefab, relative to the parent prefab.
Real3 translation {}
 Translation [x, y, z] of the nested prefab in the parent's local space.

Detailed Description

Reference to another prefab (scene or actor) for prefab nesting.

Definition at line 286 of file mochi_prefab.h.

Member Function Documentation

◆ operator==()

bool superdex::prefab::PrefabReference::operator== ( PrefabReference const & ) const
default

Member Data Documentation

◆ comment

std::optional<DynamicString> superdex::prefab::PrefabReference::comment = std::nullopt

Optional serialized comment.

Definition at line 287 of file mochi_prefab.h.

◆ name

DynamicString superdex::prefab::PrefabReference::name {}

Name of the nested prefab instance.

Used to format the names of nested actors in the form "prefabName/actorName".

Note
Name-reference ambiguity is evaluated per nested subtree. A nested prefab's own name-based references resolve within its own instance first, so a name reused across independent sibling instances is not ambiguous for each instance's internal references. It becomes ambiguous only for a reference written at the enclosing (parent) scope or above.

Definition at line 288 of file mochi_prefab.h.

◆ path

DynamicString superdex::prefab::PrefabReference::path {}

Path to the nested prefab file.

If non-empty, LoadNestedPrefabs reloads the prefab from this path on every call. EnsureFullyLoaded loads it from this path only if the reference does not already contain a loaded prefab. If empty, both functions require the reference to already contain a loaded prefab; they keep that prefab and load all prefabs nested within it.

Note
A reference created with the Python constructor needs a non-empty path before loading because the constructor cannot accept a loaded prefab. C++ callers may instead assign a loaded prefab directly and leave this path empty.
Warning
The loaded prefab is not serialized. After deserialization, an empty-path reference has no loaded prefab and is rejected by LoadNestedPrefabs and EnsureFullyLoaded. Set a non-empty path before saving if the reference must remain loadable after deserialization.

Definition at line 289 of file mochi_prefab.h.

◆ prefab

PrefabHandle superdex::prefab::PrefabReference::prefab {}

Handle to the loaded nested prefab.

Runtime state, populated at load time and never serialized.

Note
C++ callers may set this handle and leave PrefabReference::path empty. LoadNestedPrefabs and EnsureFullyLoaded then keep this prefab and load all prefabs nested within it instead of loading this reference from a file.

Definition at line 295 of file mochi_prefab.h.

◆ rotation

Quaternion superdex::prefab::PrefabReference::rotation {}

Rotation quaternion [x, y, z, w] of the nested prefab in the parent's local space.

Note
Must be finite and non-zero.

Definition at line 291 of file mochi_prefab.h.

◆ scale

real superdex::prefab::PrefabReference::scale = 1_r

Uniform scale of the nested prefab, relative to the parent prefab.

The scale applied to this nested prefab is this value multiplied by PrefabParams::scale and each enclosing PrefabReference::scale. See PrefabParams::scale for what scaling affects.

Note
Set this value before loading shapes. If changed later, call LoadShapes on the top-level ScenePrefab before adding it to a Scene.
Must be strictly positive and finite. Negative or zero scale is invalid and rejected at AddToScene.
See also
PrefabParams::scale

Definition at line 290 of file mochi_prefab.h.

◆ translation

Real3 superdex::prefab::PrefabReference::translation {}

Translation [x, y, z] of the nested prefab in the parent's local space.

Note
Must be finite.

Definition at line 292 of file mochi_prefab.h.


The documentation for this struct was generated from the following files: