Example #1
0
    along with this program.  If not, see <http://www.gnu.org/licenses/>.


'''

__version__ = '2.0'

from itertools import izip
import collections
import copy

import pymel.core as pm

from guppy_animation_tools import selectedAttributes, getLogger, internal

_log = getLogger(__name__)


# From python 3.5 docs, isclose()
def isFloatClose(a, b, rel_tol=1e-09, abs_tol=0.0):
    return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)


class PersistentSettings(object):
    '''
    Global persistent settings store.

    Uses pm.env.optionVars under the hood which may lead to some quirkieness.
    '''
    modes = ('blend', 'shift', 'average', 'default', 'shrink', 'level',
             'linear')
*******************************************************************************
'''

import collections

import maya.cmds as cmd
import maya.mel as mel
import pymel.core as pm
import maya.OpenMaya as om

import guppy_animation_tools as gat
from guppy_animation_tools import selectedAttributes


_log = gat.getLogger(__name__)


class KeyframeQueryFailed(Exception):
    pass


def toggleDebug():
    selectedAttributes.toggleDebug()


def setKey(insert=True, useSelectedCurves=True, usePartialCurveSelection=True):
    '''Sets clever keys.  Hohoho.

    If the mouse is over the graph editor, it keys the attributes
    selected there.  Otherwise it keys the attributes selected in the
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*******************************************************************************

    Author:........Jordan Hueckstaedt
    Website:.......RubberGuppy.com
    Email:[email protected]
'''

import maya.cmds as cmd
import maya.mel as mel
import pymel.core as pm

import guppy_animation_tools as gat

_log = gat.getLogger(__name__)

# Set to true to debug call traces.
traceCalls = False


def logCalled(func):
    """
    Decorator to print information about a function call for use while
    debugging.

    Prints function name, arguments, and call number when the function
    is called. Prints this information again along with the return value
    when the function returns.
    """
    def wrap(*args, **kwargs):
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

'''

from functools import partial

from guppy_animation_tools import getLogger, internal, slideAnimationKeys
from guppy_animation_tools.internal.qt import QtCore, QtGui, QtWidgets

_controller = slideAnimationKeys.controller


_log = getLogger(__name__)


class IntegerValidator(QtGui.QValidator):
    '''
    Validates lineEdit's for integer values
    '''
    def validate(self, inputString, pos):
        if inputString.startswith('-'):
            inputString = inputString[1:]
            if not inputString:
                return QtGui.QValidator.Intermediate

        for char in inputString:
            if not char.isdigit():
                return QtGui.QValidator.Invalid