def __init__(self): VisualState.__init__(self) self.textStyle = '' self.iconTextureName = '' self.iconTextureMapping = None self.iconColour = (255, 255, 255, 255) return
def onLoad(self, dataSection): VisualState.onLoad(self, dataSection) if dataSection.has_key('background'): backgroundSection = dataSection._background self.backgroundTextureName = backgroundSection.readString('textureName', '') if backgroundSection.has_key('mapping'): mappingSection = backgroundSection._mapping mappingType, mapping = self._readMappingSection(mappingSection) self.backgroundTextureMappingType = mappingType self.backgroundTextureMapping = mapping else: self.backgroundTextureMapping = None self.backgroundColour = backgroundSection.readVector4('colour', (255, 255, 255, 255)) if dataSection.has_key('thumb'): thumbSection = dataSection._thumb self.thumbTextureName = thumbSection.readString('textureName', '') if thumbSection.has_key('mapping'): mappingSection = thumbSection._mapping mappingType, mapping = self._readMappingSection(mappingSection) self.thumbTextureMappingType = mappingType self.thumbTextureMapping = mapping else: self.thumbTextureMapping = None self.thumbColour = thumbSection.readVector4('colour', (255, 255, 255, 255)) return
def __init__(self): VisualState.__init__(self) self.backgroundTextureName = '' self.backgroundTextureMapping = None self.backgroundColour = (255, 255, 255, 255) self.thumbTextureName = '' self.thumbTextureMapping = None self.thumbColour = (255, 255, 255, 255) return
def onSave(self, dataSection): VisualState.onSave(self, dataSection) if self.textStyle: dataSection.writeString('textStyle', self.textStyle) iconSection = dataSection.createSection('icon') iconSection.writeString('textureName', self.iconTextureName) iconSection.writeString('materialFX', self.iconMaterialFX) if self.iconTextureMapping: mappingSection = iconSection.createSection('mapping') self._writeMappingSection(mappingSection, self.iconTextureMappingType, self.iconTextureMapping) iconSection.writeVector4('colour', self.iconColour)
def apply(self, componentScript): VisualState.apply(self, componentScript) if hasattr(componentScript, 'sliderBackground'): componentScript.sliderBackground.textureName = self.backgroundTextureName if self.thumbTextureMapping: applyMapping(componentScript.sliderBackground, self.backgroundTextureMappingType, self.backgroundTextureMapping) componentScript.sliderBackground.colour = self.backgroundColour if hasattr(componentScript, 'sliderThumb'): componentScript.sliderThumb.textureName = self.thumbTextureName if self.thumbTextureMapping: applyMapping(componentScript.sliderThumb, self.thumbTextureMappingType, self.thumbTextureMapping) componentScript.sliderThumb.colour = self.thumbColour
def onSave(self, dataSection): VisualState.onSave(self, dataSection) backgroundSection = dataSection.createSection('background') backgroundSection.writeString('textureName', self.backgroundTextureName) if self.backgroundTextureMapping: mappingSection = backgroundSection.createSection('mapping') self._writeMappingSection(mappingSection, self.backgroundTextureMappingType, self.backgroundTextureMapping) backgroundSection.writeVector4('colour', self.backgroundColour) thumbSection = dataSection.createSection('thumb') thumbSection.writeString('textureName', self.thumbTextureName) if self.thumbTextureMapping: mappingSection = thumbSection.createSection('mapping') self._writeMappingSection(mappingSection, self.thumbTextureMappingType, self.thumbTextureMapping) thumbSection.writeVector4('colour', self.thumbColour)
def apply(self, componentScript): VisualState.apply(self, componentScript) if getattr(componentScript, 'buttonLabel', None) is not None and self.textStyle: TextStyles.setStyle(componentScript.buttonLabel, self.textStyle) if hasattr(componentScript, 'buttonIcon'): componentScript.buttonIcon.textureName = self.iconTextureName if self.iconTextureMapping: Utils.applyMapping(componentScript.buttonIcon, self.iconTextureMappingType, self.iconTextureMapping) componentScript.buttonIcon.colour = self.iconColour if self.iconMaterialFX != '': componentScript.buttonIcon.materialFX = self.iconMaterialFX else: componentScript.buttonIcon.materialFX = 'BLEND' return
def onLoad(self, dataSection): VisualState.onLoad(self, dataSection) self.textStyle = dataSection.readString('textStyle', '') if dataSection.has_key('icon'): iconSection = dataSection._icon self.iconMaterialFX = iconSection.readString('materialFX', '') self.iconTextureName = iconSection.readString('textureName', '') if iconSection.has_key('mapping'): mappingSection = iconSection._mapping mappingType, mapping = self._readMappingSection(mappingSection) self.iconTextureMappingType = mappingType self.iconTextureMapping = mapping else: self.iconTextureMapping = None self.iconColour = iconSection.readVector4('colour', (255, 255, 255, 255)) return