pub struct SceneTree { /* private fields */ }Expand description
Flat generation-indexed arena holding the entire retained UI scene graph with dense SoA metadata and intrusive child topology.
Implementations§
Source§impl SceneTree
Generation-guarded theme ownership and origin snapshot bookkeeping for in-place theme remaps.
impl SceneTree
Generation-guarded theme ownership and origin snapshot bookkeeping for in-place theme remaps.
Sourcepub fn set_theme_owned(&mut self, id: NodeId, owned: bool)
pub fn set_theme_owned(&mut self, id: NodeId, owned: bool)
Marks id as reactively theme-owned by its component so generic in-place theme remaps skip its paint.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.bool- Whether the component owns the node’s themed paint.
Sourcepub fn is_theme_owned(&self, id: NodeId) -> bool
pub fn is_theme_owned(&self, id: NodeId) -> bool
Sourcepub fn theme_baseline(&self, id: NodeId) -> Option<ThemeBaseline>
pub fn theme_baseline(&self, id: NodeId) -> Option<ThemeBaseline>
Sourcepub fn set_theme_baseline(
&mut self,
id: NodeId,
baseline: Option<ThemeBaseline>,
)
pub fn set_theme_baseline( &mut self, id: NodeId, baseline: Option<ThemeBaseline>, )
Records (or clears) the theme-origin paint snapshot for id.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.Option<ThemeBaseline>- Origin snapshot to store, orNoneto clear.
Source§impl SceneTree
Core retained scene graph mutation and traversal operations.
impl SceneTree
Core retained scene graph mutation and traversal operations.
Sourcepub fn set_backdrop_blur(&mut self, id: NodeId, blur_radius: f32)
pub fn set_backdrop_blur(&mut self, id: NodeId, blur_radius: f32)
Registers or removes a backdrop-blur effect radius on id for effect-dependency damage propagation and paint emission.
§Arguments
&Self- Mutable scene tree.NodeId- Target scene node handle.f32- Gaussian backdrop blur radius in logical pixels (<= 0.0removes backdrop blur).
Sourcepub fn backdrop_blur_radius(&self, id: NodeId) -> f32
pub fn backdrop_blur_radius(&self, id: NodeId) -> f32
Sourcepub fn has_backdrop_blur_nodes(&self) -> bool
pub fn has_backdrop_blur_nodes(&self) -> bool
Sourcepub fn propagate_effect_damage(
&self,
damage: &mut DamageRegion,
scale: f32,
) -> usize
pub fn propagate_effect_damage( &self, damage: &mut DamageRegion, scale: f32, ) -> usize
Expands damage to include every visible backdrop-blur node whose sampling region intersects any damaged rect (fixpoint propagation).
§Arguments
&Self- Scene tree reference.&mut DamageRegion- Active physical damage region to expand.f32- Active display scale factor.
§Returns
usize- Number of backdrop-blur nodes added todamagedue to overlapping underlying mutations.
Sourcepub fn effect_dependency_damage(
&self,
dirty_set: &mut DirtyRectSet,
extra_portals: &[PortalBackdropRegion],
viewport_w: u32,
viewport_h: u32,
scale: f32,
full_ratio_threshold: f32,
) -> EffectDamageReport
pub fn effect_dependency_damage( &self, dirty_set: &mut DirtyRectSet, extra_portals: &[PortalBackdropRegion], viewport_w: u32, viewport_h: u32, scale: f32, full_ratio_threshold: f32, ) -> EffectDamageReport
Computes surgical effect-dependency damage across visible backdrop-blur nodes and extra_portals, expanding ONLY intersecting or dirty regions by ceil(2.0 * blur_radius).
§Arguments
&Self- Scene tree reference.&mut DirtyRectSet- Active multi-rect dirty set in physical pixels.&[PortalBackdropRegion]- Visible top-layer portal descriptors in logical coordinates.u32- Physical viewport width in pixels.u32- Physical viewport height in pixels.f32- Active display scale factor.f32- Area coverage threshold in(0.1..=1.0]promoting toFullFrame.
§Returns
EffectDamageReport- Counts of expanded/skipped regions and whether full-frame escalation occurred.
Sourcepub fn portal_nodes(&self) -> &[NodeId]
pub fn portal_nodes(&self) -> &[NodeId]
Sourcepub fn has_portal_nodes(&self) -> bool
pub fn has_portal_nodes(&self) -> bool
Sourcepub fn scroll_nodes(&self) -> &[NodeId]
pub fn scroll_nodes(&self) -> &[NodeId]
Sourcepub fn has_scroll_nodes(&self) -> bool
pub fn has_scroll_nodes(&self) -> bool
Sourcepub fn compact_paint(&self, id: NodeId) -> Option<&CompactPaintStyle>
pub fn compact_paint(&self, id: NodeId) -> Option<&CompactPaintStyle>
Sourcepub fn paint_effect(&self, id: NodeId) -> Option<&PaintEffectEntry>
pub fn paint_effect(&self, id: NodeId) -> Option<&PaintEffectEntry>
Sourcepub fn effect_table(&self) -> &EffectTable
pub fn effect_table(&self) -> &EffectTable
Sourcepub fn has_extras(&self, id: NodeId) -> bool
pub fn has_extras(&self, id: NodeId) -> bool
Sourcepub fn has_nonzero_z_child(&self, id: NodeId) -> bool
pub fn has_nonzero_z_child(&self, id: NodeId) -> bool
Sourcepub fn has_lifecycle(&self, id: NodeId) -> bool
pub fn has_lifecycle(&self, id: NodeId) -> bool
Sourcepub fn children_iter(&self, parent: NodeId) -> SceneChildIter<'_> ⓘ
pub fn children_iter(&self, parent: NodeId) -> SceneChildIter<'_> ⓘ
Sourcepub fn for_each_child<F>(&self, parent: NodeId, visit: F)
pub fn for_each_child<F>(&self, parent: NodeId, visit: F)
Visits every direct child of parent in paint order with zero heap allocation.
§Arguments
&Self- Scene tree reference.NodeId- Parent container node handle.F- Visitor callback invoked with each childNodeId.
Sourcepub fn for_each_child_rev<F>(&self, parent: NodeId, visit: F)
pub fn for_each_child_rev<F>(&self, parent: NodeId, visit: F)
Visits every direct child of parent in reverse paint order with zero heap allocation.
§Arguments
&Self- Scene tree reference.NodeId- Parent container node handle.F- Visitor callback invoked with each childNodeIdback-to-front.
Sourcepub fn child_count(&self, parent: NodeId) -> usize
pub fn child_count(&self, parent: NodeId) -> usize
Sourcepub fn has_children(&self, parent: NodeId) -> bool
pub fn has_children(&self, parent: NodeId) -> bool
Sourcepub fn first_child(&self, parent: NodeId) -> Option<NodeId>
pub fn first_child(&self, parent: NodeId) -> Option<NodeId>
Sourcepub fn last_child(&self, parent: NodeId) -> Option<NodeId>
pub fn last_child(&self, parent: NodeId) -> Option<NodeId>
Sourcepub fn next_sibling(&self, id: NodeId) -> Option<NodeId>
pub fn next_sibling(&self, id: NodeId) -> Option<NodeId>
Sourcepub fn prev_sibling(&self, id: NodeId) -> Option<NodeId>
pub fn prev_sibling(&self, id: NodeId) -> Option<NodeId>
Sourcepub fn children_vec(&self, parent: NodeId) -> Vec<NodeId>
pub fn children_vec(&self, parent: NodeId) -> Vec<NodeId>
Sourcepub fn is_in_subtree(&self, candidate: NodeId, root: NodeId) -> bool
pub fn is_in_subtree(&self, candidate: NodeId, root: NodeId) -> bool
Sourcepub fn set_children_detached(
&mut self,
parent: NodeId,
new_children: &[NodeId],
) -> bool
pub fn set_children_detached( &mut self, parent: NodeId, new_children: &[NodeId], ) -> bool
Reorders or filters parent’s direct children to match new_children without disposing detached nodes, returning true if modified.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node handle.&[NodeId]- Desired ordered child handles.
§Returns
bool-truewhen the parent’s child sequence changed.
Sourcepub fn replace_child(
&mut self,
parent: NodeId,
old_child: NodeId,
new_child: NodeId,
) -> bool
pub fn replace_child( &mut self, parent: NodeId, old_child: NodeId, new_child: NodeId, ) -> bool
Replaces old_child under parent with new_child in O(1) without shifting sibling storage.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node handle.NodeId- Existing direct child handle to detach.NodeId- Replacement child handle to splice in place.
§Returns
bool-truewhenold_childwas replaced bynew_child.
Sourcepub fn create_node(&mut self, kind: NodeKind, style: Style) -> NodeId
pub fn create_node(&mut self, kind: NodeKind, style: Style) -> NodeId
Sourcepub fn create_view(&mut self, style: Style) -> NodeId
pub fn create_view(&mut self, style: Style) -> NodeId
Sourcepub fn create_text(&mut self, content: String, style: Style) -> NodeId
pub fn create_text(&mut self, content: String, style: Style) -> NodeId
Sourcepub fn create_input(&mut self, state: InputNodeState, style: Style) -> NodeId
pub fn create_input(&mut self, state: InputNodeState, style: Style) -> NodeId
Sourcepub fn create_image(&mut self, buffer: ImageBuffer, style: Style) -> NodeId
pub fn create_image(&mut self, buffer: ImageBuffer, style: Style) -> NodeId
Sourcepub fn create_scroll_view(&mut self, style: Style) -> NodeId
pub fn create_scroll_view(&mut self, style: Style) -> NodeId
Sourcepub fn create_canvas(
&mut self,
style: Style,
painter: CanvasDrawCallback,
) -> NodeId
pub fn create_canvas( &mut self, style: Style, painter: CanvasDrawCallback, ) -> NodeId
Sourcepub fn create_canvas_with_caching(
&mut self,
style: Style,
caching: CanvasCaching,
painter: CanvasDrawCallback,
) -> NodeId
pub fn create_canvas_with_caching( &mut self, style: Style, caching: CanvasCaching, painter: CanvasDrawCallback, ) -> NodeId
Creates a custom Canvas node bound to painter with an explicit CanvasCaching policy.
§Arguments
&Self- Mutable scene tree.Style- Initial canvas style.CanvasCaching- Fragment caching strategy (DynamicPerFrameorRetainedStatic).CanvasDrawCallback- Draw callback invoked on paint.
§Returns
NodeId- Created canvas node handle.
Sourcepub fn create_portal(&mut self, style: Style) -> NodeId
pub fn create_portal(&mut self, style: Style) -> NodeId
Sourcepub fn create_fragment(&mut self) -> NodeId
pub fn create_fragment(&mut self) -> NodeId
Sourcepub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
pub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut SceneNode>
Sourcepub fn live_node_count(&self) -> usize
pub fn live_node_count(&self) -> usize
Sourcepub fn append_child(&mut self, parent: NodeId, child: NodeId)
pub fn append_child(&mut self, parent: NodeId, child: NodeId)
Appends child to parent in O(1) via intrusive sibling links and marks layout and paint dirty upward.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.NodeId- Child node to attach.
Sourcepub fn append_children(&mut self, parent: NodeId, children: &[NodeId])
pub fn append_children(&mut self, parent: NodeId, children: &[NodeId])
Appends multiple children to parent in a single dirty-marking pass with zero heap allocations.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.&[NodeId]- Ordered child nodes to append.
Sourcepub fn replace_children(&mut self, parent: NodeId, new_children: Vec<NodeId>)
pub fn replace_children(&mut self, parent: NodeId, new_children: Vec<NodeId>)
Replaces all children of parent with new_children, disposing previous subtrees cleanly.
§Arguments
&Self- Mutable scene tree.NodeId- Parent container node.Vec<NodeId>- Replacement ordered children.
Sourcepub fn set_style(&mut self, id: NodeId, style: Style)
pub fn set_style(&mut self, id: NodeId, style: Style)
Surgically updates a node’s Style, marking only DIRTY_PAINT for pure paint changes and skipping no-op writes.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.Style- Replacement compiled style.
Sourcepub fn mutate_style<F>(&mut self, id: NodeId, mutator: F) -> bool
pub fn mutate_style<F>(&mut self, id: NodeId, mutator: F) -> bool
Sourcepub fn set_text(&mut self, id: NodeId, text: String)
pub fn set_text(&mut self, id: NodeId, text: String)
Surgically updates the UTF-8 string of a NodeKind::Text node.
§Arguments
&Self- Mutable scene tree.NodeId- Target text node handle.String- Replacement text string.
Sourcepub fn set_image(&mut self, id: NodeId, buffer: ImageBuffer)
pub fn set_image(&mut self, id: NodeId, buffer: ImageBuffer)
Replaces the RGBA8 pixel buffer of an Image node (or converts a placeholder node to NodeKind::Image) and dirties layout and paint.
§Arguments
&Self- Mutable scene tree.NodeId- Target scene node handle.ImageBuffer- Decoded RGBA8 image buffer.
Sourcepub fn set_text_str(&mut self, id: NodeId, text: &str)
pub fn set_text_str(&mut self, id: NodeId, text: &str)
Replaces the UTF-8 contents of a NodeKind::Text node in place from a borrowed &str, reusing existing String capacity with zero allocation.
§Arguments
&Self- Mutable scene tree.NodeId- Target text node handle.&str- Replacement text slice.
Sourcepub fn mutate_text<F>(&mut self, id: NodeId, mutate: F)
pub fn mutate_text<F>(&mut self, id: NodeId, mutate: F)
Mutates a NodeKind::Text node’s backing String buffer directly in place via mutate with zero heap allocations.
§Arguments
&Self- Mutable scene tree.NodeId- Target text node handle.F- Closure writing the updated text into the existing&mut Stringbuffer.
Sourcepub fn set_scroll_offset(&mut self, id: NodeId, offset: Point)
pub fn set_scroll_offset(&mut self, id: NodeId, offset: Point)
Updates scroll offset on a scroll container without triggering full subtree re-layout.
§Arguments
&Self- Mutable scene tree.NodeId- Target scroll container handle.Point- New scroll offset clamped to content bounds.
Sourcepub fn set_virtual_scroll(
&mut self,
id: NodeId,
scroll_y: f32,
content_height: f32,
)
pub fn set_virtual_scroll( &mut self, id: NodeId, scroll_y: f32, content_height: f32, )
Records virtualized scroll progress (scroll_y, content_height) on id for overlay scrollbar rendering.
§Arguments
&Self- Mutable scene tree.NodeId- Target virtualized scroll container.f32- Active virtual vertical scroll offset in logical pixels.f32- Full virtualized content height in logical pixels.
Sourcepub fn node_screen_bounds(&self, id: NodeId) -> Option<Rect>
pub fn node_screen_bounds(&self, id: NodeId) -> Option<Rect>
Computes screen-space logical bounds for id after applying ancestor scroll offsets and transforms.
Returns Some(Rect::default()) when id or any ancestor has Display::None, preserving zero-area semantics even when descendants retain warm layout caches.
§Arguments
&Self- Scene tree reference.NodeId- Target node handle.
§Returns
Option<Rect>- Screen-space rectangle if the node is alive.
Sourcepub fn start_transition(&mut self, transition: NodeTransition)
pub fn start_transition(&mut self, transition: NodeTransition)
Starts or smoothly retargets a paint/transform transition on transition.get_node().
§Arguments
&Self- Mutable scene tree.NodeTransition- Transition specification to run.
Sourcepub fn tick_transitions(&mut self, dt_secs: f32) -> bool
pub fn tick_transitions(&mut self, dt_secs: f32) -> bool
Sourcepub fn has_active_transitions(&self) -> bool
pub fn has_active_transitions(&self) -> bool
Sourcepub fn attach_lifecycle(&mut self, id: NodeId, hook: Rc<dyn Lifecycle>)
pub fn attach_lifecycle(&mut self, id: NodeId, hook: Rc<dyn Lifecycle>)
Attaches a Lifecycle hook observer onto id for mount, activate, freeze, resume, unmount, and destroy dispatch.
§Arguments
&Self- Mutable scene tree.NodeId- Target scene node handle.Rc<dyn Lifecycle>- Shared lifecycle hook observer.
Sourcepub fn collect_subtree_scope_ids(&self, root: NodeId) -> Vec<ScopeId>
pub fn collect_subtree_scope_ids(&self, root: NodeId) -> Vec<ScopeId>
Sourcepub fn cancel_subtree_transitions(&mut self, root: NodeId)
pub fn cancel_subtree_transitions(&mut self, root: NodeId)
Cancels any active paint/transform transitions targeting nodes within the subtree rooted at root.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle.
Sourcepub fn cancel_node_transitions(&mut self, node_id: NodeId)
pub fn cancel_node_transitions(&mut self, node_id: NodeId)
Cancels only active transitions targeting the single node node_id without disturbing descendant animation timelines.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.
Sourcepub fn attach_scope(&mut self, id: NodeId, scope: Scope)
pub fn attach_scope(&mut self, id: NodeId, scope: Scope)
Attaches a reactive Scope to id so it automatically disposes when the node unmounts.
§Arguments
&Self- Mutable scene tree.NodeId- Target node handle.Scope- Reactive ownership scope.
Sourcepub fn mark_dirty(&mut self, id: NodeId, mask: u16)
pub fn mark_dirty(&mut self, id: NodeId, mask: u16)
Marks id dirty with mask and propagates subtree dirty bits to ancestors in O(depth).
§Arguments
&Self- Mutable scene tree.NodeId- Mutated node handle.u16- Dirty flag bits to set.
Sourcepub fn is_node_visible(&self, id: NodeId) -> bool
pub fn is_node_visible(&self, id: NodeId) -> bool
Sourcepub fn collect_paint_damage(&mut self, scale: f32) -> DamageRegion
pub fn collect_paint_damage(&mut self, scale: f32) -> DamageRegion
Sourcepub fn dispose_subtree_collect(&mut self, id: NodeId) -> DisposedSubtreePayload
pub fn dispose_subtree_collect(&mut self, id: NodeId) -> DisposedSubtreePayload
Recursively detaches and recycles id, returning all owned Scopes and Lifecycle observers for borrow-safe finalization.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle to dispose.
§Returns
DisposedSubtreePayload- Collected scopes and lifecycle observers to finalize outside any borrow.
Sourcepub fn dispose_subtree(&mut self, id: NodeId)
pub fn dispose_subtree(&mut self, id: NodeId)
Recursively removes and disposes id, recycling all arena slots, running lifecycle hooks, and disposing scopes.
§Arguments
&Self- Mutable scene tree.NodeId- Subtree root handle to dispose.
Sourcepub fn update_focus(
&mut self,
target: Option<NodeId>,
) -> Vec<(UiEventHandler, UiEvent)>
pub fn update_focus( &mut self, target: Option<NodeId>, ) -> Vec<(UiEventHandler, UiEvent)>
Sourcepub fn effective_text_select_mode(&self, id: NodeId) -> TextSelectMode
pub fn effective_text_select_mode(&self, id: NodeId) -> TextSelectMode
Sourcepub fn is_node_selectable(&self, id: NodeId) -> bool
pub fn is_node_selectable(&self, id: NodeId) -> bool
Sourcepub fn effective_selection_color(&self, id: NodeId) -> Color
pub fn effective_selection_color(&self, id: NodeId) -> Color
Sourcepub fn text_selection(&self) -> Option<SelectionState>
pub fn text_selection(&self) -> Option<SelectionState>
Sourcepub fn set_text_selection(&mut self, selection: Option<SelectionState>)
pub fn set_text_selection(&mut self, selection: Option<SelectionState>)
Updates the active text selection state, recomputes all spanned text node ranges, and marks every previously and newly selected node dirty for repaint.
§Arguments
&Self- Mutable scene tree.Option<SelectionState>- Replacement selection state (Noneclears selection).
Sourcepub fn clear_text_selection(&mut self)
pub fn clear_text_selection(&mut self)
Clears any active text selection and repaints all previously selected nodes.
§Arguments
&Self- Mutable scene tree.
Sourcepub fn get_selected_text(&self) -> Option<String>
pub fn get_selected_text(&self) -> Option<String>
Sourcepub fn get_selected_text_within(&self, container: NodeId) -> Option<String>
pub fn get_selected_text_within(&self, container: NodeId) -> Option<String>
Sourcepub fn select_all_text(&mut self, id: NodeId) -> bool
pub fn select_all_text(&mut self, id: NodeId) -> bool
Selects all selectable text across id’s active selectable container scope (excluding TextSelectMode::None descendants).
§Arguments
&Self- Mutable scene tree.NodeId- Target text or selectable container node handle.
§Returns
bool-truewhen at least one non-empty selectable text node was selected.