def clampValues(value=0, selectionOption=1, clampOption=0): keySel = _getKeySelection(selectionOption) for curve, values in zip(keySel.curves, keySel.values): indicies = None if clampOption==0: indicies = [i for i, x in enumerate(values) if x > value] elif clampOption==1: indicies = [i for i, x in enumerate(values) if x < value] if indicies: mc.keyframe(curve, index=utl.castToTime(indicies), edit=True, valueChange=value) mc.keyTangent(curve, index=utl.castToTime(indicies), itt='auto', ott='auto')
def deleteSubFrameKeys(selectionOption=1): keySel = _getKeySelection(selectionOption) for curve, times in zip(keySel.curves, keySel.times): cutTimes = [x for x in times if x % 1 != 0 and -9999 < x < 9999] if cutTimes: mc.cutKey(curve, time=utl.castToTime(cutTimes))
def deleteRedundantKeys(selectionOption=1): keySel = _getKeySelection(selectionOption) for curve, values in zip(keySel.curves, keySel.values): groups = [list(g) for k, g in itertools.groupby(values)] i = -1 cutIndex = list() for group in groups: gsize = len(group) if gsize > 2: cutIndex.extend(range(i + 2, i + gsize)) i += gsize if cutIndex: mc.cutKey(curve, index=utl.castToTime(cutIndex))
def deleteRedundantKeys(selectionOption=1): keySel = _getKeySelection(selectionOption) for curve, values in zip(keySel.curves, keySel.values): groups = [list(g) for k, g in itertools.groupby(values)] i = -1 cutIndex = list() for group in groups: gsize = len(group) if gsize > 2: cutIndex.extend(range(i+2,i+gsize)) i+=gsize if cutIndex: mc.cutKey(curve, index=utl.castToTime(cutIndex))