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)