载入中...
搜索中...
未找到
MaterialEditorModule.cpp
浏览该文件的文档.
30class AutomationMaterialAssetResolver final : public material_editing::IMaterialRuntimeAssetResolver {
49 ecs::EntityHandle handle{ecs::current(), std::type_index(typeid(graphics::Renderable3D)), id, generation};
53editor::EditorValue runtimeMaterialSnapshot(const graphics::Renderable3D::MeshRenderer& renderer) {
58 (*properties)["shading.tint"] = editor::EditorValue::Array{double(renderer.r), double(renderer.g),
73 std::vector<std::string_view> types() const override { return {"material", "material-renderable3d"}; }
90 auto* renderable = findRenderable(static_cast<std::uint32_t>(*id), static_cast<std::uint32_t>(*generation));
96 if (renderer->material || renderer->texture || renderer->normalTexture || renderer->heightTexture ||
102 auto sink = std::make_shared<material_editing::Renderable3DMaterialRuntimeSink>(renderable, &assets);
103 auto publishing = std::make_unique<material_editing::MaterialPublishingTarget>(target.value(), sink.get());
146 editor::registerEditorWorkspace<ScriptMaterialEditor>(cls, bind, "Material editor and workspace are required");
148 cls.addFunc("set", [bind](ScriptMaterialEditor* self, const std::string& path, ssq::Object value) {
152 return editor::project(bind.vm(), self->editor().setProperty(path, editing::toEditingValue(converted.value())));
160 if (!object) return bind.fail(DiagnosticCode::InvalidArgument, "Patch requires a path-to-value table");
166 return editor::project(bind.vm(), result, result.ok() ? editing::toPresentationValue(result.value()) : Value{});
182 return editor::project(bind.vm(), self->editor().restore(editing::toEditingValue(converted.value())));
const eve::script::BindingContractRegistry & registry
Definition ProjectIndexAutomatic.cpp:24
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
Multi-provider extension point for domain-specific automation target creation.
Definition EditorAutomationTargetFactory.h:22
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...
Definition MaterialEditorModule.cpp:75
std::vector< std::string_view > types() const override
Stable target type names this factory accepts.
Definition MaterialEditorModule.cpp:73
Composition adapter that contributes material editing commands and automation targets.
Definition MaterialEditorModule.h:12
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
eve::Value toPresentationValue(const Value &value)
To presentation value.
Definition EditingProperty.cpp:98
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
ssq::Table project(HSQUIRRELVM vm, const eve::Result< void > &result)
Project a completed editing result that has no payload.
Definition EditorScriptProjection.h:28
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry ®istry)
Register Material-owned property commands with a generic editing host.
Definition MaterialEditingCommands.cpp:32
Definition MaterialEditor.cpp:7
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
Definition SquirrelBinding.cpp:524
Result< Value > valueFromSquirrel(HSQUIRRELVM vm, SQInteger index, const SquirrelValueOptions &options)
Convert one Squirrel value into the canonical owning Value tree.
Definition SquirrelBinding.cpp:412
@ InvalidArgument
Definition Container.h:602
Target plus optional borrowed-dependency owner returned by an automation factory.
Definition EditorAutomationTargetFactory.h:15
std::unique_ptr< IEditableTarget > target
Definition EditorAutomationTargetFactory.h:18