19
19
from math import pi , sqrt
20
20
from .traits_numpy import array_serialization , shape_constraints
21
21
from traittypes import Array
22
+ import numpy as np
22
23
23
24
def vector3 (trait_type = CFloat , default = None , ** kwargs ):
24
25
if default is None :
@@ -274,7 +275,7 @@ class PlainGeometry(Geometry):
274
275
vertices = Array (dtype = 'float32' ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
275
276
faces = Array (dtype = 'uint32' ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
276
277
# list of [[v1_r,v1_g,v1_b], [v2_r,v2_g,v2_b], [v3_r,v3_g,v3_b]] for each face
277
- faceColors = Array (dtype = 'float32' ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None , 3 , 3 ))
278
+ faceColors = Array (dtype = 'float32' , default_value = np . empty ( shape = ( 0 , 3 , 3 ), dtype = 'float32' ) ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None , 3 , 3 ))
278
279
#vertices = List(vector3(CFloat)).tag(sync=True)
279
280
colors = List (Color ).tag (sync = True )
280
281
#faces = List(List(CFloat)).tag(sync=True)
@@ -290,7 +291,7 @@ class PlainBufferGeometry(Geometry):
290
291
291
292
vertices = Array (dtype = 'float32' ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
292
293
faces = Array (dtype = 'uint32' ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
293
- colors = Array (dtype = 'float32' , help = "Vertex colors" ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
294
+ colors = Array (dtype = 'float32' , default_value = np . empty ( shape = ( 0 , 3 ), dtype = 'float32' ), help = "Vertex colors" ).tag (sync = True , ** array_serialization ).valid (shape_constraints (None ,3 ))
294
295
295
296
class SphereGeometry (Geometry ):
296
297
_view_name = Unicode ('SphereGeometryView' ).tag (sync = True )
0 commit comments