载入中...
搜索中...
未找到
EditorPropertyPresenter.cpp
浏览该文件的文档.
25Result<PropertyEditIntent> makeIntent(const PropertySchema& schema, const SelectionSnapshot& selection,
30 return eve::editing::failed<PropertyEditIntent>(EditorStatus::NotFound, RuleId("editor.property.not-found"),
74PropertyPresentation RuntimePropertyPresenter::present(const PropertySchema& schema, const SelectionSnapshot& selection,
114 return eve::editing::failed<RuntimeEditorPackage>(EditorStatus::Rejected, RuleId(rule), std::move(message));
119Result<RuntimeEditorPackage> RuntimeEditorPublisher::publish(const RuntimeEditorManifest& manifest,
153 if (std::none_of(package.tools.begin(), package.tools.end(), [&](const auto& value) { return value.id == id; }))
154 return manifestError("editor.runtime.tool-not-found", "Manifest tool is unavailable: " + id.value());
160 return manifestError("editor.runtime.palette-not-found", "Manifest palette is unavailable: " + id.value());
164 if (std::none_of(package.rules.begin(), package.rules.end(), [&](const auto& value) { return value.id == id; }))
165 return manifestError("editor.runtime.rule-not-found", "Manifest rule is unavailable: " + id.value());
174 return manifestError("editor.runtime.asset-not-found", "Manifest asset is unavailable: " + current.value());
189Result<SelectionSnapshot> EditorSelectionService::set(std::string channel, std::vector<SelectionItem> items,
193 EditorStatus::Rejected, RuleId("editor.selection.channel-required"), "Selection channel is required");
211Result<SelectionSnapshot> EditorSelectionService::clear(const std::string& channel) { return set(channel, {}); }
223 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.selection.invalid-listener"),
229bool EditorSelectionService::unsubscribe(const std::string& owner) { return listeners_.erase(owner) != 0; }
231Result<EditorFocusSnapshot> EditorFocusService::focus(std::string channel, StableId surface, StableId item) {
233 return eve::editing::failed<EditorFocusSnapshot>(EditorStatus::Rejected, RuleId("editor.focus.invalid"),
259IEditableTarget* EditorContext::target() const { return session_ ? session_->target() : nullptr; }
269 return eve::editing::failed<void>(EditorStatus::Failed, RuleId("editor.context.missing-session"),
274bool EditorSession::execute(std::unique_ptr<IEditCommand> command) { return executeChecked(std::move(command)).ok(); }
328void EditorSession::invalidateTrackedTarget(EditorTargetCoordinator& coordinator, const TargetId& target,
330 if (targetCoordinator_ != &coordinator || boundTargetId_ != target || targetGeneration_ != generation) return;
355Result<EditorValue> EditorSession::executeCommand(const CommandId& id, const EditorValue& payload,
358 return eve::editing::failed<EditorValue>(EditorStatus::Failed, RuleId("editor.command.missing-service"),
362 const bool ownsTransaction = descriptor && descriptor->createsTransaction && !transactions_.isActive();
365 transactions_.beginTransaction(descriptor->displayName.empty() ? id.value() : descriptor->displayName);
415Result<CommandPlan> EditorSession::planCommand(const CommandId& id, const EditorValue& payload, CommandSource source,
418 return eve::editing::failed<CommandPlan>(EditorStatus::Failed, RuleId("editor.command.missing-service"),
430Result<TransactionReceipt> EditorSession::executePlan(const CommandPlan& plan, const EditorValue& payload,
433 return eve::editing::failed<TransactionReceipt>(EditorStatus::Failed, RuleId("editor.command.missing-service"),
440 if (request.context.target != plan.target || request.context.targetRevision != plan.baseRevision ||
442 return eve::editing::failed<TransactionReceipt>(EditorStatus::Conflict, RuleId("editor.command.stale-plan"),
448Result<TransactionReceipt> EditorSession::executeCommandReceipt(const CommandId& id, const EditorValue& payload,
451 receipt.id = TransactionId((sessionId_.empty() ? std::string("editor.session") : sessionId_.value()) +
463 return Result<TransactionReceipt>::success(std::move(receipt), eve::Status(command.code(), command.diagnostics()));
467 return commandService_ ? commandService_->commands(hostProfile_) : std::vector<CommandDescriptor>{};
470Result<PlanId> EditorSession::retainPlan(const CommandId& id, const EditorValue& payload, CommandSource source,
482Result<TransactionReceipt> EditorSession::executeRetainedPlan(const PlanId& id, CommandSource source) {
486 return eve::editing::failed<TransactionReceipt>(EditorStatus::NotFound, RuleId("editor.command.plan-not-found"),
497 return eve::editing::failed<void>(EditorStatus::NotFound, RuleId("editor.command.plan-not-found"),
512void EditorSession::bindDocumentServices(DocumentService& documents, AutosaveService* autosave) {
545Result<DocumentSnapshot> EditorSession::editDocument(EditorValue content, std::optional<Revision> expectedRevision) {
547 return eve::editing::failed<DocumentSnapshot>(EditorStatus::Failed, RuleId("editor.session.no-active-document"),
554 return eve::editing::failed<DocumentSnapshot>(EditorStatus::Failed, RuleId("editor.session.no-active-document"),
577 Result<StoredDocument> result = autosaveService_->writeDraft(snapshot.value(), content.value());
587 return eve::editing::failed<DocumentSnapshot>(EditorStatus::Failed, RuleId("editor.session.no-active-document"),
593void EditorSession::setAutosaveInterval(float seconds) { autosaveInterval_ = std::max(0.f, seconds); }
595void EditorSession::setExternalPollInterval(float seconds) { externalPollInterval_ = std::max(0.f, seconds); }
672std::string EditorSession::activeToolId() const { return activeTool_ ? activeTool_->descriptor().id : std::string{}; }
682 if (activeTool_ != dispatchedTool || toolGeneration_ != generation) return {response.handled, false, false};
685 if (event.phase == EditorPointerEvent::Phase::Cancel && capturedPointerId_ == event.pointerId) {
709 if (!autosaveService_ || autosaveInterval_ <= 0.f || snapshot.value().revision.edit == lastAutosavedRevision_)
std::unique_ptr< DeformMeshPresentation > presentation
Definition PhysicsBakeGraphics.cpp:71
bool ok() const noexcept
Whether this result represents a non-failure outcome.
Definition Result.h:514
const std::vector< Diagnostic > & diagnostics() const noexcept
Inspect all diagnostics; this counts as checking the Result.
Definition Result.h:535
const T & value() const &
Borrow the value from a const lvalue after checking success.
Definition Result.h:339
const std::vector< Diagnostic > & diagnostics() const noexcept
Inspect all diagnostics; this counts as checking the Result.
Definition Result.h:314
bool ok() const noexcept
Whether this result represents a non-failure outcome.
Definition Result.h:286
const Status & status() const noexcept
Inspect the structured operation status.
Definition Result.h:300
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
UI-independent property access for an immutable selection snapshot.
Definition EditingProperty.h:141
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
Autosave coordinator that never overwrites the formal document URI.
Definition EditorDiskDocumentStore.h:58
Result< StoredDocument > writeDraft(const DocumentSnapshot &snapshot, const EditorValue &content)
Write one revisioned draft under autosave://project/document.draft.
Definition EditorDiskAssetCatalog.cpp:343
PropertyPresentation present(const PropertySchema &schema, const SelectionSnapshot &selection, const IPropertyProvider &provider) const
Read every schema property, including advanced/editor-only rows.
Definition EditorPropertyPresenter.cpp:55
Document coordinator with revision-safe requestSave/executeSave sequencing.
Definition EditorDocumentService.h:118
Result< DocumentSnapshot > reconcileExternal(const DocumentId &document)
Reconcile one open document with the latest store value. Clean documents adopt external content; dirt...
Definition EditorDocumentService.cpp:150
Result< DocumentSnapshot > edit(const DocumentId &document, EditorValue content, std::optional< Revision > expectedRevision=std::nullopt)
Replace the working content using an optional expected edit revision.
Definition EditorDocumentService.cpp:71
Result< DocumentSnapshot > snapshot(const DocumentId &document) const
Return one metadata snapshot.
Definition EditorDocumentService.cpp:132
Result< DocumentSnapshot > executeSave(const SaveTicket &ticket)
Execute a captured save ticket without reading newer working content.
Definition EditorDocumentService.cpp:99
Result< EditorValue > content(const DocumentId &document) const
Return the current working content snapshot.
Definition EditorDocumentService.cpp:124
Result< SaveTicket > requestSave(const DocumentId &document)
Capture an exact content/revision pair for a later CAS save.
Definition EditorDocumentService.cpp:84
Result< void > evaluateChecked(EditorContext &context, IEditCommand &command)
Evaluate the chain and return structured allow/warning/reject diagnostics.
Definition EditCommand.cpp:157
Registry and execution gate for UI-, script- and automation-neutral commands.
Definition EditorCommandService.h:60
Result< EditorValue > execute(const CommandId &id, const CommandContext &context, const EditorValue &payload) const
Execute a command after payload and profile checks.
Definition EditorAssetDatabase.cpp:342
const CommandDescriptor * find(const CommandId &id) const
Return command metadata or nullptr when it is not registered.
Definition EditorAssetDatabase.cpp:321
std::vector< CommandDescriptor > commands(const HostProfile &profile) const
Return descriptors visible to a host profile.
Definition EditorAssetDatabase.cpp:333
Result< TransactionReceipt > executePlan(const CommandRequest &request, const CommandPlan &plan, const HostProfile &profile) const
Execute a plan only when its lifetime, registration, policy and input bindings remain valid.
Definition EditorAssetDatabase.cpp:408
Result< CommandPlan > plan(const CommandRequest &request, const HostProfile &profile) const
Produce a side-effect-free plan bound to the target, command generation, payload and source.
Definition EditorAssetDatabase.cpp:367
bool execute(std::unique_ptr< IEditCommand > command) const
Send a command through constraints into the active transaction.
Definition EditorPropertyPresenter.cpp:263
Result< void > executeChecked(std::unique_ptr< IEditCommand > command) const
Send a command without discarding validation or transaction diagnostics.
Definition EditorPropertyPresenter.cpp:267
IEditableTarget * target() const
Target currently bound to the session.
Definition EditorPropertyPresenter.cpp:259
Loads game extensions and filters their descriptors for each host.
Definition EditorExtension.h:96
std::vector< ExtensionToolDescriptor > tools(const HostProfile &profile) const
Return tool descriptors visible to a host.
Definition EditorDocumentService.cpp:490
std::vector< ExtensionRuleDescriptor > rules(const HostProfile &profile) const
Return validation descriptors visible to a host.
Definition EditorDocumentService.cpp:506
std::vector< ExtensionPaletteDescriptor > palettes(const HostProfile &profile) const
Return palette descriptors visible to a host.
Definition EditorDocumentService.cpp:498
EditorFocusSnapshot snapshot(const std::string &channel) const
Read the current focus of one channel.
Definition EditorPropertyPresenter.cpp:244
Result< EditorFocusSnapshot > focus(std::string channel, StableId surface, StableId item={})
Set the focused surface/item for one channel.
Definition EditorPropertyPresenter.cpp:231
Result< SelectionSnapshot > clear(const std::string &channel)
Clear a channel while retaining a monotonic sequence.
Definition EditorPropertyPresenter.cpp:211
std::function< void(const SelectionSnapshot &)> Listener
Definition EditorSelection.h:33
SelectionSnapshot snapshot(const std::string &channel) const
Read one channel, returning an empty sequence-zero snapshot when absent.
Definition EditorPropertyPresenter.cpp:213
bool unsubscribe(const std::string &owner)
Remove one listener owner.
Definition EditorPropertyPresenter.cpp:229
Result< void > subscribe(std::string owner, Listener listener)
Subscribe an owner callback; owner replacement and unload are deterministic.
Definition EditorPropertyPresenter.cpp:221
Result< SelectionSnapshot > set(std::string channel, std::vector< SelectionItem > items, std::optional< SelectionItem > primary=std::nullopt)
Atomically replace a channel selection and optional primary item.
Definition EditorPropertyPresenter.cpp:189
IEditableTarget * target() const
Return the live borrowed target, or null after an explicit or tracked unbind.
Definition EditorPropertyPresenter.cpp:349
Result< StoredDocument > autosaveDocument()
Write the active dirty revision to its separate autosave draft.
Definition EditorPropertyPresenter.cpp:566
void clearTarget()
Clear the active target and invalidate retained plans derived from it.
Definition EditorPropertyPresenter.cpp:326
IEditorTool * findTool(const std::string &id) const
Finds tool.
Definition EditorPropertyPresenter.cpp:639
void unbindDocument()
Stop coordinating the active document without closing it.
Definition EditorPropertyPresenter.cpp:538
bool addTool(IEditorTool *tool)
Register a tool. Returns false for null or duplicate id/pointer.
Definition EditorPropertyPresenter.cpp:608
bool execute(std::unique_ptr< IEditCommand > command)
Validate then execute a command in the active transaction.
Definition EditorPropertyPresenter.cpp:274
bool removeTool(const std::string &id)
Remove a registered tool by id, deactivating it when necessary.
Definition EditorPropertyPresenter.cpp:617
EditorContextSnapshot contextSnapshot() const
Capture target revision and host identity for delayed command work.
Definition EditorPropertyPresenter.cpp:403
ToolResponse dispatchPointer(const EditorPointerEvent &event)
Route input to the active tool and apply pointer-capture response.
Definition EditorPropertyPresenter.cpp:674
ToolResponse dispatchKey(const EditorKeyEvent &event)
Route keyboard input to the active tool.
Definition EditorPropertyPresenter.cpp:691
void clearDocumentServices()
Clear document service bindings and unbind the active document.
Definition EditorPropertyPresenter.cpp:518
Result< void > cancelRetainedPlan(const PlanId &id)
Discard one retained plan without executing it.
Definition EditorPropertyPresenter.cpp:493
void drawOverlay(IEditorOverlay &overlay)
Ask the active tool to emit viewport feedback.
Definition EditorPropertyPresenter.cpp:715
Result< TransactionReceipt > executeCommandReceipt(const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
Execute a legacy-compatible command and return a V2 transaction receipt.
Definition EditorPropertyPresenter.cpp:448
bool activateTool(const std::string &id)
Activate a registered tool by id. Empty id deactivates all tools.
Definition EditorPropertyPresenter.cpp:646
void clearRetainedPlans()
Discard all retained plans, for example after replacing a document or target.
Definition EditorPropertyPresenter.cpp:503
Result< void > executeChecked(std::unique_ptr< IEditCommand > command)
Validate and execute a command while preserving constraint and transaction diagnostics.
Definition EditorPropertyPresenter.cpp:276
Result< CommandPlan > planCommand(const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api, std::optional< Revision > expectedRevision=std::nullopt) const
Plan a registered command without applying target mutations.
Definition EditorPropertyPresenter.cpp:415
Result< DocumentSnapshot > pollDocumentChanges()
Detect external disk changes, adopting only when the document is clean.
Definition EditorPropertyPresenter.cpp:585
Result< DocumentSnapshot > bindDocument(const DocumentId &document)
Select an already-open document for save, autosave and conflict polling.
Definition EditorPropertyPresenter.cpp:524
Result< TransactionReceipt > executeRetainedPlan(const PlanId &id, CommandSource source=CommandSource::Api)
Execute a retained plan. Successful plans are consumed exactly once.
Definition EditorPropertyPresenter.cpp:482
void inspect(IEditorInspector &inspector)
Ask the active tool to expose its configurable properties.
Definition EditorPropertyPresenter.cpp:719
Result< DocumentSnapshot > editDocument(EditorValue content, std::optional< Revision > expectedRevision=std::nullopt)
Replace active working content using optional optimistic edit revision.
Definition EditorPropertyPresenter.cpp:545
void cancelActiveTool()
Cancel its gesture and clear pointer capture.
Definition EditorPropertyPresenter.cpp:723
void clearTools()
Remove all tools and release any pointer capture.
Definition EditorPropertyPresenter.cpp:627
Result< TransactionReceipt > executePlan(const CommandPlan &plan, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
Execute a previously returned plan through its registered executor.
Definition EditorPropertyPresenter.cpp:430
void setAutosaveInterval(float seconds)
Configure draft cadence.
Definition EditorPropertyPresenter.cpp:593
void setExternalPollInterval(float seconds)
Configure external-store polling cadence.
Definition EditorPropertyPresenter.cpp:595
void bindTarget(IEditableTarget &target)
Bind a caller-managed editable target available to every tool callback.
Definition EditorPropertyPresenter.cpp:287
Result< EditorValue > executeCommand(const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api)
Execute a registered V2 command in this session.
Definition EditorPropertyPresenter.cpp:355
std::vector< CommandDescriptor > availableCommands() const
Return commands visible through this session's host profile.
Definition EditorPropertyPresenter.cpp:466
Result< DocumentSnapshot > saveDocument()
Persist the current active revision through the document CAS store.
Definition EditorPropertyPresenter.cpp:552
void setDocumentServices(DocumentService *documents, AutosaveService *autosave=nullptr)
Bind non-owning persistence services used by the active document.
Definition EditorPropertyPresenter.cpp:505
Result< PlanId > retainPlan(const CommandId &id, const EditorValue &payload={}, CommandSource source=CommandSource::Api, std::optional< Revision > expectedRevision=std::nullopt)
Plan a command and retain its immutable payload under the returned plan id.
Definition EditorPropertyPresenter.cpp:470
void bindDocumentServices(DocumentService &documents, AutosaveService *autosave=nullptr)
Bind document services; documents must outlive this binding.
Definition EditorPropertyPresenter.cpp:512
Coordinates editable targets, per-target histories and domain commands.
Definition EditorTargetCoordinator.h:26
Executes, groups, rolls back and replays arbitrary edit commands.
Definition EditorTransactions.h:13
eve::Result< TransactionId > beginTransaction(TransactionSpec specification)
Begin a canonical checked transaction.
Definition EditorSimulationPreview.cpp:275
eve::Result< void > rollbackTransaction()
Discard the active transaction and restore its preview state.
Definition EditorSimulationPreview.cpp:289
eve::Result< void > append(std::unique_ptr< IEditCommand > command)
Stage and preview one command without discarding diagnostics.
Definition EditorSimulationPreview.cpp:283
eve::Result< EditorTransactionRecord > commitTransaction()
Commit the active transaction and return its complete record.
Definition EditorSimulationPreview.cpp:287
Upper capability boundary for one editor host.
Definition EditorHostProfile.h:51
static HostProfile runtimeBuilder()
Safe runtime profile that denies commands unless allow-listed.
Definition EditorHostProfile.cpp:27
UI-independent property editor used by tools to expose settings.
Definition EditorPresentation.h:47
Sink implemented by a 2D or 3D viewport to render tool feedback.
Definition EditorPresentation.h:27
virtual void update(EditorContext &context, float dt)
Per-frame hook for an active tool.
Definition EditorTool.h:140
virtual void inspect(EditorContext &context, IEditorInspector &inspector)
Expose configurable settings through a host-provided inspector.
Definition EditorTool.h:152
virtual void drawOverlay(EditorContext &context, IEditorOverlay &overlay)
Emit renderer-independent feedback for the active viewport.
Definition EditorTool.h:146
virtual ToolResponse pointerEvent(EditorContext &context, const EditorPointerEvent &event)
Handle normalized pointer input.
Definition EditorTool.h:124
virtual ToolResponse keyEvent(EditorContext &context, const EditorKeyEvent &event)
Handle normalized keyboard input.
Definition EditorTool.h:132
virtual void activate(EditorContext &context)
Called exactly once when this tool becomes active.
Definition EditorTool.h:119
virtual void cancel(EditorContext &context)
Cancel the active gesture while keeping the tool selected.
Definition EditorTool.h:158
virtual const ToolDescriptor & descriptor() const =0
Stable tool identity and presentation metadata.
Thread-neutral in-memory asset index used by editor hosts and tests.
Definition EditorAssetDatabase.h:71
Result< AssetRecord > find(const AssetGuid &guid) const
Find one asset by stable GUID.
Definition EditorAssetDatabase.cpp:102
std::vector< AssetDependency > dependencies(const AssetGuid &guid, bool incoming=false) const
Query outgoing or incoming dependencies for one asset.
Definition EditorAssetDatabase.cpp:159
Result< RuntimeEditorPackage > publish(const RuntimeEditorManifest &manifest, const EditorCommandService &commands, const EditorExtensionRegistry &extensions, const MemoryAssetDatabase &assets) const
Build a deny-by-default runtime package.
Definition EditorPropertyPresenter.cpp:119
Result< void > validatePropertyValue(const PropertyDescriptor &descriptor, const Value &value)
Validate property value.
Definition EditingProperty.cpp:142
constexpr bool hasPropertyFlag(PropertyFlag value, PropertyFlag flag)
True when property flag.
Definition EditingProperty.h:63
Definition ActionPreviewController.cpp:6
@ EditorOnly
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
eve::editing::SelectionItem SelectionItem
Stable item stored in a selection snapshot.
Definition EditorSelection.h:22
void appendProjectedDiagnostics(std::vector< eve::Diagnostic > &destination, const eve::Status &status)
Append diagnostics while assembling a new immutable Result status.
Definition EditorResultProjection.h:16
eve::editing::SelectionSnapshot SelectionSnapshot
Immutable multi-selection captured for property and command work.
Definition EditorSelection.h:25
HostFeature
Coarse host features used to discover and gate editor extensions.
Definition EditorHostProfile.h:18
@ SourceAssets
@ SourceControl
@ ArbitraryScript
@ BuildCook
@ DebugOverride
eve::editing::PropertySetMode PropertySetMode
Definition EditorProperty.h:22
eve::editing::PropertySchema PropertySchema
Definition EditorProperty.h:19
std::vector< PropertyDescriptor > properties
Definition EditingProperty.h:120
Revision afterRevision
Definition EditingProtocol.h:110
std::vector< Diagnostic > diagnostics
Definition EditingProtocol.h:112
Revision beforeRevision
Definition EditingProtocol.h:109
Directed dependency between two stable asset identities.
Definition EditorAssetDatabase.h:38
Immutable execution context captured for a synchronous command.
Definition EditorCommandService.h:21
uint64_t targetRevision
Definition EditorCommandService.h:25
Presentation and execution metadata for a registered command.
Definition EditorCommandService.h:30
bool createsTransaction
Definition EditorCommandService.h:36
Pointer input normalized by an editor viewport adapter.
Definition EditorTool.h:20
Immutable presentation model consumed by developer or game UI.
Definition EditorPropertyPresenter.h:19
Explicit publish allow-list for a player-facing editor build.
Definition EditorRuntimeManifest.h:11
std::size_t maxPayloadBytes
Definition EditorRuntimeManifest.h:18
std::vector< ToolId > tools
Definition EditorRuntimeManifest.h:14
std::vector< RuleId > rules
Definition EditorRuntimeManifest.h:16
std::vector< StableId > palettes
Definition EditorRuntimeManifest.h:15
HostFeature features
Definition EditorRuntimeManifest.h:12
std::vector< CommandId > commands
Definition EditorRuntimeManifest.h:13
std::vector< AssetGuid > rootAssets
Definition EditorRuntimeManifest.h:17
Resolved editor package embedded into a game build.
Definition EditorRuntimeManifest.h:22
std::vector< CommandDescriptor > commands
Definition EditorRuntimeManifest.h:24
std::vector< AssetGuid > assetClosure
Definition EditorRuntimeManifest.h:28
std::vector< ExtensionToolDescriptor > tools
Definition EditorRuntimeManifest.h:25
std::vector< ExtensionRuleDescriptor > rules
Definition EditorRuntimeManifest.h:27
std::vector< ExtensionPaletteDescriptor > palettes
Definition EditorRuntimeManifest.h:26
Result returned by a tool after processing input.
Definition EditorTool.h:50