pub struct SceneCollectionEditor { /* private fields */ }Expand description
Undo/redo editor for the persisted scene-collection model.
History stores complete versioned document snapshots rather than runtime/native object IDs. Item/source/group IDs therefore remain stable across undo/redo. Group/ungroup operations accept the post-operation replacement snapshots, matching libobs’s native semantics where ungrouping creates replacement parent-scene items instead of preserving the old native handles.
Implementations§
Source§impl SceneCollectionEditor
impl SceneCollectionEditor
pub fn new( document: SceneCollectionDocument, ) -> Result<Self, SceneCollectionError>
pub fn document(&self) -> &SceneCollectionDocument
pub fn into_document(self) -> SceneCollectionDocument
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
pub fn next_undo_label(&self) -> Option<&str>
pub fn next_redo_label(&self) -> Option<&str>
pub fn undo(&mut self) -> bool
pub fn redo(&mut self) -> bool
Sourcepub fn set_item_state(
&mut self,
scene_id: &str,
item_id: &str,
state: PersistedSceneItemState,
) -> Result<(), SceneCollectionError>
pub fn set_item_state( &mut self, scene_id: &str, item_id: &str, state: PersistedSceneItemState, ) -> Result<(), SceneCollectionError>
Replaces one item’s complete persisted transform/visibility/lock/order snapshot.
Sourcepub fn move_top_level_item(
&mut self,
scene_id: &str,
item_id: &str,
new_index: usize,
) -> Result<(), SceneCollectionError>
pub fn move_top_level_item( &mut self, scene_id: &str, item_id: &str, new_index: usize, ) -> Result<(), SceneCollectionError>
Reorders one top-level source/group node in the persisted native bottom-to-top order.
Sourcepub fn replace_items_with_group(
&mut self,
scene_id: &str,
selected_item_ids: &[String],
group: PersistedGroup,
) -> Result<(), SceneCollectionError>
pub fn replace_items_with_group( &mut self, scene_id: &str, selected_item_ids: &[String], group: PersistedGroup, ) -> Result<(), SceneCollectionError>
Replaces selected top-level source items with the supplied post-grouping snapshot.
group.items must contain exactly the selected persistent item IDs. This lets a live editor
capture libobs’s post-reparent child snapshots and record them without pretending native
scene-item handles survived grouping unchanged.
Sourcepub fn ungroup_with_replacements(
&mut self,
scene_id: &str,
group_id: &str,
replacements: Vec<PersistedSourceItem>,
) -> Result<(), SceneCollectionError>
pub fn ungroup_with_replacements( &mut self, scene_id: &str, group_id: &str, replacements: Vec<PersistedSourceItem>, ) -> Result<(), SceneCollectionError>
Replaces a group with the post-ungroup replacement item snapshots returned/captured after libobs created new parent-scene items.