From d2fd1b415e5eee7edd4a1caab7aaffdf6c8b5cfa Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Wed, 20 Jul 2022 19:22:52 -0400 Subject: [PATCH 1/7] Bumping to Houdini Version: 19.5.318 Houdini Engine Version: 5.0 (API: 0) --- Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs | 3 +++ Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs index d178bc73..ca3a7fa6 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs @@ -231,6 +231,9 @@ public partial struct HAPI_CookOptions //Options which affect how nodes [MarshalAs(UnmanagedType.U1)] public HAPI_Bool cacheMeshTopology; //This toggle lets you enable the caching of the mesh topology.By default this is false. If this is set to true cooking a meshgeometry will update only the topology if the number of points changed.Use this to get better performance on deforming meshes. + [MarshalAs(UnmanagedType.U1)] + public HAPI_Bool preferOutputNodes; //If enabled calls to HAPI_CookNode on an OBJ node will cook the outputnodes of any nested SOP nodes. If none exist or the option is disabledHAPI will instead cook the display nodes of any nested SOP nodes. + [MarshalAs(UnmanagedType.I4)] public int extraFlags; //For internal use only. : diff --git a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs index 84aa7135..94ce7c83 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs @@ -41,10 +41,10 @@ public class HEU_HoudiniVersion { public const int HOUDINI_MAJOR = 19; public const int HOUDINI_MINOR = 5; - public const int HOUDINI_BUILD = 226; + public const int HOUDINI_BUILD = 318; public const int HOUDINI_PATCH = 0; - public const string HOUDINI_VERSION_STRING = "19.5.226"; + public const string HOUDINI_VERSION_STRING = "19.5.318"; public const int HOUDINI_ENGINE_MAJOR = 5; public const int HOUDINI_ENGINE_MINOR = 0; From f6c5bad8814b0e64817be30038743e7b45c33f18 Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Wed, 20 Jul 2022 19:22:50 -0400 Subject: [PATCH 2/7] - Fixed an issue that caused terrain input layer data to be incorrectly set in Houdini due to sizing inconsistencies. --- .../Scripts/Utility/HEU_InputInterfaceTerrain.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceTerrain.cs b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceTerrain.cs index de7d0c31..941b7e04 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceTerrain.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceTerrain.cs @@ -414,7 +414,12 @@ public bool UploadAlphaMaps(HEU_SessionBase session, HEU_InputDataTerrain idt, r HEU_Logger.LogError("Failed to create input volume node for layer " + layerName); break; } - } + + float[,] heights = idt._terrainData.GetHeights(0, 0, idt._terrainData.heightmapResolution, idt._terrainData.heightmapResolution); + int heightsSizeX = heights.GetLength(0); + int heightsSizeY = heights.GetLength(1); + alphaMapsConverted[m] = HEU_TerrainUtility.ResampleData(alphaMapsConverted[m], sizeX, sizeY, heightsSizeX, heightsSizeY); + } //HEU_Logger.Log("Uploading terrain layer: " + layerName); From 60c66a83c5a8b3a9eac917f65ace4a7fabc163e5 Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Wed, 10 Aug 2022 13:29:20 -0400 Subject: [PATCH 3/7] Bumping to Houdini Version: 19.5.339 Houdini Engine Version: 5.0 (API: 0) --- Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs | 2 ++ Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs index 96c19871..5f2f2320 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs @@ -609,6 +609,8 @@ public enum HAPI_PDG_EventType //Used with PDG functions HAPI_PDG_EVENT_SCHEDULER_REMOVED, //Sent when a scheduler is removed from the graph HAPI_PDG_EVENT_SET_SCHEDULER, //Deprecated HAPI_PDG_EVENT_SERVICE_MANAGER_ALL, //Deprecated + HAPI_PDG_EVENT_NODE_COOKED, //Sent when a node finishes cooking + HAPI_PDG_EVENT_NODE_GENERATED, //Sent when a node finished generating HAPI_PDG_CONTEXT_EVENTS, }; diff --git a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs index 94ce7c83..b8ed3c4b 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs @@ -41,10 +41,10 @@ public class HEU_HoudiniVersion { public const int HOUDINI_MAJOR = 19; public const int HOUDINI_MINOR = 5; - public const int HOUDINI_BUILD = 318; + public const int HOUDINI_BUILD = 339; public const int HOUDINI_PATCH = 0; - public const string HOUDINI_VERSION_STRING = "19.5.318"; + public const string HOUDINI_VERSION_STRING = "19.5.339"; public const int HOUDINI_ENGINE_MAJOR = 5; public const int HOUDINI_ENGINE_MINOR = 0; From 8da5886fbd262afd42bea07544bab22c2ec9c232 Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Wed, 10 Aug 2022 13:29:18 -0400 Subject: [PATCH 4/7] - Fixed tearing issue when round-tripping terrain in an HDA. The issue was caused by corner sampling actually adding an extra voxel to the input data, that then caused a discrepancy in the output terrain size, causing the tearing of the data. --- .../HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs index ee033174..9e977ea3 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs @@ -181,6 +181,9 @@ public static bool GenerateTerrainFromVolume(HEU_SessionBase session, ref HAPI_V if (terrainResizedDelta < 0) { HEU_Logger.LogWarningFormat("Note that Unity automatically resized terrain resolution to {0} from {1}. Use terrain size of power of two plus 1, and grid spacing of 2.", heightMapResolution, terrainData.heightmapResolution); + float[] resampledHeights = HEU_TerrainUtility.ResampleData(normalizedHeights, heightMapResolution, heightMapResolution, terrainData.heightmapResolution, terrainData.heightmapResolution); + + normalizedHeights = resampledHeights; heightMapResolution = terrainData.heightmapResolution; } else if (terrainResizedDelta > 0) From 0c03ef6ff8cfddcdb56ee52931f8a1b5ba871043 Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Tue, 6 Dec 2022 18:56:09 -0500 Subject: [PATCH 5/7] Bumping to Houdini Version: 19.5.457 Houdini Engine Version: 5.0 (API: 5) --- .../Scripts/HAPI/HEU_HAPIFunctions.cs | 18 ++++++++++++++++++ .../Scripts/HEU_HoudiniVersion.cs | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIFunctions.cs b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIFunctions.cs index 9c38fd46..8be3d0dd 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIFunctions.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIFunctions.cs @@ -447,6 +447,24 @@ public static extern HAPI_Result int choice_length); [DllImport(HEU_HoudiniVersion.HAPI_LIBRARY, CallingConvention = CallingConvention.Cdecl)] public static extern HAPI_Result + HAPI_GetLoadedAssetLibraryCount( + ref HAPI_Session session, + out int count); + [DllImport(HEU_HoudiniVersion.HAPI_LIBRARY, CallingConvention = CallingConvention.Cdecl)] + public static extern HAPI_Result + HAPI_GetAssetLibraryIds( + ref HAPI_Session session, + [Out] HAPI_AssetLibraryId[] asset_library_ids_array, + int start, + int length); + [DllImport(HEU_HoudiniVersion.HAPI_LIBRARY, CallingConvention = CallingConvention.Cdecl)] + public static extern HAPI_Result + HAPI_GetAssetLibraryFilePath( + ref HAPI_Session session, + HAPI_AssetLibraryId asset_library_id, + out HAPI_StringHandle file_path_sh); + [DllImport(HEU_HoudiniVersion.HAPI_LIBRARY, CallingConvention = CallingConvention.Cdecl)] + public static extern HAPI_Result HAPI_LoadHIPFile( ref HAPI_Session session, byte[] file_name, diff --git a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs index b8ed3c4b..04c66475 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs @@ -41,15 +41,15 @@ public class HEU_HoudiniVersion { public const int HOUDINI_MAJOR = 19; public const int HOUDINI_MINOR = 5; - public const int HOUDINI_BUILD = 339; + public const int HOUDINI_BUILD = 457; public const int HOUDINI_PATCH = 0; - public const string HOUDINI_VERSION_STRING = "19.5.339"; + public const string HOUDINI_VERSION_STRING = "19.5.457"; public const int HOUDINI_ENGINE_MAJOR = 5; public const int HOUDINI_ENGINE_MINOR = 0; - public const int HOUDINI_ENGINE_API = 0; + public const int HOUDINI_ENGINE_API = 5; public const int UNITY_PLUGIN_VERSION = 2; From 4561e21f69286a038ee15a20dab5c948e36df89d Mon Sep 17 00:00:00 2001 From: Damien Pernuit Date: Tue, 6 Dec 2022 18:56:07 -0500 Subject: [PATCH 6/7] - Fixed an issue that caused loaded curves to disappear after being recooked (but not the first one!). This was caused by the asset name being used to retrieve the curve parameters/geo data. --- .../Scripts/Asset/HEU_ObjectNode.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_ObjectNode.cs b/Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_ObjectNode.cs index e2c89c53..c16b498c 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_ObjectNode.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_ObjectNode.cs @@ -498,11 +498,19 @@ internal void UpdateObject(HEU_SessionBase session, bool bForceUpdate) int numPostCookGeoInfos = postCookGeoInfos.Count; for (int i = 0; i < numPostCookGeoInfos; i++) { + string geoName = HEU_SessionManager.GetString(postCookGeoInfos[i].nameSH, session); + bool bFound = false; for (int j = 0; j < _geoNodes.Count; j++) { - string geoName = HEU_SessionManager.GetString(postCookGeoInfos[i].nameSH, session); - if (geoName.Equals(_geoNodes[j].GeoName)) + string oldGeoName = _geoNodes[j].GeoName; + + if (geoName.Equals(oldGeoName) + // Fixes Bug #124004 + // Newly created curves all use "curve" for their geo name, + // but loaded curves use "curveX", this caused loaded curves to disappear if recooked + // due to the saved name for the geo being "curve" and the newly created node name to be "curveX" + || (oldGeoName.Equals("curve") && geoName.StartsWith("curve"))) { _geoNodes[j].SetGeoInfo(postCookGeoInfos[i]); From e3cb65416805cf5d4e2fdee65a1593a4bbb9140d Mon Sep 17 00:00:00 2001 From: Max Kramarov Date: Sun, 26 Oct 2025 20:01:51 +0200 Subject: [PATCH 7/7] converted mesh normals from local space to world space --- .../Scripts/Utility/HEU_InputInterfaceMesh.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceMesh.cs b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceMesh.cs index 6df46a73..a5aa737e 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceMesh.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceMesh.cs @@ -285,6 +285,7 @@ public bool UploadData(HEU_SessionBase session, HAPI_NodeId inputNodeID, HEU_Inp { Vector3[] meshVertices = inputDataMeshes._inputMeshes[i]._mesh.vertices; Matrix4x4 localToWorld = rootInvertTransformMatrix * inputDataMeshes._inputMeshes[i]._transform.localToWorldMatrix; + Matrix4x4 worldToLocalTransposed = localToWorld.inverse.transpose; List uniqueVertices = new List(); @@ -366,7 +367,11 @@ public bool UploadData(HEU_SessionBase session, HAPI_NodeId inputNodeID, HEU_Inp if (meshNormals != null && (originalIndex < meshNormals.Length)) { - normals.Add(meshNormals[originalIndex]); + Vector3 normalLocalSpace = meshNormals[originalIndex]; + Vector3 normalWorldSpace = worldToLocalTransposed * normalLocalSpace; + if (normalWorldSpace.sqrMagnitude > 0f) + normalWorldSpace.Normalize(); + normals.Add(normalWorldSpace); } for (int u = 0; u < NumUVSets; ++u)