Notifications
Clear all

[Closed] Spline reverse vs splineOp.revese

In this video you can see the problem(?).

https://drive.google.com/file/d/1wYIioKELCJlfomjEbJ_-r31nwNruAHbc/view?usp=sharing

When

(
 	reverse $ 1
	updateShape $
)

is used the order of the knots of the spline are reversed, but the last knot becomes the first knot and the first knot becomes the last knot. The first knot is not preserved.

When

(
	splineOps.reverse $
	updateShape $
)

is used, or the Reverse button in the Modify Panel is used, the first knot is preserved and the order of the other knots are reversed.

From Maxscript Help:

reverse <shape> <spline_index_integer>

Reverses the order of the knots in the indexed spline. 

splineOps.reverse <editable_spline_or_line_node_or_modifier>

Reverses the order of vertices in the selected splines. It is valid in the Spline Sub-Object level.

Am I miss something or the reverse <shape> <spline_index_integer> does not work as it should?

10 Replies

smth like this?

reverse shp spline_index
if isClosed shp spline_index do setfirstknot shp spline_index (numknots shp spline_index)
updateshape shp

Yes, this is a solution.
But the reverse <shape> <spline_index_integer> does not works as it should.

In which version of 3ds Max you tested it?

Since it is just a hobby for me I still use 2014 max version. You think reverse works differently across max versions?

I am using max2020 and the problem exist in it. If you have the same issue on max2014 then the reverse works the same on all max versions, but it not works as described in maxscript help. So, this has to be a bug.

works as expected in 2010 but not 2015

So, somewhere on version 2014 the big was introduced.

Just checked on max 2022 – the problem exist.

According to SDK the Reverse method has optional argument – keepFirst which is FALSE by default.
This is how MXS reverse works (and there is no other option).
splineops.reverse works with keepFirst TRUE (as well as UI Reverse).
Keeping first makes more sense for me, so in my MXS extension I use this optional argument TRUE by default.

the error is probably down to there being a change in the mxs function calling the sdk function differently

calling any one of these…

void SplineShape::Reverse  (  int  poly,   BOOL  keepFirst = FALSE )  
void BezierShape::Reverse  (  int  poly,  BOOL  keepZero = FALSE )  
void Spline3D::Reverse  (  BOOL  keepZero = FALSE   )   

with the keepFirst/KeepZero set to zero will cause the first knot to flip back and forth if set to TRUE then it would work correctly.

I’m confused now as it’s start doing the error in 2010 now

the edit spline mod op calls the BezierShape function

shape->Reverse(poly, TRUE);

that’s what I do too… I use BezierShape::Reverse(BitArray& reverse, BOOL keepZero = FLASE) with keepZero set to TRUE by default

Page 1 / 2