Set z_index of graph edges to default value
#3132
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview: What does this pull request change?
Set
z_indexof graph edges to default valueExplanation:
I implemented two changes, both solve this problem independently.
Before
AlphaScene.mp4
After
AlphaScene.mp4
Change 1
I tried to run the above code, but it showed nothing, like
self.wait(). Trying to debug, I discovered that this broke in 69666f7 in #2594. The graph edges were set to be static mobjects insidebegin_animations()inscene.py. I reverted the change, and shifted the piece of code which adds anim mobjects to sceneanimation._setup_scene(self)after the static and moving mobjects were detected, (because current animations will only have moving objects?). This worked. I think change 2 below is better but I still included this.Change 2
But then why were static/moving mobjects not detected properly? I found that
get_moving_mobjects()inscene.pygoes through all mobjects, sorted byz_index. As soon as there's one that needs updating of some kind per frame, return the list from that point forward. The problem is that by default objects (means includingGroup) havez_index=0but graph edges setz_index=-1. That means my mobjects list is something like,[Line, Line, ... Line, Group, other_mobs](sorted by z_index) whereLineare edges andGroupis introduced byLaggedStart. So everything including and after Group is set to moving as it is inanimation_mobjects, but not the lines of course. So they don't update.To fix this, I removed
z_index=-1from graph edges config and addedz_index=1in vertex config.Links to added or changed documentation pages
Reviewer Checklist