Skip to content

fix: animations process correctly with 3d object with opengl as renderer #4316

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,15 @@ def align_data(self, mobject: OpenGLMobject) -> Self:
for key in mob1.data.keys() & mob2.data.keys():
if key == "points":
continue

# here we fixe the case when some transform function make the whole thing crashes
# it appears that in some cases a float or int is processed as an array so here change it with an ndarray of a single number
# that make the whole thing process correctly
if type(mob1.data[key]) == float or type(mob1.data[key]) == int:
mob1.data[key] = np.array([mob1.data[key]])
if type(mob2.data[key]) == float or type(mob2.data[key]) == int:
mob2.data[key] = np.array([mob2.data[key]])

arr1 = mob1.data[key]
arr2 = mob2.data[key]
if len(arr2) > len(arr1):
Expand Down