XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Tue Jan 22, 2019 4:07 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Noesis Animations
PostPosted: Tue Jan 08, 2019 2:36 pm 
Offline
ultra-n00b

Joined: Tue Jan 08, 2019 2:26 pm
Posts: 4
Has thanked: 0 time
Have thanks: 1 time

Hello, I'm trying to implement animation support in a noesis plugin. I've already been able to read animation data such as its name, keyframes, etc., as described here, but I'm with a doubt about how append this animation so for noesis load it. Probably I must use setAnims (as the original code does) but I've no idea how it handle data structure. Could anyone help?

Here's the code (parse_animations it's the code that I did)
https://paste.ofcode.org/9mC999E7kF8hmSJVyHPAsX

You can make the ads go away by registering



Top
 Profile  
 
 Post subject: Re: Noesis Animations
PostPosted: Sun Jan 13, 2019 8:05 am 
Offline
n00b

Joined: Sun Aug 27, 2017 2:08 pm
Posts: 14
Has thanked: 3 times
Have thanks: 9 times
I only used animations in Noesis using the c++ interface (https://github.com/Kerilk/noesis_bayonetta_pc), but nonetheless the process should be similar in python:
  • for each animation :
    - create a (local) transform matrix for each bone of the model
    - create an animation out of the matrices using rpgAnimFromBonesAndMatsFinish (bones, bone_number, matrices, frameCount, frameRate);
    - put this anim in a list
  • create an animation from you list of animation:
    - int anims_num = animList.Num();
    - noesisAnim_t *anims = rapi->Noesis_AnimFromAnimsList(animList, anims_num);
  • set the model to use the animation: rapi->rpgSetExData_AnimsNum(anims, 1);
The api suggests that other approaches might be viable but I never managed to achieve it any other way.

Sorry I can't be of more help.

for reference:
Code:
noesisAnim_t *anim = rapi->rpgAnimFromBonesAndMatsFinish(bones, bone_number, matrixes, frameCount, 60);
   if (!anim) {
      DBGLOG("Could not create anim for %s (out of memory?)!\n", fname);
      rapi->Noesis_UnpooledFree(matrixes);
      continue;
   }

   anim->filename = rapi->Noesis_PooledString(fname);
   anim->flags |= NANIMFLAG_FILENAMETOSEQ;
   anim->aseq = rapi->Noesis_AnimSequencesAlloc(1, frameCount);
   anim->aseq->s->startFrame = 0;
   anim->aseq->s->endFrame = frameCount - 1;
   anim->aseq->s->frameRate = 60;
   anim->aseq->s->name = rapi->Noesis_PooledString(fname);
   if (anim)
   {
      animList.Append(anim);
}


Top
 Profile  
 
 Post subject: Re: Noesis Animations
PostPosted: Sun Jan 13, 2019 1:35 pm 
Offline
ultra-n00b

Joined: Tue Jan 08, 2019 2:26 pm
Posts: 4
Has thanked: 0 time
Have thanks: 1 time
Hello, thank you for your answer. I did some tries based in python scripts, but didn't work.

Code:
Code:
for i in range(animCount):
    anim = Animation()
    anim.extents = NoeVec3.fromBytes(self.inFile.readBytes(12))
    anim.name = self.read_name()
    anim.unknown = self.inFile.readInt()
    anim.time = self.inFile.readUInt()
    anim.frameCount = self.inFile.readUInt()
    animMat = []

    for j in range(anim.frameCount):
        self.inFile.readUInt()
        self.read_name()

    for k in range(self.numBones):
        for j in range(anim.frameCount):
            pos = NoeVec3.fromBytes(self.inFile.readBytes(12))
            rot = NoeQuat.fromBytes(self.inFile.readBytes(16)).transpose()
            mat = rot.toMat43()
            mat.__setitem__(3, pos)
            animMat.append(mat)

    noeAnim = NoeAnim(anim.name, self.boneList, anim.frameCount, animMat, 30.0)
    self.animList.append(noeAnim)


Result:
Image

I would like to try your suggestion, but I'm with a doubt about how "transformations" work in lithtech .abc models. I can provide the plugin with a model for testing purpose.

Besides, here's the model animation reference.
https://github.com/cmbasnett/io_scene_a ... nimation-1



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: ChaoticFusion40 and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group