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 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)