McRogueFace/docs
John McCardle 2d2c333cd7 Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313
UIEntity now depends on the grid DATA layer only:
- GridData gains cell_width_px/cell_height_px (mirrored from the grid
  texture in UIGrid's 5-arg ctor; texture is write-once) so entity
  tile<->pixel math no longer reaches into rendering (getTexture()).
- GridData gains markDirty()/markCompositeDirty(): set the flag on the
  UIGrid subobject AND notify owning_view, covering both render paths.
  UIGrid disambiguates via 'using UIDrawable::markDirty' so all
  pre-existing UIGrid-receiver calls resolve exactly as before.
- The three Python wrappers that still need the full UIGrid (GridPoint
  from entity.at(), the _GridData fallback in get_grid, find_path's temp
  wrapper) reconstruct it via a single aliasing-downcast helper
  (grid_as_uigrid) that documents the never-independently-allocated
  GridData invariant; init/set_grid simplify (share grid_data directly).
  Removing the casts is deferred to #252.

entity.texture (new, frozen surface +1): thin get/set over the entity's
own UISprite. Entities render with their OWN texture (default_texture
fallback at construction); the grid's texture only determines cell size.
Setter preserves sprite_index; rejects non-Texture (TypeError),
null-data Texture wrappers (ValueError), and deletion.

Adversarial review fixes folded in:
- set_texture/get_texture guard uninitialized Entity wrappers
  (RuntimeError), isinstance errors, and null-data Textures.
- PyUIGridViewType tp_dealloc no longer unconditionally severs
  GridData::owning_view: gated on last-owner (#251 use_count pattern)
  plus owning-view identity. Previously ANY Grid wrapper GC while the
  view lived (e.g. scene.children.append(mcrfpy.Grid(...))) silently
  broke entity.grid -> Grid identity and data-layer dirty notification.

Tests: tests/regression/issue_313_entity_grid_data_test.py (texture
semantics, grid-cell-size invariance, entity.grid identity, #251 gate
survival, GridPoint outliving teardown, review-fix guards, owning_view
survival) + tests/unit/entity_texture_test.py. API snapshot golden
re-baselined: exactly +1 surface line (Entity.texture) + writability
probe flip. Docs/stubs regenerated. Native + Emscripten builds verified.

Known edges recorded in docs/api-audit-2026-04.md: texture read-back is
a fresh wrapper each get (no Texture __eq__); sprite_index not
re-validated against a new atlas. Multi-view markDirty broadcast and
pure-GridData wrappers remain deferred to #252. Addresses #314.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:51:22 -04:00
..
cookbook Cookbook: draft docs 2026-01-13 19:42:37 -05:00
stubs Fix #161: Update Grid, GridPoint, GridPointState stubs to match current API 2026-01-21 21:47:26 -05:00
templates draft tutorial revisions 2026-01-03 11:01:10 -05:00
tutorials Update all 13 tutorial scripts to current enum-based API, refs #167 2026-04-09 23:23:35 -04:00
api-audit-2026-04.md Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313 2026-06-11 00:51:22 -04:00
api_reference_complete.html docs: Add complete API reference documentation 2025-10-23 13:19:36 -04:00
API_REFERENCE_COMPLETE.md Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
api_reference_dynamic.html Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313 2026-06-11 00:51:22 -04:00
API_REFERENCE_DYNAMIC.md Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313 2026-06-11 00:51:22 -04:00
EMSCRIPTEN_RESEARCH.md First successful Emscripten/WASM build for #158 2026-01-31 00:34:11 -05:00
ISSUE_TRIAGE_2026-04.md Fix outdated CLAUDE.md WASM audio entry; update triage notes 2026-04-20 14:37:48 -04:00
mcrfpy.3 Refactor UIEntity::grid to shared_ptr<GridData>; add entity.texture; closes #313 2026-06-11 00:51:22 -04:00
PROCEDURAL_GENERATION_SPEC.md HeightMap: core class with scalar operations (closes #193) 2026-01-11 20:07:55 -05:00
WASM_TROUBLESHOOTING.md Add WASM developer troubleshooting guide, closes #240 2026-04-10 03:31:43 -04:00