@@ -43,12 +43,13 @@ def __add__(self, other):
4343 raise ValueError ('The objects being added are not both GanjaScenes...' )
4444
4545 def add_object (self , mv_array , color = 0xAA000000 , label = None , static = False ):
46- self .mv_length = len (mv_array )
46+ mv_list = _as_list (mv_array )
47+ self .mv_length = len (mv_list )
4748 self .internal_list .append (_color .as_hex (color ))
4849 if static :
49- self .internal_list .append ({'data' : [_as_list ( mv_array ) ]})
50+ self .internal_list .append ({'data' : [mv_list ]})
5051 else :
51- self .internal_list .append (_as_list ( mv_array ) )
52+ self .internal_list .append (mv_list )
5253 if label is not None :
5354 try :
5455 assert isinstance (label , str )
@@ -58,10 +59,11 @@ def add_object(self, mv_array, color=0xAA000000, label=None, static=False):
5859
5960 def add_facet (self , mv_list , color = 0xAA000000 , label = None , static = False ):
6061 self .internal_list .append (_color .as_hex (color ))
61- self .mv_length = len (mv_list [0 ])
6262 facet_list = []
6363 for mv_array in mv_list :
64- facet_list .append (_as_list (mv_array ))
64+ mv_list = _as_list (mv_array )
65+ facet_list .append (mv_list )
66+ self .mv_length = len (mv_list )
6567 if static :
6668 self .internal_list .append ({'data' : [facet_list ]})
6769 else :
@@ -73,25 +75,26 @@ def add_facet(self, mv_list, color=0xAA000000, label=None, static=False):
7375 except :
7476 raise ValueError ('Labels must be strings' )
7577
76- def add_facets (self , mv_list , color = 0xAA000000 , label = None , static = False ):
77- for mv_array in mv_list :
78- self .add_facet (mv_array ,color = color , label = label , static = static )
78+ def add_facets (self , mv_vertex_list , color = 0xAA000000 , label = None , static = False ):
79+ for mv_array in mv_vertex_list :
80+ self .add_facet (mv_array , color = color , label = label , static = static )
7981 if label is not None :
8082 try :
8183 assert isinstance (label , str )
8284 self .internal_list .append (label )
8385 except :
8486 raise ValueError ('Labels must be strings' )
8587
86- def add_objects (self , mv_list , color = 0xAA000000 , label = None , static = False ):
88+ def add_objects (self , mv_object_list , color = 0xAA000000 , label = None , static = False ):
8789 self .internal_list .append (_color .as_hex (color ))
8890 static_list = []
89- self .mv_length = len (mv_list [0 ])
90- for mv_array in mv_list :
91+ for mv_array in mv_object_list :
92+ mv_list = _as_list (mv_array )
93+ self .mv_length = len (mv_list )
9194 if static :
92- static_list .append (_as_list ( mv_array ) )
95+ static_list .append (mv_list )
9396 else :
94- self .internal_list .append (_as_list ( mv_array ) )
97+ self .internal_list .append (mv_list )
9598 if static :
9699 self .internal_list .append ({'data' : static_list })
97100 if label is not None :
0 commit comments