def saveDb3(self, db3File): EnvObject.saveDb3(self, db3File) db3File.updateCategoryName(self._category) if self.id: db3File.updateEntityData(self.guid, 'Id', self.id) if self.graphics: db3File.updateEntityCategory(self._category, self.id, 'Graphics', self.graphics) db3File.updateEntityData(self.guid, 'Graphics', self.graphics) if self.physics: db3File.updateEntityCategory(self._category, self.id, 'Physics', self.physics) db3File.updateEntityData(self.guid, 'Physics', self.physics) if self.placeholder: db3File.updateEntityCategory(self._category, self.id, 'Placeholder', self.placeholder) db3File.updateEntityData(self.guid, 'Placeholder', self.placeholder) if self.name: db3File.updateEntityCategory(self._category, self.id, 'Name', self.name) db3File.updateEntityData(self.guid, 'Name', self.name) if self.animSet: db3File.updateEntityCategory(self._category, self.id, 'AnimSet', self.animSet) db3File.updateEntityData(self.guid, 'AnimSet', self.animSet) if self.characterSet: db3File.updateEntityCategory(self._category, self.id, 'CharacterSet', self.characterSet) db3File.updateEntityData(self.guid, 'CharacterSet', self.characterSet) if self.inputFocus: db3File.updateEntityCategory(self._category, self.id, 'InputFocus', self.inputFocus) db3File.updateEntityData(self.guid, 'InputFocus', self.inputFocus) if self.cameraFocus: db3File.updateEntityCategory(self._category, self.id, 'CameraFocus', self.cameraFocus) db3File.updateEntityData(self.guid, 'CameraFocus', self.cameraFocus) if self.maxVelocity: db3File.updateEntityCategory(self._category, self.id, 'MaxVelocity', self.maxVelocity) db3File.updateEntityData(self.guid, 'MaxVelocity', self.maxVelocity) if self.fieldOfView: db3File.updateEntityCategory(self._category, self.id, 'FieldOfView', self.fieldOfView) db3File.updateEntityData(self.guid, 'FieldOfView', self.fieldOfView)
def __init__(self, level): EnvObject.__init__(self, level) self.id = '' self.placeholder = '' self.name = '' self.animSet = '' self.characterSet = '' self.inputFocus = '' self.cameraFocus = '' self.maxVelocity = '' self.fieldOfView = ''
def loadDb3(self, db3File, guid): EnvObject.loadDb3(self, db3File, guid) self.id = db3File.queryEntityData(guid, 'Id') self.placeholder = db3File.queryEntityData(guid, 'Placeholder') self.Name = db3File.queryEntityData(guid, 'Name') self.animSet = db3File.queryEntityData(guid, 'AnimSet') self.characterSet = db3File.queryEntityData(guid, 'CharacterSet') self.inputFocus = db3File.queryEntityData(guid, 'InputFocus') self.cameraFocus = db3File.queryEntityData(guid, 'CameraFocus') self.maxVelocity = db3File.queryEntityData(guid, 'MaxVelocity') self.fieldOfView = db3File.queryEntityData(guid, 'FieldOfView')
def getAttributes(self): attrs = EnvObject.getAttributes(self) if self._category or self.id: attrs['loc'] = 'db:' + self._category + ':' + self.id if self.placeholder: attrs['Placeholder'] = self.placeholder if self.name: attrs['Name'] = self.name if self.animSet: attrs['AnimSet'] = self.animSet if self.characterSet: attrs['CharacterSet'] = self.characterSet if self.inputFocus: attrs['InputFocus'] = self.inputFocus if self.cameraFocus: attrs['CameraFocus'] = self.cameraFocus if self.maxVelocity: attrs['MaxVelocity'] = self.maxVelocity if self.fieldOfView: attrs['FieldOfView'] = self.fieldOfView return attrs #------------------------------------------------------------------------------- # Eof #-------------------------------------------------------------------------------
def loadDb3(self, db3File, id): self.id = id self.center = db3File.queryLevelData(id, 'Center').split(',') self.extents = db3File.queryLevelData(id, 'Extents').split(',') self.startLevel = db3File.queryLevelData(id, 'StartLevel') for i in db3File.queryCategoryNames(): if i != 'Light': for j in db3File.queryEntityGuid(i, id): opObject = OpObject(id) opObject.loadDb3(db3File, j) self.opObjects.append(opObject) for i in db3File.queryEntityGuid('_Environment', id): envObject = EnvObject(id) envObject.loadDb3(db3File, i) self.envObjects.append(envObject) for i in db3File.queryEntityGuid('Light', id): light = Light(id) light.loadDb3(db3File, i) self.lights.append(light)
def setAttributes(self, attrs): EnvObject.setAttributes(self, attrs) if 'loc' in attrs: str = attrs['loc'].split(':') self._category = str[1] self.id = str[2] if 'Placeholder' in attrs: self.placeholder = attrs['Placeholder'] if 'Name' in attrs: self.name = attrs['Name'] if 'AnimSet' in attrs: self.animSet = attrs['AnimSet'] if 'CharacterSet' in attrs: self.characterSet = attrs['CharacterSet'] if 'InputFocus' in attrs: self.inputFocus = attrs['InputFocus'] if 'CameraFocus' in attrs: self.cameraFocus = attrs['CameraFocus'] if 'MaxVelocity' in attrs: self.maxVelocity = attrs['MaxVelocity'] if 'FieldOfView' in attrs: self.fieldOfView = attrs['FieldOfView']
def startElement(self, name, attrs): if name == 'Global': self.mangLevel.setAttributes(attrs) elif name == 'Level': self.level = Level() self.level.setAttributes(attrs) elif name == 'Objects': pass elif name == 'Object': opObject = OpObject(self.level.id) opObject.setAttributes(attrs) self.level.opObjects.append(opObject) elif name == 'Environment': pass elif name == 'EnvObject': envObject = EnvObject(self.level.id) envObject.setAttributes(attrs) self.level.envObjects.append(envObject) elif name == 'Lights': pass elif name == 'Light': light = Light(self.level.id) light.setAttributes(attrs) self.level.lights.append(light)