collada.source.FloatSource¶
-
class
collada.source.FloatSource(id, data, components, xmlnode=None)¶ Bases:
collada.source.SourceContains a source array of floats, as defined in the collada <float_array> inside a <source>.
If
fis an instance ofcollada.source.FloatSource, thenlen(f)is the length of the shaped source.len(f)*len(f.components)would give you the number of values in the source.f[i]is the ith item in the source array.
-
__init__(id, data, components, xmlnode=None)¶ Create a float source instance.
Parameters: - id (str) – A unique string identifier for the source
- data (numpy.array) – Numpy array (unshaped) with the source values
- components (tuple) – Tuple of strings describing the semantic of the data,
e.g.
('X','Y','Z')would causedatato be reshaped as(-1, 3) - xmlnode – When loaded, the xmlnode it comes from.
Methods
__init__(id, data, components[, xmlnode])Create a float source instance. load(collada, localscope, node)Load and return a class instance from an XML node. save()Saves the source back to xmlnode-
id= None¶ The unique string identifier for the source
-
data= None¶ Numpy array with the source values. This will be shaped as
(-1,N)whereN = len(self.components)
-
components= None¶ Tuple of strings describing the semantic of the data, e.g.
('X','Y','Z')
-
xmlnode= None¶ ElementTree representation of the source.
-
static
load(collada, localscope, node)¶ Load and return a class instance from an XML node.
Inspect the data inside node, which must match this class tag and create an instance out of it.
Parameters: - collada (collada.Collada) – The collada file object where this object lives
- localscope (dict) – If there is a local scope where we should look for local ids (sid) this is the dictionary. Otherwise empty dict ({})
- node – An Element from python’s ElementTree API
-