def initUI(self): # self.setMinimumSize(200, 100) self.ui = ui.loadUiWidgetFromPyFile(__file__, parent=self) # layout self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.ui) self.layout().setSpacing(0) self.layout().setContentsMargins(2, 2, 2, 2) # fill UI info isValid = self.isValidContext() if isValid: self.ui.cb_imagePlanes.addItems(shader.getAllSceneImagePlanes()) else: self.ui.setEnabled(False) cmds.confirmDialog(t="Alert", message="There are no ImagePlanes in the scene, there must be one at least.", button=["OK"], icon="warning") # add signals to the ui elements self.ui.pb_bakeImagePlane.clicked.connect(self.bakeImagePlane) self.ui.pb_useBackgroundShader.clicked.connect(self.applyUseBackgroundShader) self.ui.pb_lambertProjection.clicked.connect(self.applyLambertShader) self.ui.pb_surfaceShader.clicked.connect(self.applySurfaceShader) self.ui.pb_applyGreenScreenShader.clicked.connect(self.applyGreenScreenShader) self.ui.pb_applyGreenScreenShaderFx.clicked.connect(self.applyGreenScreenShaderFx) self.ui.pb_applyDefaultShader.clicked.connect(self.applyDefaultShader)
def isValidContext(self): return (len(shader.getAllSceneImagePlanes()) > 0)