def textField(op: Boss_OT_base_ui, rectData: rectDataType, text: fieldType = '', onValueChange: callbackType = None, onTextChange: callbackType = None, onEnterPress: callbackType = None, ttt: str = '', tti: str = '', canDrag: bool = True, parent: uiType = None, rectIsLocal: bool = False, param=None) -> TextField: return TextField( op, rectData if isinstance(rectData, RectData) else RectData( *rectData), panelData=PanelData(text, toolTipText=ttt, toolTipImagePath=tti, canDrag=canDrag, parent=parent, rectIsLocal=rectIsLocal), value=str(text), onTextChange=onTextChange, onValueChange=onValueChange, onEnterPress=onEnterPress, param=param)
def button(op: Boss_OT_base_ui, rectData: rectDataType, text: str = '', buttonData: buttonDataType = None, ttt: str = '', tti: str = '', canDrag: bool = True, parent: uiType = None, rectIsLocal: bool = False, param=None) -> Button: if isinstance(buttonData, (tuple, Callable)): buttonData = ButtonData(onClick=buttonData) return Button(op, rectData if isinstance(rectData, RectData) else RectData( *rectData), PanelData( text=text, toolTipText=ttt, canDrag=canDrag, toolTipImagePath=tti, parent=parent, rectIsLocal=rectIsLocal, ), buttonData, param=param)
def vectorFloatField(op: Boss_OT_base_ui, rectData: rectDataType, value: vecFieldType = (.0, .0, .0), onValueChange: callbackType = None, onTextChange: callbackType = None, onEnterPress: callbackType = None, ttt: str = '', tti: str = '', canDrag: bool = True, parent: uiType = None, rectIsLocal: bool = False, param=None) -> VectorFloatField: if isinstance(value, FieldValue): val = value.value minValue = value.min maxValue = value.max changeBy = value.changeBy if value.changeBy else (.1, .1, .1) else: val = value minValue = None maxValue = None changeBy = (.1, .1, .1) return VectorFloatField( op, rectData if isinstance(rectData, RectData) else RectData( *rectData), bgPanelData=PanelData(toolTipText=ttt, toolTipImagePath=tti, canDrag=canDrag, parent=parent, rectIsLocal=rectIsLocal), value=val, minValue=minValue, maxValue=maxValue, changeBy=changeBy, isHorizontal=True, onTextChange=onTextChange, onValueChange=onValueChange, onEnterPress=onEnterPress, param=param)
def panel(op: Boss_OT_base_ui, rectData: rectDataType, text: str = '', ttt: str = '', tti: str = '', canDrag: bool = True, parent: Union[Panel, Button, None] = None, rectIsLocal: bool = False, param=None) -> Panel: return Panel(op, rectData if isinstance(rectData, RectData) else RectData( *rectData), PanelData( text=text, toolTipText=ttt, canDrag=canDrag, toolTipImagePath=tti, parent=parent, rectIsLocal=rectIsLocal, ), param=param)
def vectorBooleanField(op: Boss_OT_base_ui, rectData: rectDataType, value: tuple = None, onValueChange: callbackType = None, ttt: str = '', tti: str = '', canDrag: bool = True, parent: uiType = None, rectIsLocal: bool = False, param=None) -> VectorBooleanField: return VectorBooleanField( op, rectData if isinstance(rectData, RectData) else RectData( *rectData), bgPanelData=PanelData(toolTipText=ttt, toolTipImagePath=tti, canDrag=canDrag, parent=parent, rectIsLocal=rectIsLocal), value=value, isHorizontal=True, onValueChange=onValueChange, param=param)
def checkBox(op: Boss_OT_base_ui, rectData: rectDataType, text: str = '', value: bool = False, onValueChange: callbackType = None, ttt: str = '', tti: str = '', canDrag: bool = True, parent: uiType = None, rectIsLocal: bool = False, param=None) -> CheckBox: return CheckBox( op, rectData if isinstance(rectData, RectData) else RectData( *rectData), PanelData(text, toolTipText=ttt, toolTipImagePath=tti, canDrag=canDrag, parent=parent, rectIsLocal=rectIsLocal), value=value, onValueChange=onValueChange, param=param)
def __init__(self,op,width,colorRGBA = Color.GRAY,indicatorSize = 8,pointCount = 16): self.op = op self.uip = op.uip self.width = width self.enabled = True self.indicatorSize = indicatorSize self.pointCount = pointCount self.hueStep = 1/self.pointCount self.onColorUpdate = [] self.bgPanelBtn = Button( self.op, RectData(), PanelData( canDrag=True, normal_color=Color.GRAY_M02, panelType='ColorField' ), ButtonData() ) self.setColor_fromRGBA(colorRGBA) wheelButtonRD = RectData() self.wheelButton = Button( self.op, wheelButtonRD, PanelData( parent=self.bgPanelBtn, canDrag=True, geo_type='CIR', normal_color=getWheelColor(self.pointCount,self.hueStep), hover_color=None, panelType='ColorField', dragRect=wheelButtonRD ), ButtonData( onDragBegin=(self.removeUpdateVerts,'add'), onDragEnd=(self.removeUpdateVerts,'remove'), onDrag=self.onWheelBgDragged, onClick=self.onWheelBgDragged ) ) self.geo = self.wheelButton.geo self.valueSlider = Slider(self.op,RectData(),PanelData(parent=self.bgPanelBtn), 0,0,1,False,onValueChange=self.onColorValueChange ) self.alphaSlider = Slider(self.op,RectData(),PanelData(parent=self.bgPanelBtn), 0,0,1,False,onValueChange=self.onAlphaChange ) gradientColor = [ Color.BLACK,Color.WHITE,Color.WHITE,Color.BLACK ] self.valueSlider.sliderBase.geo.setColor( gradientColor ) self.alphaSlider.sliderBase.geo.setColor( gradientColor ) self.wheelIndicatorPanel = Panel( self.op, RectData(0,0,indicatorSize,indicatorSize), PanelData( normal_color=Color.WHITE, geo_type='Rect', panelType='none', parent=self.bgPanelBtn, ) ) self._setDimensions() self.setIndicatorFromSelectedColor() self.valueSlider.setValue(self.valueSlider.getValue(), callCallback=True)