Skip to content

animation fixes #4995

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

Merged
merged 8 commits into from
Sep 1, 2015
Merged

animation fixes #4995

merged 8 commits into from
Sep 1, 2015

Conversation

tacaswell
Copy link
Member

Using draw was triggering infinite recursion, using draw_idle does not.

This fixes the recursion depth reported in #4967

attn @WeatherGod

Using draw was triggering infinite recursion, using draw_idle does not.
This was introduced by matplotlib#4800. We need to disconnect the initial draw
callback in _start() before doing _init_draw(), otherwise, we end up
back in _start() when the draw_event fires.

Also go ahead and remove the call to _init_draw() in __init__(), since
_start() will handle it.
@tacaswell
Copy link
Member Author

I also cherry-picked @dopplershift 's infinite recursion commit onto this PR just to be safe.

For blitted animations in is essential to return a list of the animated
artists.  However, is other cases you can get away with out returning
such a list.

In the case of blitting it is important to make sure that the animation
flags on the animated artist are set correctly, t his commit makes sure
that we check that we actually got an iterable before trying to iterate
over it.
There are race conditions where _blit_clear may be called before
the first draw (which is what will grab the backgrounds)
@tacaswell tacaswell changed the title FIX: use draw_idle instead of draw animation fixes Aug 27, 2015
@tacaswell tacaswell added this to the next point release milestone Aug 27, 2015
@tacaswell
Copy link
Member Author

@WeatherGod I think I have fixed the source of the not iterable bugs. All of the animation examples run correctly on this branch.

@WeatherGod
Copy link
Member

And all of my examples now run too. There is one example of mine that is still showing a weird off-by-one-frame error, but I haven't yet determined if that is a bug on my part or a bug in matplotlib. This brings everything back to a functional state.

try:
a.figure.canvas.restore_region(bg_cache[a])
except KeyError:
# something has happened out of order?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really want to be swallowing this exception silently? Should we at least attach one of our logging stuff to it?

Only attempt to force `set_animated(True)` when blitting is
enabled.
@tacaswell
Copy link
Member Author

@WeatherGod I backed out the changes you commented on.

I am still not happy with the iterable issue. The underlying issue is that if you are using blitting then the animated artists must have art.animated == True or you will get the auto-redraw draw_idle calls causing full re-draws (which is a problem).

@tacaswell
Copy link
Member Author

@WeatherGod What is the history of the animated property?

@mdehoon
Copy link
Contributor

mdehoon commented Aug 28, 2015

Without blitting, the _post_draw method uses draw_idle; with blitting, _post_draw calls _blit_draw, which calls ax.figure.canvas.blit. This is odd; I would expect blitting to be done at idle time, just like regular drawing.

@tacaswell
Copy link
Member Author

@mdehoon I agree that is a bit odd, but I think it has to be this way so that the client code can manage the blitted artists + backgrounds.

I agree it would be better if we could push the blitting logic onto the other side of the canvas interface, but that is a bigger project that we can do before 1.5.

@WeatherGod
Copy link
Member

You'd have to ask others. It predates me.
On Aug 27, 2015 11:49 PM, "Thomas A Caswell" notifications@github.com
wrote:

@WeatherGod https://github.com/WeatherGod What is the history of the
animated property?


Reply to this email directly or view it on GitHub
#4995 (comment)
.

@mdehoon
Copy link
Contributor

mdehoon commented Aug 29, 2015

@tacaswell Once the blitting is done on the other side of the canvas interface, I can fix the MacOSX backend to handle blitting. I'm OK with waiting until after 1.5.

@tacaswell
Copy link
Member Author

@WeatherGod If you are happy with this can you merge it?

@WeatherGod
Copy link
Member

Things look good here. Merging...

WeatherGod added a commit that referenced this pull request Sep 1, 2015
@WeatherGod WeatherGod merged commit 78bb82c into matplotlib:master Sep 1, 2015
@tacaswell tacaswell deleted the fix_animation branch October 29, 2015 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants