示例#1
0
def toggleInfinityCycle():
    """Toggle infinite cycle with offset for curves on selected object(s)"""

    try:
        if "constant" not in pm.setInfinity(query=True, poi=True):
            pm.setInfinity(poi="constant", pri="constant")
        else:
            pm.setInfinity(poi="cycleRelative", pri="cycleRelative")
    except:
        pm.mel.warning("Select object(s) with animation curves.")

    pm.animCurveEditor("graphEditor1GraphEd", edit=True, displayInfinities="on")
示例#2
0
def toggleInfinityCycle():
    """Toggle infinite cycle with offset for curves on selected object(s)"""

    try:
        if 'constant' not in pm.setInfinity( query=True, poi=True ):
            pm.setInfinity( poi='constant', pri='constant' )
        else:
            pm.setInfinity( poi='cycleRelative', pri='cycleRelative' )
    except:
        mel.warning( 'Select object(s) with animation curves.' )

    pm.animCurveEditor( 'graphEditor1GraphEd', edit=True, displayInfinities='on' )
示例#3
0
def __get_curves():
    # type: () -> List[pmc.nodetypes.AnimCurve]
    available_curves = \
        pmc.keyframe(q=True, sl=True, name=True) or \
        pmc.animCurveEditor("graphEditor1GraphEd", q=True, curvesShown=True) or \
        []

    return [pmc.nodetypes.AnimCurve(crv) for crv in available_curves]
示例#4
0
def infinity_toggle():
    """toggle graph editor infinity display on/off"""
    if pm.animCurveEditor('graphEditor1GraphEd', exists=True):
        ge = 'graphEditor1GraphEd'
        if pm.animCurveEditor(ge, q=True, displayInfinities=True):
            pm.animCurveEditor(ge, edit=True, displayInfinities='off')
        else:
            pm.animCurveEditor(ge, edit=True, displayInfinities='on')
示例#5
0
def get_curves(direction=None):
    curves = pmc.animCurveEditor("graphEditor1GraphEd", q=True, curvesShown=True)
    log.debug(curves)
    if not curves:
        return []
    displayed_curves = [
        ("_".join(x.split("_")[:-1]), x.split("_")[-1])
        for x in curves
    ]
    log.debug(displayed_curves)
    keys = list(set(pmc.findKeyframe(x[0], attribute=x[1], which=direction) for x in displayed_curves))
    keys.sort()
    log.debug(keys)
    return keys
示例#6
0
def copyTangents():
    """nevermind, this is useless.
    just copy and paste the key in the graph editor
    and paste while at desired frame"""
    attrs = pmc.animCurveEditor("graphEditor1GraphEd",
                                q=True,
                                curvesShown=True)
    for attr in attrs:
        frames = pmc.keyframe(attrs, q=True, sl=True)
        if len(frames) != 2:
            pmc.error("Select a source key and a destination key")
        # must do angles BEFORE weights or there's weird behavior
        ia, oa = pmc.keyTangent(attr, q=True, t=frames[0], ia=True, oa=True)
        pmc.keyTangent(attr, e=True, t=frames[1], ia=ia, oa=oa)
        iw, ow = pmc.keyTangent(attr, q=True, t=frames[0], iw=True, ow=True)
        pmc.keyTangent(attr, e=True, t=frames[1], iw=iw, ow=ow)