Hi, I want to deform a spring mesh along a spline, and animate Rasterized Path's From/To property to create a stretch animation, but the Curvy Generator always throws ArgumentNullException. After some investigation, I found when set To=1, it's actual value becomes 0, and From is also 0,so the CGPath is null. In the BuildRasterizedPath.cs, I see From/To property make some clamp for value:
From use a specific DTMath.Repeat to clamp the value, which keep 1 for 1, but To still use Mathf.Repeat, which make 1 becomes 0. After replace Mathf.Repeat with DTMath.Repeat, it can work normally. So should it be DTMath.Repeat too for To property?
In addition, when set From and To with same value, which means Length = 0, the Generator always throws ArgumentNullException, I guess when the Length = 0, CGPath always is null. Can it generate a empty path/mesh, otherwise I have to keep a small distance between From and To to avoid the ArgumentNullException.
Beside, To use Mathf.Max(From, value) to make sure it >= From, but the From don't have such check. So when set the range, To must set after From. Should From also do the same?
Thanks.
Code:
public float From
{
get => m_Range.From;
set
{
float v = DTMath.Repeat(
value,
1
);
if (m_Range.From != v)
{
m_Range.From = v;
Dirty = true;
}
}
}
public float To
{
get => m_Range.To;
set
{
float v = Mathf.Max(
From,
value
);
if (ClampPath)
v = Mathf.Repeat(
value,
1
);
if (m_Range.To != v)
{
m_Range.To = v;
Dirty = true;
}
}
}
From use a specific DTMath.Repeat to clamp the value, which keep 1 for 1, but To still use Mathf.Repeat, which make 1 becomes 0. After replace Mathf.Repeat with DTMath.Repeat, it can work normally. So should it be DTMath.Repeat too for To property?
In addition, when set From and To with same value, which means Length = 0, the Generator always throws ArgumentNullException, I guess when the Length = 0, CGPath always is null. Can it generate a empty path/mesh, otherwise I have to keep a small distance between From and To to avoid the ArgumentNullException.
Beside, To use Mathf.Max(From, value) to make sure it >= From, but the From don't have such check. So when set the range, To must set after From. Should From also do the same?
Thanks.