I'm trying to create a script to divide selected spline segments once, but am having troubles using subdivideSegment (since splineOps.divide doesn't let you specify the number of segments). It requires the spline index to be specified, however since I'll only have the segment selected it needs to be derived from that, and I have no idea how to get the associated spline index or convert the selection to it in order to use getSplineSelection.
Another problem I'm having is that, assuming there's only one spline but multiple segments selected, using a loop results in stacked divisions on single segments instead of one per segment:
segs = getSegSelection $ 1
for i=1 to segs.count do (subdivideSegment $ 1 ((getSegSelection $ 1)) 1)
Replies
Anyhow, can someone tell me why this doesn't work? I'm Just trying to get the index numbers for all splines that have knots/verts selected on them:
You can actually convert a segment selection to a knot selection.
Even though this is not accessible via maxscript...
Just wanted to let you guys know
GIF:
One more question: This code works, but it can't be undone. Apparently this is a long standing issue with Maxscript when working with splines. Is there any easy workaround?
Filling activeKnotz array isn't necessary, getKnotSelection $ j is already the array of selected knots.
I've been trying to figure out if there's any other undo-enabled spline functions that will let it work, but no luck so far.