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

dev_warnings: ClassVar[bool]

None

freeze_check_interval: ClassVar[float]

1.0

dynamic: bool

False

visible

‘Property(…)’

update_mode

‘Property(…)’

focus_mode

‘Property(…)’

drag_threshold

‘Property(…)’

focus_entered

‘Signal(…)’

focus_exited

‘Signal(…)’

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

None

classmethod __init_subclass__(**kwargs)
property name: str
property visible_in_tree: bool
property input_player: simvx.core.input.players.InputPlayer
property input_context: simvx.core.input.contexts.InputContext | None
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(canvas) → None
on_draw_3d(gizmos) → None
on_picked(event: simvx.core.input.events.PickEvent) → bool | None
on_gui_input(event: simvx.core.input.events.GuiInputEvent) → bool | None
start_coroutine(gen: simvx.core.descriptors.Coroutine) → simvx.core.descriptors.CoroutineHandle
stop_coroutine(gen_or_handle)
property focused: bool
property focus_rect: tuple[float, float, float, float] | None
drag_threshold_for(pointer_type: simvx.core.input.enums.PointerType | str) → float
grab_focus() → None
release_focus() → None
capture_pointer(pointer_id: int | None = None) → None
release_pointer(pointer_id: int | None = None) → None
queue_redraw() → None
property render_dirty: bool
clear_children()
destroy()
property destroying: bool
property destroyed: bool
call_deferred(method: collections.abc.Callable[..., Any], *args: Any) → None
property app
property tree: simvx.core.scene_tree.SceneTree
property viewport_size: simvx.core.math.types.Vec2
property viewport_insets: tuple[float, float, float, float]
property physics
property physics_2d
__getitem__(key: str)
classmethod get_properties() → dict[str, simvx.core.descriptors.Property]
__repr__()