Exemplo n.º 1
0
 def Load(cls, dir_):
     log.debug("dir_ %s " % dir_)
     d = json_load_(cls.Path(dir_))
     s = cls()
     for k, v in d.items():
         s[k] = v
     pass
     s.init()
     return s
Exemplo n.º 2
0
 def loadMeta(self):
     path = self.metapath()
     exists = os.path.exists(path)
     if not exists:
         log.info("path %s does not exist " % path)
     pass
     meta = json_load_(path) if exists else {}
     self.meta = meta
     log.debug("loaded %s keys %s " % (path, len(self.meta)))
Exemplo n.º 3
0
    def save(self, path, load_check=True, pretty_also=False):
        gdir = os.path.dirname(path)
        log.info("saving extras in %s " % gdir)
        self.save_extras(
            gdir
        )  # sets uri for extra external files, so must come before the json gltf save

        log.info("saving gltf into %s " % path)
        gltf = self.gltf
        json_save_(path, gltf)

        if pretty_also:
            pretty_path = path.replace(".gltf", ".pretty.gltf")
            log.info("also saving to %s " % pretty_path)
            json_save_pretty_(pretty_path, gltf)
        pass

        if load_check:
            gltf2 = json_load_(path)
        pass
        return gltf
Exemplo n.º 4
0
 def __init__(self, path="$TMP/tgltf/tgltf-gdml--.gltf", t0=None):
     self.path = path
     self.gltf = json_load_(path)
     self.t0 = t0
     self.nn = {}