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 _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
def _addControls(self): self._deleteExisting() # Converting and Adding maya slider self.controlBoxLayout.addWidget(LightControl._addSeparator()) self.controlBoxLayout.addWidget( getQObject( pmc.attrColorSliderGrp('lcColorSlider', label='{:>10}'.format('Color:'), cw4=[55, 60, 60, 40], visible=False))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcTemperatureSlider', label='{:>10}'.format('Kelvin:'), pre=0, visible=False, min=-99999, max=99999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcIntensitySlider', label='{:>10}'.format('Intensity:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcExposureSlider', label='{:>10}'.format('Exposure:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcSpreadSlider', label='{:>10}'.format('Spread:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcRoundnessSlider', label='{:>10}'.format('Roundness:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcSoftEdgeSlider', label='{:>10}'.format('Soft Edge:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcConeAngleSlider', label='{:>10}'.format('Cone:'), pre=2, visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcPenumbraAngleSlider', label='{:>10}'.format('Penumbra:'), pre=2, visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcDropoffSlider', label='{:>10}'.format('Dropoff:'), pre=2, visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcSampleSlider', label='{:>10}'.format('Samples:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget(LightControl._addSeparator()) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcDiffuseSlider', label='{:>10}'.format('Diffuse:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lsSpecularSlider', label='{:>10}'.format('Specular:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcSssSlider', label='{:>10}'.format('SSS:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcIndirectSlider', label='{:>10}'.format('Indirect:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldSliderGrp('lcVolumeSlider', label='{:>10}'.format('Volume:'), visible=False, min=-9999, max=9999))) self.controlBoxLayout.addWidget(LightControl._addSeparator()) self.controlBoxLayout.addWidget( getQObject( pmc.attrFieldGrp('lcScaleSlider', label='{:>10}'.format('Scale:'), pre=3, visible=False))) self.controlBoxLayout.addWidget(LightControl._addSeparator()) self.controlBoxLayout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding))