From 7a2ccbc4e7855e029b2c1a84168487bbd0f91d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=95=B3=20=E6=82=A0=E6=A8=B9?= Date: Mon, 30 Mar 2026 12:52:12 +0900 Subject: [PATCH] Fix: Use linear curve type for splines with all-linear knots HEU_InputInterfaceSpline always sent HAPI_CURVETYPE_BEZIER regardless of the Unity Spline knot TangentMode. This caused linear splines to be converted to Bezier curves in Houdini, changing their shape. Now checks TangentMode for all knots via ISpline.GetTangentMode(). If all knots are Linear, uses HAPI_CURVETYPE_LINEAR with order 2. Otherwise, uses the existing Bezier path. --- .../Utility/HEU_InputInterfaceSpline.cs | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceSpline.cs b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceSpline.cs index 16c1c6c0..037497a0 100644 --- a/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceSpline.cs +++ b/Plugins/HoudiniEngineUnity/Scripts/Utility/HEU_InputInterfaceSpline.cs @@ -233,6 +233,7 @@ public class HEU_InputDataSpline public int _count; public float _length; public BezierKnot[] _knots; + public bool _allKnotsLinear; } /// @@ -265,6 +266,18 @@ public HEU_InputDataSplineContainer GenerateSplineDataFromGameObject(GameObject splineData._length = spline.GetLength(); splineData._knots = spline.Knots.ToArray(); + // Check if all knots use linear tangent mode + bool allLinear = spline.Count > 0; + for (int i = 0; i < spline.Count; i++) + { + if (spline.GetTangentMode(i) != TangentMode.Linear) + { + allLinear = false; + break; + } + } + splineData._allKnotsLinear = allLinear; + splineContainerData._inputSplines.Add(splineData); } splineContainerData._transform = inputObject.transform; @@ -283,8 +296,16 @@ public bool UploadData(HEU_SessionBase session, HAPI_NodeId inputNodeID, HEU_Inp { // Set the input curve info of the newly created input curve HAPI_InputCurveInfo inputCurveInfo = new HAPI_InputCurveInfo(); - inputCurveInfo.curveType = HAPI_CurveType.HAPI_CURVETYPE_BEZIER; - inputCurveInfo.order = 4; + if (inputSpline._allKnotsLinear) + { + inputCurveInfo.curveType = HAPI_CurveType.HAPI_CURVETYPE_LINEAR; + inputCurveInfo.order = 2; + } + else + { + inputCurveInfo.curveType = HAPI_CurveType.HAPI_CURVETYPE_BEZIER; + inputCurveInfo.order = 4; + } inputCurveInfo.closed = inputSpline._closed; inputCurveInfo.reverse = false; inputCurveInfo.inputMethod = HAPI_InputCurveMethod.HAPI_CURVEMETHOD_BREAKPOINTS;