collada.primitive.Primitive¶
-
class
collada.primitive.
Primitive
¶ Bases:
collada.common.DaeObject
Base class for all primitive sets like TriangleSet, LineSet, Polylist, etc.
digraph inheritanced10274bdba { rankdir=LR; size="8.0, 12.0"; "DaeObject" [URL="collada.common.DaeObject.html#collada.common.DaeObject",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="This class is the abstract interface to all collada objects."]; "LineSet" [URL="collada.lineset.LineSet.html#collada.lineset.LineSet",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Class containing the data COLLADA puts in a <lines> tag, a collection of"]; "Primitive" -> "LineSet" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Polygons" [URL="collada.polygons.Polygons.html#collada.polygons.Polygons",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Class containing the data COLLADA puts in a <polygons> tag, a collection of"]; "Polylist" -> "Polygons" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Polylist" [URL="collada.polylist.Polylist.html#collada.polylist.Polylist",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Class containing the data COLLADA puts in a <polylist> tag, a collection of"]; "Primitive" -> "Polylist" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Primitive" [URL="#collada.primitive.Primitive",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Base class for all primitive sets like TriangleSet, LineSet, Polylist, etc."]; "DaeObject" -> "Primitive" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TriangleSet" [URL="collada.triangleset.TriangleSet.html#collada.triangleset.TriangleSet",fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5)",target="_top",tooltip="Class containing the data COLLADA puts in a <triangles> tag, a collection of"]; "Primitive" -> "TriangleSet" [arrowsize=0.5,style="setlinewidth(0.5)"]; }-
__init__
()¶ x.__init__(…) initializes x; see help(type(x)) for signature
Methods
bind
(matrix, materialnodebysymbol)Binds this primitive to a transform matrix and material mapping. load
(localscope, node)Load and return a class instance from an XML node. save
()Put all the data to the internal xml node (xmlnode) so it can be serialized. Attributes
normal
Read-only numpy.array of size Nx3 where N is the number of normal values in the primitive’s normal source array. normal_index
Read-only numpy.array of size Nx3 where N is the number of vertices in the primitive. texcoord_indexset
Read-only tuple of texture coordinate index arrays. texcoordset
Read-only tuple of texture coordinate arrays. vertex
Read-only numpy.array of size Nx3 where N is the number of vertex points in the primitive’s vertex source array. vertex_index
Read-only numpy.array of size Nx3 where N is the number of vertices in the primitive. -
vertex
¶ Read-only numpy.array of size Nx3 where N is the number of vertex points in the primitive’s vertex source array.
-
normal
¶ Read-only numpy.array of size Nx3 where N is the number of normal values in the primitive’s normal source array.
-
texcoordset
¶ Read-only tuple of texture coordinate arrays. Each value is a numpy.array of size Nx2 where N is the number of texture coordinates in the primitive’s source array.
-
textangentset
¶ Read-only tuple of texture tangent arrays. Each value is a numpy.array of size Nx3 where N is the number of texture tangents in the primitive’s source array.
-
texbinormalset
¶ Read-only tuple of texture binormal arrays. Each value is a numpy.array of size Nx3 where N is the number of texture binormals in the primitive’s source array.
-
vertex_index
¶ Read-only numpy.array of size Nx3 where N is the number of vertices in the primitive. To get the actual vertex points, one can use this array to select into the vertex array, e.g.
vertex[vertex_index]
.
-
normal_index
¶ Read-only numpy.array of size Nx3 where N is the number of vertices in the primitive. To get the actual normal values, one can use this array to select into the normals array, e.g.
normal[normal_index]
.
-
texcoord_indexset
¶ Read-only tuple of texture coordinate index arrays. Each value is a numpy.array of size Nx2 where N is the number of vertices in the primitive. To get the actual texture coordinates, one can use the array to select into the texcoordset array, e.g.
texcoordset[0][texcoord_indexset[0]]
would select the first set of texture coordinates.
-
textangent_indexset
¶ Read-only tuple of texture tangent index arrays. Each value is a numpy.array of size Nx3 where N is the number of vertices in the primitive. To get the actual texture tangents, one can use the array to select into the textangentset array, e.g.
textangentset[0][textangent_indexset[0]]
would select the first set of texture tangents.
-
texbinormal_indexset
¶ Read-only tuple of texture binormal index arrays. Each value is a numpy.array of size Nx3 where N is the number of vertices in the primitive. To get the actual texture binormals, one can use the array to select into the texbinormalset array, e.g.
texbinormalset[0][texbinormal_indexset[0]]
would select the first set of texture binormals.
-
bind
(matrix, materialnodebysymbol)¶ Binds this primitive to a transform matrix and material mapping. The primitive’s points get transformed by the given matrix and its inputs get mapped to the given materials.
Parameters: - matrix (numpy.array) – A 4x4 numpy float matrix
- materialnodebysymbol (dict) – A dictionary with the material symbols inside the primitive
assigned to
collada.scene.MaterialNode
defined in the scene
Return type:
-
getInputList
()¶ Gets a
collada.source.InputList
representing the inputs from a primitive
-
save
()¶ Put all the data to the internal xml node (xmlnode) so it can be serialized.
-
static
load
(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
-