Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public class HEU_InputDataSpline
public int _count;
public float _length;
public BezierKnot[] _knots;
public bool _allKnotsLinear;
}

/// <summary>
Expand Down Expand Up @@ -265,6 +266,18 @@ public HEU_InputDataSplineContainer GenerateSplineDataFromGameObject(GameObject
splineData._length = spline.GetLength();
splineData._knots = spline.Knots.ToArray<BezierKnot>();

// 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;
Expand All @@ -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;
Expand Down