Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to override the interpolation of the BezierShape (SDK)?

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
672 Views, 9 Replies

Is it possible to override the interpolation of the BezierShape (SDK)?

Is it possible to override the interpolation method of the BezierShape, so every new spline the user creates is conformed to a surface? Or is it possible to set the interpolated points of a spline?

 

So far I found this method:

ComputeBezPoints()

But since it's not virtual it can't be overridden. And about setting the interpolation points I found nothing, of course.

Any ideas about how I could accomplish this?

 

9 REPLIES 9
Message 2 of 10
istan
in reply to: Anonymous

Message 3 of 10
Anonymous
in reply to: istan

Yeah, like that. I want my CustomSpline to behave like that but I don't know what should be overriden in order to do that.

Message 4 of 10
istan
in reply to: Anonymous

Are you an ADN member? The debug version of Max comes with additional source code..

 

Message 5 of 10
Anonymous
in reply to: istan

Yes. Do you know of any good example in specific?

Message 6 of 10
istan
in reply to: Anonymous

search for spline3d.cpp or splshape.cpp

Message 7 of 10
Anonymous
in reply to: Anonymous

Actually, I still need help on this. I thought replacing Spline3D class with my own would work but now I see it's a mess of classes that try to emulate whatever max does but with my own interpolation. This approach leaded me to have Spline3D, BezierShape, SplineKnotAssy, and SplineKnot replaced, it's a mess!

 

I have somewhere else the points interpolated, based on a modified version of Catmull-Rom. I just need to know where to return all those points in Max code, so the spline is rendered based on them. So far I know that InterpBezier3D method will retrieve the interpolated points (right?). But what's the right place in SplineShape to change that?

 

Any idea on where to hack the interpolation without trying to replicate whatever Max does with all those classes?

@denisT.MaxDoctor, @istan@nicolas.fonta - some thoughts?

Message 8 of 10
denisT.MaxDoctor
in reply to: Anonymous

tell us what your spline does have to do?  what operations with this spline do your want to provide?

the things you have override depend on a functionality of your spline. Technically you have to write your own ShapeObject.

For example, if you want to have a Catmull-Rom spline instead of Bezier you have to re-write all BezierShape. But you can convert from your spline Object to Bezier and back, you can extend the BezierShape. If there is no problem to convert from Catmull-Rom to Bezier, it's a problem to do it back.

 

 

Message 9 of 10
Anonymous
in reply to: denisT.MaxDoctor

Thanks for replying, @denisT.MaxDoctor 

 

The goal: to have spline shapes that conform to a specific surface.

 

In order to do that, I started by creating a class derived from SplineShape. I needed this class to (1) insert knots conformed to the surface and (2) interpolate the spline shape based on this surface. I also recreated Spline3D class through my own "CustomSpline3D".

 

The number (1) worked by re-writing Spline3D::Interact. For the requirement (2), I tried changing Spline3D::MakePolyline, but surprisingly the method is never called. The possible reasons why the latter does not work are: either MakePolyline isn't the right method to change spline interpolation; or BezierShape is interfering with the call of CustomSpline3D::MakePolyline, instead it's executing Spline3D::MakePolyline.

 

After this long story, I want to know:

 

  • Is Spline3D::MakePolyline the right method to change the interpolation or is there something else I'm missing?
  • Is it necessary to recreate BezierShape class too, in order to have the right calls to our CustomSpline3D class? I tried this one and things got messy.
  • OR JUST HOW WOULD YOU DO IT? Because so the code is looking a bit messy  hahah 😞
     

Again, thank you very much for any help

Message 10 of 10
Anonymous
in reply to: Anonymous

Sorry, I meant  Spline3D::ComputeBezPoints() instead of Spline3D::MakePolyline

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report