Exemplo n.º 1
0
    def __init__(self):
        super(DockableWindow, self).__init__()

        self.shown = False

        # Build our *.ui files into qt/resources, so the subclass can load its layout.
        qt_helpers.compile_all_layouts()

        # How do we make our window handle global hotkeys?
        undo = Qt.QAction('Undo', self)
        undo.setShortcut(Qt.Qt.CTRL + Qt.Qt.Key_Z)
        undo.triggered.connect(lambda: pm.undo())
        self.addAction(undo)

        redo = Qt.QAction('Redo', self)
        redo.setShortcut(Qt.Qt.CTRL + Qt.Qt.Key_Y)
        redo.triggered.connect(lambda: pm.redo(redo=True))
        self.addAction(redo)

        style = ''
        # Maya's checkbox style makes the checkbox invisible when it's deselected,
        # which makes it impossible to tell that there's even a checkbox there to
        # click.  Adjust the background color to fix this.
        style += 'QTreeView::indicator:unchecked { background-color: #000; }'

        # Make tree and list view items slightly larger by default.
        style += 'QTreeView::item { height: 20px; }'
        style += 'QListView::item { height: 26px; }'
        self.setStyleSheet(self.styleSheet() + style)
Exemplo n.º 2
0
    def __init__(self):
        super(KeyframeNamingWindow, self).__init__()

        self.callback_ids = om.MCallbackIdArray()
        self._reregister_callback_queued = False

        self.frames_in_list = []
        self._currently_refreshing = False
        self._currently_setting_selection = False
        self._listening_to_singleton = None
        self._listening_to_anim_curve = None

        self.time_change_listener = maya_helpers.TimeChangeListener(self._time_changed)

        from .qt_generated import keyframe_naming
        reload(keyframe_naming)

        self._ui = keyframe_naming.Ui_keyframe_naming()
        self._ui.setupUi(self)

        self._ui.removeFrame.clicked.connect(self.delete_selected_frame)
        self._ui.renameFrame.clicked.connect(self.rename_selected_frame)
        self._ui.addFrame.clicked.connect(self.add_new_frame)
        self._ui.frameList.itemDelegate().commitData.connect(self.frame_name_edited)
        self._ui.frameList.itemDelegate().closeEditor.connect(self.name_editor_closed)
        self._ui.frameList.itemSelectionChanged.connect(self.selected_frame_changed)
        self._ui.frameList.itemClicked.connect(self.selected_frame_changed)
        self._ui.frameList.setContextMenuPolicy(Qt.Qt.CustomContextMenu)

        def context_menu(pos):
            # Activate the context menu for the selected item.
            item = self._ui.frameList.itemAt(pos)
            if item is None:
                return

            keyframe_context_menu = self._create_keyframe_context_menu(item)
            action = keyframe_context_menu.exec_(self._ui.frameList.mapToGlobal(pos))
            
        self._ui.frameList.customContextMenuRequested.connect(context_menu)

        # Create the menu.  Why can't this be done in the designer?
        menu_bar = Qt.QMenuBar()
        self.layout().setMenuBar(menu_bar)

        edit_menu = menu_bar.addMenu('Edit')
        menu_select_naming_node = Qt.QAction('Select zKeyframeNaming node', self)
        menu_select_naming_node.setStatusTip('Select the zKeyframeNaming node, to edit keyframes in the graph editor')
        menu_select_naming_node.triggered.connect(select_naming_node)
        edit_menu.addAction(menu_select_naming_node)
        
        add_arnold_attribute = Qt.QAction('Add Arnold attribute', self)
        add_arnold_attribute.setStatusTip('Add a custom Arnold attribute to export the current frame name to rendered EXR files')
        add_arnold_attribute.triggered.connect(connect_to_arnold)
        edit_menu.addAction(add_arnold_attribute)

        self.installEventFilter(self)
        self._ui.frameList.installEventFilter(self)
Exemplo n.º 3
0
 def add_menu_item(menu, text, func):
     action = Qt.QAction(text, menu)
     menu.addAction(action)
     action.triggered.connect(func)
     return action
Exemplo n.º 4
0
    def __init__(self):
        super(KeyingWindow, self).__init__()

        # How do we make our window handle global hotkeys?
        undo = Qt.QAction('Undo', self)
        undo.setShortcut(Qt.Qt.CTRL + Qt.Qt.Key_Z)
        undo.triggered.connect(lambda: pm.undo())
        self.addAction(undo)

        redo = Qt.QAction('Redo', self)
        redo.setShortcut(Qt.Qt.CTRL + Qt.Qt.Key_Y)
        redo.triggered.connect(lambda: pm.redo(redo=True))
        self.addAction(redo)

        self.weight_node = None
        self.shown = False
        self.callback_ids = om.MCallbackIdArray()

        self._currently_refreshing = False

        style = r'''
        /* Maya's checkbox style makes the checkbox invisible when it's deselected,
         * which makes it impossible to tell that there's even a checkbox there to
         * click.  Adjust the background color to fix this. */
        QTreeView::indicator:unchecked {
            background-color: #000;
        }
        '''
        self.setStyleSheet(style)

        self.time_change_listener = maya_helpers.TimeChangeListener(self._time_changed, pause_during_playback=False)

        # Make sure zMouthController has been generated.
        qt_helpers.compile_all_layouts()

        from zMayaTools.qt_widgets import draggable_progress_bar
        reload(draggable_progress_bar)

        from zMayaTools.qt_generated import zMouthController
        reload(zMouthController)

        self.ui = zMouthController.Ui_zMouthController()
        self.ui.setupUi(self)

        self.ui.selectionBar.setMinimum(0)
        self.ui.selectionBar.setMaximum(1000)
        self.ui.mainWeightBar.setMinimum(0)
        self.ui.mainWeightBar.setMaximum(1000)

        self.ui.selectNodeButton.clicked.connect(self.select_current_node)
        self.ui.shapeSelection1.currentIndexChanged.connect(self.shape1Changed)
        self.ui.shapeSelection2.currentIndexChanged.connect(self.shape2Changed)
        self.ui.selectedNodeDropdown.currentIndexChanged.connect(self.selectedNodeChanged)
        self.ui.setKeyShape1.clicked.connect(self.clicked_key_shape_1)
        self.ui.setKeyShape2.clicked.connect(self.clicked_key_shape_2)
        self.ui.keySelection.clicked.connect(self.clicked_key_selection)
        self.ui.keyMainWeight.clicked.connect(self.clicked_key_main_weight)
        self.ui.soloShape1.clicked.connect(self.solo_shape1)
        self.ui.soloShape2.clicked.connect(self.solo_shape2)
        self.ui.selectionBar.mouse_movement.connect(self.set_selection_bar_value)
        self.ui.mainWeightBar.mouse_movement.connect(self.set_main_weight)

        self.ui.selectionBar.set_undo_chunk_around_dragging('Dragging selection')
        self.ui.mainWeightBar.set_undo_chunk_around_dragging('Dragging weight')

        # This will call selectedNodeChanged, and trigger the rest of the refresh.
        self.refresh_weight_node_list()