载入中...
搜索中...
未找到
PixelWorldCatalogPanel.cpp
浏览该文件的文档.
147eve::Result<PixelWorldCatalogPanel> PixelWorldCatalogPanel::create(std::string_view catalogJson) {
226 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "material id is outside the Catalog",
237 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "reaction index is outside the Catalog",
260 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "reaction index is outside the Catalog",
271 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "phase index is outside the Catalog",
293 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "phase index is outside the Catalog",
330 eve::DiagnosticCode::PreconditionViolation, "pixelworld catalog panel requires an active UI ECS world",
421 image("material-preview", 96.0f, 56.0f).withTint(red, green, blue, alpha).withCornerRadius(6.0f),
422 inputText("Name", selected.name, "material-name", [mutateMaterial](const std::string& value) mutable {
472 integerField("Default temperature", "material-default-temperature", selected.defaultTemperature,
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Owning immutable material and reaction table used by one PixelWorld.
Definition PixelMaterial.h:84
const MaterialDefinition & definition(MaterialId id) const noexcept
Resolve a validated id; invalid ids safely project to air.
Definition PixelMaterial.cpp:234
bool canReact(MaterialId id) const noexcept
Whether this material participates in at least one binary reaction.
Definition PixelMaterial.cpp:242
static MaterialCatalog builtIn()
Construct the engine's canonical built-in catalog.
Definition PixelMaterial.cpp:151
std::span< const MaterialReactionRule > reactions() const noexcept
Borrow immutable canonical-priority reaction rules.
Definition PixelMaterial.cpp:240
std::span< const MaterialDefinition > definitions() const noexcept
Borrow immutable definitions until this catalog is destroyed.
Definition PixelMaterial.cpp:239
std::span< const MaterialPhaseRule > phaseRules() const noexcept
Borrow immutable canonical-priority phase rules.
Definition PixelMaterial.cpp:241
static eve::Result< MaterialCatalog > create(std::vector< MaterialDefinition > definitions, std::vector< MaterialReactionRule > reactions={}, std::vector< MaterialPhaseRule > phaseRules={})
Validate and own a complete catalog candidate transactionally.
Definition PixelMaterial.cpp:38
bool canPhaseTransition(MaterialId id) const noexcept
Whether this material owns at least one phase transition rule.
Definition PixelMaterial.cpp:246
Main-thread-affine control surface shared by editor, CLI and MCP adapters.
Definition PixelWorldControl.h:47
eve::Result< PixelCatalogReloadReceipt > reloadMaterialCatalog(std::uint64_t worldId, std::string_view catalogJson, std::uint64_t expectedFingerprint)
Validate JSON and transactionally hot-reload a compatible paused world Catalog.
Definition PixelWorldControl.cpp:128
Dedicated visual material/reaction Catalog editor with transactional draft admission.
Definition PixelWorldCatalogPanel.h:47
eve::ui::WidgetDesc buildWidgetTree()
Build a dedicated material browser, property inspector and rule editor visual tree.
Definition PixelWorldCatalogPanel.cpp:387
eve::Result< CatalogDraftReceipt > addReaction(eve::pixelworld::MaterialReactionRule rule)
Add a binary rule and select its canonical post-validation position.
Definition PixelWorldCatalogPanel.cpp:244
eve::Result< CatalogDraftReceipt > removePhase(std::size_t index)
Remove one phase rule transactionally.
Definition PixelWorldCatalogPanel.cpp:290
eve::Result< CatalogDraftReceipt > removeReaction(std::size_t index)
Remove one binary rule transactionally.
Definition PixelWorldCatalogPanel.cpp:257
static eve::Result< PixelWorldCatalogPanel > create(std::string_view catalogJson)
Decode and validate a versioned Catalog document into a fresh panel draft.
Definition PixelWorldCatalogPanel.cpp:147
eve::Result< CatalogDraftReceipt > replaceReaction(std::size_t index, eve::pixelworld::MaterialReactionRule rule)
Replace one binary rule after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:233
PixelWorldCatalogPanel(const PixelWorldCatalogPanel &)=delete
std::vector< MaterialCard > materialCards() const
Project deterministic cards for the material browser.
Definition PixelWorldCatalogPanel.cpp:159
eve::Result< void > selectPhase(std::size_t index)
Select a phase-transition rule by canonical index.
Definition PixelWorldCatalogPanel.cpp:190
eve::Result< void > selectMaterial(std::size_t index)
Select a material by canonical index without mutating the Catalog.
Definition PixelWorldCatalogPanel.cpp:172
eve::Result< CatalogDraftReceipt > loadDocument(std::string_view catalogJson)
Replace the draft from a validated document; failure leaves all panel state intact.
Definition PixelWorldCatalogPanel.cpp:304
eve::Result< void > selectReaction(std::size_t index)
Select a binary reaction rule by canonical index.
Definition PixelWorldCatalogPanel.cpp:181
void close()
Hide the mounted panel without discarding its validated draft.
Definition PixelWorldCatalogPanel.cpp:349
eve::Result< CatalogDraftReceipt > replaceMaterial(eve::pixelworld::MaterialDefinition definition)
Replace one material definition after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:221
eve::Result< eve::pixelworld::PixelCatalogReloadReceipt > apply(eve::pixelworld::PixelWorldControlService &control, std::uint64_t worldId, std::uint64_t expectedFingerprint) const
Apply the draft through the canonical paused-world authority path.
Definition PixelWorldCatalogPanel.cpp:313
eve::Result< CatalogDraftReceipt > replacePhase(std::size_t index, eve::pixelworld::MaterialPhaseRule rule)
Replace one phase rule after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:267
eve::Result< CatalogDraftReceipt > addPhase(eve::pixelworld::MaterialPhaseRule rule)
Add a phase rule and select its canonical post-validation position.
Definition PixelWorldCatalogPanel.cpp:278
PixelWorldCatalogPanel & operator=(const PixelWorldCatalogPanel &)=delete
bool isOpen() const
True while the panel has a live, visible UI host.
Definition PixelWorldCatalogPanel.cpp:353
eve::ui::UIHostHandle host() const noexcept
Mounted UI host handle, or an empty handle before open().
Definition PixelWorldCatalogPanel.h:121
eve::Result< eve::ui::UIHostHandle > open()
Mount or reveal the panel in the UI ECS world and publish its current tree.
Definition PixelWorldCatalogPanel.cpp:322
static PixelWorldCatalogPanel builtIn()
Create a panel over the canonical built-in Catalog.
Definition PixelWorldCatalogPanel.cpp:155
eve::Result< void > refresh()
Reconcile the mounted host with the latest draft and selection state.
Definition PixelWorldCatalogPanel.cpp:358
eve::Result< std::string > document() const
Encode the current validated draft using the canonical versioned JSON codec.
Definition PixelWorldCatalogPanel.cpp:300
static UIHostHandle createHost(const std::string &name="")
Creates an ECS-owned UI host.
Definition UIHost.cpp:49
static eve::OptionalRef< UIHost > resolve(UIHostHandle handle) noexcept
Resolves a UI host handle with ECS generation checking.
Definition UIHost.cpp:62
ShapeState * child(const JPH::Body &body, const JPH::SubShapeID &id)
Resolves a native child record for a synchronous callback or query. @ownership Borrowed from the worl...
Definition JoltInternal.h:138
Definition PixelWorldGraphics.h:13
eve::Result< MaterialCatalog > decodeMaterialCatalogJson(std::string_view json)
Decode and validate schema eve.pixelworld.material-catalog version 1.
Definition PixelMaterialCatalogCodec.cpp:173
MaterialId
Compact stable material identifier stored in each authoritative cell.
Definition PixelMaterial.h:16
eve::Result< std::string > encodeMaterialCatalogJson(const MaterialCatalog &catalog)
Encode schema eve.pixelworld.material-catalog version 1 canonically.
Definition PixelMaterialCatalogCodec.cpp:132
ControlEdit button(const char *label, float width=0.f, float height=0.f)
Shared immediate renderer for retained and EditorHost buttons.
Definition ControlPrimitives.h:15
ControlEdit combo(const char *label, int &selected, const std::vector< const char * > &items)
Shared immediate renderer for indexed combo boxes.
Definition ControlPrimitives.h:37
ControlEdit inputText(const char *label, std::string &value, bool multiline=false, ImVec2 multilineSize=ImVec2(0.f, 96.f), bool readOnly=false, const char *hint="")
UTF-8 owning text editor with automatic buffer growth.
Definition ControlPrimitives.h:80
Definition Component.cpp:7
WidgetDesc collapsingHeader(std::string label, std::vector< WidgetDesc > children, std::string id, bool defaultOpen)
Collapsible header containing child widgets.
Definition Widget.cpp:814
WidgetDesc badge(std::string label, std::string id)
Compact status/category pill. Tint controls its background color.
Definition Widget.cpp:581
WidgetDesc statusBar(std::vector< WidgetDesc > children, std::string id)
Compact horizontal status strip; Spacer children absorb free width.
Definition Widget.cpp:688
WidgetDesc inputText(std::string label, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Editable text field; fires onTextChange.
Definition Widget.cpp:533
WidgetDesc window(std::string title, std::vector< WidgetDesc > children, std::string id)
Top-level window widget with a title bar.
Definition Widget.cpp:326
WidgetDesc spacer(std::string id, float grow)
Flexible empty space; default flexGrow=1 so it absorbs free space in a Flex parent.
Definition Widget.cpp:888
WidgetDesc toolbar(std::vector< WidgetDesc > children, std::string id)
Horizontal editor command strip; Spacer children absorb free width.
Definition Widget.cpp:655
WidgetDesc searchField(std::string hint, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Compact search field with placeholder text and a bundled search icon.
Definition Widget.cpp:557
WidgetDesc sidebar(std::vector< WidgetDesc > children, std::string id, float width)
Vertical editor side panel. Width defaults to 240 logical pixels.
Definition Widget.cpp:678
WidgetDesc scrollList(std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
Scroll list.
Definition Widget.cpp:837
WidgetDesc splitPane(FlexDirection direction, WidgetDesc first, WidgetDesc second, float ratio, std::string id, std::function< void(float)> onResize)
Two resizable panes separated by a drag handle.
Definition Widget.cpp:699
WidgetDesc sectionHeader(std::string label, std::string id)
Non-collapsible editor section heading with an accent marker.
Definition Widget.cpp:614
@ InvalidArgument
@ PreconditionViolation
Definition Container.h:602
Immutable validated properties for one catalog material.
Definition PixelMaterial.h:36
Data-driven phase transition evaluated after heat diffusion.
Definition PixelMaterial.h:61
std::int16_t temperatureDelta
Definition PixelMaterial.h:67
TemperatureDirection direction
Definition PixelMaterial.h:65
Deterministically ordered binary material reaction.
Definition PixelMaterial.h:72
MaterialId secondResult
Definition PixelMaterial.h:77
std::int16_t minimumTemperature
Definition PixelMaterial.h:78
MaterialId firstResult
Definition PixelMaterial.h:76
Draft mutation receipt used for UI reconciliation and optimistic publication.
Definition PixelWorldCatalogPanel.h:31
Declarative widget description (build once / on dirty → flatten into UIHost::Tree).
Definition Widget.h:15