载入中...
搜索中...
未找到
EditorMaterialPreview.cpp
浏览该文件的文档.
15 diagnostics.push_back(eve::editing::ruleDiagnostic(DiagnosticCode::PreconditionViolation, RuleId(rule),
20 error("editor.material.preview-geometry", "Material preview geometry is unsupported: " + settings.geometry);
23 if (settings.width < 16 || settings.height < 16 || settings.width > 4096 || settings.height > 4096)
24 error("editor.material.preview-resolution", "Material preview resolution must be between 16 and 4096");
32Result<TaskId> MaterialPreviewService::render(const DocumentId& document, const MaterialDocumentTarget& material,
35 return eve::editing::failed<TaskId>(EditorStatus::Rejected, RuleId("editor.material.preview-document"),
52 rendered.diagnostics.insert(rendered.diagnostics.begin(), diagnostics.begin(), diagnostics.end());
56 eve::editing::ruleDiagnostic(DiagnosticCode::Failed, RuleId("editor.material.preview-artifact-required"),
72Result<void> MaterialPreviewService::publish(const DocumentId& document, Revision currentRevision, const TaskId& task) {
75 return eve::editing::failed<void>(EditorStatus::NotFound, RuleId("editor.material.preview-task-not-found"),
78 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.material.preview-document-mismatch"),
81 return eve::editing::failed<void>(EditorStatus::Conflict, RuleId("editor.material.preview-stale"),
83 if (found->second.result.status != EditorStatus::Applied || found->second.result.artifact.empty()) {
124 return eve::editing::failed<void>(EditorStatus::Conflict, RuleId("editor.material.studio-interaction-active"),
129 return eve::editing::failed<void>(EditorStatus::NotFound, RuleId("editor.material.studio-property"),
140 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.material.studio-no-interaction"),
163 auto operation = target_.authoringTarget().makeSet(selectionFor(target_.authoringTarget()), *activeProperty_,
174 return eve::editing::failed<TransactionReceipt>(begun.code(), RuleId("editor.material.studio-begin"),
179 return eve::editing::failed<TransactionReceipt>(appended.code(), RuleId("editor.material.studio-append"),
185 return eve::editing::failed<TransactionReceipt>(previewed.code(), RuleId("editor.material.studio-preflight"),
206 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.material.studio-time-regressed"),
224 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.material.studio-preview-rate"),
242SelectionSnapshot MaterialStudioController::selectionFor(const MaterialDocumentTarget& material) const {
265 return eve::editing::failed<void>(result.code(), RuleId("editor.material.studio-preview-result"),
271 diagnostics_.insert(diagnostics_.end(), published.diagnostics().begin(), published.diagnostics().end());
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
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
const std::string & value() const noexcept
Returns the exact legacy or canonical compatibility spelling.
Definition Identity.h:365
bool empty() const noexcept
True when no compatibility spelling has been assigned.
Definition Identity.h:377
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
Definition EditingValue.h:23
Transaction boundary consumed by editor property and other UI models.
Definition EditorTransactionService.h:17
virtual Result< void > discard()=0
Discard pending work after reverting any provisional preview.
virtual Result< TransactionReceipt > commit()=0
Publish the pending transaction and retain it for undo.
virtual Result< void > append(DomainOperation operation)=0
Append a serializable operation to the pending transaction.
virtual bool active() const noexcept=0
Whether a transaction is currently pending.
virtual Result< EditorDryRunReport > preview()=0
Validate the pending transaction without publishing target state.
virtual Result< TransactionId > begin(TransactionSpec specification)=0
Begin an explicit transaction without mutating its target.
Host boundary that owns creation and teardown of an isolated preview scene.
Definition EditorMaterialPreview.h:40
Revision-safe material preview request and publication service.
Definition EditorMaterialPreview.h:49
std::string publishedArtifact(const DocumentId &document) const
Return the most recently published artifact for a document.
Definition EditorMaterialPreview.cpp:92
Result< MaterialPreviewRenderResult > result(const TaskId &task) const
Return one immutable render result.
Definition EditorMaterialPreview.cpp:63
Result< TaskId > render(const DocumentId &document, const MaterialDocumentTarget &material, MaterialPreviewSettings settings, IMaterialPreviewRenderer &renderer)
Validate and render a material snapshot in a unique isolated scene.
Definition EditorMaterialPreview.cpp:32
Result< void > publish(const DocumentId &document, Revision currentRevision, const TaskId &task)
Publish only a successful result matching the current document revision.
Definition EditorMaterialPreview.cpp:72
Result< void > beginInteraction(PropertyPath path)
Start one coalesced property gesture from the current live document revision.
Definition EditorMaterialPreview.cpp:122
Result< TransactionReceipt > commitInteraction()
Atomically publish the final draft value as one undoable transaction.
Definition EditorMaterialPreview.cpp:158
MaterialStudioController(DocumentId document, MaterialPublishingTarget &target, IEditorTransactionBackend &transactions, MaterialPreviewService &previews, IMaterialPreviewRenderer &renderer)
Material studio controller.
Definition EditorMaterialPreview.cpp:107
Result< void > setPreviewSettings(MaterialPreviewSettings settings)
Replace preview geometry, camera, resolution, and environment settings.
Definition EditorMaterialPreview.cpp:116
Result< void > tick(std::uint64_t monotonicMilliseconds)
Render a dirty preview when the injected monotonic time reaches the rate limit.
Definition EditorMaterialPreview.cpp:203
MaterialStudioState state() const
Return an owning snapshot suitable for any developer or in-game UI host.
Definition EditorMaterialPreview.cpp:230
Result< void > setPreviewRate(double framesPerSecond)
Set the maximum preview rate; valid range is 1 to 240 Hz.
Definition EditorMaterialPreview.cpp:222
Result< void > updateInteraction(EditorValue value)
Update the owned draft and mark its isolated preview dirty.
Definition EditorMaterialPreview.cpp:138
Result< void > refreshPreview()
Force an isolated preview of the current draft or live document.
Definition EditorMaterialPreview.cpp:218
Result< void > cancelInteraction()
Abandon the draft without changing the live material.
Definition EditorMaterialPreview.cpp:195
UI-neutral, serializable material authoring target.
Definition MaterialTarget.h:32
PropertySchema schema(const SelectionSnapshot &selection) const override
Schema.
Definition MaterialTarget.cpp:99
std::vector< EditorDiagnostic > validate() const
Validate cross-field authoring rules without mutating the target.
Definition MaterialTarget.cpp:192
Result< DomainOperation > makeSet(const SelectionSnapshot &selection, const PropertyPath &path, const EditorValue &value, PropertySetMode mode) const override
Make set.
Definition MaterialTarget.cpp:109
Candidate-first material operation target with live commit/undo publication.
Definition MaterialTarget.h:96
MaterialDocumentTarget & authoringTarget()
Mutable authoring document used by property inspectors.
Definition MaterialTarget.h:124
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build an owning common diagnostic carrying an open editing rule identity.
Definition EditingResult.cpp:20
Result< void > noOp(std::vector< Diagnostic > diagnostics={})
Construct a successful void result for an operation that made no change.
Definition EditingResult.h:62
Definition ActionPreviewController.cpp:6
material_editing::MaterialDocumentTarget MaterialDocumentTarget
Definition EditorMaterialTarget.h:9
@ PreconditionViolation
@ Failed
Definition Container.h:602
PropertyDescriptorLookup find(const PropertyPath &path) const
Finds find.
Definition EditingProperty.cpp:9
std::vector< SelectionItem > items
Definition EditingSelection.h:22
std::optional< SelectionItem > primary
Definition EditingSelection.h:23
Immutable request passed to a renderer-owned isolated preview scene.
Definition EditorMaterialPreview.h:24
StableId sceneId
Definition EditorMaterialPreview.h:25
Renderer output referenced by a stable artifact rather than GPU pointers.
Definition EditorMaterialPreview.h:33
EditorStatus status
Definition EditorMaterialPreview.h:34
std::string artifact
Definition EditorMaterialPreview.h:35
std::vector< EditorDiagnostic > diagnostics
Definition EditorMaterialPreview.h:36
Camera, mesh and environment settings for an isolated material preview.
Definition EditorMaterialPreview.h:12
Observable state for a host-rendered real-time material studio.
Definition EditorMaterialStudio.h:17
bool interactionActive
Definition EditorMaterialStudio.h:18