-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Description of bug / unexpected behavior
I'm trying to animate a 3D matrix transformation with OpenGl running into error. However, when I run the same code with cairo it works.
How to reproduce the issue
Code for reproducing the problem
class Test(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
plane1 = Surface(
lambda u, v: np.array([
u,
v,
v
]), u_range=[-1, 1], v_range=[-1, 1],
checkerboard_colors=[RED_D, RED_E], resolution=(15, 32)
)
self.renderer.camera.light_source.move_to(3*IN) # changes the source of the light
self.set_camera_orientation(phi=75 * DEGREES, theta=40 * DEGREES)
self.add(axes, plane1)
self.begin_ambient_camera_rotation()
self.wait(2)
rotation_matrix = [[1, 0, 0],
[0, np.cos(np.pi/2), np.sin(np.pi/2)],
[0, -np.sin(np.pi/2), np.cos(np.pi/2)]]
self.play(plane1.animate.apply_matrix(rotation_matrix))
self.wait(10)
self.stop_ambient_camera_rotation()Expected result
Logs
Terminal output
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/ray/Dev/manim/manim/cli/render/commands.py:103 in render │
│ │
│ 100 │ │ │ │ for SceneClass in scene_classes_from_file(file): │
│ 101 │ │ │ │ │ with tempconfig({}): │
│ 102 │ │ │ │ │ │ scene = SceneClass(renderer) │
│ ❱ 103 │ │ │ │ │ │ rerun = scene.render() │
│ 104 │ │ │ │ │ if rerun or config["write_all"]: │
│ 105 │ │ │ │ │ │ renderer.num_plays = 0 │
│ 106 │ │ │ │ │ │ continue │
│ │
│ /home/ray/Dev/manim/manim/scene/scene.py:222 in render │
│ │
│ 219 │ │ """ │
│ 220 │ │ self.setup() │
│ 221 │ │ try: │
│ ❱ 222 │ │ │ self.construct() │
│ 223 │ │ except EndSceneEarlyException: │
│ 224 │ │ │ pass │
│ 225 │ │ except RerunSceneException as e: │
│ │
│ /home/ray/Dev/manim/example_scenes/basic.py:36 in construct │
│ │
│ 33 │ │ rotation_matrix = [[1, 0, 0], │
│ 34 │ │ │ │ │ │ [0, np.cos(np.pi/2), np.sin(np.pi/2)], │
│ 35 │ │ │ │ │ │ [0, -np.sin(np.pi/2), np.cos(np.pi/2)]] │
│ ❱ 36 │ │ self.play(plane1.animate.apply_matrix(rotation_matrix)) │
│ 37 │ │ self.wait(1) │
│ 38 │ │ self.stop_ambient_camera_rotation() │
│ 39 │
│ │
│ /home/ray/Dev/manim/manim/scene/scene.py:1030 in play │
│ │
│ 1027 │ │ │ return │
│ 1028 │ │ │
│ 1029 │ │ start_time = self.renderer.time │
│ ❱ 1030 │ │ self.renderer.play(self, *args, **kwargs) │
│ 1031 │ │ run_time = self.renderer.time - start_time │
│ 1032 │ │ if subcaption: │
│ 1033 │ │ │ if subcaption_duration is None: │
│ │
│ /home/ray/Dev/manim/manim/utils/caching.py:63 in wrapper │
│ │
│ 60 │ │ │ "List of the first few animation hashes of the scene: %(h)s", │
│ 61 │ │ │ {"h": str(self.animations_hashes[:5])}, │
│ 62 │ │ ) │
│ ❱ 63 │ │ func(self, scene, *args, **kwargs) │
│ 64 │ │
│ 65 │ return wrapper │
│ 66 │
│ │
│ /home/ray/Dev/manim/manim/renderer/opengl_renderer.py:430 in play │
│ │
│ 427 │ │ self.file_writer.begin_animation(not self.skip_animations) │
│ 428 │ │ │
│ 429 │ │ scene.compile_animation_data(*args, **kwargs) │
│ ❱ 430 │ │ scene.begin_animations() │
│ 431 │ │ if scene.is_current_animation_frozen_frame(): │
│ 432 │ │ │ self.update_frame(scene) │
│ 433 │
│ │
│ /home/ray/Dev/manim/manim/scene/scene.py:1157 in begin_animations │
│ │
│ 1154 │ │ """Start the animations of the scene.""" │
│ 1155 │ │ for animation in self.animations: │
│ 1156 │ │ │ animation._setup_scene(self) │
│ ❱ 1157 │ │ │ animation.begin() │
│ 1158 │ │ │
│ 1159 │ │ if config.renderer != "opengl": │
│ 1160 │ │ │ # Paint all non-moving objects onto the screen, so they don't │
│ │
│ /home/ray/Dev/manim/manim/animation/transform.py:195 in begin │
│ │
│ 192 │ │ # Note, this potentially changes the structure │
│ 193 │ │ # of both mobject and target_mobject │
│ 194 │ │ if config["renderer"] == "opengl": │
│ ❱ 195 │ │ │ self.mobject.align_data_and_family(self.target_copy) │
│ 196 │ │ else: │
│ 197 │ │ │ self.mobject.align_data(self.target_copy) │
│ 198 │ │ super().begin() │
│ │
│ /home/ray/Dev/manim/manim/mobject/opengl/opengl_mobject.py:2288 in align_data_and_family │
│ │
│ 2285 │ │
│ 2286 │ def align_data_and_family(self, mobject): │
│ 2287 │ │ self.align_family(mobject) │
│ ❱ 2288 │ │ self.align_data(mobject) │
│ 2289 │ │
│ 2290 │ def align_data(self, mobject): │
│ 2291 │ │ # In case any data arrays get resized when aligned to shader data │
│ │
│ /home/ray/Dev/manim/manim/mobject/opengl/opengl_mobject.py:2302 in align_data │
│ │
│ 2299 │ │ │ │ │ continue │
│ 2300 │ │ │ │ arr1 = mob1.data[key] │
│ 2301 │ │ │ │ arr2 = mob2.data[key] │
│ ❱ 2302 │ │ │ │ if len(arr2) > len(arr1): │
│ 2303 │ │ │ │ │ mob1.data[key] = resize_preserving_order(arr1, len(arr2)) │
│ 2304 │ │ │ │ elif len(arr1) > len(arr2): │
│ 2305 │ │ │ │ │ mob2.data[key] = resize_preserving_order(arr2, len(arr1)) │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: object of type 'float' has no len()
Metadata
Metadata
Assignees
Labels
No labels
