Skip to content

Commit d320dae

Browse files
committed
- Merged PR#28 on behalf of @igaryhe
Don't get the new part name every time when iterating over old parts when updating the GeoNode. - Fixed Issue #29 on behalf of @ValentinBessonKlang Fixed typo in SetStringParameterValue that caused null refs exceptions. - Fixed Issue #24 on behalf of @tgaldi HDRP Terrain Detail incorrectly set for Unity 2021/2022 - Fixed issue #13: Input interfaces' priorities were incorrectly used when registering input interface.
1 parent fc16564 commit d320dae

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_GeoNode.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,16 +484,17 @@ internal void UpdateGeo(HEU_SessionBase session)
484484
continue;
485485
}
486486

487+
string partName = HEU_SessionManager.GetString(partInfo.nameSH, session);
488+
487489
// Find the old part for this new part.
488490
HEU_PartData part = null;
489491
HEU_PartData oldMatchedPart = null;
490-
491492
foreach (HEU_PartData oldPart in oldParts)
492493
{
493-
string partName = HEU_SessionManager.GetString(partInfo.nameSH, session);
494494
if (oldPart.PartName.Equals(partName))
495495
{
496496
oldMatchedPart = oldPart;
497+
break;
497498
}
498499
}
499500

Plugins/HoudiniEngineUnity/Scripts/Parameters/HEU_Parameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ public bool SetStringParameterValues(string parameterName, string[] values, bool
822822
}
823823

824824
// Copy by value
825-
for (int i = 0; i < paramData._intValues.Length; i++)
825+
for (int i = 0; i < paramData._stringValues.Length; i++)
826826
{
827827
paramData._stringValues[i] = values[i];
828828
}

Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void RegisterInputInterface(HEU_InputInterface inputInterface)
8080
{
8181
if (_inputInterfaces[i] != null && _inputInterfaces[i].Priority <= inputInterface.Priority)
8282
{
83-
_inputInterfaces.Add(inputInterface);
83+
_inputInterfaces.Insert(i, inputInterface);
8484
//HEU_Logger.LogFormat("Registered {0} at {1}. Total of {2}", inputInterface.GetType(), i, _inputInterfaces.Count);
8585
break;
8686
}

Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_TerrainUtility.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,11 +1274,15 @@ public static void ApplyDetailLayers(Terrain terrain, TerrainData terrainData,
12741274

12751275
detailPrototype.renderMode = (DetailRenderMode)heuDetail._renderMode;
12761276

1277+
#if UNITY_2021_2_OR_NEWER
1278+
if( detailPrototype.usePrototypeMesh )
1279+
detailPrototype.useInstancing = true;
1280+
#endif
1281+
12771282
detailPrototypes.Add(detailPrototype);
12781283
}
12791284

12801285
// Set the DetailPrototypes
1281-
12821286
if (detailPrototypes.Count > 0)
12831287
{
12841288
terrainData.detailPrototypes = detailPrototypes.ToArray();
@@ -1290,6 +1294,11 @@ public static void ApplyDetailLayers(Terrain terrain, TerrainData terrainData,
12901294
terrainData.SetDetailLayer(0, 0, i, convertedDetailMaps[i]);
12911295
}
12921296
#endif
1297+
1298+
#if UNITY_2022_2_OR_NEWER
1299+
// Force the detail scatter mode to instance until we add support support for the other scatter mode.
1300+
terrainData.SetDetailScatterMode( DetailScatterMode.InstanceCountMode );
1301+
#endif
12931302
}
12941303

12951304
#if UNITY_2018_3_OR_NEWER

0 commit comments

Comments
 (0)