def SaveRedFile(ball, graphicFile): dlgRes = uix.GetFileDialog(multiSelect=False, selectionType=uix.SEL_FOLDERS) if dlgRes is not None: path = dlgRes.Get('folders')[0] graphicFile = graphicFile.split('/')[-1] graphicFile = graphicFile.replace('.blue', '.red') savePath = path + '\\' + graphicFile trinity.Save(ball.model, savePath) log.LogError('GM menu: Saved object as:', savePath)
def RepairFile(filePath): filePath = subst.GetUnsubstedPath(filePath) logger.info('==== File:%s====' % filePath) original = trinity.Load(filePath) if original: if HasBrokenBindings(original): logger.info('Broken bindings found!') new = FixBrokenBindings(original) trinity.Save(new, filePath) else: logger.info('No broken bindings found!')
def fun(): path = resPath def GetMapResourcePath(map): return path + '/' + pdDef.MAPNAMES[map] + '.dds' for map in pdDef.MAPS: texture = self.doll.mapBundle[map] texture.SaveAsync(GetMapResourcePath(map)) texture.WaitForSave() meshGeometryResPaths = {} for modifier in self.doll.buildDataManager.GetSortedModifiers(): meshGeometryResPaths.update(modifier.meshGeometryResPaths) for mesh in self.avatar.visualModel.meshes: mesh.geometryResPath = meshGeometryResPaths.get(mesh.name, '') for fx in pdCcf.GetEffectsFromMesh(mesh): for resource in fx.resources: if resource.name in pdDef.MAPNAMES: resource.resourcePath = GetMapResourcePath( pdDef.MAPNAMES.index(resource.name)) trinity.Save(self.avatar, path + '/unique.red') morphTargets = {} for modifier in self.doll.buildDataManager.GetSortedModifiers(): if modifier.categorie in pdDef.BLENDSHAPE_CATEGORIES: morphTargets[modifier.name] = modifier.weight bsFilePath = blue.paths.ResolvePath(path + '/blendshapes.yaml') f = file(bsFilePath, 'w') yaml.dump(morphTargets, f) f.close() animOffsets = {} for bone in self.doll.boneOffsets: trans = self.doll.boneOffsets[bone]['translation'] animOffsets[bone] = trans aoFilePath = blue.paths.ResolvePath(path + '/animationOffsets.yaml') f = file(aoFilePath, 'w') yaml.dump(animOffsets, f) f.close()
def _SaveScene(filename): s2 = sceneutils.FindScene() if not s2: raise IOError(filename) trinity.Save(s2, filename)
def SaveTrinityObject(path, trinObj, checkOutFunc = None): if os.path.isfile(path) and checkOutFunc is not None: retVal, _ = checkOutFunc(path) if not retVal: return False return trinity.Save(trinObj, path)