making keyframed animations in Noesis
Posted: Thu Jun 09, 2016 6:31 am
Hi, I was wondering if someone could offer some insight on how to use some code for a Noesis plugin I'm working on. I'm at the point where I have my vertices and bones loaded up in Noesis and now it's time to give Noesis the animation data. I'm trying to hand Noesis key-frames instead of matrices since the data in the animation file seems to specify keyframes. For this task I am constructing the data using the Noesis classes: NoeKeyFramedValue, NoeKeyFramedBone, and NoeKeyFramedAnim.
Here is some sample code of what I'm doing to get the quaternions/rotation data:
I do similar things to construct scaling and translation data. And so I end up constructing an animation object by doing the following:
And after doing this is where I believe I'm doing something wrong. My question is to which method does this object need to be passed to? For example with animations constructed using 4x3 matrices we pass these to NoeAnim's constructor instead of NoeKeyFramedAnim's constructor, and in turn we pass the new NoeAnim instance to the method called setAnims from the object created by rapi.rpgConstructModel() like this:
Where animList is a list of NoeAnim instances. But that's when we're using matrices (NoeMat43). I'm using NoeKeyFramedAnim instead. So to which method do I need to pass this object? I've tried to pass it to setAnims to see if it would work but the results are entirely wrong; I only get 1 frame out of 100+ frames in the animation, so I assume the problem might be that I'm passing NoeKeyFramedAnim to the wrong method? I've google-searched the web and this forum to try to find examples using NoeKeyFramedAnim but nobody seems to have used them yet? So now I'm stuck, and unsure of how to proceed.
Any insight will be greatly appreciated.
I guess rephrasing the question would be: does the mdl object I created in my previous post have a setKeyFramedAnims method so i can pass to it my NoeKeyFramedAnim object? Or where can i find a list of methods for the mdl object, a.k.a. rapi.rpgConstructModel()? If there was some documentation for these objects/libraries it would make writing scripts a lot easier.
Here is some sample code of what I'm doing to get the quaternions/rotation data:
Code: Select all
#Parse rotations:
for i in range(numAnimBones):
rotationKeys = []
for frameIdx in range(kfbCat[i].rTrans):
keyFrame = bs.readUInt()
quat = NoeQuat.fromBytes(bs.readBytes(0x10))
rotationKeys.append(NoeKeyFramedValue(keyFrame, quat))
kfBones[i].setRotation(rotationKeys)
Code: Select all
NoeKeyFramedAnim(animName, modelBones, kfBones, 20.0)
Code: Select all
mdl = rapi.rpgConstructModel()
mdl.setAnims(animList)
mdlList.append(mdl)Any insight will be greatly appreciated.
I guess rephrasing the question would be: does the mdl object I created in my previous post have a setKeyFramedAnims method so i can pass to it my NoeKeyFramedAnim object? Or where can i find a list of methods for the mdl object, a.k.a. rapi.rpgConstructModel()? If there was some documentation for these objects/libraries it would make writing scripts a lot easier.