Skip to content

Commit

Permalink
commit before branch change to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
atcarter714 committed Apr 26, 2024
1 parent 885db3b commit 1760ec1
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions Plugins/HoudiniEngineUnity/Scripts/Sessions/HEU_SessionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ public static class HEU_SessionManager {
/// </summary>
/// <returns>A new session object</returns>
public static HEU_SessionBase CreateSessionObject( ) {
HEU_SessionBase sessionBase = null ;
#if HOUDINIENGINEUNITY_ENABLED
sessionBase = new HEU_SessionHAPI( ) ;
HEU_SessionHAPI sessionBase = new( ) ;
#else
sessionBase = new HEU_SessionBase();

HEU_SessionBase sessionBase = new( ) ;
#endif
return sessionBase ;
}
Expand Down Expand Up @@ -206,11 +206,12 @@ static void InternalValidateSceneAssets( ) {
// Go through each asset, and validate in session
_assets = Object.FindObjectsByType< HEU_HoudiniAsset >( FindObjectsSortMode.None ) ;
foreach ( HEU_HoudiniAsset asset in _assets ) {
if ( !asset || asset.SessionID == HEU_Defines.HEU_INVALID_NODE_ID ) continue ;
if ( asset is not { SessionID: not HEU_Defines.HEU_INVALID_NODE_ID } )
continue ;

if ( _sessionMap.TryGetValue( asset.SessionID, out HEU_SessionBase session ) )
session.RegisterAsset( asset ) ;
else
else
asset.InvalidateAsset( ) ;
}
}
Expand Down Expand Up @@ -463,15 +464,8 @@ public static bool RestartSession( ) {
/// </summary>
/// <returns>True if plugin is installed and session is valid.</returns>
public static bool ValidatePluginSession( HEU_SessionBase session = null ) {
if ( session is null ) {
session = GetOrCreateDefaultSession( ) ;
}

if ( session is null || !session.IsSessionValid( ) ) {
return false ;
}

return true ;
session ??= GetOrCreateDefaultSession( ) ;
return session?.IsSessionValid( ) is true ;
}

/// <summary>Returns last session error.</summary>
Expand Down Expand Up @@ -525,14 +519,14 @@ public static string GetConnectionError( bool clear ) {
}

public static bool IsHARSProcessRunning( int processID ) {
if ( processID <= 0 ) return false ;
if ( processID < 1 ) return false ;
try {
System.Diagnostics.Process serverProcess =
System.Diagnostics.Process.GetProcessById( processID ) ;
return serverProcess is { HasExited: false, ProcessName: "HARS" } ;
//!serverProcess.HasExited && serverProcess.ProcessName.Equals( "HARS" ) ;
}
catch ( System.Exception ) { return false ; }
catch ( Exception ) { return false ; }
}

// SESSION DEBUG ----------------------------------------------------------------------------------------------
Expand Down

0 comments on commit 1760ec1

Please sign in to comment.