amv256
06-03-2008, 06:27 AM
I'm trying to add keys to an object's position controller using AddNewKey, but I'm having a weird problem.
If I create a sphere and run the following script:
print $.pos.controller to:debug
q = addNewKey $.pos.controller 50
q.value = [50,50,50]
print q.value to:debug
$.pos.controller = bezier_position ()
print $.pos.controller to:debug
q = addNewKey $.pos.controller 60
q.value = [50,50,50]
print q.value to:debug
I get the following output:
Controller:Position_XYZ
Controller:Bezier_Position
[50,50,50]
Only the second call to AddNewKey () seems to return a working key reference. I also get the following in the MaxScript listener after the first call to AddNewKey ():
-- Unknown property: "value" in OK
In other words, the following apperas to the case:
1) By default, the sphere's position controller is Position_XYZ
2) Adding a new key to this Position_XYZ controller works, but for some reason the function does NOT return a key reference as it should.
3) If I manually add a Bezier_Position controller, a second call to AddNewKey () will also work, but this time, a working reference to a key will be returned as well.
This would make sense if there were no position controller assigned to the sphere at all by default, but there is. Furthermore, AddNewKey () works with this default controller. I see the keyframe pop up on the time slider. But for some reason, the keyframe is not returned from AddNewKey (), which makes no sense to me. Once I add a second controller (which I shouldn't have to do since Position_XYZ is already there), AddNewKey () starts returning an actual reference.
What's going on here?
If I create a sphere and run the following script:
print $.pos.controller to:debug
q = addNewKey $.pos.controller 50
q.value = [50,50,50]
print q.value to:debug
$.pos.controller = bezier_position ()
print $.pos.controller to:debug
q = addNewKey $.pos.controller 60
q.value = [50,50,50]
print q.value to:debug
I get the following output:
Controller:Position_XYZ
Controller:Bezier_Position
[50,50,50]
Only the second call to AddNewKey () seems to return a working key reference. I also get the following in the MaxScript listener after the first call to AddNewKey ():
-- Unknown property: "value" in OK
In other words, the following apperas to the case:
1) By default, the sphere's position controller is Position_XYZ
2) Adding a new key to this Position_XYZ controller works, but for some reason the function does NOT return a key reference as it should.
3) If I manually add a Bezier_Position controller, a second call to AddNewKey () will also work, but this time, a working reference to a key will be returned as well.
This would make sense if there were no position controller assigned to the sphere at all by default, but there is. Furthermore, AddNewKey () works with this default controller. I see the keyframe pop up on the time slider. But for some reason, the keyframe is not returned from AddNewKey (), which makes no sense to me. Once I add a second controller (which I shouldn't have to do since Position_XYZ is already there), AddNewKey () starts returning an actual reference.
What's going on here?
