HAPI_Initialize( ref HAPI_Session session, ref HAPI_CookOptions cook_options, [MarshalAs(UnmanagedType.U1)] bool use_cooking_thread, int cooking_thread_stack_size, string otl_search_path, string dso_search_path, string image_dso_search_path, string audio_dso_search_path);
public static bool initialize() { #if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || (UNITY_METRO && UNITY_EDITOR)) return(false); #else // During the batch creation of our .unitypackage file we don't want to actually // initialize We use this environment variable to inhibit initialization. string no_init = System.Environment.GetEnvironmentVariable("HAPI_UNITY_NO_INIT"); if (no_init != null) { return(false); } if (!HoudiniSetPath.prIsPathSet) { prLastInitializationError = HoudiniSetPath.prLastError; return(false); } if (!prHoudiniSceneExists) { HAPI_Result status_code; try { string otls_path = getAllFoldersInPath(Application.dataPath + "/OTLs/Scanned"); string dsos_path = getAllFoldersInPath(Application.dataPath + "/DSOs"); // Check version match. int houdini_engine_major = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MAJOR); int houdini_engine_minor = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MINOR); int houdini_engine_api = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_API); /* * Debug.Log( "Running Houdini Engine Unity Plugin Version: " + * HoudiniVersion.HOUDINI_ENGINE_MAJOR + "." + * HoudiniVersion.HOUDINI_ENGINE_MINOR + * ", API: " + HoudiniVersion.HOUDINI_ENGINE_API ); * * Debug.Log( "Linking Against Houdini Engine Version: " + * houdini_engine_major + "." + houdini_engine_minor + * ", API: " + houdini_engine_api ); * * Debug.Log( "Underlying Houdini Core Version: " + * houdini_major + "." + houdini_minor + "." + houdini_build + ( houdini_patch > 0 ? "." + houdini_patch : "" ) ); */ // Make sure we are linking against the expected Houdini Engine API version. // Note: We don't need to be so strict as to require the BUILD to match. if (houdini_engine_major != HoudiniVersion.HOUDINI_ENGINE_MAJOR || houdini_engine_minor != HoudiniVersion.HOUDINI_ENGINE_MINOR || houdini_engine_api != HoudiniVersion.HOUDINI_ENGINE_API) { prLastInitializationError = "Houdini Engine version mis-match. Expected " + HoudiniVersion.HOUDINI_ENGINE_MAJOR + "." + HoudiniVersion.HOUDINI_ENGINE_MINOR + "." + HoudiniVersion.HOUDINI_ENGINE_API + ". Got " + houdini_engine_major + "." + houdini_engine_minor + "." + houdini_engine_api + "."; return(false); } HAPI_CookOptions cook_options = new HAPI_CookOptions(); cook_options.splitGeosByGroup = prSplitGeosByGroup; cook_options.maxVerticesPerPrimitive = HoudiniConstants.HAPI_MAX_VERTICES_PER_FACE; cook_options.refineCurveToLinear = HoudiniConstants.HAPI_CURVE_REFINE_TO_LINEAR; cook_options.curveRefineLOD = HoudiniConstants.HAPI_CURVE_LOD; // Initialize. status_code = HAPI_Initialize(otls_path, dsos_path, ref cook_options, true, -1); if (status_code != HAPI_Result.HAPI_RESULT_ALREADY_INITIALIZED) { processStatusCode(status_code); } } catch (HoudiniError error) { prLastInitializationError = error.ToString(); return(false); } catch (System.Exception error) { prLastInitializationError = error.ToString(); return(false); } prHoudiniSceneExists = true; } return(true); #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) }
public static bool initialize() { #if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || (UNITY_METRO && UNITY_EDITOR)) // Getting rid of warning abiout unused variable. bool tempFlag = myCurrentCSharpSessionInitialized; myCurrentCSharpSessionInitialized = tempFlag; return(false); #else // During the batch creation of our .unitypackage file we don't want to actually // initialize We use this environment variable to inhibit initialization. string no_init = System.Environment.GetEnvironmentVariable("HAPI_UNITY_NO_INIT"); if (no_init != null) { return(false); } if (!HoudiniSetPath.prIsPathSet) { prLastInitializationError = HoudiniSetPath.prLastError; return(false); } if (!prHoudiniSceneExists) { // Check version match. int houdini_engine_major = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MAJOR); int houdini_engine_minor = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MINOR); int houdini_engine_api = getEnvInt(HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_API); // Make sure we are linking against the expected Houdini Engine API version. // Note: We don't need to be so strict as to require the BUILD to match. if (houdini_engine_major != HoudiniVersion.HOUDINI_ENGINE_MAJOR || houdini_engine_minor != HoudiniVersion.HOUDINI_ENGINE_MINOR || houdini_engine_api != HoudiniVersion.HOUDINI_ENGINE_API) { prLastInitializationError = "Houdini Engine version mis-match. Expected " + HoudiniVersion.HOUDINI_ENGINE_MAJOR + "." + HoudiniVersion.HOUDINI_ENGINE_MINOR + "." + HoudiniVersion.HOUDINI_ENGINE_API + ". Got " + houdini_engine_major + "." + houdini_engine_minor + "." + houdini_engine_api + "."; return(false); } } // The session partial class decided what to do regarding prHoudiniSceneExists. if (!initializeSession()) { return(false); } if (!prHoudiniSceneExists) { HAPI_Result status_code; try { string otls_path = getAllFoldersInPath(Application.dataPath + "/OTLs/Scanned"); string dsos_path = getAllFoldersInPath(Application.dataPath + "/DSOs"); HAPI_CookOptions cook_options = new HAPI_CookOptions(); cook_options.splitGeosByGroup = prSplitGeosByGroup; cook_options.maxVerticesPerPrimitive = HoudiniConstants.HAPI_MAX_VERTICES_PER_FACE; cook_options.refineCurveToLinear = HoudiniConstants.HAPI_CURVE_REFINE_TO_LINEAR; cook_options.curveRefineLOD = HoudiniConstants.HAPI_CURVE_LOD; cook_options.cookTemplatedGeos = HoudiniHost.prImportTemplatedGeos; cook_options.packedPrimInstancingMode = HAPI_PackedPrimInstancingMode.HAPI_PACKEDPRIM_INSTANCING_MODE_DISABLED; // Initialize. status_code = HAPI_Initialize( ref mySession, ref cook_options, true, -1, otls_path, dsos_path, dsos_path, dsos_path); if (status_code != HAPI_Result.HAPI_RESULT_ALREADY_INITIALIZED) { processStatusCode(status_code); } // Set client name. setServerEnvString("HAPI_CLIENT_NAME", "unity"); } catch (HoudiniError error) { prLastInitializationError = error.ToString(); return(false); } catch (System.Exception error) { prLastInitializationError = error.ToString(); return(false); } prHoudiniSceneExists = true; } // This is used in isInstallationOk() to determine whether we need to // recover the session information from the data file or not. It basically // just means that the current C# state is aware of the Houdini session. myCurrentCSharpSessionInitialized = true; return(true); #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) }
public static bool initialize() { #if !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) return false; #else // During the batch creation of our .unitypackage file we don't want to actually // initialize We use this environment variable to inhibit initialization. string no_init = System.Environment.GetEnvironmentVariable( "HAPI_UNITY_NO_INIT" ); if ( no_init != null ) return false; if ( !HoudiniSetPath.prIsPathSet ) { prLastInitializationError = HoudiniSetPath.prLastError; return false; } if ( !prHoudiniSceneExists ) { // Check version match. int houdini_engine_major = getEnvInt( HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MAJOR ); int houdini_engine_minor = getEnvInt( HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_MINOR ); int houdini_engine_api = getEnvInt( HAPI_EnvIntType.HAPI_ENVINT_VERSION_HOUDINI_ENGINE_API ); // Make sure we are linking against the expected Houdini Engine API version. // Note: We don't need to be so strict as to require the BUILD to match. if ( houdini_engine_major != HoudiniVersion.HOUDINI_ENGINE_MAJOR || houdini_engine_minor != HoudiniVersion.HOUDINI_ENGINE_MINOR || houdini_engine_api != HoudiniVersion.HOUDINI_ENGINE_API ) { prLastInitializationError = "Houdini Engine version mis-match. Expected " + HoudiniVersion.HOUDINI_ENGINE_MAJOR + "." + HoudiniVersion.HOUDINI_ENGINE_MINOR + "." + HoudiniVersion.HOUDINI_ENGINE_API + ". Got " + houdini_engine_major + "." + houdini_engine_minor + "." + houdini_engine_api + "."; return false; } } // The session partial class decided what to do regarding prHoudiniSceneExists. if ( !initializeSession() ) return false; if ( !prHoudiniSceneExists ) { HAPI_Result status_code; try { string otls_path = getAllFoldersInPath( Application.dataPath + "/OTLs/Scanned" ); string dsos_path = getAllFoldersInPath( Application.dataPath + "/DSOs" ); HAPI_CookOptions cook_options = new HAPI_CookOptions(); cook_options.splitGeosByGroup = prSplitGeosByGroup; cook_options.maxVerticesPerPrimitive = HoudiniConstants.HAPI_MAX_VERTICES_PER_FACE; cook_options.refineCurveToLinear = HoudiniConstants.HAPI_CURVE_REFINE_TO_LINEAR; cook_options.curveRefineLOD = HoudiniConstants.HAPI_CURVE_LOD; cook_options.cookTemplatedGeos = HoudiniHost.prImportTemplatedGeos; cook_options.packedPrimInstancingMode = HAPI_PackedPrimInstancingMode.HAPI_PACKEDPRIM_INSTANCING_MODE_DISABLED; // Initialize. status_code = HAPI_Initialize( ref mySession, ref cook_options, true, -1, otls_path, dsos_path, dsos_path, dsos_path ); if ( status_code != HAPI_Result.HAPI_RESULT_ALREADY_INITIALIZED ) processStatusCode( status_code ); } catch ( HoudiniError error ) { prLastInitializationError = error.ToString(); return false; } catch ( System.Exception error ) { prLastInitializationError = error.ToString(); return false; } prHoudiniSceneExists = true; } // This is used in isInstallationOk() to determine whether we need to // recover the session information from the data file or not. It basically // just means that the current C# state is aware of the Houdini session. myCurrentCSharpSessionInitialized = true; return true; #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) }
public static void cookAsset( HAPI_AssetId asset_id, bool split_geos_by_group, bool import_templated_geos ) { #if ( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) HAPI_CookOptions cook_options = new HAPI_CookOptions(); cook_options.splitGeosByGroup = split_geos_by_group; cook_options.maxVerticesPerPrimitive = HoudiniConstants.HAPI_MAX_VERTICES_PER_FACE; cook_options.refineCurveToLinear = HoudiniConstants.HAPI_CURVE_REFINE_TO_LINEAR; cook_options.curveRefineLOD = HoudiniConstants.HAPI_CURVE_LOD; cook_options.cookTemplatedGeos = import_templated_geos; cook_options.packedPrimInstancingMode = HAPI_PackedPrimInstancingMode.HAPI_PACKEDPRIM_INSTANCING_MODE_DISABLED; HAPI_Result status_code = HAPI_CookAsset( ref mySession, asset_id, ref cook_options ); processStatusCode( status_code ); #else throw new HoudiniErrorUnsupportedPlatform(); #endif }
HAPI_Initialize( ref HAPI_Session session, ref HAPI_CookOptions cook_options, [ MarshalAs( UnmanagedType.U1 ) ] bool use_cooking_thread, int cooking_thread_stack_size, string otl_search_path, string dso_search_path, string image_dso_search_path, string audio_dso_search_path );
HAPI_CookAsset( ref HAPI_Session session, HAPI_AssetId asset_id, ref HAPI_CookOptions cook_options );
HAPI_Initialize( string otl_search_path, string dso_search_path, ref HAPI_CookOptions cook_options, [MarshalAs(UnmanagedType.U1)] bool use_cooking_thread, int cooking_thread_stack_size);
HAPI_CookAsset( HAPI_AssetId asset_id, ref HAPI_CookOptions cook_options);
HAPI_CookAsset( ref HAPI_Session session, HAPI_AssetId asset_id, ref HAPI_CookOptions cook_options);
private static extern HAPI_Result HAPI_CookAsset( ref HAPI_Session session, HAPI_AssetId asset_id, ref HAPI_CookOptions cook_options );