code: def to_gltf(self, scene):
          
          # geometry is an OrderedDict
          # {geometry key : index}
          mesh_index = {name: i for i, name
                        in enumerate(scene.geometry.keys())}
          # save the output
          gltf = collections.deque([])
          for node in self.nodes:
              # don't include edge for base frame
              if node == self.base_frame:
                  continue
              # get the transform and geometry from the graph
              transform, geometry = self.get(
                  frame_to=node, frame_from=self.base_frame)
  
              gltf.append({
                  'matrix': transform.T.reshape(-1).tolist(),
                  'name': node})
              # assign geometry if it exists
              if geometry is not None:
                  gltf[-1]['mesh'] = mesh_index[geometry]
  
              if node == scene.camera.name:
                  gltf[-1]['camera'] = 0
  
          # we have flattened tree, so all nodes will be child of world
          gltf.appendleft({
              'name': self.base_frame,
              'children': list(range(1, 1 + len(gltf)))
          })
          result = {'nodes': list(gltf)}
  
          return result
docs: Export a transforms as the 'nodes' section of a GLTF dict.
          Flattens tree.
  
          Returns
          --------
          gltf : dict
            with keys:
                    'nodes': list of dicts