载入中...
搜索中...
未找到
procgen_editor.cpp
浏览该文件的文档.
2
3#include "common/Capability.h"
10
11#include <simplesquirrel/simplesquirrel.hpp>
12
13#include <stdexcept>
14#include <string_view>
15#include <utility>
16#include <vector>
17
18namespace eve::procgen_editor {
19
21public:
22 std::vector<std::string_view> types() const override { return {"procgen-script", "road-network"}; }
23
25 const editor::TargetId& target, std::string_view type, const editor::EditorValue::Object&) override {
27 if (type == "road-network")
29 else
30 owned.target = std::make_unique<procgen_editing::ProcgenScriptDocumentTarget>(target.value());
31 return eve::editing::applied(std::move(owned));
32 }
33};
34
36
38 auto* registry = eve::cap::query<editing::IEditingCommandRegistry>();
39 if (!registry || !procgen_editing::registerRoadNetworkEditingCommands(*registry).ok())
40 throw std::runtime_error("Failed to register road network editing commands");
41 eve::cap::addListener<editor::IEditorAutomationTargetFactory>(factory_.get());
42}
43
45 eve::cap::removeListener<editor::IEditorAutomationTargetFactory>(factory_.get());
46 if (auto* registry = eve::cap::query<editing::IEditingCommandRegistry>())
47 registry->unregisterOwner("procgen_editing.road").ignore("procgen editor adapter shutdown");
48}
49
50void ProcgenEditorModule::expose(ssq::Table& table) {
51 auto module = table.addClass(name, ProcgenEditorModule::create, false);
53}
54void ProcgenEditorModule::expose(ssq::Class&) {}
55
56} // namespace eve::procgen_editor
LogicalId target
ActiveSource owned
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:26
Squirrel adapter for the procgen script editor.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
std::map< std::string, Value > Object
Multi-provider extension point for domain-specific automation target creation.
static EVENGINE_API_ORCHESTRATION std::unique_ptr< RoadNetworkEditTarget > createOwned(std::string id)
Create an editor-owned empty road target for automation/composition hosts.
editor::Result< editor::AutomationOwnedTarget > create(const editor::TargetId &target, std::string_view type, const editor::EditorValue::Object &) 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 for the script-hosted procgen generator editor.
~ProcgenEditorModule() override
Releases ProcgenEditorModule resources.
ProcgenEditorModule()
Constructs a ProcgenEditorModule.
Result< T > applied(T value, std::vector< Diagnostic > diagnostics={})
Construct an Applied result with an owning payload and optional diagnostics.
editing::Result< void > registerRoadNetworkEditingCommands(editing::IEditingCommandRegistry &registry)
Register stable road topology commands with an existing editing host.
void exposeProcgenScriptEditorScriptBindings(ssq::Table &table, ssq::Class &moduleClass)
Expose the script-owned ProcgenScriptEditor factory on ProcgenEditorModule.
Target plus optional borrowed-dependency owner returned by an automation factory.
std::unique_ptr< IEditableTarget > target