Spline3D.Closed Error and further IntPointer

 
 
 
Posted by:MichiMichbeck
Data created:27 August 2010

Hey Marsel, I am currently working with Splines and encountered a problem using the class Autodesk.Max.Wrappers.Spline3D and its Closed Property. When querying the property its value changes sometimes althoug no assignment is made. It turns out to be a very weird behaviour:

         int numKnots = spline3D.KnotCount;
         int isClosed = spline3D.Closed;
         GFXBezierSpline gfxSpline = new GFXBezierSpline(isClosed == 1);

After this codeblock the value spline3D.Closed has changed! It might also depend on the call to KnotCount - plz have a look at this issue.

Further I have an IntPtr which should be replaced: MNMesh.newFace(...)
That issue is quite urgent as the one above.

best regards
Michbeck

Btw. it turned out that calling the KnotCount getter sometimes changes the value of the Closed property. We couldn't figure out what the underlying native call really does.

Hi guys,

Something is up with forum's notification system, I'll investigate whats going on. Basically I didn't get the new post notifications and as such didn't know of this post, my apologies.

I'm looking at the sources for the Closed and KnotCount methods and it doesn't do anything that would alter behaviour thats otherwise there in 3dsmax:

int Spline3D::Closed::get()
{
    return (int)( (::Spline3D&)unmanaged() ).Closed();
}

int Spline3D::KnotCount::get()
{
    return (int)( (::Spline3D&)unmanaged() ).KnotCount();
}

In the unmanaged SDK the two calls appear as follows:

int Spline3D::Closed()
{ return (flags & SPLINE_CLOSED) ? 1:0; }

int Spline3D::KnotCount()
{ return knotCount; }

I don't see anything that'd alter the class in any way here.

Does this happen even if you just create a very trivial Spline3D instance (i.e. with one or two knots), or does this only apply to specific cases? I can try to reproduce this in unmanaged code, and if its a 3dsmax bug submit it to Autodesk.

Also noted down newFace(...) for next build, thanks.

Marsel Khadiyev (Software Developer, EPHERE Inc.)