载入中...
搜索中...
未找到
VoxelCatalog.cpp
浏览该文件的文档.
21 return std::any_of(d.begin(), d.end(), [](const auto& v) { return v.severity() == DiagnosticSeverity::Error; });
42 return eve::editing::failed<VoxelSocket>(EditorStatus::Rejected, RuleId("editor.voxel-model.socket"),
48 return eve::editing::failed<VoxelSocket>(EditorStatus::Rejected, RuleId("editor.voxel-model.socket-kind"),
57 EditorStatus::Rejected, RuleId("editor.voxel-model.sockets"), "Voxel sockets require six faces");
62 return eve::editing::failed<std::array<VoxelSocket, 6>>(parsed.code(), RuleId("editor.voxel-model.socket"),
80 EditorStatus::Rejected, RuleId("editor.voxel-model.voxels"), "Voxel occupancy must be an array");
83 EditorStatus::Rejected, RuleId("editor.voxel-model.voxels-capacity"), "Model occupancy exceeds 4096 cells");
131 if (!ids || ids->empty() || !names || names->empty() || !sx || !sy || !sz || !sockets.ok() || !voxels.ok())
132 return eve::editing::failed<VoxelModelValue>(EditorStatus::Rejected, RuleId("editor.voxel-model.entry"),
222VoxelPick pickVoxelModel(const VoxelModelValue& model, float ox, float oy, float oz, float dx, float dy, float dz,
321 if (c == IEditingSnapshotProvider::editingCapabilityId()) return static_cast<IEditingSnapshotProvider*>(this);
326 const auto it = std::find_if(models_.begin(), models_.end(), [&](const auto& v) { return v.id == id; });
342eve::Result<eve::Revision> VoxelCatalogTarget::currentRevision(const SelectionSnapshot& s) const {
355 schema.properties.push_back(prop("model.socket." + std::to_string(face) + ".tag", PropertyType::String, ""));
362PropertyReadResult VoxelCatalogTarget::read(const SelectionSnapshot& s, const PropertyPath& p) const {
393Result<DomainOperation> VoxelCatalogTarget::replacement(EditorValue content, std::string property) const {
406Result<DomainOperation> VoxelCatalogTarget::makeSet(const SelectionSnapshot& s, const PropertyPath& p,
410 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.set"),
419 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.name"),
427 EditorStatus::Unsupported, RuleId("editor.voxel-model.property"), "Unknown voxel model property");
448 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.invalid"),
453Result<DomainOperation> VoxelCatalogTarget::makeReset(const SelectionSnapshot& s, const PropertyPath& p) const {
456 return eve::editing::failed<DomainOperation>(EditorStatus::Unsupported, RuleId("editor.voxel-model.property"),
464 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.identity"),
469 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.invalid"),
476 return eve::editing::failed<DomainOperation>(EditorStatus::NotFound, RuleId("editor.voxel-model.entry"),
483Result<DomainOperation> VoxelCatalogTarget::makeSetVoxel(const ObjectId& model, int x, int y, int z,
487 return eve::editing::failed<DomainOperation>(EditorStatus::NotFound, RuleId("editor.voxel-model.entry"),
490 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.range"),
495 std::find_if(dest->voxels.begin(), dest->voxels.end(), [&](const auto& v) { return v.x == x && v.y == y && v.z == z; });
501 return eve::editing::failed<DomainOperation>(EditorStatus::Rejected, RuleId("editor.voxel-model.invalid"),
512 d.push_back(eve::editing::ruleDiagnostic(eve::DiagnosticCode::Conflict, RuleId("editor.voxel-model.identity"),
544 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.voxel-model.operation"),
575 return eve::editing::failed<void>(EditorStatus::Conflict, RuleId("editor.voxel-model.candidate"),
589 return eve::editing::failed<void>(EditorStatus::Unsupported, RuleId("editor.voxel-model.snapshot"),
600std::vector<ObjectId> VoxelCatalogTarget::hullJoinPartners(const ObjectId& model, int face) const {
MagicaVoxel-style sculpted models: bounded occupancy grids and hull sockets.
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.
Optional capability exposing a deterministic, persistence-safe editing snapshot.
Definition EditableTarget.h:247
static CapabilityId editingCapabilityId()
Stable capability identity shared by every editable domain target.
Definition EditableTarget.h:252
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 project of MagicaVoxel-style sculpted models.
Definition VoxelCatalog.h:137
Result< DomainOperation > makeSet(const SelectionSnapshot &, const PropertyPath &, const EditorValue &, PropertySetMode) const override
Make set.
Definition VoxelCatalog.cpp:406
std::vector< ObjectId > hullJoinPartners(const ObjectId &model, int face) const
Hull join partners.
Definition VoxelCatalog.cpp:600
Result< void > applyDomainOperation(const DomainOperation &) override
Applies domain operation.
Definition VoxelCatalog.cpp:542
Result< DomainOperation > makeCreateModel(const VoxelModelValue &) const
Make create model.
Definition VoxelCatalog.cpp:461
Result< DomainOperation > makeSetVoxel(const ObjectId &model, int x, int y, int z, bool occupied) const
Make set voxel.
Definition VoxelCatalog.cpp:483
const VoxelModelValue * findModel(const ObjectId &) const
Look up a sculpted model by stable id.
Definition VoxelCatalog.cpp:325
PropertyReadResult read(const SelectionSnapshot &, const PropertyPath &) const override
Reads .
Definition VoxelCatalog.cpp:362
Result< DomainOperation > makeReset(const SelectionSnapshot &, const PropertyPath &) const override
Make reset.
Definition VoxelCatalog.cpp:453
eve::Result< eve::Revision > currentRevision(const SelectionSnapshot &) const override
Current revision.
Definition VoxelCatalog.cpp:342
Result< void > commitDomainState(std::unique_ptr< IDomainOperationTarget >) override
Commits domain state.
Definition VoxelCatalog.cpp:572
PropertySchema schema(const SelectionSnapshot &) const override
Schema.
Definition VoxelCatalog.cpp:350
std::unique_ptr< IDomainOperationTarget > cloneDomainState() const override
Clones domain state.
Definition VoxelCatalog.cpp:568
void * queryCapability(const CapabilityId &) override
Query Inspector property and snapshot capabilities.
Definition VoxelCatalog.cpp:319
Result< DomainOperation > makeDeleteModel(const ObjectId &) const
Make delete model.
Definition VoxelCatalog.cpp:474
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
Definition VoxelCatalog.cpp:10
VoxelCellFill voxelClassifyModelFill(const VoxelModelValue &model)
Classify a sculpted model as empty, partial, or a solid cube.
Definition VoxelCatalog.cpp:215
constexpr int kVoxelModelMaxOccupied
Occupied-cell budget for one sculpted object.
Definition VoxelCatalog.h:53
editing::DomainOperation DomainOperation
Definition VoxelCatalog.h:24
VoxelSocketKind voxelSocketKindFromName(std::string_view name)
Parse a socket kind name.
Definition VoxelCatalog.cpp:175
bool canJoinVoxelSockets(const VoxelSocket &a, const VoxelSocket &b)
True when two facing sockets may join.
Definition VoxelCatalog.cpp:196
bool isVoxelModelOccupied(const VoxelModelValue &model, int x, int y, int z)
True when model contains an occupied cell at (x,y,z).
Definition VoxelCatalog.cpp:210
int voxelOppositeFace(int face)
Opposite FaceDir index in PosX/NegX/PosY/NegY/PosZ/NegZ order.
Definition VoxelCatalog.cpp:204
constexpr int kVoxelModelMaxSize
Inclusive maximum MagicaVoxel-like object edge (cells).
Definition VoxelCatalog.h:51
const char * voxelSocketKindName(VoxelSocketKind kind)
Stable serialized name for a socket kind. @ownership Observed static string; callers must not free it...
Definition VoxelCatalog.cpp:182
VoxelPick pickVoxelModel(const VoxelModelValue &model, float ox, float oy, float oz, float dx, float dy, float dz, float maxDistance)
Raycast occupied cells with MagicaVoxel-style previous-cell attach.
Definition VoxelCatalog.cpp:222
editing::SelectionSnapshot SelectionSnapshot
Definition VoxelCatalog.h:46
@ InvalidArgument
@ PreconditionViolation
@ Conflict
Definition Container.h:602
std::vector< PropertyDescriptor > properties
Definition EditingProperty.h:120
PropertyDescriptorLookup find(const PropertyPath &path) const
Finds find.
Definition EditingProperty.cpp:9
Stable discovery metadata exposed by every editable target.
Definition EditableTarget.h:39
One occupied cell inside a sculpted model.
Definition VoxelCatalog.h:68
One MagicaVoxel-style object: a bounded occupancy grid.
Definition VoxelCatalog.h:75
std::array< VoxelSocket, 6 > sockets
Definition VoxelCatalog.h:81
std::vector< VoxelCoord > voxels
Definition VoxelCatalog.h:82
One face socket: matching tag plus compatible polarity.
Definition VoxelCatalog.h:62