def FillInFieldData(self): defaultFields = PD.LoadYamlFileNicely('res:/Graphics/Character/Global/FaceSetup/DefaultFields.trif') import copy def FillInFields(mapping): for m in mapping: for var in ['Front', 'Side']: fieldName = mapping[m] + '_' + var if fieldName not in self.fieldData['Fields']: defaultField = copy.deepcopy(defaultFields['Fields']['Default_' + var]) newAttr = [] for a in defaultField['Attributes']: newAttr.append(a.replace('XXX', mapping[m])) defaultField['Attributes'] = newAttr for v in defaultField['VertData']: for pair in defaultField['VertData'][v]: pair[0] = pair[0].replace('XXX', mapping[m]) if False: print 'New Field:' print defaultField print '-----------------------------------' self.fieldData['Fields'][fieldName] = defaultField FillInFields(self.mapping) FillInFields(self.bodyMapping)
def PopulateVirtualModifierFolders(self, gender): genderData = self.genderData[gender] entries = genderData.GetEntries() pathsToEntries = genderData.GetPathsToEntries() yamlFiles = [ yamlFile for yamlFile in self.GetFilesByExtension('yaml', gender) if 'modifiernames' in yamlFile ] for yamlFile in yamlFiles: yamlFileData = PD.LoadYamlFileNicely(yamlFile) if not yamlFileData: continue else: virtualModifierFolders = yamlFileData.lower().replace( '\n', '').split() rootEntry = self.GetEntryByFullResPath(yamlFile) for virtualModifierFolder in virtualModifierFolders: if virtualModifierFolder not in rootEntry.dirs: rootEntry.dirs.append(virtualModifierFolder) newEntry = self._AddEntry( gender, entries, pathsToEntries, '{0}/{1}'.format(rootEntry.root, virtualModifierFolder), rootEntry.GetResPath(virtualModifierFolder), [], []) newEntry.isModifierFolder = True
def Load(source): inst = source if isinstance(source, basestring): inst = PD.LoadYamlFileNicely(source) projectedDecal = PD.ProjectedDecal() for key, val in inst.__dict__.iteritems(): if key in projectedDecal.__dict__: projectedDecal.__dict__[key] = val if inst.texturePath: projectedDecal.SetTexturePath(inst.texturePath) if inst.maskPath: projectedDecal.SetMaskPath(inst.maskPath) return projectedDecal
def LoadFromYaml(path): return paperDoll.LoadYamlFileNicely(path)
def LoadFieldData(self): self.fieldData = PD.LoadYamlFileNicely('res:/Graphics/Character/Global/FaceSetup/TriangleFields.trif') self.fieldDataAnimation = PD.LoadYamlFileNicely('res:/Graphics/Character/Global/FaceSetup/TriangleFieldsAnimation.trif')