def _setupTransformTabWidgets(self): self.transformLayout.addWidget( self._groupWidgets([ self.addControl('X', QtWidgets.QDoubleSpinBox(), 'tx'), self.addControl('Y', QtWidgets.QDoubleSpinBox(), 'ty'), self.addControl('Z', QtWidgets.QDoubleSpinBox(), 'tz') ], 'Translate')) self.transformLayout.addWidget( self._groupWidgets([ self.addControl('X', QtWidgets.QDoubleSpinBox(), 'rx'), self.addControl('Y', QtWidgets.QDoubleSpinBox(), 'ry'), self.addControl('Z', QtWidgets.QDoubleSpinBox(), 'rz') ], 'Rotate')) self.transformLayout.addWidget( self._groupWidgets([ self.addControl( 'X', QtWidgets.QDoubleSpinBox(), 'sx', default=1), self.addControl( 'Y', QtWidgets.QDoubleSpinBox(), 'sy', default=1), self.addControl( 'Z', QtWidgets.QDoubleSpinBox(), 'sz', default=1), self.addControl( 'XYZ', QtWidgets.QDoubleSpinBox(), 'sxyz', default=1) ], 'Scale')) self.transformLayout.addWidget( self._groupWidgets([ self.addControl('Visibility', { 'Off': 0, 'On': 1 }, 'visibility'), self.addControl('LOD Visibility', { 'Off': 0, 'On': 1 }, 'lodVisibility'), self.addControl('Template', { 'Off': 0, 'On': 1 }, 'template'), self.addControl('Display', { 'Normal': 0, 'Template': 1, 'Reference': 2 }, 'overrideDisplayType'), self.addControl('Overrides', { 'Off': 0, 'On': 1 }, 'overrideEnabled'), self.addControl('LOD', { 'Full': 0, 'BBox': 1 }, 'overrideLevelOfDetail'), ], 'Display')) self.transformLayout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding))
def _setupWidgets(self): self.layout = QtWidgets.QVBoxLayout() self.controlLayout = QtWidgets.QHBoxLayout() self.buttonLayout = QtWidgets.QHBoxLayout() self.minSlider = QtWidgets.QDoubleSpinBox() self.maxSlider = QtWidgets.QDoubleSpinBox() self.cancelButton = QtWidgets.QPushButton('Cancel') self.setButton = QtWidgets.QPushButton('Set') self._addWidgets() self._editWidgets()
def _setupMeshTabWidgets(self): self.meshLayout.addWidget( self._groupWidgets([ self.addControl('Smooth Mesh Preview', { 'Off': 0, 'On': 2 }, 'displaySmoothMesh'), self.addControl('Use Smooth for Rendering', { 'Off': 0, 'On': 1 }, 'useSmoothPreviewForRender'), self.addControl('Render Level', QtWidgets.QDoubleSpinBox(), 'renderSmoothLevel'), self.addControl('Visibilty', { 'Off': 0, 'On': 1 }, 'visibility') ], 'Mesh Preview')) self.meshLayout.addWidget( self._groupWidgets([ self.addControl('Casts Shadows', { 'Off': 0, 'On': 1 }, 'castsShadows'), self.addControl('Receive Shadows', { 'Off': 0, 'On': 1 }, 'receiveShadows'), self.addControl('Primary Visibility', { 'Off': 0, 'On': 1 }, 'primaryVisibility'), self.addControl('Visible Reflections', { 'Off': 0, 'On': 1 }, 'visibleInReflections'), self.addControl('Visible Refractions', { 'Off': 0, 'On': 1 }, 'visibleInRefractions'), self.addControl('Double Sided', { 'Off': 0, 'On': 1 }, 'doubleSided'), ], 'Render Stats')) self.meshLayout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding))
def _setupLightTabWidgets(self): self.lightColorWidget = self.addControl('Color', 'colorSlider', 'color') self.lightLayout.addWidget( self._groupWidgets([ self.lightColorWidget, self.addControl('Intensity', QtWidgets.QDoubleSpinBox(), 'intensity'), self.addControl('Decay', { 'No': 0, 'Linear': 1, 'Quadratic': 2, 'Cubic': 3 }, 'decayRate'), self.addControl('Visibility', { 'Off': 0, 'On': 1 }, 'visibility') ], 'Light Attributes')) self.lightLayout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding))
def addControl(self, name, control, attribute, default=None): buttonHeight = 18 widget = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(2) widget.setLayout(layout) label = QtWidgets.QLabel(name) incrementButton = QtWidgets.QPushButton('Increment') randomButton = QtWidgets.QPushButton('Random') setButton = QtWidgets.QPushButton('Set') incrementButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight) randomButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight) setButton.setFixedSize(self.controlButtonWidth / 3, buttonHeight) # Adding Widgets layout.addWidget(label) if control == 'intSlider': control = QtWidgets.QDoubleSpinBox() elif control == 'floatSlider': control = QtWidgets.QDoubleSpinBox() elif control == 'colorSlider': control = QtWidgets.QPushButton() if control and isinstance(control, dict): incrementButton.setVisible(False) randomButton.setVisible(False) setButton.setVisible(False) count = len(control) for key, value in control.iteritems(): button = QtWidgets.QPushButton(key) button.setFixedSize(self.controlButtonWidth / count, buttonHeight) button.setProperty('attribute', attribute) button.setProperty('value', value) self.Signal.addSignal(button, 'clicked', self.controlSignalEvent) layout.addWidget(button) elif control == 'custom': if attribute == 'aiSssSetname' or attribute == 'aiAov': incrementButton.setVisible(False) randomButton.setVisible(False) control = QtWidgets.QLineEdit() control.setFixedSize(self.controlButtonWidth / 2, buttonHeight) setButton.setFixedSize(self.controlButtonWidth / 2, buttonHeight) setButton.setProperty('control', control) setButton.setProperty('attribute', attribute) self.Signal.addSignal(setButton, 'clicked', self.controlSignalEvent) layout.addWidget(control) elif attribute == 'color' or attribute == 'lightColor': incrementButton.setVisible(False) randomButton.setVisible(False) control.setFixedWidth(70) layout.addItem( QtWidgets.QSpacerItem(73, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)) layout.addWidget(control) layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) control.setStyleSheet('QPushButton {background-color: white}') control.setProperty('red', 1) control.setProperty('green', 1) control.setProperty('blue', 1) self.Signal.addSignal(control, 'clicked', self.colorPickerEvent) self.Signal.addSignal(setButton, 'clicked', self.controlSignalEvent) setButton.setProperty('control', control) setButton.setProperty('attribute', attribute) elif control: if attribute == 'renderSmoothLevel': self._setupControlWidgetDefaults(control, default, precision=0, minV=0, maxV=7) elif attribute in [ 'aiSubdivIterations', 'aiSamples', 'aiColorTemperature', 'aiVolumeSamples', 'temperature', 'fixedSampleCount' ]: defaultValue = 1 if attribute == 'aiColorTemperature' or attribute == 'temperature': defaultValue = 6500 self._setupControlWidgetDefaults(control, defaultValue, precision=0, minV=0) elif attribute in [ 'aiDispHeight', 'intensity', 'aiDiffuse', 'aiSpecular', 'aiSss', 'aiIndirect', 'aiVolume', 'aiSpread', 'diffuse', 'specular' ]: self._setupControlWidgetDefaults(control, 1) else: self._setupControlWidgetDefaults(control, default) self.Signal.addSignal(incrementButton, 'clicked', self.controlSignalEvent) self.Signal.addSignal(randomButton, 'clicked', self.controlSignalEvent) self.Signal.addSignal(setButton, 'clicked', self.controlSignalEvent) incrementButton.setProperty('attribute', attribute) randomButton.setProperty('attribute', attribute) setButton.setProperty('attribute', attribute) incrementButton.setProperty('control', control) setButton.setProperty('control', control) layout.addWidget(control) layout.addWidget(incrementButton) layout.addWidget(randomButton) layout.addWidget(setButton) return widget