simvx.core._drawable2d¶
The two dirty bits are deliberately SEPARATE¶
- attr:
_render_dirty– “this drawable’s geometry/appearance changed; its item(s) must be re-collected/re-uploaded.” Its lifetime is owned by the render layer: it persists until the upload step clears it (:meth:_clear_render_dirty), and is NEVER cleared by aworld_positionread.
- attr:
_transform_render_dirty– “this drawable moved; its transform row must be rewritten (geometry untouched – the scroll-by-translation fast path).” Also render-owned, also persists until the upload step clears it.
Neither is Node2D._transform_dirty: that flag is cleared lazily by any
world_position/world_transform read (scene-adapter / collision / audio /
culling all read it mid-frame) and _invalidate_transform short-circuits its
descendant recursion if not self._transform_dirty. A render-dirty bit layered
on it would inherit that early-return and leave descendants stale after a
read-then-move sequence. So the transform-render bit gets its OWN propagation
with no such short-circuit.
Retention bits¶
These render-retention bits are read by the 2D item pipeline’s
- class:
RenderItemCacheto decide what to re-collect, re-capture, or patch in place each frame.
The shared 2D-drawable concept.
The blanket Property.__set__ -> queue_redraw hook (descriptors.py) only
does anything on a node that actually defines queue_redraw. The build-once
retention path rides that same hook to set a per-item dirty bit, so every 2D
drawable needs it: without it a Sprite2D colour / texture / visible change
would mark nothing dirty and item-level invalidation would never fire.
This module supplies it as a small mixin (:class:Drawable2D) carrying the
render-retention state + queue_redraw. A mixin rather than a hoist onto
Node2D, because the drawable concept must also cover CanvasLayer, which
is a Node and not a Node2D. The mixin lets Node2D and
CanvasLayer share one implementation without forcing CanvasLayer through
Node2D’s 2D transform cache. Control inherits it via Node2D and
extends queue_redraw additively, so its _DrawRecorder path keeps
working.
Module Contents¶
Classes¶
Mixin: render-retention dirty state + |
API¶
- class simvx.core._drawable2d.Drawable2D[source]¶
Mixin: render-retention dirty state +
queue_redrawfor 2D drawables.Mixed into :class:
~simvx.core.nodes_2d.node2d.Node2D(so every sprite / shape / Text2D / Control inherits it) and- Class:
~simvx.core.nodes_2d.canvas.CanvasLayer(aNode, covered by the mixin rather than by aNode2Dhoist).
The mixin owns no transform: it never reads
position/world_transform. It only flips render-retention flags, which the item pipeline reads and drains after upload.- hdr¶
‘Property(…)’