def addClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            msg = 'Cannot add markers, active collection is not defined.'
            LOG.warning(msg)
            return

        sel = lib_maya_utils.get_scene_selection()
        mkr_list = lib_maya_utils.get_markers_from_selection()
        if len(mkr_list) == 0:
            msg = 'Please select objects, found no markers.'
            LOG.warning(msg)
            return
        lib_marker.add_markers_to_collection(mkr_list, col)

        def update_func():
            if uiutils.isValidQtObject(self) is False:
                return
            self.dataChanged.emit()
            self.viewUpdated.emit()
            return

        # Add Callbacks
        callback_manager = self.callback_manager
        if callback_manager is not None:
            lib_marker.add_callbacks_to_markers(mkr_list, update_func,
                                                callback_manager)

        update_func()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
    def addClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            msg = 'Cannot add markers, active collection is not defined.'
            LOG.warning(msg)
            return

        sel = lib_maya_utils.get_scene_selection()
        mkr_list = lib_maya_utils.get_markers_from_selection()
        if len(mkr_list) == 0:
            msg = 'Please select objects, found no markers.'
            LOG.warning(msg)
            return
        lib_marker.add_markers_to_collection(mkr_list, col)

        # Add Callbacks
        callback_manager = self.callback_manager
        if callback_manager is not None:
            lib_marker.add_callbacks_to_markers(
                mkr_list,
                callback_manager
            )

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
Esempio n. 3
0
def show_deviation():
    """
    Open the Maya Graph Editor, showing Deviation curves of selected markers.
    """
    # Get Selected Markers, if camera is selected, all markers
    # underneath are used.
    mkr_list = solver_maya_utils.get_markers_from_selection()
    mkr_nodes = [mkr.get_node() for mkr in mkr_list]
    if len(mkr_nodes) == 0:
        msg = 'No Markers found from selection. No deviation to display.'
        LOG.warning(msg)
        return
    maya.cmds.select(mkr_nodes, replace=True)

    # Open Maya Graph Editor, only show 'deviation' attribute.
    #
    # Note: 'graphEditor1OutlineEd' and 'graphEditor1GraphEd' are
    # constants used by Maya since v1.0. We should dynamically look
    # these up, if possible.
    cmd = (
        'GraphEditor;'
        'filterUISelectAttributesCheckbox deviation 1 graphEditor1OutlineEd;'
        'GraphEditorAbsoluteView;'
        'animCurveEditor -autoFit graphEditor1GraphEd;')
    maya.mel.eval(cmd)
    return
Esempio n. 4
0
    def objectAddClicked(self):
        col = lib_state.get_active_collection()
        if col is None:
            msg = 'Cannot add markers, active collection is not defined.'
            LOG.warning(msg)
            return

        sel = lib_maya_utils.get_scene_selection()
        mkr_list = lib_maya_utils.get_markers_from_selection()
        if len(mkr_list) == 0:
            msg = 'Please select objects, found no markers.'
            LOG.warning(msg)
            return
        lib_marker.add_markers_to_collection(mkr_list, col)

        def update_func():
            if uiutils.isValidQtObject(self) is False:
                return
            self.updateObjectToggleButtons()
            self.updateObjectColumnVisibility()
            self.updateObjectModel()
            self.updateSolveValidState()
            return

        # Add Callbacks
        callback_manager = self.getCallbackManager()
        if callback_manager is not None:
            lib_marker.add_callbacks_to_markers(mkr_list, update_func,
                                                callback_manager)

        update_func()

        # Restore selection.
        lib_maya_utils.set_scene_selection(sel)
        return
Esempio n. 5
0
    def objectAddClicked(self):
        mkr_list = lib_maya_utils.get_markers_from_selection()
        if len(mkr_list) == 0:
            msg = 'Please select objects, found no markers.'
            LOG.warning(msg)
            return
        col = lib_state.get_active_collection()
        if col is None:
            msg = 'Cannot add markers, active collection is not defined.'
            LOG.warning(msg)
            return
        lib_marker.add_markers_to_collection(mkr_list, col)

        def update_func():
            self.updateObjectModel()
            self.updateSolveValidState()
            self.setStatusLine(const.STATUS_READY)
            return

        # Add Callbacks
        callback_manager = self.getCallbackManager()
        if callback_manager is not None:
            lib_marker.add_callbacks_to_markers(
                mkr_list,
                update_func,
                callback_manager
            )

        update_func()
        return