Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Plugins/HoudiniEngineUnity/Scripts/Asset/HEU_ObjectNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down
2 changes: 2 additions & 0 deletions Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
18 changes: 18 additions & 0 deletions Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions Plugins/HoudiniEngineUnity/Scripts/HAPI/HEU_HAPIStructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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. :

Expand Down
6 changes: 3 additions & 3 deletions Plugins/HoudiniEngineUnity/Scripts/HEU_HoudiniVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 226;
public const int HOUDINI_BUILD = 457;
public const int HOUDINI_PATCH = 0;

public const string HOUDINI_VERSION_STRING = "19.5.226";
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector3> uniqueVertices = new List<Vector3>();

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down