polyscope-py icon indicating copy to clipboard operation
polyscope-py copied to clipboard

Add still-alive checks for structures

Open nmwsharp opened this issue 4 years ago • 0 comments

Right now the following code results in segfault:

import polyscope as ps
import numpy as np
ps.init()
cloud = ps.register_point_cloud("my cloud", np.random.rand(100,3))
ps.remove_point_cloud("my cloud")
cloud.add_scalar_quantity("my scalar", np.random.rand(100)) # boom!

(the same applies for all structures/quantities)

The solution is that add_scalar_quantity() should first check if the underlying point cloud still exists, and if not throw an informative Python error. There are a couple possible ways to implement this; we could check by name, or just set some flag in the python point cloud handle object.

nmwsharp avatar Dec 10 '21 22:12 nmwsharp