C# Class HoudiniEngineUnity.HEU_SessionManager

Manages a session for Houdini Engine. Supports all types of sessions.
显示文件 Open project: sideeffects/HoudiniEngineForUnity Class Usage Examples

Public Properties

Property Type Description
_createSessionFromTypeDelegate CreateSessionFromTypeDelegate

Public Methods

Method Description
CheckVersionMatch ( ) : bool

Check that the Unity plugin's Houdini Engine version matches with the linked Houdini Engine API version.

ClearConnectionError ( ) : bool
CloseAllSessions ( ) : void

Close all sessions

CloseDefaultSession ( ) : bool

Close the default session.

ConnectSessionSyncUsingThriftPipe ( string pipeName, bool autoClose, float timeout, bool logError ) : bool
ConnectSessionSyncUsingThriftSocket ( string hostName, int serverPort, bool autoClose, float timeout, bool logError ) : bool
ConnectThriftPipeSession ( string pipeName, bool autoClose, float timeout ) : bool
ConnectThriftSocketSession ( string hostName, int serverPort, bool autoClose, float timeout ) : bool
CreateCustomSession ( ) : bool

Create custom Houdini Engine session.

CreateInProcessSession ( ) : bool

Create in-process Houdini Engine session.

CreateSessionFromType ( System.Type type ) : HEU_SessionBase
CreateSessionObject ( ) : HEU_SessionBase

Create new session if specified.

CreateThriftPipeSession ( string pipeName, bool autoClose, float timeout, bool logError ) : bool

Create pipe session for Houdini Engine.

CreateThriftSocketSession ( string hostName, int serverPort, bool autoClose, float timeout, bool logError ) : bool

Create socket session for Houdini Engine.

GetComposedChildNodeList ( HEU_SessionBase session, HAPI_NodeId parentNodeID, HAPI_NodeTypeBits nodeTypeFilter, HAPI_NodeFlagsBits nodeFlagFilter, bool bRecursive, Array &childNodeIDs, bool bLogIfError = true ) : bool

Get the composed list of child node IDs.

GetComposedObjectListMemorySafe ( HEU_SessionBase session, HAPI_NodeId nodeID, Array objectInfos, int start, int length ) : bool

Fill an array of HAPI_ObjectInfo list. Use for large arrays where marshalling is done in chunks.

GetComposedObjectTransformsMemorySafe ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_RSTOrder rstOrder, Array transforms, int start, int length ) : bool

Fill in array of HAPI_Transform list. Use for large arrays where marshalling is done in chunks.

GetConnectionError ( bool clear ) : string
GetCurrentLicense ( bool bLogError ) : HAPI_License

Returns the current license value.

GetDefaultSession ( ) : HEU_SessionBase

Returns the default session in use. Tries to reconnect to a stored session. Does not create a new session.

GetGroupMembership ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName, Array &membership, bool isInstanced ) : bool

Get group membership

GetGroupNames ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, bool isInstanced ) : string[]

Gets the group names for given group type.

GetHoudiniPathOnMacOS ( string houdiniPath ) : string
GetLastSessionError ( ) : string

Returns last session error.

GetNodeInputName ( HAPI_NodeId nodeID, int inputIndex, string &inputName ) : bool

Get the name of the given node's input.

GetNodeName ( HAPI_NodeId nodeID, HEU_SessionBase session = null ) : string

Returns the name of the specified node.

GetOrCreateDefaultSession ( bool bNotifyUserError = true ) : HEU_SessionBase

Returns a valid session by either reconnecting to an existing session, or creating a new session. Note that this will display error (once) if unable to get a valid session.

GetSessionData ( ) : HEU_SessionData

Return the existing session data.

GetSessionInfo ( ) : string

Return the session info.

GetSessionWithID ( long sessionID ) : HEU_SessionBase

Get the session associated with this session ID. As long as the session was registered, this will return it.

GetString ( int stringHandle, HEU_SessionBase session = null ) : string

Get the string value of the given string handle.

GetStringValuesFromStringIndices ( Array strIndices ) : string[]
GetUniqueMaterialShopName ( HAPI_NodeId assetID, HAPI_NodeId materialID ) : string
InitializeDefaultSession ( ) : bool
IsHARSProcessRunning ( int processID ) : bool
LoadAllSessionData ( ) : void

Load stored session data and recreate the session objects.

LoadSessionFromHIP ( bool bCookNodes, HEU_SessionBase session = null ) : bool

Load a HIP file into given session. The user will be prompted to choose a HIP file via Unity's file dialog.

LoadStoredDefaultSession ( ) : bool

Tries to load a stored default session. This would be after a code refresh or if the Houdini session is still running but Unity hasn't connected to it.

OpenHoudini ( string args ) : bool
OpenSessionInHoudini ( HEU_SessionBase session = null ) : bool

Open given session in a new Houdini instance.

RecreateDefaultSessionData ( ) : void
RegisterSession ( long sessionID, HEU_SessionBase session ) : void

Register the given session so that it can be retrieved via its session ID. This guarantees persistence reconnectiong across code refresh/compiles.

RestartSession ( ) : bool

Close default (if valid) and open a new session.

SaveAllSessionData ( ) : void

Save given list of sessions (HEU_SessionData) into storage for retrieval later. A way to persist current session information through code refresh/compiles.

SaveSessionToHIP ( bool bLockNodes, HEU_SessionBase session = null ) : bool

Save given session to a HIP file. The user will be prompted with Unity's file dialog to choose HIP file location.

UnregisterSession ( long sessionID ) : void

Unregister the session (used when closing).

ValidatePluginSession ( HEU_SessionBase session = null ) : bool

Returns true if the plugin is installed properly, and that a session (new or existing) can be established. Notifies user if either fails. This can be called before each operation into Houdini Engine to establish or reconnect to session.

Private Methods

Method Description
CheckAndCloseExistingSession ( ) : void

Closes session if one exists and is valid. Trying to close invalid session might throw error so this bypasses it.

InternalValidateSceneAssets ( ) : void

Goes through all assets in scene, and re-registers them with the scene they were originally created in. If their session is not valid, the asset is invalidated so it will be created again in the default session.

Method Details

CheckVersionMatch() public static method

Check that the Unity plugin's Houdini Engine version matches with the linked Houdini Engine API version.
public static CheckVersionMatch ( ) : bool
return bool

ClearConnectionError() public static method

public static ClearConnectionError ( ) : bool
return bool

CloseAllSessions() public static method

Close all sessions
public static CloseAllSessions ( ) : void
return void

CloseDefaultSession() public static method

Close the default session.
public static CloseDefaultSession ( ) : bool
return bool

ConnectSessionSyncUsingThriftPipe() public static method

public static ConnectSessionSyncUsingThriftPipe ( string pipeName, bool autoClose, float timeout, bool logError ) : bool
pipeName string
autoClose bool
timeout float
logError bool
return bool

ConnectSessionSyncUsingThriftSocket() public static method

public static ConnectSessionSyncUsingThriftSocket ( string hostName, int serverPort, bool autoClose, float timeout, bool logError ) : bool
hostName string
serverPort int
autoClose bool
timeout float
logError bool
return bool

ConnectThriftPipeSession() public static method

public static ConnectThriftPipeSession ( string pipeName, bool autoClose, float timeout ) : bool
pipeName string
autoClose bool
timeout float
return bool

ConnectThriftSocketSession() public static method

public static ConnectThriftSocketSession ( string hostName, int serverPort, bool autoClose, float timeout ) : bool
hostName string
serverPort int
autoClose bool
timeout float
return bool

CreateCustomSession() public static method

Create custom Houdini Engine session.
public static CreateCustomSession ( ) : bool
return bool

CreateInProcessSession() public static method

Create in-process Houdini Engine session.
public static CreateInProcessSession ( ) : bool
return bool

CreateSessionFromType() public static method

public static CreateSessionFromType ( System.Type type ) : HEU_SessionBase
type System.Type
return HEU_SessionBase

CreateSessionObject() public static method

Create new session if specified.
public static CreateSessionObject ( ) : HEU_SessionBase
return HEU_SessionBase

CreateThriftPipeSession() public static method

Create pipe session for Houdini Engine.
public static CreateThriftPipeSession ( string pipeName, bool autoClose, float timeout, bool logError ) : bool
pipeName string
autoClose bool
timeout float
logError bool
return bool

CreateThriftSocketSession() public static method

Create socket session for Houdini Engine.
public static CreateThriftSocketSession ( string hostName, int serverPort, bool autoClose, float timeout, bool logError ) : bool
hostName string Network name of the host.
serverPort int Network port of the host.
autoClose bool
timeout float
logError bool
return bool

GetComposedChildNodeList() public static method

Get the composed list of child node IDs.
public static GetComposedChildNodeList ( HEU_SessionBase session, HAPI_NodeId parentNodeID, HAPI_NodeTypeBits nodeTypeFilter, HAPI_NodeFlagsBits nodeFlagFilter, bool bRecursive, Array &childNodeIDs, bool bLogIfError = true ) : bool
session HEU_SessionBase
parentNodeID HAPI_NodeId Parent node ID
nodeTypeFilter HAPI_NodeTypeBits Node type by which to filter the children
nodeFlagFilter HAPI_NodeFlagsBits Node flags by which to filter the children
bRecursive bool Whether or not to compose the list recursively
childNodeIDs Array
bLogIfError bool
return bool

GetComposedObjectListMemorySafe() public static method

Fill an array of HAPI_ObjectInfo list. Use for large arrays where marshalling is done in chunks.
public static GetComposedObjectListMemorySafe ( HEU_SessionBase session, HAPI_NodeId nodeID, Array objectInfos, int start, int length ) : bool
session HEU_SessionBase
nodeID HAPI_NodeId The parent node ID
objectInfos Array Array to fill. Should atleast be size of length
start int At least 0 and at most object count returned by ComposeObjectList
length int Object count returned by ComposeObjectList. Should be at least 0 and at most object count - start
return bool

GetComposedObjectTransformsMemorySafe() public static method

Fill in array of HAPI_Transform list. Use for large arrays where marshalling is done in chunks.
public static GetComposedObjectTransformsMemorySafe ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_RSTOrder rstOrder, Array transforms, int start, int length ) : bool
session HEU_SessionBase
nodeID HAPI_NodeId The parent node ID
rstOrder HAPI_RSTOrder Transform order
transforms Array Array to fill. Should at least be size of length
start int At least 0 and at most object count returned by ComposeObjectList
length int Object count returned by ComposeObjectList. Should be at least 0 and at most object count - start
return bool

GetConnectionError() public static method

public static GetConnectionError ( bool clear ) : string
clear bool
return string

GetCurrentLicense() public static method

Returns the current license value.
public static GetCurrentLicense ( bool bLogError ) : HAPI_License
bLogError bool
return HAPI_License

GetDefaultSession() public static method

Returns the default session in use. Tries to reconnect to a stored session. Does not create a new session.
public static GetDefaultSession ( ) : HEU_SessionBase
return HEU_SessionBase

GetGroupMembership() public static method

Get group membership
public static GetGroupMembership ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, string groupName, Array &membership, bool isInstanced ) : bool
session HEU_SessionBase
nodeID HAPI_NodeId
partID HAPI_PartId
groupType HAPI_GroupType
groupName string
membership Array Array of ints representing the membership of this group
isInstanced bool
return bool

GetGroupNames() public static method

Gets the group names for given group type.
public static GetGroupNames ( HEU_SessionBase session, HAPI_NodeId nodeID, HAPI_PartId partID, HAPI_GroupType groupType, bool isInstanced ) : string[]
session HEU_SessionBase
nodeID HAPI_NodeId The node ID
partID HAPI_PartId
groupType HAPI_GroupType The group type to query
isInstanced bool
return string[]

GetHoudiniPathOnMacOS() public static method

public static GetHoudiniPathOnMacOS ( string houdiniPath ) : string
houdiniPath string
return string

GetLastSessionError() public static method

Returns last session error.
public static GetLastSessionError ( ) : string
return string

GetNodeInputName() public static method

Get the name of the given node's input.
public static GetNodeInputName ( HAPI_NodeId nodeID, int inputIndex, string &inputName ) : bool
nodeID HAPI_NodeId Node's ID
inputIndex int Index of the input
inputName string Input name string
return bool

GetNodeName() public static method

Returns the name of the specified node.
public static GetNodeName ( HAPI_NodeId nodeID, HEU_SessionBase session = null ) : string
nodeID HAPI_NodeId Node ID of the node to find the name of
session HEU_SessionBase Session that the node should be in
return string

GetOrCreateDefaultSession() public static method

Returns a valid session by either reconnecting to an existing session, or creating a new session. Note that this will display error (once) if unable to get a valid session.
public static GetOrCreateDefaultSession ( bool bNotifyUserError = true ) : HEU_SessionBase
bNotifyUserError bool
return HEU_SessionBase

GetSessionData() public static method

Return the existing session data.
public static GetSessionData ( ) : HEU_SessionData
return HEU_SessionData

GetSessionInfo() public static method

Return the session info.
public static GetSessionInfo ( ) : string
return string

GetSessionWithID() public static method

Get the session associated with this session ID. As long as the session was registered, this will return it.
public static GetSessionWithID ( long sessionID ) : HEU_SessionBase
sessionID long Session ID to use for matching to session
return HEU_SessionBase

GetString() public static method

Get the string value of the given string handle.
public static GetString ( int stringHandle, HEU_SessionBase session = null ) : string
stringHandle int String handle to query.
session HEU_SessionBase
return string

GetStringValuesFromStringIndices() public static method

public static GetStringValuesFromStringIndices ( Array strIndices ) : string[]
strIndices Array
return string[]

GetUniqueMaterialShopName() public static method

public static GetUniqueMaterialShopName ( HAPI_NodeId assetID, HAPI_NodeId materialID ) : string
assetID HAPI_NodeId
materialID HAPI_NodeId
return string

InitializeDefaultSession() public static method

public static InitializeDefaultSession ( ) : bool
return bool

IsHARSProcessRunning() public static method

public static IsHARSProcessRunning ( int processID ) : bool
processID int
return bool

LoadAllSessionData() public static method

Load stored session data and recreate the session objects.
public static LoadAllSessionData ( ) : void
return void

LoadSessionFromHIP() public static method

Load a HIP file into given session. The user will be prompted to choose a HIP file via Unity's file dialog.
public static LoadSessionFromHIP ( bool bCookNodes, HEU_SessionBase session = null ) : bool
bCookNodes bool True if nodes should be cooked on load
session HEU_SessionBase Session to load into. If null, will use default session
return bool

LoadStoredDefaultSession() public static method

Tries to load a stored default session. This would be after a code refresh or if the Houdini session is still running but Unity hasn't connected to it.
public static LoadStoredDefaultSession ( ) : bool
return bool

OpenHoudini() public static method

public static OpenHoudini ( string args ) : bool
args string
return bool

OpenSessionInHoudini() public static method

Open given session in a new Houdini instance.
public static OpenSessionInHoudini ( HEU_SessionBase session = null ) : bool
session HEU_SessionBase Session to open. If null, will use default session.
return bool

RecreateDefaultSessionData() public static method

public static RecreateDefaultSessionData ( ) : void
return void

RegisterSession() public static method

Register the given session so that it can be retrieved via its session ID. This guarantees persistence reconnectiong across code refresh/compiles.
public static RegisterSession ( long sessionID, HEU_SessionBase session ) : void
sessionID long
session HEU_SessionBase
return void

RestartSession() public static method

Close default (if valid) and open a new session.
public static RestartSession ( ) : bool
return bool

SaveAllSessionData() public static method

Save given list of sessions (HEU_SessionData) into storage for retrieval later. A way to persist current session information through code refresh/compiles.
public static SaveAllSessionData ( ) : void
return void

SaveSessionToHIP() public static method

Save given session to a HIP file. The user will be prompted with Unity's file dialog to choose HIP file location.
public static SaveSessionToHIP ( bool bLockNodes, HEU_SessionBase session = null ) : bool
bLockNodes bool Whether to lock nodes in HIP file so as not to recook them on load
session HEU_SessionBase Session to save out. If null, uses default session.
return bool

UnregisterSession() public static method

Unregister the session (used when closing).
public static UnregisterSession ( long sessionID ) : void
sessionID long Session to remove from registry
return void

ValidatePluginSession() public static method

Returns true if the plugin is installed properly, and that a session (new or existing) can be established. Notifies user if either fails. This can be called before each operation into Houdini Engine to establish or reconnect to session.
public static ValidatePluginSession ( HEU_SessionBase session = null ) : bool
session HEU_SessionBase
return bool

Property Details

_createSessionFromTypeDelegate public_oe static_oe property

public static CreateSessionFromTypeDelegate _createSessionFromTypeDelegate
return CreateSessionFromTypeDelegate