jupyter-widgets-contrib / ipygany

3-D Scientific Visualization in the Jupyter Notebook
BSD 3-Clause "New" or "Revised" License
487 stars 53 forks source link

Hide Mesh #97

Open akaszynski opened 3 years ago

akaszynski commented 3 years ago

Great work with this module!

Is there any way of toggling the visibility of a mesh? I'm trying to incorporate this with ipytree, but there's no callback or trait that lets me toggle the global visibility of a mesh. Is this a low hanging PR?

martinRenou commented 3 years ago

Thanks for the kind words!

I'm trying to incorporate this with ipytree

I originally created ipytree with this exact purpose in mind!

but there's no callback or trait that lets me toggle the global visibility of a mesh. Is this a low hanging PR?

It's unfortunately not possible as of today. And it requires changes in https://github.com/QuantStack/GanyJS. It would need adding a setter for visible just like for the defaultColor in here: https://github.com/QuantStack/GanyJS/blob/master/src/Block.ts#L192 (this requires adding a setter for visible in this class as well that does this.mesh.visible = visibility).

Then we need to update ipygany to expose the visible trait to Python.