simvx.core.graphics.texture_slot

The one seam a backend publishes a resolved texture handle through.

Module Contents

Classes

TextureSlot

Mixin for a node that shows a texture and caches the backend’s handle.

Data

API

simvx.core.graphics.texture_slot.__all__

[‘TextureSlot’]

class simvx.core.graphics.texture_slot.TextureSlot(name: str = '', **kwargs)[source]

Bases: simvx.core.graphics.texture_slot._Base

Mixin for a node that shows a texture and caches the backend’s handle.

A backend resolves node.texture to a bindless slot and has to hand that number back to the node. Doing it with a plain attribute write is the bug this mixin removes: the write fires none of the invalidation a

Class:

~simvx.core.descriptors.Property fires, so a node that drew nothing while its slot was still -1 keeps serving that empty draw out of the retained 2D cache forever. It is silent – an invisible node and no error – and it was fixed once per backend, per node type, before it was fixed here.

So the slot is not assignable. :meth:publish_texture_slot is the only route, it invalidates, and it is a no-op when the slot has not moved, which is what lets an offscreen target republish its handle every frame without dirtying anything.

The other half is re-resolution. _invalidate_texture_slot is the on_change hook on every texture property: reassigning the texture drops the cached slot, which is what re-opens the backend’s resolve gate. Without it the first successful resolve latches and the node draws the old image for the life of the scene.

Initialization

property texture_slot: int[source]

The published backend handle for the current texture, or -1.

publish_texture_slot(slot: int) None[source]

Publish a resolved backend handle and invalidate the cached draw.

Idempotent: republishing the handle a node already has does nothing, so a per-frame publish costs one comparison and never dirties the node.

publish_overlay_slot(slot: int) None[source]

Web: publish the 2D overlay-table handle and draw with it.

A combined 2D+3D export may have already published a 3D material-table handle on this node; for a 2D overlay the overlay table is the right one, so it wins.

strict_errors: ClassVar[bool]

True

dev_checks: ClassVar[bool]

None

script_error_raised

‘Signal(…)’

dynamic: bool

False

visible

‘Property(…)’

update_mode

‘Property(…)’

__properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]

None

classmethod __init_subclass__(**kwargs)
property name: str
property visible_in_tree: bool
reset_error() None
add_child(node: simvx.core.node.T) simvx.core.node.T
remove_child(node: simvx.core.node.Node) None
reparent(new_parent: simvx.core.node.Node)
node_at(path, default=_NO_DEFAULT)
find(target, *, direct: bool = False)
find_all(target, *, direct: bool = False)
expect(target, *, direct: bool = False)
ancestor(target)
walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]
property path: str
property is_scene_root: bool
add_to_group(group: str)
remove_from_group(group: str)
is_in_group(group: str) bool
on_ready() None
on_enter_tree() None
on_exit_tree() None
on_update(dt: float) None
on_fixed_update(dt: float) None
on_draw(renderer) None
on_picked(event: simvx.core.events.InputEvent) None
on_unhandled_input(event: simvx.core.events.TreeInputEvent) None
start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
queue_redraw() None
property render_dirty: bool
clear_children()
destroy()
property destroying: bool
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None
property app
property tree: simvx.core.scene_tree.SceneTree
property physics
property physics_2d
__getitem__(key: str)
classmethod get_properties() dict[str, simvx.core.descriptors.Property]
__repr__()