载入中...
搜索中...
未找到
ActionPreviewProfile.cpp
浏览该文件的文档.
14 return Result<T>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, std::move(message), std::move(path)));
18 return Result<void>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, std::move(message), std::move(path)));
21const Value* field(const Value& value, std::string_view name) { return value.find(std::string(name)); }
25 if (!member || !member->isString()) return invalid<std::string>("expected string field", std::move(path));
31 if (!member || !member->isBool()) return invalid<bool>("expected boolean field", std::move(path));
37 if (!member || !member->isInt64()) return invalid<std::int64_t>("expected integer field", std::move(path));
59 if (bone.name.empty()) return invalid("skeleton bone name is empty", path + ".bones[" + std::to_string(index) + "]");
61 return invalid("skeleton parent must precede its child", path + ".bones[" + std::to_string(index) + "].parent");
68 if (target.bones.size() != candidate.bones.size()) return ActionPreviewCompatibility::Incompatible;
73 const std::string parent = bone.parent < 0 ? std::string{} : normalizedBone(target.bones[bone.parent].name);
79 const std::string parent = bone.parent < 0 ? std::string{} : normalizedBone(candidate.bones[bone.parent].name);
81 if (found == targetParents.end() || found->second != parent) return ActionPreviewCompatibility::Incompatible;
82 exact = exact && target.bones[index].name == bone.name && target.bones[index].parent == bone.parent;
84 return exact ? ActionPreviewCompatibility::Compatible : ActionPreviewCompatibility::Retargetable;
98 if (actionAsset.format().empty()) return invalid("preview profile requires an action asset", "actionAssetGuid");
128 if (!value.isObject()) return invalid<ActionPreviewProfile>("expected preview profile object", "$");
192 if (!timelineValid) return Result<ActionPreviewCompatibilityReport>::failure(timelineValid.status());
194 if (!profileValid) return Result<ActionPreviewCompatibilityReport>::failure(profileValid.status());
199 DiagnosticCode::Unsupported, "animation/model preview asset provider is not available", "provider"));
209 DiagnosticCode::NotFound, "preview requires a model or at least one animation section", "previewModelUri"));
217 if (!targetValid) return Result<ActionPreviewCompatibilityReport>::failure(targetValid.status());
250 DiagnosticCode::Conflict, "animation skeleton requires normalized-name retargeting", "animationUri"));
253 DiagnosticCode::Conflict, "animation skeleton is incompatible with the preview target", "animationUri"));
259ActionPreviewProfileStore::ActionPreviewProfileStore(std::filesystem::path projectRoot)
282 DiagnosticCode::Failed, "could not create action preview sidecar directory", destination.string()));
287 DiagnosticCode::Failed, "could not open action preview sidecar temporary file", temporary.string()));
303 DiagnosticCode::Failed, "could not atomically replace action preview sidecar", destination.string()));
307Result<ActionPreviewProfile> ActionPreviewProfileStore::load(const AssetGuid& actionAsset) const {
312 Diagnostic::error(DiagnosticCode::NotFound, "action preview sidecar was not found", source.string()));
316 Diagnostic::error(DiagnosticCode::Failed, "could not read action preview sidecar", source.string()));
Versioned action-editor preview settings and skeleton diagnostics.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Diagnostic warning(DiagnosticCode code, std::string message, std::string path={})
Construct a warning diagnostic.
Definition Diagnostic.cpp:24
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
const std::string & format() const noexcept
Returns the compatibility spelling; use canonicalFormat at persistence boundaries.
Definition Identity.h:368
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:177
EVENGINE_API_EDITORS Result< ActionPreviewCompatibilityReport > analyze(const action::ActionTimeline &timeline, const ActionPreviewProfile &profile, IActionPreviewAssetProvider *provider) const
Analyze every animation section against the selected model or first animation anchor.
Definition ActionPreviewProfile.cpp:188
EVENGINE_API_EDITORS Result< ActionPreviewProfile > load(const AssetGuid &actionAsset) const
Load and validate one profile without modifying caller state on failure.
Definition ActionPreviewProfile.cpp:307
EVENGINE_API_EDITORS Result< void > save(const ActionPreviewProfile &profile) const
Atomically validate and save one profile under .eve/action-preview.
Definition ActionPreviewProfile.cpp:270
EVENGINE_API_EDITORS std::filesystem::path pathFor(const AssetGuid &actionAsset) const
Return the stable sidecar path for diagnostics and file watching.
Definition ActionPreviewProfile.cpp:262
Optional provider implemented by an animation/model authoring integration.
Definition ActionPreviewProfile.h:64
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
Definition BuildingSnapshot.cpp:96
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
Definition ActionPreviewController.cpp:6
std::string_view actionPreviewShadingName(ActionPreviewShading shading) noexcept
Stable protocol spelling for a shading option.
Definition ActionPreviewProfile.cpp:89
constexpr std::string_view kActionPreviewProfileSchemaId
Definition ActionPreviewProfile.h:19
ActionPreviewCompatibility
Severity of one animation section's compatibility with the preview target.
Definition ActionPreviewProfile.h:79
@ Incompatible
@ Retargetable
@ Unsupported
ActionPreviewShading
Renderer-neutral shading preference persisted only for editor preview.
Definition ActionPreviewProfile.h:23
constexpr std::uint64_t kActionPreviewProfileSchemaVersion
Definition ActionPreviewProfile.h:20
Status invalid(const char *message)
Definition OceanBindingInternal.h:21
@ InvalidArgument
@ NotFound
@ Unsupported
@ Failed
@ Conflict
@ Applied
Definition Container.h:602
Canonical action timeline asset shared by runtime and editor.
Definition ActionTimeline.h:192
Result< void > validate() const
Validate ids, ranges, uniqueness and deterministic ordering.
Definition ActionTimeline.cpp:264
std::vector< ActionAnimationSection > animationSections
Definition ActionTimeline.h:198
Complete compatibility report suitable for timeline decoration and tooltips.
Definition ActionPreviewProfile.h:89
std::vector< ActionPreviewSectionDiagnostic > sections
Definition ActionPreviewProfile.h:90
EVENGINE_API_EDITORS bool canPreview() const noexcept
True when no section or profile diagnostic prevents preview.
Definition ActionPreviewProfile.cpp:180
std::vector< Diagnostic > profileDiagnostics
Definition ActionPreviewProfile.h:91
Asset-specific editor state kept outside the runtime action timeline.
Definition ActionPreviewProfile.h:26
bool showJointNames
Definition ActionPreviewProfile.h:36
std::string previewModelUri
Definition ActionPreviewProfile.h:28
std::string boneMaskUri
Definition ActionPreviewProfile.h:31
EVENGINE_API_EDITORS Result< void > validate() const
Validate stable identity, URI spelling and enum state.
Definition ActionPreviewProfile.cpp:97
bool showRootMotion
Definition ActionPreviewProfile.h:32
AssetGuid actionAsset
Definition ActionPreviewProfile.h:27
std::string baseMotionUri
Definition ActionPreviewProfile.h:29
bool showSkeleton
Definition ActionPreviewProfile.h:35
ActionPreviewShading shading
Definition ActionPreviewProfile.h:37
static EVENGINE_API_EDITORS Result< ActionPreviewProfile > fromValue(const Value &value)
Decode and validate a sidecar transactionally.
Definition ActionPreviewProfile.cpp:127
std::string animationProfileUri
Definition ActionPreviewProfile.h:30
EVENGINE_API_EDITORS Result< Value > toValue() const
Encode the canonical sidecar value.
Definition ActionPreviewProfile.cpp:107