Notifications
Clear all

[Closed] get access to a spline with modifiers on top

in the maxScript Help you can read “MAXScript cannot modify a spline with modifiers on top” in the “How to…Flatten a SplineShape” Section.

But I need this functionality or a simple workaround.

I animated a group of shapes via a FFD 2x2x2. Now I want to access knots of the splines of my shapes not in original state but in modified (animated) state. So I thought: just put an Editable Spline Modifier in the top of the stack an then access the knots.

Like the maxScript Help says this is’nt possible: I get everytime the original knot positions.and not the ones in the Editable Spline Modifier at animated frames. Converting to Editable Spline removes the animation data.

Does there exist a known way or a known workaround or a “SplineOven”-MaxScript as solution for my problem?

3 Replies

I haven’t looked into this, but here is an idea for a dirty hack.
Create a mesh object with verts in the same place as the spline with the same transform and bounding box (use 3 extra verts at the end for this purpose) You needn’t create any faces. Then apply the same FFD to the mesh object. You can then look up the new locations from the mesh.

You should be able to use the getPointPos method for this (max 2008 or higher), which works for both meshes as shapes. In the case of shapes it actually allows you to retrieve both the bezier handles as knot positions.

-- the index of the knot of which you want to get the position.
knt = 6

-- calculate the point index as used by [b]getPointPos[/b].
-- 1 = intangent, 2 = knot, 3 = outtangent, 4 = intangent, 5 = knot, etc..
-- also works when your shape contains multiple splines.
pnt = (knt * 3) - 1

-- get the position!
getPointPos myShape pnt

Hope this helps,
Martijn

@magicm: Thanks a lot. I only changed a little part in my script with your code and now it works very well.