Ejemplo n.º 1
0
 def __init__(self,
              vertices=None,
              faces=None,
              edges=None,
              vertex_colors=None,
              face_colors=None):
     MeshData.__init__(self,
                       vertices=None,
                       faces=None,
                       edges=None,
                       vertex_colors=None,
                       face_colors=None)
Ejemplo n.º 2
0
 def __init__(self, vertices=None, faces=None, edges=None,
              vertex_colors=None, face_colors=None):
     MeshData.__init__(self, vertices=None, faces=None, edges=None,
                          vertex_colors=None, face_colors=None)
Ejemplo n.º 3
0
    def __init__(self,
                 parent=None,
                 children=None,
                 objectID=0,
                 materialID=0,
                 textureCoordinates=None,
                 **kwargs):
        MeshData.__init__(self, **kwargs)

        # Set parent (None=root)
        self._parent = parent

        # Set children
        if children is not None:
            if isinstance(children, list):
                self._children = children
            else:
                self._children = [children]
        else:
            self._children = []

        # Set IDs
        self._objectID = objectID
        self._materialID = materialID

        checkID(self, self._objectID)
        checkID(self, self._materialID)

        # Set empty array for unset data, ndarray for set data
        if self._vertices is None:
            self._vertices = np.empty(0, dtype=np.float32)
            warn('Unset vertices for object ' + self.__repr__(),
                 category=RuntimeWarning)
        elif isinstance(self._vertices, list) or isinstance(
                self._vertices, tuple):
            self._vertices = np.asarray(self._vertices, dtype=np.float32)
        elif not isinstance(self._vertices, np.ndarray):
            raise ValueError('Invalid container type!')

        if self._faces is None:
            self._faces = np.empty(0, dtype=np.uint32)
            warn('Unset faces for object ' + self.__repr__(),
                 category=RuntimeWarning)
        elif isinstance(self._faces, list) or isinstance(self._faces, tuple):
            self._faces = np.asarray(self._faces, dtype=np.uint32)
        elif not isinstance(self._faces, np.ndarray):
            raise ValueError('Invalid container type!')

        if textureCoordinates is None:
            self._textureCoordinates = np.zeros((len(self._vertices), 2),
                                                dtype=np.float32)
            warn('Unset texture coordinates for object ' + self.__repr__(),
                 category=RuntimeWarning)
        elif isinstance(textureCoordinates, list) or isinstance(
                textureCoordinates, tuple):
            self._textureCoordinates = np.asarray(textureCoordinates,
                                                  dtype=np.float32)
        elif isinstance(textureCoordinates, np.ndarray):
            self._textureCoordinates = textureCoordinates
        else:
            raise ValueError('Invalid container type!')