K3D-jupyter icon indicating copy to clipboard operation
K3D-jupyter copied to clipboard

Controls -> Mode -> Manipulate doesn't work and shows a crash in the console log

Open williamstein opened this issue 2 years ago • 4 comments

Using JupyterLab and the latest Google Chrome, I ran this:

import k3d
from k3d.platonic import Icosahedron
plot = k3d.plot(camera_auto_fit=False)
plot += Icosahedron().mesh
plot.display()

Then in the menu on the right, I selected "Controls -> Mode -> Manipulate ", and nothing appears to happen.

In the console.log, I see this:

Screen Shot 2022-05-07 at 8 45 22 PM

This probably isn't much of a bug to most K3D users, since it is just a silent failure of a presumably undocumented mysterious menu option. I hit this when porting the extension to https://CoCalc.com, where we surface all uncaught exceptions in the console to users, and automate creating a support ticket from them. Thus for me this is a slightly more serious issue.

One fix would be to remove the menu item. The K3D documentation doesn't contain the word "manipulate" once, so the only way for a user to guess even know what this does would be to read the source code...

williamstein avatar May 08 '22 03:05 williamstein

Manipulate is a feature in k3d but probably not well tested - that I didn't put it to documentation. I will look at this.

artur-trzesiok avatar May 16 '22 01:05 artur-trzesiok

I updated TransformControls to recent version from three.js. It is working.

artur-trzesiok avatar May 16 '22 02:05 artur-trzesiok

Please download new version of [email protected]:

  • https://pypi.org/project/k3d/
  • https://anaconda.org/conda-forge/k3d

It should be there :)

artur-trzesiok avatar May 18 '22 03:05 artur-trzesiok

@artur-trzesiok thanks! I can confirm that you've fixed the bug and manipulate now works.

I'm working on integrated k3d directly into cocalc.com so it is available to all of our users. We install the k3d pypi library on our standard backend image and the k3d npmjs.com package on the frontend (it then gets built as a chunk by webpack that is loaded on demand). I updated cocalc to use the newest k3d npm package, and immediately the Manipulate functionality started working.

Regarding architecture, I ended up rewriting the ipywidgets integration part of k3d, mainly because Cocalc has its own implementation of widgets with full realtime collaboration support, as explained here, and I needed to make some small tweaks to ensure everything works (e.g., especially to how serialize works). I've put the relevant code here, along with I hope a clear statement regarding code attribution: https://github.com/sagemathinc/cocalc/tree/master/src/packages/frontend/jupyter/widgets/k3d

williamstein avatar May 18 '22 17:05 williamstein