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;