载入中...
搜索中...
未找到
ActionPreviewProfile.h
浏览该文件的文档.
1#pragma once
2
6#include "common/Export.h"
7#include "common/Result.h"
8#include "common/Value.h"
9#include "editor/EditorIds.h"
10
11#include <cstdint>
12#include <filesystem>
13#include <string>
14#include <string_view>
15#include <vector>
16
17namespace eve::editor {
18
19inline constexpr std::string_view kActionPreviewProfileSchemaId = "eve.action.preview-profile";
20inline constexpr std::uint64_t kActionPreviewProfileSchemaVersion = 1;
21
23enum class ActionPreviewShading : std::uint8_t { Lit, Unlit };
24
28 std::string previewModelUri;
29 std::string baseMotionUri;
31 std::string boneMaskUri;
32 bool showRootMotion = true;
33 bool footIk = false;
34 bool showGrid = true;
35 bool showSkeleton = false;
36 bool showJointNames = false;
38
40 [[nodiscard]] EVENGINE_API_EDITORS Result<void> validate() const;
42 [[nodiscard]] EVENGINE_API_EDITORS Result<Value> toValue() const;
45
46 auto operator<=>(const ActionPreviewProfile&) const = default;
47};
48
51 std::string name;
52 int parent = -1;
53
54 auto operator<=>(const ActionPreviewBone&) const = default;
55};
56
59 std::string sourceUri;
60 std::vector<ActionPreviewBone> bones;
61};
62
65public:
66 static constexpr const char* capabilityName = "eve.action.preview-asset-provider";
67 virtual ~IActionPreviewAssetProvider() = default;
68
70 [[nodiscard]] virtual Result<ActionPreviewSkeleton> modelSkeleton(std::string_view modelUri) = 0;
72 [[nodiscard]] virtual Result<ActionPreviewSkeleton> animationSkeleton(std::string_view animationUri) = 0;
74 [[nodiscard]] virtual Result<void> validateBoneMask(std::string_view boneMaskUri,
75 const ActionPreviewSkeleton& target) = 0;
76};
77
80
87
90 std::vector<ActionPreviewSectionDiagnostic> sections;
91 std::vector<Diagnostic> profileDiagnostics;
92
94 [[nodiscard]] EVENGINE_API_EDITORS bool canPreview() const noexcept;
95};
96
108
111public:
113 explicit EVENGINE_API_EDITORS ActionPreviewProfileStore(std::filesystem::path projectRoot);
114
116 [[nodiscard]] EVENGINE_API_EDITORS Result<void> save(const ActionPreviewProfile& profile) const;
118 [[nodiscard]] EVENGINE_API_EDITORS Result<ActionPreviewProfile> load(const AssetGuid& actionAsset) const;
120 [[nodiscard]] EVENGINE_API_EDITORS std::filesystem::path pathFor(const AssetGuid& actionAsset) const;
121
122private:
123 std::filesystem::path projectRoot_;
124};
125
127[[nodiscard]] EVENGINE_API_EDITORS std::string_view actionPreviewShadingName(ActionPreviewShading shading) noexcept;
128
129} // namespace eve::editor
LogicalId target
Versioned, deterministic authoring timeline for gameplay actions.
#define EVENGINE_API_EDITORS
Definition Export.h:112
Object::Ptr value
Move-only, checked operation results for the common layer.
Owning, renderer-independent dynamic values.
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:414
Move-only operation result carrying either a value or Status.
Definition Result.h:176
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
Stateless deterministic compatibility analysis over owning provider snapshots.
Disk sidecar store keyed only by stable action AssetGuid.
Optional provider implemented by an animation/model authoring integration.
virtual Result< ActionPreviewSkeleton > modelSkeleton(std::string_view modelUri)=0
Resolve a model URI to an owning skeleton topology.
virtual Result< ActionPreviewSkeleton > animationSkeleton(std::string_view animationUri)=0
Resolve an animation URI to an owning skeleton topology.
static constexpr const char * capabilityName
virtual Result< void > validateBoneMask(std::string_view boneMaskUri, const ActionPreviewSkeleton &target)=0
Validate a mask against the target skeleton without retaining either argument.
std::string_view actionPreviewShadingName(ActionPreviewShading shading) noexcept
Stable protocol spelling for a shading option.
constexpr std::string_view kActionPreviewProfileSchemaId
ActionPreviewCompatibility
Severity of one animation section's compatibility with the preview target.
ActionPreviewShading
Renderer-neutral shading preference persisted only for editor preview.
constexpr std::uint64_t kActionPreviewProfileSchemaVersion
Canonical action timeline asset shared by runtime and editor.
One owning bone entry used across optional asset-provider boundaries.
auto operator<=>(const ActionPreviewBone &) const =default
Complete compatibility report suitable for timeline decoration and tooltips.
std::vector< ActionPreviewSectionDiagnostic > sections
EVENGINE_API_EDITORS bool canPreview() const noexcept
True when no section or profile diagnostic prevents preview.
Asset-specific editor state kept outside the runtime action timeline.
auto operator<=>(const ActionPreviewProfile &) const =default
EVENGINE_API_EDITORS Result< void > validate() const
Validate stable identity, URI spelling and enum state.
static EVENGINE_API_EDITORS Result< ActionPreviewProfile > fromValue(const Value &value)
Decode and validate a sidecar transactionally.
EVENGINE_API_EDITORS Result< Value > toValue() const
Encode the canonical sidecar value.
Owning diagnostic projection for one animation section.
Owning skeleton topology independent of animation backend object lifetimes.
std::vector< ActionPreviewBone > bones