Skip to main content

SceneItemExtSceneTrait

Trait SceneItemExtSceneTrait 

Source
pub trait SceneItemExtSceneTrait {
    // Required methods
    fn add_source<T: ObsSourceTrait + Clone + 'static>(
        &mut self,
        source: T,
    ) -> Result<ObsSceneItemRef<T>, ObsError>;
    fn add_and_create_source(
        &mut self,
        info: SourceInfo,
    ) -> Result<ObsSceneItemRef<ObsSourceRef>, ObsError>;
    fn get_source(
        &self,
        name: &str,
    ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>;
    fn remove_every_item_of_source<T: ObsSourceTrait>(
        &mut self,
        source: T,
    ) -> Result<(), ObsError>;
    fn remove_item<K: SceneItemTrait + ?Sized>(
        &mut self,
        scene_item: &K,
    ) -> Result<(), ObsError>;
    fn remove_all_sources(&mut self) -> Result<(), ObsError>;
    fn items_for_source<T: ObsSourceTrait + Clone>(
        &self,
        source: &T,
    ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>;

    // Provided methods
    fn get_source_mut(
        &self,
        name: &str,
    ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError> { ... }
    fn remove_scene_item<K: SceneItemTrait>(
        &mut self,
        scene_item: K,
    ) -> Result<(), ObsError> { ... }
    fn get_scene_item_ptr<T: ObsSourceTrait + Clone>(
        &self,
        source: &T,
    ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError> { ... }
}

Required Methods§

Source

fn add_source<T: ObsSourceTrait + Clone + 'static>( &mut self, source: T, ) -> Result<ObsSceneItemRef<T>, ObsError>

Adds the specified source to this scene. Returns a reference to the created scene item. You can use that SceneItemPtr to manipulate the source within this scene (position, scale, rotation, etc).

Source

fn add_and_create_source( &mut self, info: SourceInfo, ) -> Result<ObsSceneItemRef<ObsSourceRef>, ObsError>

Creates and adds a source to this scene based on the given SourceInfo. Returns a reference to the created scene item, which internally holds the created source.

Source

fn get_source( &self, name: &str, ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>

Gets a source by name from this scene. Returns None if no source with the given name exists in this scene.

Source

fn remove_every_item_of_source<T: ObsSourceTrait>( &mut self, source: T, ) -> Result<(), ObsError>

Removes the given source from this scene. Removes the corresponding scene item as well. It may be possible that this source is still added to another scene.

Source

fn remove_item<K: SceneItemTrait + ?Sized>( &mut self, scene_item: &K, ) -> Result<(), ObsError>

Removes a specific scene item from this scene immediately.

Source

fn remove_all_sources(&mut self) -> Result<(), ObsError>

Removes all sources from this scene.

Source

fn items_for_source<T: ObsSourceTrait + Clone>( &self, source: &T, ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>

Gets the underlying scene item pointers for the given source in this scene.

A scene item is basically the representation of a source within this scene. It holds information about the position, scale, rotation, etc.

Provided Methods§

Source

fn get_source_mut( &self, name: &str, ) -> Result<Option<Arc<dyn ObsSourceTrait>>, ObsError>

👎Deprecated:

Use get_source; the returned shared handle was never a mutable reference

Source

fn remove_scene_item<K: SceneItemTrait>( &mut self, scene_item: K, ) -> Result<(), ObsError>

👎Deprecated:

Use remove_item; it removes the native scene item immediately without consuming the handle

Source

fn get_scene_item_ptr<T: ObsSourceTrait + Clone>( &self, source: &T, ) -> Result<Vec<Arc<dyn SceneItemTrait>>, ObsError>

👎Deprecated:

Use items_for_source; scene item handles are managed objects, not raw pointers

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§