Skip to content

force evaluate animation system, fix #10 - #11

Merged
digitalillusions merged 2 commits into
InteractiveComputerGraphics:mainfrom
losanc:main
Mar 7, 2023
Merged

digitalillusions merged 2 commits into
InteractiveComputerGraphics:mainfrom
losanc:main

Conversation

@losanc

@losanc losanc commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@digitalillusions

Copy link
Copy Markdown
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

losanc commented Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

@losanc

losanc commented Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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

@losanc

losanc commented Feb 23, 2023

Copy link
Copy Markdown
Contributor Author

ok. will do it later

@digitalillusions

Copy link
Copy Markdown
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