コード例 #1
0
ファイル: main.py プロジェクト: luckylyk/ncachefactory
 def __init__(self, text, child, parent=None):
     super(Expander, self).__init__(parent)
     self.setStyleSheet('text-align: left; font: bold')
     self.setFixedHeight(20)
     self.icons = get_icon('arrow_close.png'), get_icon('arrow_open.png')
     self.setText(text)
     self.child = child
     self.state = True
     self.setIcon(self.icons[int(self.state)])
     self.clicked.connect(self._call_clicked)
コード例 #2
0
    def get_icon(self, dynamic_node):
        if dynamic_node != self.last_dynamic_node_set:
            self.last_dynamic_node_set = dynamic_node
            self.icons = None

        if self.icons is None:
            self.icons = (
                get_icon(dynamic_node.ICONS['off']),
                get_icon(dynamic_node.ICONS['on']))

        return self.icons[bool(dynamic_node.enable)]
コード例 #3
0
    def get_icon(self, dynamic_node):
        if dynamic_node != self.last_dynamic_node_set:
            self.last_dynamic_node_set = dynamic_node
            self.icons = None

        if self.icons is None:
            self.icons = (
                get_icon(dynamic_node.ICONS[self.OFF_ICON_NAME]),
                get_icon(dynamic_node.ICONS[self.ON_ICON_NAME]))

        return self.icons[bool(dynamic_node.visible)]
コード例 #4
0
ファイル: infos.py プロジェクト: luckylyk/ncachefactory
    def __init__(self, parent=None):
        super(CacheversionToolbar, self).__init__(parent)
        self.setIconSize(QtCore.QSize(15, 15))
        self.sort_type = 0

        # self.filter = QtWidgets.QAction(get_icon('filter.png'), '', self)
        # self.filter.setToolTip('Filter versions available for selected nodes')
        # self.filter.setCheckable(True)
        self.sort = QtWidgets.QAction(get_icon('sort.png'), '', self)
        self.sort.setToolTip('Sort version by')

        self.sort_menu = QtWidgets.QMenu()
        self.name = QtWidgets.QAction("Name", self)
        self.name.setCheckable(True)
        self.name.triggered.connect(partial(self.set_sort_type, 0))
        self.last_modification = QtWidgets.QAction("Last modification", self)
        self.last_modification.setCheckable(True)
        method = partial(self.set_sort_type, 1)
        self.last_modification.triggered.connect(method)
        self.creation = QtWidgets.QAction("Creation date", self)
        self.creation.setCheckable(True)
        self.creation.triggered.connect(partial(self.set_sort_type, 2))

        self.sort_menu.addAction(self.name)
        self.sort_menu.addAction(self.last_modification)
        self.sort_menu.addAction(self.creation)
        self.sort.setMenu(self.sort_menu)

        # self.addAction(self.filter)
        self.addAction(self.sort)
        # update chevecked action menu
        index = cmds.optionVar(query=CACHEVERSION_SORTING_TYPE_OPTIONVAR)
        self.set_sort_type(index, emit=False)
コード例 #5
0
    def __init__(self, parent=None):
        super(WorkspaceWidget, self).__init__(parent)
        self.workspace = None
        self.callbacks = []
        self.label = QtWidgets.QLabel("Workspace")
        self.label.setFixedWidth(60)
        self.workspace_combo = QtWidgets.QComboBox()
        self.workspace_combo.setFixedWidth(300)
        self.workspace_combo.setEditable(True)
        self.workspace_combo.activated.connect(self._call_set_workspace)
        self.button = QtWidgets.QPushButton(get_icon("folder.png"), "")
        self.button.setFixedSize(22, 22)
        self.button.released.connect(self.get_directory)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        self.layout.addWidget(self.label)
        self.layout.addStretch(1)
        self.layout.addSpacing(8)
        self.layout.addWidget(self.workspace_combo)
        self.layout.addWidget(self.button)

        self.populate()
        self.register_callbacks()
コード例 #6
0
class SwitcherDelegate(QtWidgets.QStyledItemDelegate):
    """ this delegate is an icon 'on' or 'off' defined by the dynamic node
    given by the table model. It switch the dynamic node state en clic
    """
    ICONSIZE = 24, 24
    LOCKED_ICON = get_icon("locker.png")
    LOCKED_CHECK_ATTRIBUTE = None
    ON_ICON_NAME = None
    OFF_ICON_NAME = None
    LOCKED_CHECK_ATTRIBUTE = None

    def __init__(self, table):
        super(SwitcherDelegate, self).__init__(table)
        self._model = table.model()
        self.icons = None
        to_check_attributes = (
            self.ON_ICON_NAME, self.OFF_ICON_NAME, self.LOCKED_CHECK_ATTRIBUTE)
        if any([attr is None for attr in to_check_attributes]):
            raise NotImplementedError

    def get_icon(self, dynamic_node):
        if dynamic_node != self.last_dynamic_node_set:
            self.last_dynamic_node_set = dynamic_node
            self.icons = None

        if self.icons is None:
            self.icons = (
                get_icon(dynamic_node.ICONS[self.OFF_ICON_NAME]),
                get_icon(dynamic_node.ICONS[self.ON_ICON_NAME]))

        return self.icons[bool(dynamic_node.visible)]

    def paint(self, painter, option, index):
        dynamic_node = self._model.data(index, QtCore.Qt.UserRole)
        icon = self.get_icon(dynamic_node)
        pixmap = icon.pixmap(24, 24).scaled(
            QtCore.QSize(*self.ICONSIZE),
            transformMode=QtCore.Qt.SmoothTransformation)
        left = option.rect.center().x() - 8
        top = option.rect.center().y() - 8
        rect = QtCore.QRect(left, top, 16, 16)
        painter.drawPixmap(rect, pixmap)

        # draw Locker
        if self.LOCKED_CHECK_ATTRIBUTE is None:
            return
        if getattr(dynamic_node, self.LOCKED_CHECK_ATTRIBUTE) is False:
            return
        pixmap = self.LOCKED_ICON.pixmap(15, 15).scaled(
            QtCore.QSize(15, 15),
            transformMode=QtCore.Qt.SmoothTransformation)
        left = option.rect.right() - 15
        top = option.rect.bottom() - 15
        rect = QtCore.QRect(left, top, 15, 15)
        painter.drawPixmap(rect, pixmap)

    def sizeHint(self, *args):
        return QtCore.QSize(24, 24)
コード例 #7
0
ファイル: main.py プロジェクト: luckylyk/ncachefactory
    def __init__(self):
        super(BrowserLine, self).__init__()
        self.text = QtWidgets.QLineEdit()
        self.button = QtWidgets.QPushButton(get_icon("folder.png"), "")
        self.button.setFixedSize(22, 22)

        self.layout = QtWidgets.QHBoxLayout(self)
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)
        self.layout.addWidget(self.text)
        self.layout.addWidget(self.button)
コード例 #8
0
    def __init__(self, table, parent=None):
        super(TableToolBar, self).__init__(parent)
        self.table = table
        self.setIconSize(QtCore.QSize(15, 15))
        self.selection = QtWidgets.QAction(get_icon('select.png'), '', self)
        self.selection.setToolTip('select maya dynamic shapes')
        self.selection.triggered.connect(self.select_nodes)
        self.select_cache = QtWidgets.QAction(get_icon('select.png'), '', self)
        self.select_cache.setToolTip('select connected cache/blend nodes')
        self.select_cache.triggered.connect(self.select_cache_nodes)
        self.interactive = QtWidgets.QAction(get_icon('link.png'), '', self)
        self.interactive.setCheckable(True)
        self.interactive.setToolTip('interactive selection')
        self.switch = QtWidgets.QAction(get_icon('on_off.png'), '', self)
        self.switch.setToolTip('on/off selected dynamic shapes')
        self.switch.triggered.connect(self.switch_nodes)
        icon = get_icon('visibility.png')
        self.visibility = QtWidgets.QAction(icon, '', self)
        self.visibility.setToolTip('swith visibility state')
        self.visibility.triggered.connect(self.switch_nodes_visibility)
        self.delete = QtWidgets.QAction(get_icon('trash.png'), '', self)
        self.delete.setToolTip('remove cache connected')
        self.delete.triggered.connect(self.clear_connected_caches)
        self.filter = QtWidgets.QAction(get_icon('filter.png'), '', self)
        self.filter.setToolTip('exclude node to manager')
        self.filter.triggered.connect(self.showFilterRequested.emit)

        self.addAction(self.selection)
        self.addAction(self.select_cache)
        self.addAction(self.interactive)
        self.addSeparator()
        self.addAction(self.switch)
        self.addAction(self.visibility)
        self.addAction(self.delete)
        self.addSeparator()
        self.addAction(self.filter)
コード例 #9
0
    def __init__(self, parent=None):
        super(BatchCacher, self).__init__(parent)
        self.setFixedHeight(350)
        self.workspace = None
        self.selection_model = None
        self.model = MultiCacheTableModel()
        self.table = MultiCacheTableView()
        self.table.set_model(self.model)

        self.flash = QtWidgets.QAction(get_icon("flash.png"), '', self)
        self.flash.setToolTip("Save current scene and add it to job queue")
        self.flash.triggered.connect(self._call_flash_scene)
        self.remove = QtWidgets.QAction(get_icon("trash.png"), '', self)
        self.remove.setToolTip("Remove selected scene from job queue")
        self.remove.triggered.connect(self._call_remove_selected_jobs)
        self.toolbar = QtWidgets.QToolBar()
        self.toolbar.setIconSize(QtCore.QSize(15, 15))
        self.toolbar.addAction(self.flash)
        self.toolbar.addAction(self.remove)
        self.cache_selection = QtWidgets.QPushButton('Cache selection')
        self.cache_selection.setEnabled(False)
        method = self.sendMultiCacheSelectionRequested.emit
        self.cache_selection.released.connect(method)
        self.cache_all = QtWidgets.QPushButton('Cache all')
        self.cache_all.setEnabled(False)
        self.cache_all.released.connect(self.sendMultiCacheRequested.emit)

        self.menu_layout = QtWidgets.QHBoxLayout()
        self.menu_layout.addStretch(1)
        self.menu_layout.addWidget(self.toolbar)
        self.multicache = QtWidgets.QWidget()
        self.multicache_layout = QtWidgets.QVBoxLayout(self.multicache)
        self.multicache_layout.setSpacing(2)
        self.multicache_layout.addWidget(self.table)
        self.multicache_layout.addLayout(self.menu_layout)
        self.multicache_layout.addSpacing(4)
        self.multicache_layout.addWidget(self.cache_selection)
        self.multicache_layout.addWidget(self.cache_all)

        self._wedging_name = QtWidgets.QLineEdit()
        self._wedging_name.textEdited.connect(self.update_wedging_tabs_states)
        self._wedging_name.setText(WEDGINGCACHE_NAME)
        self._attribute = QtWidgets.QLineEdit()
        self._attribute.textEdited.connect(self.update_wedging_tabs_states)
        self._pick = QtWidgets.QPushButton(get_icon("pipette.png"), "")
        self._pick.setToolTip("Pick selected channel in channel editor")
        self._pick.setFixedSize(18, 18)
        self._pick.released.connect(self._call_pick_attribute)
        self._find = QtWidgets.QPushButton(get_icon("magnifyingglass.png"), "")
        self._find.setToolTip("Find attribute in selection")
        self._find.setFixedSize(18, 18)
        self._find.released.connect(self._call_find_attribute)
        self._values = QtWidgets.QLineEdit()
        self._values.textEdited.connect(self.update_wedging_tabs_states)
        self._values_builder = QtWidgets.QPushButton(get_icon("hammer.png"),
                                                     "")
        self._values_builder.setToolTip("Build value list")
        self._values_builder.setFixedSize(18, 18)
        self._values_builder.released.connect(self._call_values_builder)

        self.cache_wedging = QtWidgets.QPushButton("Cache all")
        method = partial(self._send_wedging_cache, selection=False)
        self.cache_wedging.released.connect(method)
        self.cache_wedging.setEnabled(False)
        self.cache_wedging_selection = QtWidgets.QPushButton("Cache selection")
        method = partial(self._send_wedging_cache, selection=True)
        self.cache_wedging_selection.released.connect(method)
        self.cache_wedging_selection.setEnabled(False)

        self.attribute_layout = QtWidgets.QHBoxLayout()
        self.attribute_layout.setContentsMargins(0, 0, 0, 0)
        self.attribute_layout.setSpacing(0)
        self.attribute_layout.addWidget(self._attribute)
        self.attribute_layout.addWidget(self._pick)
        self.attribute_layout.addWidget(self._find)

        self.values_layout = QtWidgets.QHBoxLayout()
        self.values_layout.setContentsMargins(0, 0, 0, 0)
        self.values_layout.setSpacing(0)
        self.values_layout.addWidget(self._values)
        self.values_layout.addWidget(self._values_builder)

        self.wedging = QtWidgets.QWidget()
        self.wedging_form = QtWidgets.QFormLayout()
        self.wedging_form.setSpacing(2)
        self.wedging_form.addRow("Name", self._wedging_name)
        self.wedging_form.addRow("Attribute", self.attribute_layout)
        self.wedging_form.addRow("Values", self.values_layout)
        self.wedging_layout = QtWidgets.QVBoxLayout(self.wedging)
        self.wedging_layout.setSpacing(2)
        self.wedging_layout.addLayout(self.wedging_form)
        self.wedging_layout.addWidget(self.cache_wedging_selection)
        self.wedging_layout.addWidget(self.cache_wedging)

        self.tabwidget = QtWidgets.QTabWidget()
        self.tabwidget.addTab(self.multicache, "Multi scenes")
        self.tabwidget.addTab(self.wedging, "Attribute wedging")

        self.options = SimulationKillerOptions()
        self.options_layout = QtWidgets.QHBoxLayout()
        self.options_layout.addWidget(self.options)
        self.killer_group = QtWidgets.QGroupBox('Auto kill simulation options')
        self.killer_group.setLayout(self.options_layout)

        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.tabwidget)
        self.layout.addWidget(self.killer_group)