载入中...
搜索中...
未找到
ActionTimeline.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
10#include "common/Identity.h"
11#include "common/Result.h"
13#include "common/Time.h"
14#include "common/Value.h"
15
16#include <cstdint>
17#include <optional>
18#include <string>
19#include <utility>
20#include <vector>
21
22namespace eve::action {
23
25inline constexpr std::string_view kActionTimelineSchemaId = "eve.action.timeline";
27inline constexpr std::uint64_t kActionTimelineSchemaVersion = 5;
28
30enum class ActionBlendCurve : std::uint8_t {
31 Linear,
32 EaseIn,
33 EaseOut,
36};
37
54
81
83[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionBlendCurveName(ActionBlendCurve curve) noexcept;
85[[nodiscard]] EVENGINE_API_PLATFORM std::optional<ActionBlendCurve> actionBlendCurveFromName(
86 std::string_view name) noexcept;
93[[nodiscard]] EVENGINE_API_PLATFORM double evaluateActionBlendCurve(ActionBlendCurve curve, double normalized) noexcept;
94
96enum class ActionTrackKind : std::uint8_t {
99 Effect,
100 Audio,
101 Camera,
102 Movement,
103 Tag,
104 Custom,
105};
106
108[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionTrackKindName(ActionTrackKind kind) noexcept;
111
123
136
140 std::string label;
142 bool muted = false;
143 bool locked = false;
144 std::vector<ActionNotify> notifies;
145 std::vector<ActionNotifyState> states;
146
148 auto operator<=>(const ActionTrack&) const = default;
149};
150
152enum class ActionTimelineEventKind : std::uint8_t { Notify, StateEnter, StateExit };
153
171
184
195 Duration duration = Duration::zero();
197 std::string animationUri;
198 std::vector<ActionAnimationSection> animationSections;
206 std::vector<Duration> splitTimestamps;
207 std::vector<ActionTrack> tracks;
209
211 [[nodiscard]] Result<void> validate() const;
213 [[nodiscard]] std::size_t sectionCount() const noexcept { return splitTimestamps.size() + 1; }
215 [[nodiscard]] Result<std::pair<Duration, Duration>> sectionRange(std::size_t index) const;
216
223 bool includePrevious = false) const;
224
230 [[nodiscard]] Result<std::vector<ActionActiveBlock>> activeBlocks(Duration time) const;
231
233 [[nodiscard]] Result<Value> toValue() const;
235 [[nodiscard]] static Result<ActionTimeline> fromValue(const Value& value);
236};
237
238} // namespace eve::action
float duration
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_PLATFORM
Definition Export.h:107
Strong identity values shared by persistence, content and logical-name APIs.
std::shared_ptr< const OceanSprayFrame > previous
Object::Ptr value
Move-only, checked operation results for the common layer.
Persistent data-contract version identity.
std::string text
std::string kind
double current
Heightmap curve
Common time values and an injectable deterministic simulation clock.
uint32_t index
Owning, renderer-independent dynamic values.
Signed, fixed-resolution simulation duration in nanoseconds.
Definition Time.h:43
static constexpr Duration zero() noexcept
Return zero duration.
Definition Time.h:60
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
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
std::map< std::string, Value > Object
Definition Value.h:34
std::string_view actionTrackKindName(ActionTrackKind kind) noexcept
Stable lowercase protocol spelling for a track kind.
std::optional< ActionBlendCurve > actionBlendCurveFromName(std::string_view name) noexcept
Parse a persisted montage cross-fade curve name.
constexpr std::uint64_t kActionTimelineSchemaVersion
Current action timeline schema version.
constexpr std::string_view kActionTimelineSchemaId
Canonical schema identifier for persisted action timelines.
Result< ActionTrackKind > parseActionTrackKind(std::string_view text)
Parse a stable track kind spelling.
std::string_view actionBlendCurveName(ActionBlendCurve curve) noexcept
Stable persisted name for a montage cross-fade curve.
ActionTimelineEventKind
Boundary emitted by deterministic timeline sampling.
ActionTrackKind
Semantic lane kind; hosts choose presentation without changing data.
ActionBlendCurve
Built-in deterministic cross-fade curve evaluated without asset callbacks.
double evaluateActionBlendCurve(ActionBlendCurve curve, double normalized) noexcept
Evaluate a deterministic built-in blend curve for a normalized input.
Owning per-step sample of one currently active timeline state.
auto operator<=>(const ActionActiveBlock &) const =default
Operator <=>.
Objective animation segment placed on the montage presentation lane.
ActionBlendCurve blendInCurve
Curve used for the incoming cross-fade.
Duration sourceStart
Clip-local trim-in timestamp.
auto operator<=>(const ActionAnimationSection &) const =default
Operator <=>.
Duration blendOut
Duration of the outgoing envelope before a following gap.
Duration sourceEnd
Clip-local trim-out timestamp; zero means the physical clip end.
ActionBlendCurve blendOutCurve
Curve used for the outgoing envelope before a following gap.
Montage-wide presentation settings persisted with the action timeline.
auto operator<=>(const ActionMontageSettings &) const =default
Operator <=>.
Typed interval with explicit enter/exit boundaries.
auto operator<=>(const ActionNotifyState &) const =default
Operator <=>.
Instantaneous typed event placed on an action track.
auto operator<=>(const ActionNotify &) const =default
Operator <=>.
Owning event projection returned by the runtime sampler.
ActionTimelineEventKind kind
auto operator<=>(const ActionTimelineEvent &) const =default
Operator <=>.
Canonical action timeline asset shared by runtime and editor.
std::size_t sectionCount() const noexcept
Number of objective physical sections.
ActionMontageSettings montage
std::vector< ActionAnimationSection > animationSections
std::string animationUri
Compatibility-only single-clip projection; v2 runtime uses animationSections.
std::vector< ActionTrack > tracks
std::vector< Duration > splitTimestamps
Sorted objective split timestamps forming N+1 physical sections.
Ordered semantic lane in one action timeline.
std::vector< ActionNotifyState > states
std::vector< ActionNotify > notifies
auto operator<=>(const ActionTrack &) const =default
Operator <=>.