Struct hapi_rs::session::Session

source ·
pub struct Session { /* private fields */ }
Expand description

Session represents a unique connection to the Engine instance and all API calls require a valid session. It implements Clone and is Send and Sync

Implementations§

source§

impl Session

source

pub fn session_type(&self) -> SessionType

Return SessionType current session is initialized with.

source

pub fn connection_type(&self) -> &ConnectionType

Return enum with extra connection data such as pipe file or socket.

source

pub fn set_server_var<T: EnvVariable + ?Sized>( &self, key: &str, value: &T::Type ) -> Result<()>

Set environment variable on the server

source

pub fn get_server_var<T: EnvVariable + ?Sized>( &self, key: &str ) -> Result<<T::Type as ToOwned>::Owned>

Get environment variable from the server

source

pub fn get_server_variables(&self) -> Result<StringArray>

Retrieve all server variables

source

pub fn get_string(&self, handle: StringHandle) -> Result<String>

Retrieve string data given a handle.

source

pub fn cleanup(&self) -> Result<()>

Cleanup the session. Session will not be valid after this call and needs to be initialized again

source

pub fn is_initialized(&self) -> bool

Check if session is initialized

source

pub fn create_input_node(&self, name: &str) -> Result<Geometry>

Create an input geometry node which can accept modifications

source

pub fn create_input_curve_node(&self, name: &str) -> Result<Geometry>

Create an input geometry node with crate::enums::PartType set to Curve

source

pub fn create_node(&self, name: impl AsRef<str>) -> Result<HoudiniNode>

Create a node. name must start with a network category, e.g, “Object/geo”, “Sop/box”, in operator namespace was used, the full name may look like this: namespace::Object/mynode If you need more creating options, see the Session::node_builder API. New node will not be cooked.

source

pub fn node_builder(&self, node_name: impl Into<String>) -> NodeBuilder<'_>

A builder pattern for creating a node with more options.

source

pub fn delete_node<H: Into<NodeHandle>>(&self, node: H) -> Result<()>

Delete the node from the session. See also HoudiniNode::delete

source

pub fn get_node_from_path( &self, path: impl AsRef<str>, parent: impl Into<Option<NodeHandle>> ) -> Result<Option<HoudiniNode>>

Find a node given an absolute path. To find a child node, pass the parent node or use HoudiniNode::find_child_node

source

pub fn find_parameter_from_path( &self, path: impl AsRef<str> ) -> Result<Option<Parameter>>

Find a parameter by its absolute path

source

pub fn get_manager_node(&self, manager: ManagerType) -> Result<ManagerNode>

Returns a manager (root) node such as OBJ, TOP, CHOP, etc

source

pub fn save_hip(&self, path: impl AsRef<Path>, lock_nodes: bool) -> Result<()>

Save current session to hip file

source

pub fn load_hip(&self, path: impl AsRef<Path>, cook: bool) -> Result<()>

Load a hip file into current session

source

pub fn merge_hip(&self, name: &str, cook: bool) -> Result<i32>

Merge a hip file into current session

source

pub fn get_hip_file_nodes(&self, hip_id: i32) -> Result<Vec<NodeHandle>>

Get node ids created by merging Session::merge_hip a hip file.

source

pub fn load_asset_file(&self, file: impl AsRef<Path>) -> Result<AssetLibrary>

Load an HDA file into current session

source

pub fn interrupt(&self) -> Result<()>

Interrupt session cooking

source

pub fn get_status(&self, flag: StatusType) -> Result<SessionState>

Get session state of a requested crate::enums::StatusType

source

pub fn is_cooking(&self) -> Result<bool>

Is session currently cooking. In non-threaded mode always returns false

source

pub fn is_valid(&self) -> bool

Explicit check if the session is valid. Many APIs do this check in the debug build.

source

pub fn get_status_string( &self, status: StatusType, verbosity: StatusVerbosity ) -> Result<String>

Get the status message given a type and verbosity

source

pub fn get_cook_result_string( &self, verbosity: StatusVerbosity ) -> Result<String>

Get session cook result status as string

source

pub fn cooking_total_count(&self) -> Result<i32>

How many nodes need to cook

source

pub fn cooking_current_count(&self) -> Result<i32>

How many nodes have already cooked

source

pub fn cook(&self) -> Result<CookResult>

In threaded mode wait for Session finishes cooking. In single-thread mode, immediately return See Documentation

source

pub fn get_connection_error(&self, clear: bool) -> Result<String>

Retrieve connection error if could not connect to engine instance

source

pub fn get_time(&self) -> Result<f32>

Get Houdini time

source

pub fn set_time(&self, time: f32) -> Result<()>

Set Houdini time

source

pub fn lock(&self) -> ReentrantMutexGuard<'_, ()>

Lock the internal reentrant mutex. Should not be used in general, but may be useful in certain situations when a series of API calls must be done in sequence

source

pub fn set_timeline_options(&self, options: TimelineOptions) -> Result<()>

Set Houdini timeline options

source

pub fn get_timeline_options(&self) -> Result<TimelineOptions>

Get Houdini timeline options

source

pub fn set_use_houdini_time(&self, do_use: bool) -> Result<()>

Set session to use Houdini time

source

pub fn get_use_houdini_time(&self) -> Result<bool>

Check if session uses Houdini time

source

pub fn get_viewport(&self) -> Result<Viewport>

Get the viewport(camera) position

source

pub fn set_viewport(&self, viewport: &Viewport) -> Result<()>

Set the viewport(camera) position

source

pub fn set_sync(&self, enable: bool) -> Result<()>

Set session sync mode on/off

source

pub fn get_sync_info(&self) -> Result<SessionSyncInfo>

Get session sync info

source

pub fn set_sync_info(&self, info: &SessionSyncInfo) -> Result<()>

Set session sync info

source

pub fn get_license_type(&self) -> Result<License>

Get license type used by this session

source

pub fn render_cop_to_image( &self, cop_node: impl Into<NodeHandle>, image_planes: impl AsRef<str>, path: impl AsRef<Path> ) -> Result<String>

Render a COP node to an image file

source

pub fn render_cop_to_memory( &self, cop_node: impl Into<NodeHandle>, buffer: &mut Vec<u8>, image_planes: impl AsRef<str>, format: impl AsRef<str> ) -> Result<()>

Render a COP node to a memory buffer

source

pub fn get_supported_image_formats(&self) -> Result<Vec<ImageFileFormat<'_>>>

Trait Implementations§

source§

impl Clone for Session

source§

fn clone(&self) -> Session

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Session

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Session

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl PartialEq<Session> for Session

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.