def data(self, index, role): """Get item data.""" row = index.row() value = self.aovs[row] if role == QtCore.Qt.DisplayRole: return value.variable if role == QtCore.Qt.DecorationRole: return utils.getIconFromVexType(value.vextype)
def initUI(self): """Initialize the UI.""" layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # ===================================================================== help_layout = QtWidgets.QHBoxLayout() layout.addLayout(help_layout) help_layout.addStretch(1) help_layout.addWidget(widgets.HelpButton("aov_dialog")) # ===================================================================== grid_layout = QtWidgets.QGridLayout() layout.addLayout(grid_layout) row = 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("VEX Variable"), row, 0) self.variable_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.variable_name, row, 1) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("VEX Type"), row, 0) self.type_box = QtWidgets.QComboBox() grid_layout.addWidget(self.type_box, row, 1) for entry in uidata.VEXTYPE_MENU_ITEMS: icon = utils.getIconFromVexType(entry[0]) self.type_box.addItem(icon, entry[1], entry[0]) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Channel Name"), row, 0) self.channel_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.channel_name, row, 1) self.channel_name.setToolTip( "Optional channel name Mantra will rename the AOV to.") row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Quantize"), row, 0) self.quantize_box = QtWidgets.QComboBox() grid_layout.addWidget(self.quantize_box, row, 1) for entry in uidata.QUANTIZE_MENU_ITEMS: self.quantize_box.addItem(entry[1], entry[0]) self.quantize_box.setCurrentIndex(2) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Sample Filter"), row, 0) self.sfilter_box = QtWidgets.QComboBox() grid_layout.addWidget(self.sfilter_box, row, 1) for entry in uidata.SFILTER_MENU_ITEMS: self.sfilter_box.addItem(entry[1], entry[0]) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Pixel Filter"), row, 0) self.pfilter_widget = widgets.MenuField(uidata.PFILTER_MENU_ITEMS) grid_layout.addWidget(self.pfilter_widget, row, 1) row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Exclude from DCM"), row, 0) self.exclude_from_dcm = QtWidgets.QCheckBox() grid_layout.addWidget(self.exclude_from_dcm, row, 1) row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== self.export_label = QtWidgets.QLabel( "Export variable \nfor each component") grid_layout.addWidget(self.export_label, row, 0, 2, 1) self.componentexport = QtWidgets.QCheckBox() grid_layout.addWidget(self.componentexport, row, 1, 2, 1) row += 2 # ===================================================================== self.component_mode_label = QtWidgets.QLabel("Set Components") grid_layout.addWidget(self.component_mode_label, row, 0) self.component_mode = QtWidgets.QComboBox() grid_layout.addWidget(self.component_mode, row, 1) self.component_mode.addItem("From ROP", "rop") self.component_mode.addItem("In AOV", "aov") self.component_mode_label.setDisabled(True) self.component_mode.setDisabled(True) # self.component_mode.currentIndexChanged.connect(self.enableExports) row += 1 # ===================================================================== self.components_label = QtWidgets.QLabel("Export Components") grid_layout.addWidget(self.components_label, row, 0) self.components_label.setDisabled(True) self.components = QtWidgets.QLineEdit() self.components.setText("diffuse reflect coat refract volume sss") grid_layout.addWidget(self.components, row, 1) self.components.setDisabled(True) self.components.setToolTip( "Shading component names. Leaving this field empty will use the components" " selected on the Mantra ROP.") self.componentexport.stateChanged.connect(self.enableComponentMode) self.component_mode.currentIndexChanged.connect(self.enableComponents) row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Light Exports"), row, 0) self.lightexport = QtWidgets.QComboBox() grid_layout.addWidget(self.lightexport, row, 1) for entry in uidata.LIGHTEXPORT_MENU_ITEMS: self.lightexport.addItem(entry[1], entry[0]) self.lightexport.currentIndexChanged.connect(self.enableExports) row += 1 # ===================================================================== self.light_mask_label = QtWidgets.QLabel("Light Mask") grid_layout.addWidget(self.light_mask_label, row, 0) self.light_mask_label.setDisabled(True) self.light_mask = QtWidgets.QLineEdit() grid_layout.addWidget(self.light_mask, row, 1) self.light_mask.setText("*") self.light_mask.setDisabled(True) row += 1 # ===================================================================== self.light_select_label = QtWidgets.QLabel("Light Selection") grid_layout.addWidget(self.light_select_label, row, 0) self.light_select_label.setDisabled(True) self.light_select = QtWidgets.QLineEdit() grid_layout.addWidget(self.light_select, row, 1) self.light_select.setText("*") self.light_select.setDisabled(True) row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Priority"), row, 0) self.priority = widgets.CustomSpinBox() grid_layout.addWidget(self.priority, row, 1) self.priority.setMinimum(-1) self.priority.setValue(-1) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Intrinsics"), row, 0) self.intrinsics = QtWidgets.QLineEdit() grid_layout.addWidget(self.intrinsics, row, 1) self.intrinsics.setToolTip( "Optional intrinsic groups for automatic group addition, eg. Diagnostic" ) row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Comment"), row, 0) self.comment = QtWidgets.QLineEdit() grid_layout.addWidget(self.comment, row, 1) self.comment.setToolTip( "Optional comment, eg. 'This AOV represents X'.") row += 1 # ===================================================================== grid_layout.setRowMinimumHeight(row, 25) row += 1 # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("File Path"), row, 0) self.file_widget = widgets.FileChooser() grid_layout.addWidget(self.file_widget, row, 1) row += 1 # ===================================================================== self.status_widget = widgets.StatusMessageWidget() layout.addWidget(self.status_widget) # ===================================================================== self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.validInputSignal.connect(self.enableCreation)
def initUI(self): """Initialize the UI.""" layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self.aov_chooser = QtWidgets.QComboBox() layout.addWidget(self.aov_chooser) # Start menu index. start_idx = -1 # Populate the AOV chooser with all the existing AOVs. for idx, aov in enumerate(sorted(manager.MANAGER.aovs.values())): # If a channel is specified, put it into the display name. if aov.channel is not None: label = "{} ({})".format(aov.variable, aov.channel) else: label = aov.variable self.aov_chooser.addItem(utils.getIconFromVexType(aov.vextype), label, aov) # The AOV matches our start AOV so set the start index. if aov == self.aov: start_idx = idx if start_idx != -1: self.aov_chooser.setCurrentIndex(start_idx) self.aov_chooser.currentIndexChanged.connect(self.selectionChanged) # ===================================================================== self.table = widgets.AOVInfoTableView(self.aov) layout.addWidget(self.table) # ===================================================================== self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) edit_button = QtWidgets.QPushButton(hou.qt.createIcon("BUTTONS_edit"), "Edit") edit_button.setToolTip("Edit this AOV.") self.button_box.addButton(edit_button, QtWidgets.QDialogButtonBox.ResetRole) edit_button.clicked.connect(self.edit) # ===================================================================== delete_button = QtWidgets.QPushButton( hou.qt.createIcon("COMMON_delete"), "Delete") self.button_box.addButton(delete_button, QtWidgets.QDialogButtonBox.ResetRole) delete_button.setToolTip("Delete this AOV.") delete_button.clicked.connect(self.delete) # ===================================================================== self.table.resizeColumnToContents(0) self.setMinimumSize(self.table.size())
def icon(self): """Icon for this AOV.""" return utils.getIconFromVexType(self.item.vextype)
def initUI(self): """Initialize the UI.""" layout = QtGui.QVBoxLayout() self.setLayout(layout) # ===================================================================== help_layout = QtGui.QHBoxLayout() layout.addLayout(help_layout) help_layout.addStretch(1) help_layout.addWidget(widgets.HelpButton("aov_dialog")) # ===================================================================== grid_layout = QtGui.QGridLayout() layout.addLayout(grid_layout) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("VEX Variable"), 1, 0) self.variable_name = QtGui.QLineEdit() grid_layout.addWidget(self.variable_name, 1, 1) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("VEX Type"), 2, 0) self.type_box = QtGui.QComboBox() grid_layout.addWidget(self.type_box, 2, 1) for entry in uidata.VEXTYPE_MENU_ITEMS: icon = utils.getIconFromVexType(entry[0]) self.type_box.addItem( icon, entry[1], entry[0] ) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Channel Name"), 3, 0) self.channel_name = QtGui.QLineEdit() grid_layout.addWidget(self.channel_name, 3, 1) self.channel_name.setToolTip( "Optional channel name Mantra will rename the AOV to." ) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Quantize"), 4, 0) self.quantize_box = QtGui.QComboBox() grid_layout.addWidget(self.quantize_box, 4, 1) for entry in uidata.QUANTIZE_MENU_ITEMS: self.quantize_box.addItem(entry[1], entry[0]) self.quantize_box.setCurrentIndex(2) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Sample Filter"), 5, 0) self.sfilter_box = QtGui.QComboBox() grid_layout.addWidget(self.sfilter_box, 5, 1) for entry in uidata.SFILTER_MENU_ITEMS: self.sfilter_box.addItem(entry[1], entry[0]) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Pixel Filter"), 6, 0) self.pfilter_widget = widgets.MenuField( uidata.PFILTER_MENU_ITEMS ) grid_layout.addWidget(self.pfilter_widget, 6, 1) # ===================================================================== grid_layout.setRowMinimumHeight(7, 25) # ===================================================================== self.componentexport = QtGui.QCheckBox() grid_layout.addWidget(self.componentexport, 8, 0) grid_layout.addWidget( QtGui.QLabel("Export variable for each component"), 8, 1 ) # ===================================================================== self.components_label = QtGui.QLabel("Export Components") grid_layout.addWidget(self.components_label, 9, 0) self.components_label.setDisabled(True) self.components = QtGui.QLineEdit() grid_layout.addWidget(self.components, 9, 1) self.components.setDisabled(True) self.components.setToolTip( "Shading component names. Leaving this field empty will use the components" \ " selected on the Mantra ROP." ) self.componentexport.stateChanged.connect(self.enableComponents) # ===================================================================== grid_layout.setRowMinimumHeight(10, 25) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Light Exports"), 11, 0) self.lightexport = QtGui.QComboBox() grid_layout.addWidget(self.lightexport, 11, 1) for entry in uidata.LIGHTEXPORT_MENU_ITEMS: self.lightexport.addItem(entry[1], entry[0]) self.lightexport.currentIndexChanged.connect(self.enableExports) # ===================================================================== self.light_mask_label = QtGui.QLabel("Light Mask") grid_layout.addWidget(self.light_mask_label, 12, 0) self.light_mask_label.setDisabled(True) self.light_mask = QtGui.QLineEdit() grid_layout.addWidget(self.light_mask, 12, 1) self.light_mask.setText("*") self.light_mask.setDisabled(True) # ===================================================================== self.light_select_label = QtGui.QLabel("Light Selection") grid_layout.addWidget(self.light_select_label, 13, 0) self.light_select_label.setDisabled(True) self.light_select = QtGui.QLineEdit() grid_layout.addWidget(self.light_select, 13, 1) self.light_select.setText("*") self.light_select.setDisabled(True) # ===================================================================== grid_layout.setRowMinimumHeight(14, 25) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Priority"), 15, 0) self.priority = widgets.CustomSpinBox() grid_layout.addWidget(self.priority, 15, 1) self.priority.setMinimum(-1) self.priority.setValue(-1) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Intrinsic"), 16, 0) self.intrinsic = QtGui.QLineEdit() grid_layout.addWidget(self.intrinsic, 16, 1) self.intrinsic.setToolTip( "Optional intrinsic group for automatic group addition, eg. Diagnostic" ) # ===================================================================== grid_layout.setRowMinimumHeight(17, 25) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("Comment"), 18, 0) self.comment = QtGui.QLineEdit() grid_layout.addWidget(self.comment, 18, 1) self.comment.setToolTip( "Optional comment, eg. 'This AOV represents X'." ) # ===================================================================== grid_layout.setRowMinimumHeight(19, 25) # ===================================================================== grid_layout.addWidget(QtGui.QLabel("File Path"), 20, 0) self.file_widget = widgets.FileChooser() grid_layout.addWidget(self.file_widget, 20, 1) # ===================================================================== self.status_widget = widgets.StatusMessageWidget() layout.addWidget(self.status_widget) # ===================================================================== self.button_box = QtGui.QDialogButtonBox( QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel ) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.validInputSignal.connect(self.enableCreation)
def initUI(self): """Initialize the UI.""" layout = QtGui.QVBoxLayout() self.setLayout(layout) self.aov_chooser = QtGui.QComboBox() layout.addWidget(self.aov_chooser) # Start menu index. start_idx = -1 # Populate the AOV chooser with all the existing AOVs. for idx, aov in enumerate(sorted(manager.MANAGER.aovs.values())): # If a channel is specified, put it into the display name. if aov.channel is not None: label = "{0} ({1})".format( aov.variable, aov.channel ) else: label = aov.variable self.aov_chooser.addItem( utils.getIconFromVexType(aov.vextype), label, aov ) # The AOV matches our start AOV so set the start index. if aov == self.aov: start_idx = idx if start_idx != -1: self.aov_chooser.setCurrentIndex(start_idx) self.aov_chooser.currentIndexChanged.connect(self.selectionChanged) # ===================================================================== self.table = widgets.AOVInfoTableView(self.aov) layout.addWidget(self.table) # ===================================================================== self.button_box = QtGui.QDialogButtonBox( QtGui.QDialogButtonBox.Ok ) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) edit_button = QtGui.QPushButton( hou.ui.createQtIcon("BUTTONS_edit"), "Edit" ) edit_button.setToolTip("Edit this AOV.") self.button_box.addButton(edit_button, QtGui.QDialogButtonBox.HelpRole) edit_button.clicked.connect(self.edit) # ===================================================================== delete_button = QtGui.QPushButton( hou.ui.createQtIcon("COMMON_delete"), "Delete" ) self.button_box.addButton(delete_button, QtGui.QDialogButtonBox.HelpRole) delete_button.setToolTip("Delete this AOV.") delete_button.clicked.connect(self.delete) # ===================================================================== self.table.resizeColumnToContents(0) self.setMinimumSize(self.table.size())
def initUI(self): """Initialize the UI.""" layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # ===================================================================== help_layout = QtWidgets.QHBoxLayout() layout.addLayout(help_layout) help_layout.addStretch(1) help_layout.addWidget(widgets.HelpButton("aov_dialog")) # ===================================================================== grid_layout = QtWidgets.QGridLayout() layout.addLayout(grid_layout) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("VEX Variable"), 1, 0) self.variable_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.variable_name, 1, 1) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("VEX Type"), 2, 0) self.type_box = QtWidgets.QComboBox() grid_layout.addWidget(self.type_box, 2, 1) for entry in uidata.VEXTYPE_MENU_ITEMS: icon = utils.getIconFromVexType(entry[0]) self.type_box.addItem( icon, entry[1], entry[0] ) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Channel Name"), 3, 0) self.channel_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.channel_name, 3, 1) self.channel_name.setToolTip( "Optional channel name Mantra will rename the AOV to." ) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Quantize"), 4, 0) self.quantize_box = QtWidgets.QComboBox() grid_layout.addWidget(self.quantize_box, 4, 1) for entry in uidata.QUANTIZE_MENU_ITEMS: self.quantize_box.addItem(entry[1], entry[0]) self.quantize_box.setCurrentIndex(2) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Sample Filter"), 5, 0) self.sfilter_box = QtWidgets.QComboBox() grid_layout.addWidget(self.sfilter_box, 5, 1) for entry in uidata.SFILTER_MENU_ITEMS: self.sfilter_box.addItem(entry[1], entry[0]) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Pixel Filter"), 6, 0) self.pfilter_widget = widgets.MenuField( uidata.PFILTER_MENU_ITEMS ) grid_layout.addWidget(self.pfilter_widget, 6, 1) # ===================================================================== grid_layout.setRowMinimumHeight(7, 25) # ===================================================================== self.componentexport = QtWidgets.QCheckBox() grid_layout.addWidget(self.componentexport, 8, 0) grid_layout.addWidget( QtWidgets.QLabel("Export variable for each component"), 8, 1 ) # ===================================================================== self.components_label = QtWidgets.QLabel("Export Components") grid_layout.addWidget(self.components_label, 9, 0) self.components_label.setDisabled(True) self.components = QtWidgets.QLineEdit() grid_layout.addWidget(self.components, 9, 1) self.components.setDisabled(True) self.components.setToolTip( "Shading component names. Leaving this field empty will use the components" \ " selected on the Mantra ROP." ) self.componentexport.stateChanged.connect(self.enableComponents) # ===================================================================== grid_layout.setRowMinimumHeight(10, 25) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Light Exports"), 11, 0) self.lightexport = QtWidgets.QComboBox() grid_layout.addWidget(self.lightexport, 11, 1) for entry in uidata.LIGHTEXPORT_MENU_ITEMS: self.lightexport.addItem(entry[1], entry[0]) self.lightexport.currentIndexChanged.connect(self.enableExports) # ===================================================================== self.light_mask_label = QtWidgets.QLabel("Light Mask") grid_layout.addWidget(self.light_mask_label, 12, 0) self.light_mask_label.setDisabled(True) self.light_mask = QtWidgets.QLineEdit() grid_layout.addWidget(self.light_mask, 12, 1) self.light_mask.setText("*") self.light_mask.setDisabled(True) # ===================================================================== self.light_select_label = QtWidgets.QLabel("Light Selection") grid_layout.addWidget(self.light_select_label, 13, 0) self.light_select_label.setDisabled(True) self.light_select = QtWidgets.QLineEdit() grid_layout.addWidget(self.light_select, 13, 1) self.light_select.setText("*") self.light_select.setDisabled(True) # ===================================================================== grid_layout.setRowMinimumHeight(14, 25) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Priority"), 15, 0) self.priority = widgets.CustomSpinBox() grid_layout.addWidget(self.priority, 15, 1) self.priority.setMinimum(-1) self.priority.setValue(-1) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Intrinsic"), 16, 0) self.intrinsic = QtWidgets.QLineEdit() grid_layout.addWidget(self.intrinsic, 16, 1) self.intrinsic.setToolTip( "Optional intrinsic group for automatic group addition, eg. Diagnostic" ) # ===================================================================== grid_layout.setRowMinimumHeight(17, 25) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Comment"), 18, 0) self.comment = QtWidgets.QLineEdit() grid_layout.addWidget(self.comment, 18, 1) self.comment.setToolTip( "Optional comment, eg. 'This AOV represents X'." ) # ===================================================================== grid_layout.setRowMinimumHeight(19, 25) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("File Path"), 20, 0) self.file_widget = widgets.FileChooser() grid_layout.addWidget(self.file_widget, 20, 1) # ===================================================================== self.status_widget = widgets.StatusMessageWidget() layout.addWidget(self.status_widget) # ===================================================================== self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel ) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.validInputSignal.connect(self.enableCreation)