载入中...
搜索中...
未找到
VoxelPaletteTarget.cpp
浏览该文件的文档.
30 const auto * id = field(v, "id"), *name = field(v, "name"), *directional = field(v, "directional"),
31 *group = field(v, "composeGroup"), *connects = field(v, "connects"), *faceValue = field(v, "faces");
50 EditorStatus::Rejected, RuleId("editor.voxel-palette.face"), "Voxel face texture must be 0..255");
67 return std::any_of(d.begin(), d.end(), [](const auto& v) { return v.severity() == DiagnosticSeverity::Error; });
79 return c == CapabilityId("eve.editor.target.voxel-palette-properties") ? static_cast<IPropertyProvider*>(this)
90eve::Result<eve::Revision> VoxelPaletteTarget::currentRevision(const SelectionSnapshot& s) const {
107PropertyReadResult VoxelPaletteTarget::read(const SelectionSnapshot& s, const PropertyPath& p) const {
148Result<DomainOperation> VoxelPaletteTarget::makeSet(const SelectionSnapshot& s, const PropertyPath& p,
152 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-palette.set"),
169 EditorStatus::Rejected, RuleId("editor.voxel-palette.face"), "Voxel texture ID must be 0..255");
180 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-palette.capacity"),
184Result<DomainOperation> VoxelPaletteTarget::makeReset(const SelectionSnapshot& s, const PropertyPath& p) const {
187 return eve::editing::failed<DomainOperation>(EditorStatus::Unsupported, RuleId("editor.voxel-palette.property"),
192 if (v.id.empty() || v.type.name.empty() || std::any_of(entries_.begin(), entries_.end(), [&](const auto& x) {
195 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-palette.identity"),
200 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-palette.capacity"),
206 return eve::editing::failed<DomainOperation>(EditorStatus::NotFound, RuleId("editor.voxel-palette.entry"),
234 RuleId("editor.voxel-palette.empty"), DiagnosticSeverity::Warning, "Voxel palette has no cube types"));
239 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.voxel-palette.operation"),
244 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.voxel-palette.payload"),
255 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.voxel-palette.invalid"),
268 return eve::editing::failed<void>(EditorStatus::Conflict, RuleId("editor.voxel-palette.candidate"),
280 return eve::editing::failed<void>(EditorStatus::Unsupported, RuleId("editor.voxel-palette.snapshot"),
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
void bumpRevision()
Advance the revision without touching the dirty region.
Definition EditableTarget.h:179
Revision revisionValue() const noexcept
Return the revision as the shared protocol revision type.
Definition EditableTarget.h:169
void widenDirty()
Mark an unknown area dirty without advancing the revision.
Definition EditableTarget.h:177
virtual void clearDirtyRegion()=0
Clears dirty region.
UI-independent property access for an immutable selection snapshot.
Definition EditingProperty.h:139
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:19
bool isWithinLimits(size_t maxDepth, size_t maxElements, size_t maxStringBytes) const
Validate nesting, element count and approximate string byte limits.
Definition EditingValue.cpp:50
Revisioned Voxel CubeType palette with face-material Inspector.
Definition VoxelPaletteTarget.h:58
Result< void > commitDomainState(std::unique_ptr< IDomainOperationTarget >) override
Commits domain state.
Definition VoxelPaletteTarget.cpp:265
eve::Result< eve::Revision > currentRevision(const SelectionSnapshot &) const override
Current revision.
Definition VoxelPaletteTarget.cpp:90
PropertyReadResult read(const SelectionSnapshot &, const PropertyPath &) const override
Reads .
Definition VoxelPaletteTarget.cpp:107
Result< DomainOperation > makeReset(const SelectionSnapshot &, const PropertyPath &) const override
Make reset.
Definition VoxelPaletteTarget.cpp:184
void * queryCapability(const CapabilityId &) override
Query an optional stable editing capability.
Definition VoxelPaletteTarget.cpp:78
Result< void > loadSnapshot(const EditorValue &)
Loads snapshot.
Definition VoxelPaletteTarget.cpp:276
Result< DomainOperation > makeCreate(const VoxelPaletteEntryValue &) const
Add one unique named cube type.
Definition VoxelPaletteTarget.cpp:191
Result< DomainOperation > makeDelete(const ObjectId &) const
Delete one cube type by stable editor ID.
Definition VoxelPaletteTarget.cpp:204
Result< DomainOperation > makeSet(const SelectionSnapshot &, const PropertyPath &, const EditorValue &, PropertySetMode) const override
Make set.
Definition VoxelPaletteTarget.cpp:148
PropertySchema schema(const SelectionSnapshot &) const override
Schema.
Definition VoxelPaletteTarget.cpp:97
std::unique_ptr< IDomainOperationTarget > cloneDomainState() const override
Clones domain state.
Definition VoxelPaletteTarget.cpp:262
Result< void > applyDomainOperation(const DomainOperation &) override
Applies domain operation.
Definition VoxelPaletteTarget.cpp:237
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build a common diagnostic carrying an open editing rule identity.
Definition EditingResult.h:25
const EditorValue * field(const EditorValue &value, const char *name)
Definition RoadNetworkEditTarget.cpp:15
Definition VoxelCatalog.cpp:10
editing::DomainOperation DomainOperation
Definition VoxelCatalog.h:24
editing::PropertyDescriptor PropertyDescriptor
Definition VoxelCatalog.h:36
@ InvalidArgument
@ PreconditionViolation
@ Conflict
Definition Container.h:602
PropertyDescriptorLookup find(const PropertyPath &path) const
Finds find.
Definition EditingProperty.cpp:9
Stable discovery metadata exposed by every editable target.
Definition EditableTarget.h:39
Stable authored entry in a Voxel cube palette.
Definition VoxelPaletteTarget.h:48