Struct 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 server_pid(&self) -> Option<u32>

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 get_string_batch(&self, handles: &[StringHandle]) -> Result<StringArray>

Retrieve multiple strings in batch mode.

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, parent: Option<NodeHandle>, ) -> Result<Geometry>

Create an input geometry node which can accept modifications

Source

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

Create an input geometry node with 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>, start: impl Into<Option<NodeHandle>>, ) -> Result<Option<Parameter>>

Find a parameter by path, absolute or relative to a start node.

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 get_composed_object_transform( &self, parent: impl AsRef<NodeHandle>, rst_order: RSTOrder, ) -> Result<Vec<Transform>>

Return a list of transforms for all object nodes under a given parent node.

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 get_loaded_asset_libraries(&self) -> Result<Vec<AssetLibrary>>

Returns a list of loaded asset libraries including Houdini’s default.

Source

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

Interrupt session cooking

Source

pub fn get_cook_state_status(&self) -> Result<SessionState>

Get session state when the server is in threaded mode.

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_texture_to_image( &self, node: impl Into<NodeHandle>, parm_name: &str, ) -> Result<()>

Source

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

Source

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

Source

pub fn get_image_info(&self, node: impl Into<NodeHandle>) -> Result<ImageInfo>

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<'_>>>

Source

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

Source

pub fn get_cache_property_value( &self, cache_name: &str, property: CacheProperty, ) -> Result<i32>

Source

pub fn set_cache_property_value( &self, cache_name: &str, property: CacheProperty, value: i32, ) -> Result<()>

Source

pub fn python_thread_interpreter_lock(&self, lock: bool) -> Result<()>

Source

pub fn get_compositor_options(&self) -> Result<CompositorOptions>

Source

pub fn set_compositor_options(&self, options: &CompositorOptions) -> Result<()>

Source

pub fn get_preset_names(&self, bytes: &[u8]) -> Result<Vec<String>>

Source

pub fn start_performance_monitor_profile(&self, title: &str) -> Result<i32>

Source

pub fn stop_performance_monitor_profile( &self, profile_id: i32, output_file: &str, ) -> Result<()>

Source

pub fn get_job_status(&self, job_id: i32) -> Result<JobStatus>

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Session

Returns a duplicate 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 for Session

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.