Karana.KUtils.kdpy_model_io#
Load and identify serialized kdFlex models for the kdpy launcher.
The launcher accepts one --from-model path without requiring the user to
name its serialized root type. This module owns that probing policy and
normalizes every successful load into LoadedModel, allowing the rest
of kdpy to work with one small interface.
Attributes#
Classes#
Normalize a successfully loaded root model for launcher orchestration. |
Functions#
|
Load the first supported kdFlex model type that accepts the file. |
Module Contents#
- class Karana.KUtils.kdpy_model_io.LoadedModel[source]#
Normalize a successfully loaded root model for launcher orchestration.
state_targetis the object reset from--from-state. It may be a subtree even whensim.mbis the complete multibody.model_targetis retained until output serialization so kdpy writes the same kind of model that it read. The caller ownssimand therefore controls the lifetime of every native object reachable through the other fields.- state_target: Karana.Dynamics.SubTree#
- model_target: Any#
- Karana.KUtils.kdpy_model_io.MODEL_LOADERS: tuple[tuple[str, Callable[[pathlib.Path], tuple[Karana.KUtils.Sim.Sim, Karana.Dynamics.SubTree, Any]]], Ellipsis]#
- Karana.KUtils.kdpy_model_io.loadModel(model_file: pathlib.Path) LoadedModel[source]#
Load the first supported kdFlex model type that accepts the file.
Each kdFlex
fromFilecall performs schema validation. A schema mismatch is therefore the dispatch signal rather than a fatal error. Failed probes can allocate native objects and register cleanup callbacks, so each attempt is treated as a small transaction: remember the callback boundary, try the loader, and unwind only callbacks introduced by that attempt on failure.