animsmith_engine/lib.rs
1//! Strict, immutable engine-import profile facts and deterministic settings
2//! resolution for AnimSmith.
3//!
4//! The V1 registry has exactly five version-pinned profiles. [`resolve_static`]
5//! validates a profile tuple and every declared setting before asset I/O;
6//! [`StaticResolution::resolve_input`] then checks the authoritative
7//! [`animsmith_core::SourceFormatV1`] and materializes per-clip settings.
8//! Unknown engine behavior remains [`FactState::Unknown`]. This crate performs
9//! no filesystem access, parses no TOML, and imports no format crate. Its
10//! one-way [`project_prediction_provenance_v1`] adapter publishes the already
11//! resolved profile/settings and same-load core source evidence. The borrowed
12//! [`EngineAddressabilityCheck`] uses that evidence for the single frozen Bevy
13//! 0.19.0 source-animation index-selector prediction; other engine behavior
14//! remains outside this crate unless a version-pinned rule is added.
15//! [`BevyAnimationAssetLabelV1`] is the one bounded selector formatter used by
16//! that check, while [`build_bevy_animation_addressability_adapter_v1`] runs
17//! the same check lifecycle once and packages its unchanged evaluation for the
18//! standalone glTF animation-addressability contract.
19//! [`EngineImportAdviceV1`] independently projects exact materialized Unity
20//! importer settings beside same-load provenance and bounded clip evidence;
21//! profiles without modeled settings produce a typed refusal rather than a
22//! guessed preset.
23//!
24//! # Example
25//!
26//! ```
27//! use animsmith_core::SourceFormatV1;
28//! use animsmith_engine::{
29//! BakeOrExtract, EngineDeclaration, ProfileSelection, SettingValue,
30//! resolve_static,
31//! };
32//!
33//! let mut declaration = EngineDeclaration {
34//! selection: Some(ProfileSelection::new(
35//! "unity-generic", 1, "6000.3", "fbx-model-importer",
36//! )),
37//! document_settings: Some(Default::default()),
38//! ..EngineDeclaration::default()
39//! };
40//! let document = declaration.document_settings.as_mut().unwrap();
41//! document.insert("convert_units".into(), SettingValue::Boolean(true));
42//! document.insert("bake_axis_conversion".into(), SettingValue::Boolean(true));
43//! document.insert(
44//! "root_motion_source".into(),
45//! SettingValue::SourceTransformPath("Reference/Root".into()),
46//! );
47//! declaration.clip_settings.insert(
48//! "walk_*".into(),
49//! [
50//! ("root_rotation".into(), SettingValue::BakeOrExtract(BakeOrExtract::Extract)),
51//! ("root_position_y".into(), SettingValue::BakeOrExtract(BakeOrExtract::Bake)),
52//! ("root_position_xz".into(), SettingValue::BakeOrExtract(BakeOrExtract::Extract)),
53//! ].into(),
54//! );
55//! let static_profile = resolve_static(declaration)?.unwrap();
56//! let resolved = static_profile.resolve_input(SourceFormatV1::Fbx, &["walk_forward".into()])?;
57//! assert_eq!(resolved.clip_settings().len(), 1);
58//! # Ok::<(), animsmith_engine::ResolutionError>(())
59//! ```
60//!
61//! The crate has no public feature flags and supports the workspace MSRV,
62//! Rust 1.88. Its Rust API is pre-1.0.
63
64#![warn(missing_docs)]
65
66mod addressability;
67mod canonical;
68mod error;
69mod import_advice;
70mod prediction;
71mod provenance;
72mod registry;
73mod resolver;
74mod types;
75
76pub use addressability::{
77 GLTF_ANIMATION_ADDRESSABILITY_COMMAND, GLTF_ANIMATION_ADDRESSABILITY_SCHEMA_VERSION,
78 GLTF_ANIMATION_ADDRESSABILITY_V1_ID, GLTF_ANIMATION_ADDRESSABILITY_V1_MAX_REPORT_BYTES,
79 GltfAnimationAddressabilityAnimationSetV1, GltfAnimationAddressabilityAnimationV1,
80 GltfAnimationAddressabilityBevyAdapterV1, GltfAnimationAddressabilityBevyReadbackV1,
81 GltfAnimationAddressabilityChannelSetV1, GltfAnimationAddressabilityChannelV1,
82 GltfAnimationAddressabilityCheckReadbackV1, GltfAnimationAddressabilityError,
83 GltfAnimationAddressabilityIdentityV1, GltfAnimationAddressabilityInput,
84 GltfAnimationAddressabilityInventoryV1, GltfAnimationAddressabilityReadError,
85 GltfAnimationAddressabilityReadbackV1, GltfAnimationAddressabilityToolReadbackV1,
86 GltfAnimationAddressabilityV1, GltfAnimationChannelPropertyV1, GltfAnimationCoverageStateV1,
87 GltfAnimationCoverageV1, GltfAnimationObservationV1, GltfAnimationTargetKindV1,
88 GltfAnimationTargetV1, GltfAnimationUnavailableReasonV1,
89};
90pub use error::{
91 InvalidSettingReason, PredictionRuleError, RegistryValidationError, ResolutionError,
92 SettingLocation,
93};
94pub use import_advice::{
95 ENGINE_IMPORT_ADVICE_COMMAND, ENGINE_IMPORT_ADVICE_SCHEMA_VERSION, ENGINE_IMPORT_ADVICE_V1_ID,
96 ENGINE_IMPORT_ADVICE_V1_MAX_REPORT_BYTES, EngineImportAdviceClipEvidenceV1,
97 EngineImportAdviceClipV1, EngineImportAdviceError, EngineImportAdviceIdentityV1,
98 EngineImportAdviceInput, EngineImportAdviceMovementOwnerV1, EngineImportAdvicePayloadV1,
99 EngineImportAdviceReadError, EngineImportAdviceReadbackV1, EngineImportAdviceRefusalReasonV1,
100 EngineImportAdviceSourceNameV1, EngineImportAdviceSourceUnavailableReasonV1,
101 EngineImportAdviceStateV1, EngineImportAdviceToolReadbackV1, EngineImportAdviceV1,
102 UnityClipAdviceV1, UnityDocumentAdviceV1,
103};
104pub use prediction::{
105 BevyAnimationAssetLabelError, BevyAnimationAssetLabelV1, ENGINE_ADDRESSABILITY_CHECK_ID,
106 ENGINE_CHECK_IDS_V1, EngineAddressabilityCheck, GltfAnimationAddressabilityAdapterError,
107 build_bevy_animation_addressability_adapter_v1,
108};
109pub use provenance::{PredictionProvenanceProjectionError, project_prediction_provenance_v1};
110pub use registry::{profiles_v1, validate_registry_v1};
111pub use resolver::{
112 ResolvedClipSettings, ResolvedProfile, SOURCE_TRANSFORM_PATH_MAX_BYTES, StaticResolution,
113 lookup_profile, resolve_static,
114};
115pub use types::{
116 AnimationAddressability, BakeOrExtract, ConversionControl, CoordinateBasis, DefaultStatus,
117 EngineDeclaration, EngineProfile, FactId, FactState, FactValue, ForwardAxis, Handedness,
118 ImportHandling, LinearUnit, PrimarySource, ProfileFact, ProfileSelection,
119 RootMotionAddressability, SettingApplicability, SettingDescriptor, SettingDomain, SettingId,
120 SettingMap, SettingScope, SettingValue, TargetAddressability, UpAxis,
121};
122
123/// Runtime kind of one closed [`SettingValue`] variant.
124#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
125pub enum SettingValueKind {
126 /// Boolean value.
127 Boolean,
128 /// Bake-or-extract value.
129 BakeOrExtract,
130 /// Source-transform path value.
131 SourceTransformPath,
132}