manim icon indicating copy to clipboard operation
manim copied to clipboard

Porting Typing and new functionality from 3b1b/manim

Open MrDiver opened this issue 2 years ago • 1 comments

Overview: What does this pull request change?

This pull requests ports all the new changes from 3b1b/manim and adds type hints to OpenGLMobject and OpenGLVmobject

Current annotations and state is pushed in https://github.com/MrDiver/manimlib Every method commented with #DONE is already in this PR

TODO:

  • find out the difference between manimgl arrange_in_grid and our version

changelog

OpenGLMobject

Additions: init_constructor, __add__, __mul__, are_points_touching, is_touching, apply_over_attr_arrays, get_ancestors, insert_submobject, set_submobject, set_rgba_array, set_color_by_rgba_func, set_color_by_rgb_func, set_rgba_array_by_color, arrange_to_fit_dim, replicate Renamed: set_rgba_array -> set_rgba_array_by_color (added new set_rgba_array) set_rgba_array_direct -> set_rgba_array

Removed/Depcrecated: set_rgba_array_direct

Changes:

  • self.uniform.fixed_orientation_center is now a np.ndarray
  • __init__:
    • Now holds all initial self.x = x assignments and the rest of the constructor which is useful to see is now in init_constructor
  • set_points:
    • Uses asarray instead of array to not unnecessarily copy arrays when not needed.
  • add_updater:
    • now uses self.update(dt=0)
  • set_color:
    • now uses set_rgba_array_by_color instead of setting color directly
  • set_opacity:
    • now uses set_rgba_array_by_color
  • interpolate:
    • now treats all uniforms equally
  • fix_orientation:
    • creates a np.ndarray to set fixed_orientation_center instead of tuple

Temporary changes:

  • check_data_alignment:
    • Does not directly work on self.data instead returns the new result directly to be used in get_resized_shader_data_array

OpenGLVmobject

Additions:

  • @property:stroke_opacity, _stroke_opacity, @property:stroke_width, _stroke_width

Removed/Deprecated

Changes:

Temporary changes:


Shader

Additions:

Removed/Deprecated

Changes:

  • set_uniform:
    • now converts np.ndarray to tuple for easier outside usage to only need to convert on the last step when creating uniforms

Temporary changes:


Color

Additions:

Removed/Deprecated

Changes:

  • rgb_to_hex:
    • always returns Uppercase version of Hex string for uniformity

Temporary changes:


Motivation and Explanation: Why and how do your changes improve the library?

Links to added or changed documentation pages

Further Information and Comments

Reviewer Checklist

  • [ ] The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • [ ] If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • [ ] If applicable: newly added functions and classes are tested

MrDiver avatar May 28 '22 15:05 MrDiver

Depends on

  • #2837 after that we can continue with deepcopy and serialization

MrDiver avatar Jun 18 '22 20:06 MrDiver

#3107 Will be continued here

MrDiver avatar Jan 03 '23 11:01 MrDiver