Closed KelSolaar closed 5 years ago
For the rotation, I would recommend you rotate the objects, not the geometries. I.e. rotate the Mesh
and Line
and LineSegments
. That only changes the transform matrix of the objects, not the underlying vertices, and should therefore be simpler.
It's harder to determine why the vertex colors are not retained properly. I'll run some smaller tests here.
There does also seem to be an issue with pythreejs where it doesn't recognize the need to sync back the updated vertices array of the geometry. I'll look further into that.
There does also seem to be an issue with pythreejs where it doesn't recognize the need to sync back the updated vertices array of the geometry. I'll look further into that.
wouldn't be surprised if that is an underscore issue (_.eq) with typed arrays, it doesn't detect changes (or was is that it always thinks it is different
I do have a similar problem. When I do rotate the objects not the meshes, this rotation is not embedded in the widget state. I attached a minimal (non-)working notebook with two ellipsis and one tube connecting the two positions. Everything looks fine in the live notebook, but not when opening it up again or exporting the notebook state. It would be really awesome to have this for rotatable 3d (molecular) models in a reveal.js exported presentation.
Sorry for this taking a while, but I have now submitted a fix in #226. The different orientation properties (rotation, quaternion and matrix) were interfering with each other.
The vertex color issue is also solved in the same PR: it was an issue with how the faces of Geometry
was serialized. In general though, I would recommend to switch to use BufferGeometry
over Geometry
though. It should be more performant in almost all aspects.
Hi,
It seems like the widget state might not be fully saved. Taking the following notebook which requires latest Colour develop branch: https://nbviewer.jupyter.org/github/colour-science/colour-ramblings/blob/master/pythreejs_ramblings.ipynb
This is how it looks in the live notebook:![image](https://user-images.githubusercontent.com/99779/42729882-c613fd1c-883a-11e8-8e3f-1327e7558d24.png)
And this is once the state is saved and viewed with NBViewer:![image](https://user-images.githubusercontent.com/99779/42729891-23141592-883b-11e8-9fbe-fb0144f83b22.png)
It seems like some of the vertex colours or a related attribute is not saved and the rotations are not preserved.
Cheers,
Thomas