载入中...
搜索中...
未找到
ControlRigEditor.h
浏览该文件的文档.
1#pragma once
2#include <cstdint>
3#include <memory>
4#include <string>
5#include <string_view>
6#include "common/Export.h"
7#include "common/Result.h"
8
9namespace eve {
10class Value;
11}
12namespace eve::animation {
13class AnimSkeleton;
14class AnimPose;
15class AnimClip;
16struct RigDefinition;
17struct TransformTRS;
18} // namespace eve::animation
19namespace eve::animation_editor {
26public:
28 explicit ControlRigEditor(std::string targetId);
36 [[nodiscard]] Result<void> initialize(const animation::AnimSkeleton& skeleton);
50 [[nodiscard]] Result<Value> snapshot() const;
52 [[nodiscard]] Result<void> restore(const Value& value);
54 [[nodiscard]] Result<void> seek(double seconds);
56 [[nodiscard]] Result<void> setControl(std::string_view id, const animation::TransformTRS& transform, bool key);
58 [[nodiscard]] Result<void> moveControl(int index, float x, float y, float z, bool key);
60 [[nodiscard]] Result<void> previewMoveControl(int index, float x, float y, float z);
62 [[nodiscard]] Result<void> deleteKey(std::string_view id);
64 [[nodiscard]] Result<void> reparent(std::string_view id, std::string_view parent);
66 [[nodiscard]] Result<void> undo();
68 [[nodiscard]] Result<void> redo();
70 [[nodiscard]] Result<void> bakeInto(animation::AnimClip& clip, double sampleRate) const;
82 int controlCount() const;
84 std::string controlId(int index) const;
86 std::uint64_t revision() const;
88 double time() const;
90 double duration() const;
91
92private:
93 struct Impl;
94 std::unique_ptr<Impl> impl_;
95};
96} // namespace eve::animation_editor
double z
double y
double x
std::string output
eve::EntitySpatialPose pose
SQObjectPtr key
Definition ECS.cpp:155
EnvironmentTest definition
#define EVENGINE_API_EDITORS
Definition Export.h:112
glm::vec4 clip
const ColourScope * parent
std::uint32_t targetId
Object::Ptr value
Move-only, checked operation results for the common layer.
uint32_t index
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
Keyframed skeletal animation clip (local TRS tracks per bone). Script type: AnimClip.
Definition AnimClip.h:145
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
UI-independent rig authoring controller with existing editing transactions. @ownership Owns document,...
Result< void > disableAutomation()
Remove Agent access without discarding the UI document or history.
Result< void > keyFromPose(const animation::AnimPose &pose)
Match an existing pose to unique full-weight FK controls, recording one undoable key batch....
Result< Value > snapshot() const
Copy authoritative document for inspection/serialization.
~ControlRigEditor()
Release all owned state.
Result< void > enableAutomation()
Register the initialized live document and existing history with the active editor host.
int controlCount() const
Number of authored controls.
double duration() const
Document duration.
ControlRigEditor & operator=(const ControlRigEditor &)=delete
Result< void > undo()
Undo latest committed edit and rebuild derived preview.
double time() const
Current playhead in seconds.
Result< void > seek(double seconds)
Seek an explicit time; updates preview atomically.
Result< void > previewMoveControl(int index, float x, float y, float z)
Preview a model-space drag without history; seek cancels, moveControl commits.
Result< void > moveControl(int index, float x, float y, float z, bool key)
Move a control in model space, converting through its sampled parent transform.
std::uint64_t revision() const
Monotonic document revision for UI invalidation after external edits.
Result< void > copyPose(animation::AnimPose &output) const
Copy current solved pose into caller output.
Result< void > replace(const animation::RigDefinition &definition)
Validate and transactionally replace rig definition, preserving history. @cost Compile and preview on...
std::string controlId(int index) const
Control ID at index, empty if invalid.
Result< animation::TransformTRS > controlWorld(int index) const
Copy current control model transform by index for viewport drawing/picking.
ControlRigEditor(const ControlRigEditor &)=delete
Result< void > redo()
Redo latest compensated edit and rebuild derived preview.
ControlRigEditor(std::string targetId)
Create an empty editor with stable identity.
Result< void > deleteKey(std::string_view id)
Remove a control key exactly at playhead; returns a diagnostic when absent.
Result< void > initialize(const animation::AnimSkeleton &skeleton)
Copy skeleton, seed FK controls and clear history after validation. @cost Skeleton-sized preparation,...
Result< animation::TransformTRS > controlLocal(int index) const
Copy sampled parent-local control for inspector/drag edits.
Result< void > restore(const Value &value)
Load schema-validated document through same reversible replacement path.
Result< void > reparent(std::string_view id, std::string_view parent)
Reparent unanimated controls preserving model-space pose.
Result< void > bakeInto(animation::AnimClip &clip, double sampleRate) const
Bake into caller clip only after complete successful preparation.
Result< void > setControl(std::string_view id, const animation::TransformTRS &transform, bool key)
Edit a control's local TRS, optionally creating/replacing a key at playhead.
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
Owning, versioned rig authoring data; no runtime pointers or indices.
Definition ControlRig.h:62
Local TRS used by skeletal animation (quaternion xyzw).
Definition AnimMath.h:9