载入中...
搜索中...
未找到
AnimationEditorModule.cpp
浏览该文件的文档.
2
8#include "common/Capability.h"
11
12#include <simplesquirrel/simplesquirrel.hpp>
13
14#include <stdexcept>
15#include <string_view>
16#include <utility>
17#include <vector>
18
19namespace eve::animation_editor {
20namespace {
21
23 const auto found = request.find(key);
24 return found == request.end() ? nullptr : &found->second;
25}
26
27} // namespace
28
30public:
31 std::vector<std::string_view> types() const override { return {"animation-clip", "animation-clip-document"}; }
32
34 const editor::TargetId& target, std::string_view, const editor::EditorValue::Object& request) override {
35 auto clip = std::make_unique<animation_editing::AnimationClipDocumentTarget>(target.value());
36 if (const editor::EditorValue* snapshot = field(request, "snapshot")) {
37 auto loaded = clip->loadSnapshot(*snapshot);
38 if (!loaded.ok())
40 }
42 owned.target = std::move(clip);
43 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(owned));
44 }
45};
46
48
50 auto* registry = eve::cap::query<editing::IEditingCommandRegistry>();
52 throw std::runtime_error("Failed to register animation editing commands");
53 auto rigCommands = registerControlRigAutomation(*registry);
54 if (!rigCommands.ok()) throw std::runtime_error("Failed to register control rig editing commands");
55 eve::cap::addListener<editor::IEditorAutomationTargetFactory>(factory_.get());
56}
57
59 eve::cap::removeListener<editor::IEditorAutomationTargetFactory>(factory_.get());
60 if (auto* registry = eve::cap::query<editing::IEditingCommandRegistry>())
61 registry->unregisterOwner("animation_editing").ignore("animation editor adapter shutdown");
62}
63
64void AnimationEditorModule::expose(ssq::Table& table) {
65 auto module = table.addClass(name, AnimationEditorModule::create, false);
67 exposeControlRigBindings(table, module);
68}
69void AnimationEditorModule::expose(ssq::Class&) {}
70
71} // namespace eve::animation_editor
LogicalId target
Squirrel adapter for the animation clip editor.
ActiveSource owned
SQObjectPtr key
Definition ECS.cpp:155
const GltfImportRequest & request
glm::vec4 clip
Snapshot snapshot
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:27
std::unordered_set< std::string > loaded
Definition Plugins.cpp:24
const eve::script::BindingContractRegistry & registry
bool found
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
editor::Result< editor::AutomationOwnedTarget > create(const editor::TargetId &target, std::string_view, const editor::EditorValue::Object &request) override
Create a domain target from an automation request. @ownership Success transfers the target and any su...
std::vector< std::string_view > types() const override
Stable target type names this factory accepts.
Composition adapter that contributes animation editing commands and automation targets.
~AnimationEditorModule() override
Animation editor module.
Deterministic owning value tree shared by authoring hosts.
std::map< std::string, Value > Object
Multi-provider extension point for domain-specific automation target creation.
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry &registry)
Register animation-clip commands with a generic editing host.
Result< void > registerControlRigAutomation(editing::IEditingCommandRegistry &)
Register schema-described Rig planners with the existing editor command registry.
void exposeAnimationClipEditorScriptBindings(ssq::Table &table, ssq::Class &moduleClass)
Expose the script-owned AnimationClipEditor factory on AnimationEditorModule.
void exposeControlRigBindings(ssq::Table &, ssq::Class &)
Register owned rig authoring facade when animation runtime is available.
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
Target plus optional borrowed-dependency owner returned by an automation factory.
std::unique_ptr< IEditableTarget > target