(contents, body_getter)
return Skin(vertices=vertices, texcoords=texcoords, faces=faces, bones=bones)
Parses the contents of a MuJoCo skin file.

  Args:
    contents: a bytes-like object containing the contents of a skin file.
    body_getter: a callable that takes a string and returns the `mjcf.Element`
      instance of a MuJoCo body of the specified name.

  Returns:
    A `Skin` named tuple.
Parses the contents of a MuJoCo skin file.
Parses the contents of a MuJoCo skin file .
def parse(contents, body_getter):
  """Parses the contents of a MuJoCo skin file.

  Args:
    contents: a bytes-like object containing the contents of a skin file.
    body_getter: a callable that takes a string and returns the `mjcf.Element`
      instance of a MuJoCo body of the specified name.

  Returns:
    A `Skin` named tuple.
  """
  f = io.BytesIO(contents)
  nvertex, ntexcoord, nface, nbone = struct.unpack('<iiii', f.read(4*4))
  vertices = np.frombuffer(f.read(4*(3*nvertex)), dtype='<f4').reshape(-1, 3)
  texcoords = np.frombuffer(f.read(4*(2*ntexcoord)), dtype='<f4').reshape(-1, 2)
  faces = np.frombuffer(f.read(4*(3*nface)), dtype='<i4').reshape(-1, 3)
  bones = []
  for _ in range(nbone):
    body_name = f.read(MAX_BODY_NAME_LENGTH).decode().split('\0')[0]
    body = lambda body_name=body_name: body_getter(body_name)
    bindpos = np.asarray(
        struct.unpack('<fff', f.read(4*3)), dtype=np.float)
    bindquat = np.asarray(
        struct.unpack('<ffff', f.read(4*4)), dtype=np.float)
    vertex_count = struct.unpack('<i', f.read(4))[0]
    vertex_ids = np.frombuffer(f.read(4*vertex_count), dtype='<i4')
    vertex_weights = np.frombuffer(f.read(4*vertex_count), dtype='<f4')
    bones.append(Bone(body=body, bindpos=bindpos, bindquat=bindquat,
                      vertex_ids=vertex_ids, vertex_weights=vertex_weights))

  return Skin(vertices=vertices, texcoords=texcoords, faces=faces, bones=bones)
def parse ( contents , body_getter ) : f = io . BytesIO ( contents ) nvertex , ntexcoord , nface , nbone = struct . unpack ( '<iiii' , f . read ( 4 * 4 ) ) vertices = np . frombuffer ( f . read ( 4 * ( 3 * nvertex ) ) , dtype = '<f4' ) . reshape ( - 1 , 3 ) texcoords = np . frombuffer ( f . read ( 4 * ( 2 * ntexcoord ) ) , dtype = '<f4' ) . reshape ( - 1 , 2 ) faces = np . frombuffer ( f . read ( 4 * ( 3 * nface ) ) , dtype = '<i4' ) . reshape ( - 1 , 3 ) bones = [ ] for _ in range ( nbone ) : body_name = f . read ( MAX_BODY_NAME_LENGTH ) . decode ( ) . split ( '\0' ) [ 0 ] body = lambda body_name = body_name : body_getter ( body_name ) bindpos = np . asarray ( struct . unpack ( '<fff' , f . read ( 4 * 3 ) ) , dtype = np . float ) bindquat = np . asarray ( struct . unpack ( '<ffff' , f . read ( 4 * 4 ) ) , dtype = np . float ) vertex_count = struct . unpack ( '<i' , f . read ( 4 ) ) [ 0 ] vertex_ids = np . frombuffer ( f . read ( 4 * vertex_count ) , dtype = '<i4' ) vertex_weights = np . frombuffer ( f . read ( 4 * vertex_count ) , dtype = '<f4' ) bones . append ( Bone ( body = body , bindpos = bindpos , bindquat = bindquat , vertex_ids = vertex_ids , vertex_weights = vertex_weights ) ) return Skin ( vertices = vertices , texcoords = texcoords , faces = faces , bones = bones )