You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a mesh is passed to the Picker, it is legitimate for there to be no uv specified. (and saves a lot of memory). In this case it was created using an array of vertices and faces.
pickable_objects = self.drawable.mesh
picker = three.Picker(controlling=pickable_objects, event='click')
This case seems to cause the front end to return a uv array filled with [None,None]
However the uv is stored in a Vector2 which has a trait of Cfloat, which does not allow None.
So it generates a Picker traiterror (which is difficult to interpret)
Maybe this could be fixed by detecting no uv specified and not trying to create the Vector2. There seems to be a lot of places where this is done, and I am not sure which one is causing the problem. In some of the cases some checks are made to see if uv is specified or not, but not in most of the cases.
If traits.py has a one line change then this error can be avoided (might not be the best solution):
change:
trait = CFloat()
to:
trait = CFloat(allow_none=True)
as in the following:
class Vector2(Tuple):
"""A trait for a 2-tuple corresponding to a three.js Vector2.
"""
default_value = (0, 0)
info_text = 'a two-element vector'
def __init__(self, trait=Undefined, default_value=Undefined, **kwargs):
if trait is Undefined:
trait = CFloat(allow_none=True)
if default_value is Undefined:
default_value = self.default_value
else:
self.default_value = default_value
super(Vector2, self).__init__(*(trait, trait), default_value=default_value, **kwargs)
The text was updated successfully, but these errors were encountered:
When a mesh is passed to the Picker, it is legitimate for there to be no uv specified. (and saves a lot of memory). In this case it was created using an array of vertices and faces.
pickable_objects = self.drawable.mesh
picker = three.Picker(controlling=pickable_objects, event='click')
This case seems to cause the front end to return a uv array filled with [None,None]
However the uv is stored in a Vector2 which has a trait of Cfloat, which does not allow None.
So it generates a Picker traiterror (which is difficult to interpret)
Maybe this could be fixed by detecting no uv specified and not trying to create the Vector2. There seems to be a lot of places where this is done, and I am not sure which one is causing the problem. In some of the cases some checks are made to see if uv is specified or not, but not in most of the cases.
If traits.py has a one line change then this error can be avoided (might not be the best solution):
change:
trait = CFloat()
to:
trait = CFloat(allow_none=True)
as in the following:
class Vector2(Tuple):
"""A trait for a 2-tuple corresponding to a three.js Vector2.
"""
The text was updated successfully, but these errors were encountered: