simvx.core._draw_context

Which ambient values a node’s on_draw read, so a change to one re-captures it.

A retained on_draw re-runs only when something marks it stale. A Property write marks its own node, but a draw that lays itself out from the render target (viewport_size, viewport_insets, tree.screen_size, tree.screen_insets, tree.ui_scale) depends on a value that belongs to nobody’s properties. So the getters of those values record the read on the node being captured, and whoever changes one marks exactly the nodes that read it.

draw_context.node is the node whose on_draw is running, set by Node._draw_dispatch for the duration of one capture and None otherwise. It is a module instance rather than a Node class attribute because writing a class attribute bumps the type’s version and flushes the attribute cache of every subclass, twice per capture.

Each node carries its reads as an int, _ambient_reads, cleared when its capture starts, so the mask always describes the draw currently retained. The getters OR plain ints into it: the AmbientRead members are the names, and the module-level ints are what the hot path uses, because an IntFlag operation goes through the enum machinery.

Module Contents

Classes

AmbientRead

The ambient values a draw can depend on.

Functions

redraw_readers

queue_redraw() every node under root, root included, whose last draw read one of flags.

Data

API

class simvx.core._draw_context.AmbientRead[source]

Bases: enum.IntFlag

The ambient values a draw can depend on.

Initialization

Initialize self. See help(type(self)) for accurate signature.

VIEWPORT_SIZE

1

VIEWPORT_INSETS

2

UI_SCALE

4

__abs__()
__add__()
__and__()
__bool__()
__ceil__()
__delattr__()
__dir__()
__divmod__()
__eq__()
__float__()
__floor__()
__floordiv__()
__format__()
__ge__()
__getattribute__()
__getnewargs__()
__getstate__()
__gt__()
__hash__()
__index__()
__int__()
__invert__()
__le__()
__lshift__()
__lt__()
__mod__()
__mul__()
__ne__()
__neg__()
__new__()
__or__()
__pos__()
__pow__()
__radd__()
__rand__()
__rdivmod__()
__reduce__()
__reduce_ex__()
__repr__()
__rfloordiv__()
__rlshift__()
__rmod__()
__rmul__()
__ror__()
__round__()
__rpow__()
__rrshift__()
__rshift__()
__rsub__()
__rtruediv__()
__rxor__()
__setattr__()
__sizeof__()
__str__()
__sub__()
__subclasshook__()
__truediv__()
__trunc__()
__xor__()
as_integer_ratio()
bit_count()
bit_length()
conjugate()
class denominator
class imag
is_integer()
class numerator
class real
to_bytes()
__deepcopy__(memo)
__copy__()
name()
value()
__contains__(other)
__iter__()
__len__()
simvx.core._draw_context.READS_VIEWPORT_SIZE

‘int(…)’

simvx.core._draw_context.READS_VIEWPORT_INSETS

‘int(…)’

simvx.core._draw_context.READS_UI_SCALE

‘int(…)’

simvx.core._draw_context.draw_context

‘_DrawContext(…)’

simvx.core._draw_context.redraw_readers(root: Any, flags: int) → None[source]

queue_redraw() every node under root, root included, whose last draw read one of flags.

root is a render target, the tree’s top node or a SubViewport. A SubViewport below it is a different target, so the walk does not enter one: its nodes read that viewport’s size, not root’s.