How to store object keys?!
I've wrote up this basic script that takes a selection of objects and I want it to be able to take each objects individual keys and flip them on the x-axis. I do this by running a function that multiplies the existing keys on the object by -1.
Problems
-It's bugging out when I hit the apply button of the script. It's not applying the function to each key properly when applied.
-I'm not sure if the storing of the objects pre-existing keys is where the problem is.
Help would be appreciated.
Thanks
JokerMartini
Attachment | Size |
---|---|
02.ms | 1.02 KB |
Comments
I'm not sure why there is a
I'm not sure why there is a pick object button?
I'm trying to avoid having a pick button. I just want each object in the select to reference itself for its keys.
That way users to can select an array of objects with different animation on them and flip them.
John Martini
Digital Artist
http://www.JokerMartini.com (new site)
Hi Martin, this was in case
Hi Martin, this was in case you copy keys from an object to multiple objects. I just trying to figure out why you use $ sign on multiple objects. Now, reading your last post, I think so you need only the function that I post before --
my recent MAXScripts RSS (archive here)
This does not work with a
This does not work with a selection of objects, it only works with one object selected?
I've hit a mind block and can not solve it.
John Martini
Digital Artist
http://www.JokerMartini.com (new site)
This ObjKeys =
This
ObjKeys = $.position.controller
will works only on single selected. Maybe I miss the final goal as well... if the objects already animated, the next function will work on multiple selection. if you need to copy the keys from 1 object to multiple objects, just write separate function.my recent MAXScripts RSS (archive here)
Maybe appendKey() function is
Maybe appendKey() function is buged?... If to say the object has 2 keys #(1f, 30f), the function create 2 new keys at time 1 i.e. #(1f, 1f, 1f, 30f), totaly irregular result.
my recent MAXScripts RSS (archive here)
(ObjKeys = undefined
(
ObjKeys = undefined
rollout roAdjustAnimation "Animation Abjust"
(
button btnApply "Apply" width:90 height:90 pos:[5,5]
function flipPositionKeys axisS axisD dir =
(
ObjKeys = $.position.controller
userSel = getCurrentSelection ()
for i = 1 to userSel.count do
(
s = userSel[i]
if(ObjKeys[axisS].controller.keys.count >= 1) then
(
userKeys = ObjKeys[axisS].controller.keys --holds keys from animated object's X-Position as a variable
for k = 1 to userKeys.count do
(
deletekeys s.pos.track
deletekeys s.rotation.track
deletekeys s.scale.track
appendKey s.position.controller[axisD].controller.keys userKeys[k]
s.position.controller[axisD].controller.keys[k].value *= dir
)
)
)
)
on btnApply pressed do
(
flipPositionKeys 1 1 -1
)
)
createDialog roAdjustAnimation 100 100
)
John Martini
Digital Artist
http://www.JokerMartini.com (new site)
Here is what I have so far.
Here is what I have so far. This is more recent than what the attached file is. I'm trying to store the keys in the variable ObjKeys but it is not working when its calling them up later to append the keys.
John Martini
Digital Artist
http://www.JokerMartini.com (new site)