pub struct Session { /* private fields */ }Expand description
An initialized connection to a Houdini Engine runtime.
Clones share one underlying HAPI session. The connection remains open until
Self::close is called or the last clone and all objects retaining a clone
are dropped. Final teardown is performed exactly once.
Session is Send and Sync. HARC serializes individual calls made to
one Thrift session; callers must still coordinate multi-call operations for
which ordering matters.
Dropping or closing a session always calls HAPI_CloseSession. The optional,
potentially expensive HAPI_Cleanup step is controlled by
SessionOptions::cleanup and is disabled by default.
Implementations§
Source§impl Session
impl Session
Sourcepub fn session_type(&self) -> SessionType
pub fn session_type(&self) -> SessionType
Return SessionType current session is initialized with.
Sourcepub fn server_pid(&self) -> Option<u32>
pub fn server_pid(&self) -> Option<u32>
Return the server PID when it was supplied by the caller or the server
was started by this crate. In-process sessions return None.
Sourcepub fn set_server_var<T: EnvVariable + ?Sized>(
&self,
key: &str,
value: &T::Type,
) -> Result<()>
pub fn set_server_var<T: EnvVariable + ?Sized>( &self, key: &str, value: &T::Type, ) -> Result<()>
Set environment variable on the server. This is set AFTER the server has started.
For variables set before the server starts, use ServerOptions::with_env_variables.
Sourcepub fn get_server_var<T: EnvVariable + ?Sized>(
&self,
key: &str,
) -> Result<<T::Type as ToOwned>::Owned>
pub fn get_server_var<T: EnvVariable + ?Sized>( &self, key: &str, ) -> Result<<T::Type as ToOwned>::Owned>
Get environment variable from the server
Sourcepub fn get_server_variables(&self) -> Result<StringArray>
pub fn get_server_variables(&self) -> Result<StringArray>
Retrieve all server variables as contiguous string array. Iterating over the array will yield strings like “TEST=177”.
Sourcepub fn get_string(&self, handle: StringHandle) -> Result<String>
pub fn get_string(&self, handle: StringHandle) -> Result<String>
Retrieve string data given a handle.
Sourcepub fn get_string_batch(&self, handles: &[StringHandle]) -> Result<StringArray>
pub fn get_string_batch(&self, handles: &[StringHandle]) -> Result<StringArray>
Retrieve multiple strings in batch mode.
Sourcepub fn set_custom_string(&self, string: impl AsRef<str>) -> Result<StringHandle>
pub fn set_custom_string(&self, string: impl AsRef<str>) -> Result<StringHandle>
Push a custom string to the server and return a handle to it.
Sourcepub fn remove_custom_string(&self, handle: StringHandle) -> Result<()>
pub fn remove_custom_string(&self, handle: StringHandle) -> Result<()>
Remove a custom string from the server.
Sourcepub fn close(&self) -> Result<()>
pub fn close(&self) -> Result<()>
Close the shared underlying session.
This operation is idempotent. All clones become closed after this call.
Sourcepub fn cleanup(self) -> Result<()>
👎Deprecated: use Session::close; HAPI cleanup alone does not close a session
pub fn cleanup(self) -> Result<()>
use Session::close; HAPI cleanup alone does not close a session
Close the shared underlying session.
Sourcepub fn create_input_node(
&self,
name: &str,
parent: Option<NodeHandle>,
) -> Result<Geometry>
pub fn create_input_node( &self, name: &str, parent: Option<NodeHandle>, ) -> Result<Geometry>
Create an input geometry node which can accept modifications
Sourcepub fn create_input_curve_node(
&self,
name: &str,
parent: Option<NodeHandle>,
) -> Result<Geometry>
pub fn create_input_curve_node( &self, name: &str, parent: Option<NodeHandle>, ) -> Result<Geometry>
Create an input geometry node with PartType set to Curve
Sourcepub fn create_node(&self, name: impl AsRef<str>) -> Result<HoudiniNode>
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.
Sourcepub fn node_builder(&self, node_name: impl Into<String>) -> NodeBuilder<'_>
pub fn node_builder(&self, node_name: impl Into<String>) -> NodeBuilder<'_>
A builder pattern for creating a node with more options.
Sourcepub fn delete_node<H: Into<NodeHandle>>(&self, node: H) -> Result<()>
pub fn delete_node<H: Into<NodeHandle>>(&self, node: H) -> Result<()>
Delete the node from the session. See also HoudiniNode::delete
Sourcepub fn get_node_from_path(
&self,
path: impl AsRef<str>,
parent: impl Into<Option<NodeHandle>>,
) -> Result<Option<HoudiniNode>>
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
Sourcepub fn find_parameter_from_path(
&self,
path: impl AsRef<str>,
start: impl Into<Option<NodeHandle>>,
) -> Result<Option<Parameter>>
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.
Sourcepub fn get_manager_node(&self, manager: ManagerType) -> Result<ManagerNode>
pub fn get_manager_node(&self, manager: ManagerType) -> Result<ManagerNode>
Returns a manager (root) node such as OBJ, TOP, CHOP, etc
Sourcepub fn get_composed_object_transform(
&self,
parent: impl AsRef<NodeHandle>,
rst_order: RSTOrder,
) -> Result<Vec<Transform>>
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.
Sourcepub fn save_hip(&self, path: impl AsRef<Path>, lock_nodes: bool) -> Result<()>
pub fn save_hip(&self, path: impl AsRef<Path>, lock_nodes: bool) -> Result<()>
Save current session to hip file
Sourcepub fn load_hip(&self, path: impl AsRef<Path>, cook: bool) -> Result<()>
pub fn load_hip(&self, path: impl AsRef<Path>, cook: bool) -> Result<()>
Load a hip file into current session
Sourcepub fn merge_hip(&self, name: &str, cook: bool) -> Result<i32>
pub fn merge_hip(&self, name: &str, cook: bool) -> Result<i32>
Merge a hip file into current session
Sourcepub fn get_hip_file_nodes(&self, hip_id: i32) -> Result<Vec<NodeHandle>>
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.
Sourcepub fn load_asset_file(&self, file: impl AsRef<Path>) -> Result<AssetLibrary>
pub fn load_asset_file(&self, file: impl AsRef<Path>) -> Result<AssetLibrary>
Load an HDA file into current session
Sourcepub fn get_loaded_asset_libraries(&self) -> Result<Vec<AssetLibrary>>
pub fn get_loaded_asset_libraries(&self) -> Result<Vec<AssetLibrary>>
Returns a list of loaded asset libraries including Houdini’s default.
Sourcepub fn get_cook_state_status(&self) -> Result<SessionState>
pub fn get_cook_state_status(&self) -> Result<SessionState>
Get session state when the server is in threaded mode.
Sourcepub fn is_cooking(&self) -> Result<bool>
pub fn is_cooking(&self) -> Result<bool>
Is session currently cooking. In non-threaded mode always returns false
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Explicit check if the session is valid. Many APIs do this check in the debug build.
Sourcepub fn get_status_string(
&self,
status: StatusType,
verbosity: StatusVerbosity,
) -> Result<String>
pub fn get_status_string( &self, status: StatusType, verbosity: StatusVerbosity, ) -> Result<String>
Get the status message given a type and verbosity
Sourcepub fn get_cook_result_string(
&self,
verbosity: StatusVerbosity,
) -> Result<String>
pub fn get_cook_result_string( &self, verbosity: StatusVerbosity, ) -> Result<String>
Get session cook result status as string
Sourcepub fn cooking_total_count(&self) -> Result<i32>
pub fn cooking_total_count(&self) -> Result<i32>
How many nodes need to cook
Sourcepub fn cooking_current_count(&self) -> Result<i32>
pub fn cooking_current_count(&self) -> Result<i32>
How many nodes have already cooked
Sourcepub fn cook(&self) -> Result<CookResult>
pub fn cook(&self) -> Result<CookResult>
In threaded mode wait for Session finishes cooking. In single-thread mode, immediately return See Documentation
Sourcepub fn get_connection_error(&self, clear: bool) -> Result<String>
pub fn get_connection_error(&self, clear: bool) -> Result<String>
Retrieve connection error if could not connect to engine instance
Sourcepub fn lock(&self) -> ReentrantMutexGuard<'_, ()>
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
Sourcepub fn set_timeline_options(&self, options: &TimelineOptions) -> Result<()>
pub fn set_timeline_options(&self, options: &TimelineOptions) -> Result<()>
Set Houdini timeline options
Sourcepub fn get_timeline_options(&self) -> Result<TimelineOptions>
pub fn get_timeline_options(&self) -> Result<TimelineOptions>
Get Houdini timeline options
Sourcepub fn set_use_houdini_time(&self, do_use: bool) -> Result<()>
pub fn set_use_houdini_time(&self, do_use: bool) -> Result<()>
Set session to use Houdini time
Sourcepub fn get_use_houdini_time(&self) -> Result<bool>
pub fn get_use_houdini_time(&self) -> Result<bool>
Check if session uses Houdini time
Sourcepub fn get_viewport(&self) -> Result<Viewport>
pub fn get_viewport(&self) -> Result<Viewport>
Get the viewport(camera) position
Sourcepub fn set_viewport(&self, viewport: &Viewport) -> Result<()>
pub fn set_viewport(&self, viewport: &Viewport) -> Result<()>
Set the viewport(camera) position
Sourcepub fn get_sync_info(&self) -> Result<SessionSyncInfo>
pub fn get_sync_info(&self) -> Result<SessionSyncInfo>
Get session sync info
Sourcepub fn set_sync_info(&self, info: &SessionSyncInfo) -> Result<()>
pub fn set_sync_info(&self, info: &SessionSyncInfo) -> Result<()>
Set session sync info
Sourcepub fn get_license_type(&self) -> Result<LicenseType>
pub fn get_license_type(&self) -> Result<LicenseType>
Get license type used by this session
Sourcepub fn render_cop_to_image(
&self,
cop_node: impl Into<NodeHandle>,
output_name: Option<&str>,
image_planes: impl AsRef<str>,
out_image: impl AsRef<Path>,
) -> Result<String>
pub fn render_cop_to_image( &self, cop_node: impl Into<NodeHandle>, output_name: Option<&str>, image_planes: impl AsRef<str>, out_image: impl AsRef<Path>, ) -> Result<String>
Render a COP node to an image file
Sourcepub fn create_input_camera_node(
&self,
name: &str,
label: &str,
parent_node: Option<NodeHandle>,
) -> Result<NodeHandle>
pub fn create_input_camera_node( &self, name: &str, label: &str, parent_node: Option<NodeHandle>, ) -> Result<NodeHandle>
Create a new input camera node with the given name/label.
Sourcepub fn set_input_camera_info(
&self,
node: NodeHandle,
info: &CameraInfo,
) -> Result<()>
pub fn set_input_camera_info( &self, node: NodeHandle, info: &CameraInfo, ) -> Result<()>
Set the camera parameters on an input camera node.
Sourcepub fn set_input_camera_transform(
&self,
node: NodeHandle,
rst_order: RSTOrder,
rot_order: XYZOrder,
transform: &Transform,
) -> Result<()>
pub fn set_input_camera_transform( &self, node: NodeHandle, rst_order: RSTOrder, rot_order: XYZOrder, transform: &Transform, ) -> Result<()>
Set the transform on an input camera node.
Sourcepub fn create_cop_image(
&self,
description: CopImageDescription<'_>,
parent_node: Option<NodeHandle>,
) -> Result<NodeHandle>
pub fn create_cop_image( &self, description: CopImageDescription<'_>, parent_node: Option<NodeHandle>, ) -> Result<NodeHandle>
Loads some raw image data into a COP node, returning the handle of the created node.
pub fn render_texture_to_image( &self, node: impl Into<NodeHandle>, parm_name: &str, ) -> Result<()>
pub fn extract_image_to_file( &self, node: impl Into<NodeHandle>, image_planes: &str, path: impl AsRef<Path>, ) -> Result<String>
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<()>
pub fn get_image_info(&self, node: impl Into<NodeHandle>) -> Result<ImageInfo>
Sourcepub 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<()>
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