Skip to content

Simplify 3d axes callback setup. - #15855

Merged
timhoffm merged 1 commit into
matplotlib:masterfrom
anntzer:3dcb
Mar 9, 2020
Merged

timhoffm merged 1 commit into
matplotlib:masterfrom
anntzer:3dcb

Conversation

@anntzer

@anntzer anntzer commented Dec 7, 2019

Copy link
Copy Markdown
Contributor

Always setup the 3d mouse rotate/zoom callbacks and don't store their
cids; instead, handle their disconnection by disabling all mouse buttons
(which has the same observable effect).

This is in preparation of restoring the pan/zoom callbacks upon
unpickling (#10843): after a pickle/unpickle cycle, even if we restore the
callbacks, we can't guarantee that the callback numeric ids will stay
the same, and so self._cids would become incorrect.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@WeatherGod

Copy link
Copy Markdown
Member

I am a little uneasy about this change. How does the regular 2d axes object handle this stuff? I am also realizing that it was possible to accidentally connect multiple sets of the same callbacks through repeated calls, which is technically "fixed" by this..

@anntzer

anntzer commented Dec 7, 2019

Copy link
Copy Markdown
Contributor Author

2d axes don't generate their own callbacks (they are completely ignorant of the callback system), they are set up by the canvas (more specifically, by the toolbar) and attached to the canvas object.
When unpickling, the figure is attached to a new canvas who may or may not have a toolbar, which again is in charge of the callbacks.

@timhoffm

timhoffm commented Mar 9, 2020

Copy link
Copy Markdown
Member

Please rebase so that Travis can run.

Always setup the 3d mouse rotate/zoom callbacks and don't store their
cids; instead, handle their disconnection by disabling all mouse buttons
(which has the same observable effect).

This is in preparation of restoring the pan/zoom callbacks upon
unpickling: after a pickle/unpickle cycle, even if we restore the
callbacks, we can't guarantee that the callback numeric ids will stay
the same, and so self._cids would become incorrect.
@anntzer

anntzer commented Mar 9, 2020

Copy link
Copy Markdown
Contributor Author

done

@timhoffm timhoffm added this to the v3.3.0 milestone Mar 9, 2020
@timhoffm
timhoffm merged commit 2938c6f into matplotlib:master Mar 9, 2020
@anntzer
anntzer deleted the 3dcb branch March 9, 2020 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants