def __init__(self, gltf_file, usd_file, fps, scale, verbose=False, use_euler_rotation=False): """Initializes the glTF to USD converter Arguments: gltf_file {str} -- path to the glTF file usd_file {str} -- path to store the generated usda file verbose {boolean} -- specifies if the output should be verbose from this tool """ self.logger = logging.getLogger('gltf2usd') self.logger.setLevel(logging.DEBUG) console_handler = logging.StreamHandler() console_handler.setLevel(logging.DEBUG) self.logger.addHandler(console_handler) self.fps = fps self.gltf_loader = GLTF2Loader(gltf_file) self.verbose = verbose self.scale = scale self.use_euler_rotation = use_euler_rotation self.output_dir = os.path.dirname(os.path.abspath(usd_file)) if self.verbose: self.logger.info("Converting {0} to {1}".format(gltf_file, usd_file)) #if usdz file is desired, change to usdc file if usd_file.endswith('usdz'): usd_file = usd_file[:-1] + 'c' self.logger.info("converted usd file extension from .usdz to .usdc: {}".format(usd_file)) self.stage = Usd.Stage.CreateNew(usd_file) self.gltf_usd_nodemap = {} self.gltf_usdskel_nodemap = {} self._usd_mesh_skin_map = {} self._joint_hierarchy_name_map = {} self.convert()
def setUp(self): gltf_file = os.path.join("tests", "assets", "Start_Walking", "Start_Walking.gltf") self.loader = GLTF2Loader(gltf_file)