Unable to convert: [] to type: Float
Hi, I'm really new to 3DSMax scripting and I have a real beginner question. My problem is that I can't figure out how to convert a value into a Float. In my example I created a 2 lines ms script:
x = [0.5,0.5,0.5]
x as Float
That's all.
When running the script 3DSMax shows the following message error:
--Unable to convert [0.5,0.5,0.5] to type: Float
Does anyone have an idea what I'm doing wrong?
Many thanks in advance,
Ewok
Comments
Hi miauu, Thank you for these
Hi miauu,
Thank you for these explanations. The problem is that I try to use the '.inTangent' command which needs 3 different values as shown in the example of the MAXScript Reference:
Examples:
c = bezier_position () -- create and assign new controller
$bar.pos.controller = c
k = addNewKey c 0f -- add a key at frame 0
k.value = [10,0,0] -- set value there
k.outTangentType = #slow -- and outgoing tangent type
k = addNewKey c 100f -- add another key at 100
k.value = [200,10,0] -- set value
k.inTangentType = #custom -- make inTangent custom
k.inTangent = [0.2, 0.02, 0.112] -- set its tangents
k.x_locked = false -- and unlock handles
When using '.in tangent' as shown in that example 3DSMax will show the error message telling that it can't convert these values to Float.
Do you have an idea what's wrong with that?
Ewok
I test the code in max2012
I test the code in max2012 and there is no error.
But, try this:
[(0.2 as float),(0.02 as float),(0.112 as float)]
Which version of max you have?
Tools and Scripts for Autodesk 3dsMax
Thank you for the workaround.
Thank you for the workaround. But, I unfortunately I still get the same error message.
I'm working on max 2011.
I don't have max2011.
I don't have max2011. Sorry.
On my max9, max2009 and max2012 when I execute your code with Ctrl+E the error not occurs. When I execute the code line by line the error not occurs.
Tools and Scripts for Autodesk 3dsMax
Thank you for all your
Thank you for all your help!!!
I'll explain you what I'm trying to do. :)
I'm trying to modifiy Brad Nobles' excelent QuickTangents script to make it apply specific ease in and/or out values by using the .intangent property.
What I did. I modified the actions to bee done when the smooth button (the second one) is pressed.
Instead of smoothing the tangents I unlock de curve handles, set the tangent type to custom and I add the .intangent property in order to determine the degree of easing.
That means that from line 129 on I replaced the following code:
on tan_smooth pressed do
(
GetSelKeys()
for kframes in selkeyarray do
(
if tan_in.checked then kframes.intangenttype = #smooth
if tan_out.checked then kframes.outtangenttype = #smooth
)
)
by this code:
on tan_smooth pressed do
(
GetSelKeys()
for kframes in selkeyarray do
(
if tan_in.checked then kframes.x_locked = false
if tan_in.checked then kframes.intangenttype = #custom
if tan_in.checked then kframes.inTangent = [0.2, 0.02, 0.112]
if tan_out.checked then kframes.x_locked = false
if tan_out.checked then kframes.outtangenttype = #custom
if tan_out.checked then kframes.outTangent = [0.2, 0.02, 0.112]
)
)
When I now run the script (on a selected key!!!) and hit the smooth button I get the the error message:
--Unable to convert [0.2, 0.02, 0.112] to type: Float
Do you get the same result?
I test the code, but .... I
I test the code, but .... I don't have proper scene to see if there is a problem or not. Can you send me a simple scene.
Tools and Scripts for Autodesk 3dsMax
No problem. Here is my really
No problem.
Here is my really simple animation scene with which I tested the script:
(mybox = box width:5 height:5 length:5
select $Box001
sliderTime = 0f
move $ [-50,0,0]
sliderTime = 15f
set animate on
move $ [100,50,25]
sliderTime = 30f
move $ [-100,-50,-25]
sliderTime = 45f
move $ [100,50,25]
sliderTime = 60f
move $ [-100,-50,-25]
set animate off
sliderTime = 0f)
I think that I found the
I think that I found the problem.
You using this code as exmaple and based on the code you changed the original script:
This code is from maxscript help file.
Now, execute this in the listener:
In the listener you will see:
k: #Bezier Position key(6 @ 100f)
Now, use this code and put it in the original file:
In the listener you will see:
kframes: #Bezier Float key(2 @ 15f)
The code from maxscript help file work with position key, while your code work with Float key.
This is from maxscript help file. Read it carefully
-----
The .inTangent and .outTangent values are Floats in keys of float controllers and Point3s for the other appropriate controllers. Default value is 0 for float controllers, [0,0,0] otherwise.
----
So, you have to use the float, not the point3 value.
and the script will work as you want.
Tools and Scripts for Autodesk 3dsMax
Cool, ok, so you changed the
Cool,
ok, so you changed the format of "kframes".
Great, you tought me an important thing!!! I thank you very very much for you very comprehensible explanations.
This helps me a lot. I was really stuck.
Ewok
Glad to help. :)
Glad to help. :)
Tools and Scripts for Autodesk 3dsMax