Nothing Special   »   [go: up one dir, main page]

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

Let OpenGLMobject.copy return a deep copy by default #1733

Merged
merged 5 commits into from
Jul 2, 2021

Conversation

behackl
Copy link
Member
@behackl behackl commented Jun 30, 2021

Changelog / Overview

This adds a keyword shallow to OpenGLMobject.copy that controls whether a shallow or deep copy is returned. By default (and this is a change to the current behavior), a deep copy is returned.

Motivation

Returning a shallow mobject copy by default sometimes causes problems with (method) animations of complex mobjects, like Graph.change_layout (see the comment in #1202 for an example).

Testing Status

Well, this is a problem: given the lack of OpenGL tests, I'm not sure in how far this could degrade rendering speed. From what I've tried locally, I didn't really see a difference in the rendering times, but that's of course no guarantee.

Further Comments

This is just one potential solution to this problem. The more "courageous" way would be to always return a deep copy (as in the case of Mobject.copy and to delete the shallow copy code entirely.

Checklist

  • I have read the Contributing Guidelines
  • I have written a descriptive PR title (see top of PR template for examples)
  • I have written a changelog entry for the PR or deem it unnecessary
  • My new functions/classes either have a docstring or are private
  • My new functions/classes have tests added and (optional) examples in the docs
  • My new documentation builds, looks correctly formatted, and adds no additional build warnings

Reviewer Checklist

  • The PR title is descriptive enough
  • The PR is labeled correctly
  • The changelog entry is completed if necessary
  • Newly added functions/classes either have a docstring or are private
  • Newly added functions/classes have tests added and (optional) examples in the docs
  • Newly added documentation builds, looks correctly formatted, and adds no additional build warnings

@behackl behackl added pr:bugfix Bug fix for use in PRs solving a specific issue:bug enhancement Additions and improvements in general labels Jun 30, 2021
@TRoboto
Copy link
Collaborator
TRoboto commented Jun 30, 2021

Since the regular mobject uses deep copy by default, which all users are familiar with, deep copy should be the default for OpenGL mobject as well. I always use copy, assuming it does deep copy, and then spend most of my time figuring out why nothing renders correctly. Also, animations that generate a target are broken for OpenGL, Transform for example, because they also use ~.copy function.

I have rendered few complicated 2d scenes in the past all of which use ~.deepcopy function more than 20 times and didn't notice any issue or performance degradation.

@behackl
Copy link
Member Author
behackl commented Jul 2, 2021

Let's merge this. If there are serious problems with OpenGL rendering, we can issue a bugfix release where this is reverted.

@behackl behackl enabled auto-merge (squash) July 2, 2021 12:17
@behackl behackl disabled auto-merge July 2, 2021 12:32
@behackl behackl merged commit 1e57ab6 into ManimCommunity:main Jul 2, 2021
@behackl behackl deleted the opengl-mobject-copy branch July 2, 2021 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general pr:bugfix Bug fix for use in PRs solving a specific issue:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants