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

force evaluate animation system, fix #10 #11

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

losanc
Copy link
Contributor

@losanc losanc commented Feb 22, 2023

No description provided.

@digitalillusions
Copy link
Member

This looks good, but is it really necessary to set the rotation in this way? Seems like its a bit redundant to set quaternion, euler AND axis angle, no?

@losanc
Copy link
Contributor Author

losanc commented Feb 23, 2023

because blender only use object with one rotation mode, (in obj.rotation_mode setting). Then for example, if the object is set to rotation_quaterion, then you insert the key frames with rotation. Now you should be able to play the animation, but if you change the animation mode to rotation_euler, (without changing anything else with keyframes) the animation system won't work, unless you switch back to rotation_quaternion.
So, it feels like it's 3 independent system to rotate the object.

Also, for example, if I only update rotation_quaterion in the code, but the animation is set to rotate with rotation_euler, then rotation_euler is actually not updated, then blender won't rotate the object

@digitalillusions
Copy link
Member

wouldnt the cleaner solution then be to only set the correct rotation based on rotation mode?

@losanc
Copy link
Contributor Author

losanc commented Feb 23, 2023

do you mean something like this?

if obj.rotation_mode == "EULER":
    obj.rotation_euler = obj.evaluated_get(depsgraph).rotation_euler
if obj.rotation_mode == "QUATERNION":
    obj.rotation_quaternion = obj.evaluated_get(depsgraph).rotation_quaternion
if obj.rotation_mode == "AXIS_ANGLE":
    obj.rotatino_axis = obj.evaluated_get(depsgraph).rotation_axis

@digitalillusions
Copy link
Member

yes, but make it an elif. you could even use the match case syntax introduced in python 3.10.

@losanc
Copy link
Contributor Author

losanc commented Feb 23, 2023

ok. will do it later

@digitalillusions
Copy link
Member

thanks, i will merge this as it is for now but will probably make some adjustments later

@digitalillusions digitalillusions merged commit 0351964 into InteractiveComputerGraphics:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants