Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bake operators fix #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Griperis
Copy link

@Griperis Griperis commented Feb 13, 2023

By using bpy_extras.anim_utils module directly there is more control over baking actions, but the steering pose transform bone needs to be reset in order to bake steering correctly.

The root of the issues was in inconsistency between the bpy.ops.nla.bake operator, if the internal functions are used directly it's behaviour is more controlled.

Blend with follow path constraint and baked rotation and steering from this PR. (Blender 3.4)
bmw27_with_rig.zip

Closes #93, Closes #95, Closes #97, Closes #98

Edit: .zip with changes from this MR:
rigacar-bake-operator-fix.zip

@spoonless spoonless self-assigned this Feb 28, 2023
@spoonless spoonless added the bug label Feb 28, 2023
@ExtremeAddons
Copy link

Bingo! I tested the code by replacing it with your file. Bake seems to work again in Blender 3.4. Good job!

@Griperis
Copy link
Author

Griperis commented Mar 3, 2023

Nice, thanks @ExtremeAddons. Let's bump @spoonless here so the code can get to master.

@spoonless
Copy link
Member

thanks for the fix @Griperis . The bake operator is a real nightmare in Blender.
However, I would like to make it work properly when baking action from NLA strips.
I'm on it...

@Griperis
Copy link
Author

Griperis commented Mar 6, 2023

Hopefuly the code will help you a bit @spoonless. Although can you elaborate on what you mean by

work properly when baking action from NLA strips?

Like having selected NLA strip and clicking the bake buttons it bakes the animation into the NLA strip?

@spoonless
Copy link
Member

spoonless commented Mar 6, 2023

yep but the bake is correct only if your strip starts at frame 1 and you keep the default settings. Which is supposed to be not the case in most situations for a NLA editor.
You can tweak the speed of the animation and even the start frame and the end frame.
That's why I originally used the NLA bake operator to avoid having to deal with all those cases. But as the NLA bake operator becomes so restricted in Blender 3.4, your solution is probably the safest. It is just that I have to provide the necessary code to deal with the most common cases when someone would like to bake animation from the NLA editor.
I didn't take time to read the code of the original NLA bake operator but I suppose it has to deal with that. I just tried to introduce a function to recompute the correct frame number before adding the key in the action. It seems to be good enough at least for a first release.

@Griperis
Copy link
Author

Griperis commented Mar 9, 2023

I think it is possible that with some smart tweak to the code I provided will work also with NLA. In order to fix this issue I actually looked how the nla operator is implemented, and it's just a call with different parameters to the bpy_extras.anim_utils.bake_action_objects. And there weren't that many changes. Maybe there are changes in the NLA itself which I am not aware of, then it won't work. But it indeed seems like a very important use case, that I wasn't aware of.

@Nacreo
Copy link

Nacreo commented Mar 17, 2023

Hey there! Unfortunately I can not get it to work. I ran the code as a script, imported it as a module and addon but it does not solve the problem. After reading rigacar still works in 3.1 I downloaded that version but it still was not working. I then imported a model with a working rig I created back in 2.8 with the same addon and also that wasn't working anymore.. Any ideas?
Thanks in advance!

@Ledjob
Copy link

Ledjob commented Mar 28, 2023

Tried on 3.4 works fine ! thanks

@Alucardrangel
Copy link

hey I'm new to blender and I don't rely know how to use the fix at all so can you show how

@vilestorm
Copy link

hey I'm new to blender and I don't rely know how to use the fix at all so can you show how

Remove the old Rigacar from your blender properties and install his files which have the fix :)

@timtyson3d
Copy link

timtyson3d commented Apr 14, 2023

how exactly am I supposted to transfer his data into my project

@dilmandila
Copy link

How do I install this fix? I tried copying the contents of the file, pasting onto a text document and saving as bake_operators.py to replace in original AddOn, but it is not working when I try to install in Blender 3.5

Might be something a noob is missing....

@Griperis
Copy link
Author

Griperis commented Apr 23, 2023

Sometimes wheel rotation can be baked in the wrong direction, I will test that and also try to fix it. I will provide a .zip file here, so you can download the hotfix, before @spoonless works on the proper fix.

The baking wheel rotation was fixed, and there was an issue with the non-reset transform. This issue was also happening in 3.3, not only 3.4.

Also I have checked and it seems like the NLA strips can be edited, and to my understanding it works the same as in 3.3. Or is there a different expected behaviour @spoonless?

Addon .zip with the version of addon from this MR:
rigacar-bake-operator-fix.zip

By using bpy_extras.anim_utils module directly
there is more control over baking actions, but
the pose transform bone needs to be reset
in order to correctly bake steering. The bone resetting
is neccessary even for Blender 3.3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
9 participants