[Closed] Script works but nothing hapens
I was following Paul Neale’s tutorial on rigging faces and when I ran his script the Maxscript listener returned the name of the function and did not report any errors.
Maybe I missed a simple mistake but I’m prettty something should hapen. Either create the point helpers or aply the position constraint or look at constraints.
This the script.
fn makestretchybones=
(
pts=#()
for x in selection do
(
pt=point size:0.4 centermarker:false axistripod:false cross:false box:true wirecolore:[200,0,0]
pt.transform=x.transform
append pts pt
)
for i = 1 to selection.count do
(
b=selection[i]
posCon=position_constraint()
b.position.controller=posCon
posCon.appendtarget pts[i] 100
if i < selection.count do
(
lookatcon=lookAt_constraint()
b.rotation.controllers=lookatcon
lookatcon.appendtarget pts [i+1] 100
lookatcon.lookat_vector_length=0
lookatcon.upnode_world=false
lookatcon.pickupNode=pts[i]
)
)
)
Thanks in advance.
It’s script that aplies a stretch for bones with point helpers, position constraints and look at constraints.
the clue is in the code – for x in selection. What is being selected? You must begin with some bones…the script then turns them into stretchy bones correctly oriented with point helpers attached to hubs and tidied up…that all it does…
This is a function definition. The function is not being called. You must also call the function.
makeStretchyBones()
Yes what all of them said, so your new code should look like this:
fn makestretchybones=
(
pts=#()
for x in selection do
(
pt=point size:0.4 centermarker:false axistripod:false cross:false box:true wirecolore:[200,0,0]
pt.transform=x.transform
append pts pt
)
for i = 1 to selection.count do
(
b=selection[i]
posCon=position_constraint()
b.position.controller=posCon
posCon.appendtarget pts[i] 100
if i < selection.count do
(
lookatcon=lookAt_constraint()
b.rotation.controllers=lookatcon
lookatcon.appendtarget pts [i+1] 100
lookatcon.lookat_vector_length=0
lookatcon.upnode_world=false
lookatcon.pickupNode=pts[i]
)
)
)
rollout makestretchybonesrollout "Make Stretchy Bones" width:210 height:30
(
button maketheselectedintostretchy "Make Stretchy Bones From Selection"
on maketheselectedintostretchy pressed do
(
makestretchybones ()
)
)
createDialog makestretchybonesrollout
Just run the script and you’ll see a new dialog with a button, just select whatever you want (bones with point helpers, position constraints and look at constraints) to make into stretchy bones and click the button “Make Stretchy Bones”.
Good Luck!