0

I'd like to dynamically change the color parameters of a cube or sphere, I'm working from the sphere example and trying to set as seen below:

However, what I end up seeing is the parameter I'm setting being removed entirely and not updated.

import sys

from vispy import scene
from vispy.visuals.transforms import STTransform

canvas = scene.SceneCanvas(keys='interactive', bgcolor='white',
                           size=(800, 600), show=True)

view = canvas.central_widget.add_view()
view.camera = 'arcball'

sphere1 = scene.visuals.Sphere(radius=1, method='latitude', parent=view.scene,
                               edge_color='black')

sphere2 = scene.visuals.Sphere(radius=1, method='ico', parent=view.scene,
                               edge_color='black')

sphere3 = scene.visuals.Sphere(radius=1, rows=10, cols=10, depth=10,
                               method='cube', parent=view.scene,
                               edge_color='black')

sphere1.transform = STTransform(translate=[-2.5, 0, 0])
sphere3.transform = STTransform(translate=[2.5, 0, 0])

sphere3.mesh.set_data(vertex_colors='yellow')
sphere2.border.set_data(face_colors='r')

view.camera.set_range(x=[-3, 3])

if __name__ == '__main__' and sys.flags.interactive == 0:
    canvas.app.run()

enter image description here

Progman
  • 16,827
  • 6
  • 33
  • 48
  • Do you think you could file a bug report on the [VisPy github](https://github.com/vispy/vispy/issues)? This seems to be a bug or at least an inconvenient implementation. When calling `set_data` without a `meshdata` object it overwrites the previous mesh information (see https://github.com/vispy/vispy/blob/c52c48194c0af60ce97ac844eb87a54f8434988c/vispy/visuals/mesh.py#L155-L187) instead of updating the existing information. – djhoese Nov 28 '22 at 16:07

0 Answers0