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.get_icon_for_vex_type(value.vextype) return None
def __init__(self, parent=None): # pylint: disable=too-many-statements super(_BaseAOVDialog, self).__init__(parent) # UI elements are valid. self._variable_valid = False self._file_valid = False 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.setSpacing(5) 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 = widgets.ComboBox() grid_layout.addWidget(self.type_box, row, 1) for entry in uidata.VEXTYPE_MENU_ITEMS: icon = utils.get_icon_for_vex_type(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 = widgets.ComboBox() 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 = widgets.ComboBox() 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, 15) row += 1 # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Exclude from DCM"), row, 0) self.exclude_from_dcm = hou.qt.createCheckBox() grid_layout.addWidget(self.exclude_from_dcm, row, 1) row += 1 # --------------------------------------------------------------------- grid_layout.setRowMinimumHeight(row, 15) row += 1 # --------------------------------------------------------------------- self.export_label = QtWidgets.QLabel("Export variable \nfor each component") grid_layout.addWidget(self.export_label, row, 0, 2, 1) self.componentexport = hou.qt.createCheckBox() 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 = widgets.ComboBox() 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.enable_exports) 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.enable_component_mode) self.component_mode.currentIndexChanged.connect(self.enable_components) row += 1 # --------------------------------------------------------------------- grid_layout.setRowMinimumHeight(row, 15) row += 1 # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Light Exports"), row, 0) self.lightexport = widgets.ComboBox() 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.enable_exports) 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, 15) row += 1 # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Priority"), row, 0) self.priority = QtWidgets.QSpinBox() 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, 15) 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, 15) 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.valid_input_signal.connect(self.enable_creation) # --------------------------------------------------------------------- self.setMinimumWidth(450)
def __init__(self, aov, parent=None): super(AOVInfoDialog, self).__init__(parent) self._edit_dialog = None self._aov = aov self.setWindowTitle("View AOV Info") # Initialize UI layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self.aov_chooser = widgets.ComboBox() layout.addWidget(self.aov_chooser) # Start menu index. start_idx = -1 # Populate the AOV chooser with all the existing AOVs. for idx, available_aov in enumerate(sorted(manager.MANAGER.aovs.values())): # If a channel is specified, put it into the display name. if available_aov.channel is not None: label = "{} ({})".format(available_aov.variable, available_aov.channel) else: label = available_aov.variable self.aov_chooser.addItem( utils.get_icon_for_vex_type(available_aov.vextype), label, available_aov ) # The AOV matches our start AOV so set the start index. if available_aov == self.aov: start_idx = idx if start_idx != -1: self.aov_chooser.setCurrentIndex(start_idx) self.aov_chooser.currentIndexChanged.connect(self.aov_selection_changed) # --------------------------------------------------------------------- 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.get_icon_for_vex_type(self.item.vextype)