11#include <simplesquirrel/simplesquirrel.hpp>
24 const auto*
value =
found->second.getIf<std::string>();
32 std::vector<std::string_view>
types()
const override {
return {
"scene",
"scene-host"}; }
38 if (
type ==
"scene") {
39 auto sceneTarget = std::make_unique<scene_editing::SceneDocumentTarget>(
target.value());
40 const std::string
object = stringField(
request,
"object");
41 if (!
object.empty()) {
49 auto applied = sceneTarget->applyDomainOperation(
operation.value());
54 owned.target = std::move(sceneTarget);
55 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(
owned));
58 const std::string
host = stringField(
request,
"host");
60 return eve::editing::failed<editor::AutomationOwnedTarget>(
61 editor::EditorStatus::Rejected,
editor::RuleId(
"editor.automation.scene-host-name"),
62 "Live scene target requires a host name");
63 auto* sceneModule = eve::ModuleManager::getInstance<eve::scene::Scene>(
"Scene");
65 return eve::editing::failed<editor::AutomationOwnedTarget>(
66 editor::EditorStatus::Unsupported,
editor::RuleId(
"editor.automation.scene-module-unavailable"),
67 "Scene module is not available");
68 auto hostResult = sceneModule->findHost(
host);
69 if (!hostResult.ok() || !hostResult.value())
70 return eve::editing::failed<editor::AutomationOwnedTarget>(
71 editor::EditorStatus::NotFound,
editor::RuleId(
"editor.automation.scene-host-not-found"),
72 "Live SceneHost does not exist: " +
host);
73 owned.target = std::make_unique<scene_editing::SceneHostEditorTarget>(
target.value(), hostResult.value());
74 return eve::editing::applied<editor::AutomationOwnedTarget>(std::move(
owned));
81 auto* registry = eve::cap::query<editing::IEditingCommandRegistry>();
83 throw std::runtime_error(
"Failed to register scene editing commands");
84 eve::cap::addListener<editor::IEditorAutomationTargetFactory>(factory_.get());
88 eve::cap::removeListener<editor::IEditorAutomationTargetFactory>(factory_.get());
89 if (
auto* registry = eve::cap::query<editing::IEditingCommandRegistry>())
90 registry->unregisterOwner(
"scene_editing").ignore(
"scene editor adapter shutdown");
93void SceneEditorModule::expose(ssq::Table& table) {
94 auto module = table.addClass(name, SceneEditorModule::create, false);
97void SceneEditorModule::expose(ssq::Class&) {}
ActionParameterOperation operation
const GltfImportRequest & request
#define Module_IMPL(ModuleName, newExpr)
Move-only operation result carrying either a value or Status.
static Result failure(Status status)
Construct a failed result from a structured status.
UUID-backed identifier adapter for legacy textual boundaries.
std::map< std::string, Value > Object
Multi-provider extension point for domain-specific automation target creation.
std::vector< std::string_view > types() const override
Stable target type names this factory accepts.
editor::Result< editor::AutomationOwnedTarget > create(const editor::TargetId &target, std::string_view type, const editor::EditorValue::Object &request) override
Create a domain target from an automation request. @ownership Success transfers the target and any su...
Composition adapter that contributes scene editing commands and automation targets.
~SceneEditorModule() override
Scene editor module.
SceneEditorModule()
Scene editor module.
eve::editing::ObjectId ObjectId
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry ®istry)
Register Scene-owned commands with a generic editing host.
void exposeSceneEditorSessions(ssq::Table &table, ssq::Class &module)
Register owned, UI-neutral scene editing sessions in the supplied VM; owner-thread only.
Target plus optional borrowed-dependency owner returned by an automation factory.
Request used to create a scene object in either backend.