animsmith-engine 0.4.0

Strict, versioned engine-import profile facts and deterministic settings resolution for AnimSmith
Documentation
//! Strict, immutable engine-import profile facts and deterministic settings
//! resolution for AnimSmith.
//!
//! The V1 registry has exactly five version-pinned profiles. [`resolve_static`]
//! validates a profile tuple and every declared setting before asset I/O;
//! [`StaticResolution::resolve_input`] then checks the authoritative
//! [`animsmith_core::SourceFormatV1`] and materializes per-clip settings.
//! Unknown engine behavior remains [`FactState::Unknown`]. This crate performs
//! no filesystem access, parses no TOML, and imports no format crate. Its
//! one-way [`project_prediction_provenance_v1`] adapter publishes the already
//! resolved profile/settings and same-load core source evidence. The borrowed
//! [`EngineAddressabilityCheck`] uses that evidence for the single frozen Bevy
//! 0.19.0 source-animation index-selector prediction; other engine behavior
//! remains outside this crate unless a version-pinned rule is added.
//! [`BevyAnimationAssetLabelV1`] is the one bounded selector formatter used by
//! that check, while [`build_bevy_animation_addressability_adapter_v1`] runs
//! the same check lifecycle once and packages its unchanged evaluation for the
//! standalone glTF animation-addressability contract.
//! [`EngineImportAdviceV1`] independently projects exact materialized Unity
//! importer settings beside same-load provenance and bounded clip evidence;
//! profiles without modeled settings produce a typed refusal rather than a
//! guessed preset.
//!
//! # Example
//!
//! ```
//! use animsmith_core::SourceFormatV1;
//! use animsmith_engine::{
//!     BakeOrExtract, EngineDeclaration, ProfileSelection, SettingValue,
//!     resolve_static,
//! };
//!
//! let mut declaration = EngineDeclaration {
//!     selection: Some(ProfileSelection::new(
//!         "unity-generic", 1, "6000.3", "fbx-model-importer",
//!     )),
//!     document_settings: Some(Default::default()),
//!     ..EngineDeclaration::default()
//! };
//! let document = declaration.document_settings.as_mut().unwrap();
//! document.insert("convert_units".into(), SettingValue::Boolean(true));
//! document.insert("bake_axis_conversion".into(), SettingValue::Boolean(true));
//! document.insert(
//!     "root_motion_source".into(),
//!     SettingValue::SourceTransformPath("Reference/Root".into()),
//! );
//! declaration.clip_settings.insert(
//!     "walk_*".into(),
//!     [
//!         ("root_rotation".into(), SettingValue::BakeOrExtract(BakeOrExtract::Extract)),
//!         ("root_position_y".into(), SettingValue::BakeOrExtract(BakeOrExtract::Bake)),
//!         ("root_position_xz".into(), SettingValue::BakeOrExtract(BakeOrExtract::Extract)),
//!     ].into(),
//! );
//! let static_profile = resolve_static(declaration)?.unwrap();
//! let resolved = static_profile.resolve_input(SourceFormatV1::Fbx, &["walk_forward".into()])?;
//! assert_eq!(resolved.clip_settings().len(), 1);
//! # Ok::<(), animsmith_engine::ResolutionError>(())
//! ```
//!
//! The crate has no public feature flags and supports the workspace MSRV,
//! Rust 1.88. Its Rust API is pre-1.0.

#![warn(missing_docs)]

mod addressability;
mod canonical;
mod error;
mod import_advice;
mod prediction;
mod provenance;
mod registry;
mod resolver;
mod types;

pub use addressability::{
    GLTF_ANIMATION_ADDRESSABILITY_COMMAND, GLTF_ANIMATION_ADDRESSABILITY_SCHEMA_VERSION,
    GLTF_ANIMATION_ADDRESSABILITY_V1_ID, GLTF_ANIMATION_ADDRESSABILITY_V1_MAX_REPORT_BYTES,
    GltfAnimationAddressabilityAnimationSetV1, GltfAnimationAddressabilityAnimationV1,
    GltfAnimationAddressabilityBevyAdapterV1, GltfAnimationAddressabilityBevyReadbackV1,
    GltfAnimationAddressabilityChannelSetV1, GltfAnimationAddressabilityChannelV1,
    GltfAnimationAddressabilityCheckReadbackV1, GltfAnimationAddressabilityError,
    GltfAnimationAddressabilityIdentityV1, GltfAnimationAddressabilityInput,
    GltfAnimationAddressabilityInventoryV1, GltfAnimationAddressabilityReadError,
    GltfAnimationAddressabilityReadbackV1, GltfAnimationAddressabilityToolReadbackV1,
    GltfAnimationAddressabilityV1, GltfAnimationChannelPropertyV1, GltfAnimationCoverageStateV1,
    GltfAnimationCoverageV1, GltfAnimationObservationV1, GltfAnimationTargetKindV1,
    GltfAnimationTargetV1, GltfAnimationUnavailableReasonV1,
};
pub use error::{
    InvalidSettingReason, PredictionRuleError, RegistryValidationError, ResolutionError,
    SettingLocation,
};
pub use import_advice::{
    ENGINE_IMPORT_ADVICE_COMMAND, ENGINE_IMPORT_ADVICE_SCHEMA_VERSION, ENGINE_IMPORT_ADVICE_V1_ID,
    ENGINE_IMPORT_ADVICE_V1_MAX_REPORT_BYTES, EngineImportAdviceClipEvidenceV1,
    EngineImportAdviceClipV1, EngineImportAdviceError, EngineImportAdviceIdentityV1,
    EngineImportAdviceInput, EngineImportAdviceMovementOwnerV1, EngineImportAdvicePayloadV1,
    EngineImportAdviceReadError, EngineImportAdviceReadbackV1, EngineImportAdviceRefusalReasonV1,
    EngineImportAdviceSourceNameV1, EngineImportAdviceSourceUnavailableReasonV1,
    EngineImportAdviceStateV1, EngineImportAdviceToolReadbackV1, EngineImportAdviceV1,
    UnityClipAdviceV1, UnityDocumentAdviceV1,
};
pub use prediction::{
    BevyAnimationAssetLabelError, BevyAnimationAssetLabelV1, ENGINE_ADDRESSABILITY_CHECK_ID,
    ENGINE_CHECK_IDS_V1, EngineAddressabilityCheck, GltfAnimationAddressabilityAdapterError,
    build_bevy_animation_addressability_adapter_v1,
};
pub use provenance::{PredictionProvenanceProjectionError, project_prediction_provenance_v1};
pub use registry::{profiles_v1, validate_registry_v1};
pub use resolver::{
    ResolvedClipSettings, ResolvedProfile, SOURCE_TRANSFORM_PATH_MAX_BYTES, StaticResolution,
    lookup_profile, resolve_static,
};
pub use types::{
    AnimationAddressability, BakeOrExtract, ConversionControl, CoordinateBasis, DefaultStatus,
    EngineDeclaration, EngineProfile, FactId, FactState, FactValue, ForwardAxis, Handedness,
    ImportHandling, LinearUnit, PrimarySource, ProfileFact, ProfileSelection,
    RootMotionAddressability, SettingApplicability, SettingDescriptor, SettingDomain, SettingId,
    SettingMap, SettingScope, SettingValue, TargetAddressability, UpAxis,
};

/// Runtime kind of one closed [`SettingValue`] variant.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum SettingValueKind {
    /// Boolean value.
    Boolean,
    /// Bake-or-extract value.
    BakeOrExtract,
    /// Source-transform path value.
    SourceTransformPath,
}