aresdevo / animaide

AnimAide is a free add-on for Blender that has some helpful tools for animation.
720 stars 62 forks source link

Anim offset changes all pose bones for action in NLA clip when the clip isn't starting at frame 1 #63

Closed RiggingDojoAdmin closed 2 years ago

RiggingDojoAdmin commented 2 years ago

Anim offset changes all pose bones for action in NLA clip when the clip isn't starting at frame 1

https://www.dropbox.com/s/8pb573nnwbqca2x/Recording%202022-02-15%20at%209.40.02%20AM.mp4?dl=0 Example video of what happens.

works when clip is on frame one, when it isn't all bones in the action start rotating and translating into a crushed ball.

aresdevo commented 2 years ago

Well... what can I say, the code never took NLA into consideration... Not too proud of that :P

There are other bugs reported for layers.

I just need to learn more about NLA. That and trying to change the behavior of AnimOffset to affect the direction of the translation when you rotate the "All" are two things I'm trying to code for, but I need some learning to do.

aresdevo commented 2 years ago

I should mention in the readme that Animaide does not works well with NLA for the moment.

RiggingDojoAdmin commented 2 years ago

Yeah let me test it on a few other files and see what might be going on.

The update translation based on rotation is still a nice tool, I hope I can get it into the NLA clips at some point as well :)

Any idea why it would work while on frame 1 and not on any other frames? or why it would grab all the animation curves instead of just the selected bone when it isn't on frame one?

aresdevo commented 2 years ago

I'm not so sure at the moment. AnimOffset is kind of a hack (maybe everything I code is a hack :P ). What it does is look for the difference between the value in every curve at the current frame and the values being changed by the user, but it does that before the curve is updated. Then it adds the difference to every key on every curve. Since you are shifting the animation in the NLA it might be adding the values to the curves at the wrong frame.... but It is even weirder than that because it adds the values even if you don't modify the object in the 3D view.

Let me show you: do the same you did on your video, but instead of transforming your model in the 3D view, go to the Graph Editor select every key and hit "tab" several times (just to refresh the view)... values will be added to the curves, and the furder away to the right your clip is in NLA the faster the curves will move in the graph editor when you refresh it

I think there must be a not-so-complex solution to that. Seems interesting!

Let me give it a try.

aresdevo commented 2 years ago

I think to make a correct AnimOffset tool I need to address it with matrices, but for the moment that is going over my head. I think that will not only make it so the rotations affect translations but maybe will address the NLA issue too.

RiggingDojoAdmin commented 2 years ago

Yes just tested with the meta human. Create meta human, make two whole character keys, turn on anim offset.. then with the clip moved in time, just going in and out of edit mode on the clip (tab key ) or edit-tweak action in the NLA, will cause the character to move/shift

I can make another example video with a very simple action to help if you need, later. but I am seeing if the playback head isn't at 1, entering edit mode causes something to move.

aresdevo commented 2 years ago

even simpler!... wonder what it is?

aresdevo commented 2 years ago

hmmm... it actually makes sense. AnimOffset always see the curves in their original position in the "action", but since it is receiving values now from shifted keys it modifies the original curves, but since the clip is made of the original curves it turns into a loop... Every time we do something in Blender the addon refreshes the values on every key.

So, the solution is to find a way to let AnimOffset know where the keys are in the NLA... that should not be that complicated... I hope :P

RiggingDojoAdmin commented 2 years ago

Yes can confirm that where the playback head is for some reason is + to the offset value during refresh. move to 0, tab, no change, the closer you get to the start of the action first key, it starts to move, the further past the first key, the larger the movement.

RiggingDojoAdmin commented 2 years ago

https://docs.google.com/document/d/1mRMN4pv28YUHd6w3_vW3ZHzchKe8fuKZ6lwOPcawk74/edit# there might be some info in the document near the end about remaping keys.

aresdevo commented 2 years ago

oh!... thanks a lot!

RiggingDojoAdmin commented 2 years ago

Let me make a small video for you to go over a few quirks and situations that can happen to the keys and clips in the NLA for reference.

RiggingDojoAdmin commented 2 years ago

https://capture.dropbox.com/ORjLzJqi6LRjkerS offset fun

aresdevo commented 2 years ago

Very, very interesting finding. That helps a lot, but at the same time my head wants to explode because you could have a lot of clips with the same action!

aresdevo commented 2 years ago

I guess I need to let AnimOffset know what clip the user is modifying... uff, prevented my head from exploding at the last minute :) ... let me see what I can find about NLA in the python modules... I'll escape from work early today

aresdevo commented 2 years ago

Well, I think I have a very good coding day. I think I addressed the NLA issue among most of the other bugs. Check this version 1.0.38 and let me know if it works.

aresdevo commented 2 years ago

I didn't try it with a complex scene, so I'm letting you break it for me :P (hopefully not)

RiggingDojoAdmin commented 2 years ago

So far so good!!! It is running faster also, really great!! Thank you so much. This is fantastic. NLA and New scene turning off , offset both work great! And gizmo is working.

aresdevo commented 2 years ago

Great!... I'll close all the issues that you referred there. You can open new ones if you find anything (don't know if you can reopen closed issues). Thank you so much for your help.