Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rasterized Path Range issue
#1
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:

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.
Reply
#2
Hi
Your points seem valid, I will look into this and update you shortly.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Here are my findings regarding the issues you raised. Please correct me if I forgot something:
  1. Invalid From and To setters: You are right. Please replace these implementations with the ones from BuildShapeExtrusion. These don't have the issue.
  2. ArgumentNullExceptions when path has 0 length: I could not reproduce this issue. Can you please send me a reproduction case?
  3. the check for From <= To: You are right, the results differ depending on whether you set From first or To first. This is something I will work on in the future. For now, make sure your set To after From.
I hope this helped.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#4
Hi Here is how to reproduce this issue. The generator graph is created from Deform Template. You can see then set From and To in Rasterized path to same value, it will throw ArgumentNullException. This issue still exists after I update to the latest version.

Thanks.
Reply
#5
Will try to reproduce it soon. Will keep you updated.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
Hi,

Here is the fix:
In DeformMesh.cs, go to line 128. It should read like this:
Code:
if (inputMeshes.Count != 0)
Replace it with
Code:
if (path != null && inputMeshes.Count != 0)
This should fix the issue.

I hope this helped.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Incorrect mesh alignment after extrusion on curved path Thinkurvy 10 21 04-17-2024, 10:57 AM
Last Post: _Aka_
  Curvy discards Input Spline Range VoltDriver 3 5 11-28-2023, 07:14 PM
Last Post: _Aka_
  Disable Generator Rasterized Objects SAMYTHEBIGJUICY 3 5 09-01-2023, 03:38 PM
Last Post: _Aka_
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect

Forum Jump: