Hello,
Is there a way to adjust only the LENGTH of an Editable Spline tangent handle? I am doing some precision work and need to preserve the angle of the tangent handle while adjusting its length ONLY.
I searched the docs and couldn't find anything. I tried random hotkeys. I tried different reference coordinate systems. Nothing gave me the result I need.
This seems like a pretty basic and obvious feature that should have existed since the day that Bezier splines were introduced.
Thank you,
Aaron
I'm a bit of a hacker when it comes to Max scripts but I thought I'd give your request a try.
The following script is a work-in-progress but may prove useful in seeing if its capabilities are worth expanding. I've limited the code to adjust only the in-vector magnitude of the specified editable spline vertex. If you feel this has potential I can add and Out-Vector option. Before using the script you may want to show the spline's vertex numbers.
To use the script select an editable spline that has Bezier controllers on its vertices then just specify a vertex number and a scale factor.
-- Modifies the magnitude of the In-Vector of the identified editable spline
-- The user specifies the spline's vertex number and the desired scale factor
-- keeping the slope unchanged.
-- L. Minardi 8/24/2021 v01
--
spl = selection[1]
rollout vectorRollout3 "In Vector Tangent Magnitude" width:200 height:160
(
button 'btnGo' "Go" pos:[32,104] width:96 height:36 align:#left
edittext 'edt1' "" pos:[80,32] width:78 height:24 align:#left
label 'lbl1' "Vertex number" pos:[0,32] width:70 height:15 align:#left
edittext 'edt2' "" pos:[64,64] width:78 height:24 align:#left
label 'lbl2' "Scale Factor" pos:[0,64] width:56 height:16 align:#left
on btnGo pressed do
(
vnum = edt1.text as integer
vscale = edt2.text as float
vKnot = (getKnotPoint spl 1 vnum)
vIn = (getInVec spl 1 vnum)
vInRel = (vIn - vKnot)
vRelScale = (vInRel * vscale) as point3
v = vKnot + vRelScale
setInVec spl 1 vnum v
updateshape spl
messagebox "Done"
)
)
createdialog vectorRollout3
Uniform scale spline vertex (Select and Scale tool).
Reference coordinate system doesn't matter (well, almost) but transform center is...
If want scale tangents on more knots (or all) use pivot point cent.
(In Local System all Centers are the same thing.)
Other center options in other Sys. will move vertices.
Quick "Flatten Spline tool" without MXS:
Select all spline verts,
Set "Selection" as trans. center
R to get Non_uniform Scale,
RMB click on Scale tool to get Transform Tipe-in (or change to offset mode on the bottom)
and RMB click on wanted axes spinner
That's "Flatten Whatever You Want" tool!
And you can single click "flatten locally" all tangent handles
@domo.spaji
Thanks for the reply. I should have said that I want to change the length of only ONE tangent handle. As far as I know, the scale method you mentioned always operates on both handles. I actually already knew that. Sorry I didn't formulate my question properly.
Thanks, that's certainly better than what we have now, which apparently is nothing.
Of course, to be useful it needs an out vector.
Another issue is that the dialog doesn't seem to work for successive operations. I have to close the dialog and re-run the script to perform another operation.
A scale factor is, again, better than nothing, but for this to be really effective the user should be able to enter absolute length values.
Thanks again.
I can add an out vector option and make it so that you enter an absolute value for the length of the vector and remove the scale method. I don't have access to Max at the moment but my recollection was that I could try different values without re-executing the script. I will check it out. What "successive operations" were you trying to do?
Any other features you would like? Be specific. The greater the detail the less likely for misinterpretation.
Here's a modified version of my script. It sets the in and out tangent vectors to the user specified length and maintains their current direction. After specifying the vertex number the user should press the "Current Lengths" button then edit the lengths as desired.
-- Modifies the magnitude of the In-Vector and Out-Vector of the identified editable spline
-- The user specifies the spline's vertex number and the desired tangen vector length
-- keeping the slope unchanged.
-- L. Minardi 8/26/2021 v02
--
spl = selection[1]
rollout vectorRollout3 "Spline Tangent Lengths" width:220 height:220
(
button 'btnCurrent' "Current Lengths" pos:[50,64] width:96 height:32 align:#left
button 'btnGo' "Go" pos:[50,168] width:96 height:36 align:#left
edittext 'vn' "" pos:[100,32] width:78 height:24 align:#left
label 'lbl1' "Vertex number" pos:[10,32] width:90 height:15 align:#left
edittext 'LenIn' "" pos:[100,110] width:78 height:24 align:#left
label 'lbl2' "Vector IN Length" pos:[10,110] width:90 height:16 align:#left
edittext 'LenOut' "" pos:[100,142] width:78 height:24 align:#left
label 'lbl3' "Vector OUT Length" pos:[10,142] width:90 height:16 align:#left
on btnCurrent pressed do
(
vnum = vn.text as integer
vKnot = (getKnotPoint spl 1 vnum)
vIn = (getInVec spl 1 vnum)
vInRel = (vIn - vKnot)
LenIn.text = (length vInRel) as string
vOut = (getOutVec spl 1 vnum)
vOutRel = (vOut - vKnot)
LenOut.text = (length vOutRel) as string
)
on btnGo pressed do
(
vnum = vn.text as integer
vKnot = (getKnotPoint spl 1 vnum)
LIn = LenIn.text as float
vIn = (getInVec spl 1 vnum)
vInRel = (vIn - vKnot)
vInEnd = (vKnot + normalize(vInRel) * LIn) as point3
setInVec spl 1 vnum vInEnd
LOut = LenOut.text as float
vOut= (getOutVec spl 1 vnum)
vOutRel = (vOut - vKnot)
vOutEnd = (vKnot + normalize(vOutRel) * LOut) as point3
setOutVec spl 1 vnum vOutEnd
updateshape spl
)
)
createdialog vectorRollout3
I think it still needs some tweaking but it should do what you requested.
Animate verts/knots and you/they will have pos. controllers for verts ctrl points and In/Out Vec.
You could see that in Curve Editor and edit values for each single "handle" individually.
You get all precision you want.
Transform/animate spline parent orientation and you'll get different (orientation) values and (all) gizmos orientation in viewport for verts when changing coordinate systems.
@aaronfross wrote:
As far as I know, the scale method you mentioned always operates on both handles. I actually already knew that.
You're putting big effort here to say that you actually already knew that.
Can't find what you're looking for? Ask the community or share your knowledge.