• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.keyTangent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.keyTangent函数的典型用法代码示例。如果您正苦于以下问题:Python keyTangent函数的具体用法?Python keyTangent怎么用?Python keyTangent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了keyTangent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: convertConnectionAsAnimCurve

def convertConnectionAsAnimCurve( node, attr ):
    
    separateParentConnection( node, attr )
          
    cons = cmds.listConnections( node+'.'+attr, s=1, d=0, p=1, c=1 )
    if not cons: return None
    
    attrType = cmds.attributeQuery( attr, node= node, attributeType=1 )
    
    if attrType == 'doubleLinear':
        animCurveType= 'animCurveUL'
    elif attrType == 'doubleAngle':
        animCurveType = 'animCurveUA'
    else:
        animCurveType = 'animCurveUU'
    
    animCurve = cmds.createNode( animCurveType )
    cmds.connectAttr( cons[1], animCurve+'.input' )
    cmds.connectAttr( animCurve+'.output', cons[0], f=1 )
    
    cmds.setKeyframe( animCurve, f= -1, v= -1 )
    cmds.setKeyframe( animCurve, f=-.5, v=-.5 )
    cmds.setKeyframe( animCurve, f=  0, v=  0 )
    cmds.setKeyframe( animCurve, f= .5, v= .5 )
    cmds.setKeyframe( animCurve, f=  1, v=  1 )
    
    cmds.setAttr( animCurve + ".postInfinity", 1 )
    cmds.setAttr( animCurve + ".preInfinity", 1 )
    
    cmds.selectKey( animCurve )
    cmds.keyTangent( itt='spline', ott='spline' )
    
    return animCurve
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgBFunction_connection.py


示例2: setSmartKey

def setSmartKey(time=None, animCurves=None, select=True, insert=True, replace=True, addTo=False):
    
    if not time: time   = animMod.getTimelineTime()    
    getFrom             = "timeline"
    
    if not animCurves:
        getCurves  = animMod.getAnimCurves()
        animCurves = getCurves[0]
        getFrom    = getCurves[1]
    
    
    if animCurves and getFrom != "timeline": 
        cmds.setKeyframe(animCurves, time=time, insert=insert)
        if select: cmds.selectKey(animCurves, replace=replace, addTo=addTo, time=time)
        
    else:
        objects = animMod.getObjsSel()
        if objects:
            
            channelboxSelObjs = animMod.channelBoxSel()
            if channelboxSelObjs:
                #objsAttrs     = ["%s.%s"%(loopObj, loopChannelboxSel) for loopObj in objects for loopChannelboxSel in channelboxSel]
                         
                #key selected attributes in the channelbox
                for n, loopObjAttr in enumerate(channelboxSelObjs):
                    prevKey       = cmds.findKeyframe(loopObjAttr, time=(time,time), which="previous")
                    tangentType   = cmds.keyTangent(loopObjAttr, query=True, outTangentType=True, time=(prevKey,prevKey)) 
               
                    if not tangentType: #if there is no key 
                        tangentType = cmds.keyTangent(query=True, g=True, outTangentType=True)
                        inTangentType  = tangentType[0].replace("fixed", "auto").replace("step", "auto")
                        outTangentType = tangentType[0].replace("fixed", "auto")
                        cmds.setKeyframe(loopObjAttr, time=time, insert=False, shape=False, inTangentType=inTangentType, outTangentType=outTangentType)
                        continue
                    
                    inTangentType  = tangentType[0].replace("fixed", "auto").replace("step", "auto")
                    outTangentType = tangentType[0].replace("fixed", "auto")
                
                    cmds.setKeyframe(loopObjAttr, time=time, insert=insert, shape=False, inTangentType=inTangentType, outTangentType=outTangentType)
                    
            else:
                #allChannels   = animMod.getAllChannels(objects)
                #objAttrs      = ["%s.%s"%(objects[n], loopAttr) for n, loopObj in enumerate(allChannels) for loopAttr in loopObj]
                prevKeys      = [cmds.findKeyframe(obj, time=(time,time), which="previous") for obj in objects]
                tangentTypes  = [cmds.keyTangent(obj, query=True, outTangentType=True, time=(prevKeys[n],prevKeys[n])) for n, obj in enumerate(objects)]
                #prevKeys      = [cmds.findKeyframe(obj, time=(time,time), which="previous") for obj in objAttrs]
                #tangentTypes  = [cmds.keyTangent(obj, query=True, outTangentType=True, time=(prevKeys[n],prevKeys[n])) for n, obj in enumerate(objAttrs)]
                #key all atributes
                cmds.setKeyframe(objects, time=time, insert=insert, shape=False) 
                #cmds.setKeyframe(objAttrs, time=time, insert=insert, shape=False)    
                            
                if insert: #will force create key if there is no key
                    for n, loopTangent in enumerate(tangentTypes):
                        if not loopTangent:
                            cmds.setKeyframe(objects[n], time=time, insert=False, shape=False)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:55,代码来源:commandsMod.py


示例3: keyFullRotation

def keyFullRotation (pObjectName, pStartTime, pEndTime, pTargetAttribute):
    
     cmds.cutKey (pObjectName, time = (pStartTime, pEndTime), attribute=pTargetAttribute)
     cmds.setKeyframe (pObjectName, time = pStartTime, attribute=pTargetAttribute, value=0)
     cmds.setKeyframe (pObjectName, time = pEndTime, attribute=pTargetAttribute, value=360)
     cmds.selectKey (pObjectName, time = (pStartTime, pEndTime), attribute=pTargetAttribute, keyframe=True)
     cmds.keyTangent (inTangentType='linear', outTangentType='linear')
开发者ID:FranTirado,项目名称:PruebaMaya,代码行数:7,代码来源:#createRotwithUI.py


示例4: smoothAnimCurves

def smoothAnimCurves(objects, isLoop):
	"""Set all keys on provided objects to auto tangent, optionally matching in and out tangents."""
	if isinstance(objects, types.StringTypes):
		objects = [objects]
	if not isinstance(objects, types.ListType) and not isinstance(objects, types.TupleType):
		sys.stderr.write("ERROR: Unable to smooth animation curves on object %s. Argument must be a string, list, or tuple of objects or attribute names.\n")
		return False
	for object in objects:
		cmds.selectKey(object)
		cmds.keyTangent(itt="spline", ott="spline")
		if isLoop: matchInOutTangents(object)
	return True
开发者ID:0xb1dd1e,项目名称:PipelineConstructionSet,代码行数:12,代码来源:animation.py


示例5: keyFullRotation

def keyFullRotation(pObjectName, pStartTime, pEndTime, pTangentAttribute):
            
    # Enable key on selected objects
    cmds.cutKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTangentAttribute)
            
    # Set keyframes
    cmds.setKeyframe(pObjectName, time=pStartTime, attribute=pTangentAttribute, value=0)
    cmds.setKeyframe(pObjectName, time=pEndTime, attribute=pTangentAttribute, value=360)
    
    # Set linear tangent
    cmds.selectKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTangentAttribute)
    cmds.keyTangent(inTangentType='linear', outTangentType='linear')
开发者ID:Kif11,项目名称:maya_tools,代码行数:12,代码来源:turntable.py


示例6: keyFullRotation

def keyFullRotation(pObjectName, pStartTime, pEndTime, pTargetAttribute):
    #The keys are deleted
    cmds.cutKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTargetAttribute)

    #Define new keys for the animations (rotation in the axis Y). 
    cmds.setKeyframe(pObjectName, time= pStartTime, attribute=pTargetAttribute, value = 0)
    
    cmds.setKeyframe(pObjectName,time=pEndTime, attribute=pTargetAttribute, value = 360)

    #In order to mantain a constant rate of rotation with linear tangents
    cmds.selectKey(pObjectName, time=(pStartTime, pEndTime), attribute=pTargetAttribute)
    cmds.keyTangent( inTangentType='linear', outTangentType='linear')
开发者ID:cesarpazguzman,项目名称:Maya---Basics-concepts,代码行数:12,代码来源:rotationWithGUI.py


示例7: smoothKeys

def smoothKeys(weight=0.5):
    crvs = cmds.keyframe(q=True, name=True, sl=True)
    if crvs:
        for crv in crvs:
            frames = cmds.keyframe(crv, q=True, sl=True)
            size = len(frames)
            if size > 2:
                # first key val
                # x = cmds.keyframe(crvs, q=True, vc=True, time=(frames[0], frames[0]))[0]
                i = 0
                for frame in frames:
                    if frame == frames[0] or frame == frames[size - 1]:
                        pass
                    else:
                        # previous itter
                        x = cmds.keyframe(crv, q=True, vc=True, time=(frames[i - 1], frames[i - 1]))[0]
                        # this itter
                        y = cmds.keyframe(crv, q=True, vc=True, time=(frame, frame))[0]
                        # next itter
                        z = cmds.keyframe(crv, q=True, vc=True, time=(frames[i + 1], frames[i + 1]))[0]
                        # frame range between keys
                        frameRange = int((frames[i - 1] - frames[i + 1]) * -1)
                        # value range between keys, account for negative
                        valueRange = x - z
                        # force positive
                        if valueRange < 0:
                            valueRange = valueRange * -1
                        # find increments
                        inc = valueRange / frameRange
                        # how many increments to add
                        mlt = int((frames[i - 1] - frame) * -1)
                        # add up increments
                        keyPos = inc * mlt
                        # final value to add/subtract from previous key
                        # operation depends on x relative to z value
                        if x < z:
                            # print 'above'
                            val = x + keyPos
                            # print y, '  current'
                            # print val, '  actual'
                            val = y - val
                            # print val, '  dif'
                            val = val * weight
                            # print val, '  multip'
                            val = y - val
                            # print val, '  final'
                        else:
                            # print 'below'
                            val = x - keyPos
                            # print y, '  current'
                            # print val, '  actual'
                            val = y - val
                            # print val, '  dif'
                            val = val * weight
                            # print val, '  multip'
                            val = y - val
                            # print val, '  final'
                        cmds.keyframe(crv, vc=val, time=(frame, frame))
                        cmds.keyTangent(crv, edit=True, itt='auto', ott='auto', time=(frame, frame))
                    i = i + 1
开发者ID:boochos,项目名称:work,代码行数:60,代码来源:animCurve_lib.py


示例8: apply

    def apply(self, attr):
        obj = attr.node()
        obj_mel = obj.__melobject__()
        attr_longName = attr.longName()
        attrMel = attr.__melobject__()
        if len(self.times) > 0:
            for time, value in zip(self.times, self.values):
                cmds.setKeyframe(obj_mel, time=time, attribute=attr_longName, value=value,
                     breakdown=False,  # TODO: Approve
                     hierarchy='none',  # TODO: Approve
                     controlPoints=False,  # TODO: Approve
                     shape=False)  # TODO: Approve

            # set tangents
            cmds.keyTangent(attrMel, edit=True, wt=int(self.weightedTangent))  # todo: approve int cast
            for time, inAngle, outAngle, inWeight, outWeight, inTangentType, outTangentType, lock in zip(
                self.times, self.inAngles, self.outAngles, self.inWeights, self.outWeights, self.inTangentTypes, self.outTangentTypes, self.locks):
                fn_keyTangent = functools.partial(cmds.keyTangent, attrMel, edit=True, time=(time, time))
                fn_keyTangent(inAngle=inAngle,
                    outAngle=outAngle,
                    inWeight=inWeight,
                    outWeight=outWeight)
                fn_keyTangent(inTangentType=inTangentType,outTangentType=outTangentType)
                fn_keyTangent(lock=lock) # TODO: Optimise

            # set infinity
            if self.preInfinity != "constant":
                cmds.setInfinity(obj, attribute=attr_longName, preInfinity=self.preInfinity)
            if self.postInfinity != "constant":
                cmds.setInfinity(obj, attribute=attr_longName, postInfinity=self.postInfinity)
        else:
            attr.set(self.value)
开发者ID:Leopardob,项目名称:omtk,代码行数:32,代码来源:cpAnim.py


示例9: __init__

	def __init__( self, attrpath, keyTime=None, keyIdx=None ):
		#if the attrpath doesn't exist, then just create an empty key instance
		if not cmd.objExists(attrpath):
			self.obj = None
			self.attr = None
			self.time = None
			self.value = None
			self.iw = None
			self.ow = None
			self.itt = None
			self.ott = None
			return

		self.obj,self.attr = attrpath.split('.')

		#make sure the attr name is the long version of the name, its too annoying to have to deal with shortnames AND long names...
		self.attr = cmd.attributeQuery(self.attr,longName=True,node=self.obj)

		#and just for uber convenience, store the attrpath as well...
		self.attrpath = attrpath

		if keyIdx != None:
			times = cmd.keyframe(attrpath,index=keyIdx,query=True)
			self.time = times[0]
		elif keyTime != None:
			self.time = keyTime

		#is there a key at the time?
		if cmd.keyframe(attrpath,time=(keyTime,),query=True,keyframeCount=True):
			self.value = cmd.keyframe(attrpath,time=(keyTime,),query=True,valueChange=True)[0]
			self.iw,self.ow,self.ia,self.oa = cmd.keyTangent(attrpath,time=(keyTime,),query=True,inWeight=True,outWeight=True,inAngle=True,outAngle=True)
			self.itt,self.ott = cmd.keyTangent(attrpath,time=(keyTime,),query=True,inTangentType=True,outTangentType=True)

			#this is purely 'clean up after maya' code.  for whatever reason maya will return a tangent type of "fixed" even though its a completely invalid tangent type...  not sure what its supposed to map to, so I'm just assuming spline
			if self.itt == 'fixed': self.itt = 'spline'
			if self.ott == 'fixed': self.ott = 'spline'

		else:
			self.value = cmd.keyframe(attrpath,time=(keyTime,),query=True,eval=True,valueChange=True)
			index = self.index
			previousOutTT = None
			previousOutTW = None
			nextInTT = None
			nextInTW = None
			if index > 1:
				previousOutTT = cmd.keyTangent(attrpath,index=(index-1,),query=True,outTangentType=True)
				previousOutTW = cmd.keyTangent(attrpath,index=(index-1,),query=True,outWeight=True)
			else:
				previousOutTT = cmd.keyTangent(attrpath,index=(index,),query=True,outTangentType=True)
				previousOutTW = cmd.keyTangent(attrpath,index=(index,),query=True,outWeight=True)

			if index < cmd.keyframe(self.attr,query=True,keyframeCount=True):
				nextInTT = cmd.keyTangent(attrpath,index=(index+1,),query=True,inTangentType=True)
				nextInTW = cmd.keyTangent(attrpath,index=(index+1,),query=True,inWeight=True)
			else:
				nextInTT = cmd.keyTangent(attrpath,index=(index,),query=True,inTangentType=True)
				nextInTW = cmd.keyTangent(attrpath,index=(index,),query=True,inWeight=True)

			#now average the tangents
				self.iw = self.ow = (previousOutTW + nextInTW )/2
开发者ID:BGCX261,项目名称:zootoolbox-svn-to-git,代码行数:60,代码来源:keyUtils.py


示例10: hold

def hold():
	curves = mc.keyframe(q=1, sl=1, name=1)
	for curve in curves:
		index = mc.keyframe(curve, q=1, sl=1, iv=1)
		firstValue = mc.keyframe(curve, q=1, sl=1, vc=1)[0]
		mc.keyframe(curve, vc=firstValue, index=(index[0], index[-1]))
		mc.keyTangent(itt='flat', ott='flat')
开发者ID:atsbomb,项目名称:bombKey,代码行数:7,代码来源:bombKey.py


示例11: _cleanCurves

def _cleanCurves(animCurves):
    '''Pulisce le curve rimuovendo le chiavi superflue.'''

    tol = 0.0001
    for c in animCurves:
        keyCount = cmds.keyframe(c, query=True, keyframeCount=True)
        if keyCount == 0:
            continue
        # cancella le chiavi superflue intermedie
        if keyCount > 2:
            times = cmds.keyframe(c, query=True, index=(0, keyCount-1), timeChange=True)
            values = cmds.keyframe(c, query=True, index=(0, keyCount-1), valueChange=True)
            inTan = cmds.keyTangent(c, query=True, index=(0, keyCount-1), inAngle=True)
            outTan = cmds.keyTangent(c, query=True, index=(0, keyCount-1), outAngle=True)
            for i in range(1, keyCount-1):
                if math.fabs(values[i]-values[i-1]) < tol and math.fabs(values[i+1]-values[i]) < tol and math.fabs(inTan[i]-outTan[i-1]) < tol and math.fabs(inTan[i+1]-outTan[i]) < tol:
                    cmds.cutKey(c, time=(times[i], times[i]))

        # ricalcola il numero di chiavi e pulisce le chiavi agli estremi
        keyCount = cmds.keyframe(c, query=True, keyframeCount=True)
        times = cmds.keyframe(c, query=True, index=(0, keyCount-1), timeChange=True)
        values = cmds.keyframe(c, query=True, index=(0, keyCount-1), valueChange=True)
        inTan = cmds.keyTangent(c, query=True, index=(0, keyCount-1), inAngle=True)
        outTan = cmds.keyTangent(c, query=True, index=(0, keyCount-1), outAngle=True)
        # piu' di due key rimanenti
        if keyCount > 2:
            if math.fabs(values[1]-values[0]) < tol and math.fabs(inTan[1]-outTan[0]) < tol:
                cmds.cutKey(c, time=(times[0], times[0]))
            if math.fabs(values[-1]-values[-2]) < tol and math.fabs(inTan[-1]-outTan[-2]) < tol:
                cmds.cutKey(c, time=(times[-1], times[-1]))
        # uno o due key rimanenti
        elif keyCount == 1 or (math.fabs(values[1]-values[0]) < tol and math.fabs(inTan[1]-outTan[0]) < tol):
            val = cmds.getAttr(c)       # debuggato
            cmds.cutKey(c)
            cmds.setAttr(c, val)
开发者ID:jasperges,项目名称:ZvParentMaster,代码行数:35,代码来源:ZvParentMaster.py


示例12: set_handle_in

def set_handle_in(name, dof, time, tangent, weight):
    node = "%s.%s" % (name, dof)
    cmds.selectKey(node, replace=True, k=True, t=(time,time))
    cmds.keyTangent( edit=True
                   , absolute=True
                   , inAngle=tangent * 180.0 / m.pi
                   , inWeight=weight )
开发者ID:richard-roberts,项目名称:InterpDesigner,代码行数:7,代码来源:import_mocap.py


示例13: __init__

 def __init__(self, curve_sel, vertex_list, chain_geo):
     self.curve_sel = curve_sel
     self.verts = vertex_list
     self.chain_geo = chain_geo
     self.find_length = Find_Out()
     
     self.link_length = self.find_length.edge_length(self.verts)
     self.chain_length = self.find_length.curve_length(self.curve_sel)
     self.link_total = int(self.chain_length/self.link_length)
     self.motion_path_name = str(self.chain_geo) + '_Path'
     
     cmds.pathAnimation(self.chain_geo, name = self.motion_path_name, fractionMode = True, follow= True, followAxis = 'x', 
             upAxis = 'y', worldUpType = 'object', startTimeU = 1, endTimeU = self.link_total, c = self.curve_sel)
             
     cmds.setKeyframe(self.motion_path_name + '.frontTwist', v = 0.0, t = 1 )
     cmds.setKeyframe(self.motion_path_name + '.frontTwist', v = 60.0*self.link_total, t = self.link_total )
     
     cmds.keyTangent(self.motion_path_name + '.uValue', itt = 'linear', ott = 'linear' )
     cmds.keyTangent(self.motion_path_name + '.frontTwist', itt = 'linear', ott = 'linear')
     
     cmds.snapshot( self.chain_geo, constructionHistory=True, startTime=1, endTime = self.link_total, increment=1, update = 'animCurve', 
             name = str(self.chain_geo) + '_snapShot' )
     
     self.chain_group = cmds.group( em=True, name=str(self.chain_geo) + '_geo_grp' )
     
     self.chain_list = cmds.listRelatives(str(self.chain_geo + '_snapShotGroup'))
     
     for dummy_geo in self.chain_list:
         cmds.delete(icn = True, ch = True)
         cmds.parent(dummy_geo, self.chain_group)
开发者ID:XJZeng,项目名称:ChainMaker,代码行数:30,代码来源:chain_maker.py


示例14: getKeyByObject

def getKeyByObject(obj):
    data = dict()
    
    #- object exists ?
    if not mc.objExists(obj):
        return data
    data['object'] = re.search('\w+$', obj).group()
    
    #- object has attributes ?
    attributes = mc.listAttr(obj, k=True)
    if not attributes:
        return data
    
    #- get keys
    for attr in attributes:
        times      = mc.keyframe(obj,   at=attr, q=True,  tc=True)
        values     = mc.keyframe(obj,   at=attr, q=True,  vc=True)
        inAngles   = mc.keyTangent(obj, at=attr, q=True,  ia=True)
        outAngles  = mc.keyTangent(obj, at=attr, q=True,  oa=True)
        inWeights  = mc.keyTangent(obj, at=attr, q=True,  iw=True)
        outWeights = mc.keyTangent(obj, at=attr, q=True,  ow=True)
        #- keys not found..
        if not times:
            continue
        
        #- save data..
        data.setdefault('keyData', {})[attr] = zip(times, values, inAngles, inWeights, outAngles, outWeights)
    
    return data
开发者ID:auqeyjf,项目名称:poseLibrary,代码行数:29,代码来源:KeyData.py


示例15: getControlPoints

def getControlPoints(crv='', p0=[1.0, 0.0], p3=[10.0, 10.0]):
    # could use multiplier to adjust length of existing weights after key is inserted
    mltp = 0.3333333333333333  # multiplier to solve adjacent side, p[1] x coor, 33.333333333333%
    # gap between keys
    gap = p3[0] - p0[0]
    # print gap, ' gap'

    # p1
    outA = cmds.keyTangent(crv, q=True, time=(p0[0], p0[0]), outAngle=True)[0]
    # print outA, ' p1 hyp angle'
    adj = gap * mltp  # tangent coor in x
    # print adj, ' p1 adj length'
    opo = math.tan(math.radians(outA)) * (adj)
    # print opo, ' p1 opo height'
    p1 = [p0[0] + adj, p0[1] + opo]
    # print p1

    # p2
    outA = cmds.keyTangent(crv, q=True, time=(p3[0], p3[0]), inAngle=True)[0]
    # print outA, ' p2 hyp angle'
    adj = gap * mltp  # tangent coor in x
    # print adj, ' p2 adj length'
    opo = math.tan(math.radians(outA)) * adj
    # print opo, ' p2 opo height'
    p2 = [p3[0] - adj, p3[1] - opo]  # adjusting, may need fixing for +/- angles
    # print p2
    # resort lists [x,x,x,x] [y,y,y,y]
    return [p0[0], p1[0], p2[0], p3[0]], [p0[1], p1[1], p2[1], p3[1]]
开发者ID:boochos,项目名称:work,代码行数:28,代码来源:clipPickleBezier_lib.py


示例16: sweepPipe

def sweepPipe(circle, pipeCurve):
	numberOfCVs = cmds.getAttr('%s.cp' % pipeCurve[0], size=1)
	motionPath = cmds.pathAnimation("%s" % circle[0], curve=pipeCurve[0], follow=True, startTimeU=1, endTimeU=numberOfCVs)
	cmds.selectKey("%s.uValue" % motionPath)
	cmds.keyTangent( itt="linear", ott="linear")
	pipeSweep = cmds.snapshot(circle, startTime=1, endTime=numberOfCVs)
	return pipeSweep
开发者ID:SindreOpsahl,项目名称:fastPipe,代码行数:7,代码来源:fastPipe.py


示例17: connectCommand

 def connectCommand( uiInstance ):
     
     sels = cmds.ls( sl=1 )
     selChannels = cmds.channelBox( 'mainChannelBox', q=1, sma=1 )
     
     numItems = uiInstance.layout.count()
     animNode = cmds.createNode( 'animCurveUU' )
     
     for i in range( 1, numItems-1 ):
         targetWidget = uiInstance.layout.itemAt( i ).widget()
         
         key = targetWidget.lineEdit_key.text()
         value = targetWidget.lineEdit_value.text()
         
         cmds.setKeyframe( animNode, f=float(key), v=float(value) )
         cmds.keyTangent( animNode, f=(float(key),float(key)), itt='linear', ott = 'linear' )
     
     if sels and selChannels:
         cmds.connectAttr( sels[0] + '.' + selChannels[0], animNode + '.input' )
         addString = ''
         if float(key) > 0:
             addString = 'positive'
         else:
             addString = 'negative'
         animNode = cmds.rename( animNode, selChannels[0] + '_' + addString + '_from_' + sels[0] )
     
     cmds.select( animNode )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:createAnimCurve.py


示例18: toggleTangentLock

def toggleTangentLock():
    state = cmds.keyTangent(q=True, lock=True)[0]
    if state:
        cmds.keyTangent(lock=False)
        message('Tangent Broken')
    else:
        cmds.keyTangent(lock=True)
        message('Tangent Unified')
开发者ID:boochos,项目名称:work,代码行数:8,代码来源:animCurve_lib.py


示例19: setKeyFrameControl

 def setKeyFrameControl(self, curve, attri):
     try:
         selValue = mc.keyframe(curve, at=attri, t=(startFrame,startFrame), q=True, eval=True)
         mc.setKeyframe(curve, at=attri, t=(actionFrame,actionFrame), v=selValue[0])
         mc.setKeyframe(curve, at=attri, t=(tposeFrame,tposeFrame), v=0)
         mc.keyTangent(curve, at=attri, inTangentType='flat', ott='flat', time=(actionFrame, actionFrame))
         mc.keyTangent(curve, at=attri, inTangentType='linear', ott='linear', time=(startFrame, startFrame))
     except:
         return 'Fail sekkey'
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:9,代码来源:poseMachine_new_01.py


示例20: setKeyFrameControl

 def setKeyFrameControl(self, curve, attri):
     try:
         selValue = mc.keyframe(curve, at=attri, t=(1001,1001), q=True, eval=True)
         mc.setKeyframe(curve, at=attri, t=(980,980), v=selValue[0])
         mc.setKeyframe(curve, at=attri, t=(960,960), v=0)
         mc.keyTangent(curve, at=attri, inTangentType='flat', ott='flat', time=(980, 980))
         mc.keyTangent(curve, at=attri, inTangentType='linear', ott='linear', time=(1001, 1001))
     except:
         return 'Fail sekkey'
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:9,代码来源:poseMachine_new.py



注:本文中的maya.cmds.keyTangent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.keyframe函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.joint函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap