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

Python core.setKeyframe函数代码示例

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

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



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

示例1: setUp

 def setUp(self):
     cmds.file(new=1, f=1)
     self.cube = cmds.polyCube()[0]
     for i in xrange(1,21,2):
         cmds.currentTime(i)
         pm.setAttr(self.cube + '.tx', i)
         pm.setKeyframe(self.cube + '.tx')
开发者ID:williambong,项目名称:pymel,代码行数:7,代码来源:test_animation.py


示例2: fixedSeed

def fixedSeed():
  sel = pm.selected()
  
  animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
  animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
    
  for attr in sel:
    animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
    animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
    
    xVal = attr.rotateX.get()
    yVal = attr.rotateY.get()
    zVal = attr.rotateZ.get()
  
    print animStartTime
    print animEndTime
    print xVal
    print yVal
    print zVal
      
    while animStartTime<=animEndTime:
      attr.rotateX.set(xVal+random.uniform(-.1,.1))
      attr.rotateY.set(yVal+random.uniform(-.1,.1))
      attr.rotateZ.set(zVal+random.uniform(-.1,.1))
      pm.setKeyframe(attribute="rotate", time=animStartTime)
      animStartTime+=1
开发者ID:maitelels,项目名称:maya_scripts,代码行数:26,代码来源:tim_bakeJitter.py


示例3: testGDuplicateStandin

 def testGDuplicateStandin(self):
     self.standIn = pm.ls('testStandin_standInCtrl')[0]
     pm.select(self.standIn)
     self.cc.duplicateStandin()
     pm.setKeyframe('controllerB.testSrc', t=1, v=1.5)
     self.cc.saveState()
     # now cache that standin too
     self.cc.cacheStandin()
开发者ID:campbellwmorgan,项目名称:charactercrowd,代码行数:8,代码来源:test_characterCrowd.py


示例4: rigCurveShapeControl

def rigCurveShapeControl( ctrl=None, attr=None, sampleParams=[0,1,2,3,4,5,6,7,8,9,10], container=False  ):
    '''
    스쿼시 스트레치시 그래프 에디터 커브로 쉐입을 조정하려고 만들어짐.

    powAttr = rigCurveShapeControl( ctrl='spinCtrl', attr='sideAxisScaleShape', sampleParams=range( len(joints) ) )

    @param ctrl:
    @param attr:
    @param sampleParams:
    @param container:
    @return: ctrl.results 어트리뷰트를 리턴함.
    @rtype: pm.Attribute
    '''
    if not ctrl:
        sel = pm.selected()
        if sel:
            ctrl = sel[0]
        else:
            return

    if not attr:
        attr = 'curveCtrl'
        ctrl.addAttr( attr, keyable=True )

    ctrl     = pm.PyNode(ctrl)
    ctrlAttr = pm.Attribute( ctrl.attr(attr) )

    # 애니메이션 커브 생성
    pm.setKeyframe( ctrlAttr, t=sampleParams[ 0], v=0)
    pm.setKeyframe( ctrlAttr, t=sampleParams[-1], v=0)
    pm. keyTangent( ctrlAttr, weightedTangents=True )
    pm. keyTangent( ctrlAttr, weightLock=False )
    pm. keyTangent( ctrlAttr, e=True, absolute=True, time=[sampleParams[ 0]], outAngle=77, outWeight=1 )
    pm. keyTangent( ctrlAttr, e=True, absolute=True, time=[sampleParams[-1]], inAngle=-77,  inWeight=1 )

    # frameCache노드로 애니메이션 커브의 각 포인트에서 값을 가져옴
    ctrl.addAttr( 'samples', multi=True, readable=True, indexMatters=False )
    ctrl.addAttr( 'results', multi=True, readable=True, indexMatters=False )

    frameCaches = []
    for i,param in enumerate(sampleParams):
        ctrl.samples[i].set( param )

        frameCache = pm.createNode( 'frameCache' )
        pm.connectAttr( ctrlAttr, frameCache.stream)
        pm.connectAttr( ctrl.samples[i], frameCache.varyTime )
        pm.connectAttr( frameCache.varying, ctrl.results, na=True)

        frameCaches.append(frameCache)

    # container Setting : wip
    if container:
        cont = pm.container( type='dagContainer', addNode=frameCaches )
        cont.blackBox.set(True)

    return ctrl.results
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:56,代码来源:joint.py


示例5: model_screenshot

def model_screenshot(selected=True, debug=False, centerCam=False):
	meshes = pm.ls(sl=True)
	cam = pm.camera(n='tempCam')
	hfv=cam[1].getHorizontalFieldOfView()
	vfv=cam[1].getVerticalFieldOfView()
	grp = pm.group(em=True, n='tempCamOffset_GRP')
	
	#Determine the selection
	if selected==False:
		meshes = [mesh.getParent() for mesh in pm.ls(type=pm.nt.Mesh)]
	print meshes
	boundingBox = pm.polyEvaluate(meshes, b=True)
	
	#Determine the positions of the bounding box as variables
	xmin=boundingBox[0][0]
	xmax=boundingBox[0][1]
	ymin=boundingBox[1][0]
	ymax=boundingBox[1][1]
	zmin=boundingBox[2][0]
	zmax=boundingBox[2][1]
	
	#get the midpoints (these are also the object center!)
	zmid=(zmin+zmax)/2
	ymid=(ymin+ymax)/2
	xmid=(xmin+xmax)/2
	
	# Create locators to visualize the bounding box
	locators=[]
	locators.append(pm.spaceLocator(n='xmin',p=[xmin,ymid,zmid]))
	locators.append(pm.spaceLocator(n='xmax',p=[xmax,ymid,zmid]))
	locators.append(pm.spaceLocator(n='ymin',p=[xmid,ymin,zmid]))
	locators.append(pm.spaceLocator(n='ymax',p=[xmid,ymax,zmid]))
	locators.append(pm.spaceLocator(n='zmin',p=[xmid,ymid,zmin]))
	locators.append(pm.spaceLocator(n='zmax',p=[xmid,ymid,zmax]))
	
	#Determine the furthest distance needed from the object
	h_dist=(math.tan(hfv)*abs(xmin-xmax)) + abs(zmin-zmax)
	zh_dist=(math.tan(vfv)*abs(zmin-zmax)) + abs(zmin-zmax)
	zv_dist=(math.tan(vfv)*abs(zmin-zmax)) + abs(zmin-zmax)
	v_dist=(math.tan(vfv)*abs(ymin-ymax)) + abs(zmin-zmax) #this will never be used, always going to be shortest.
	
	#set the camera distance etc for the bounding box.
	print h_dist,v_dist,zh_dist, zv_dist
	print max(h_dist,v_dist,zh_dist, zv_dist)
	cam[0].translateZ.set(max(h_dist,zh_dist,v_dist,zv_dist))
	cam[0].translateY.set(ymid)
	
	cam[0].setParent(grp)
	if debug:
		pm.delete(locators)
	if centerCam:
		grp.translate.set([zmid,0,xmid])
		pm.setKeyframe(grp.rotateY, t=pm.playbackOptions(q=True,ast=True), v=0)
		pm.setKeyframe(grp.rotateY, t=pm.playbackOptions(q=True,aet=True), v=360)
开发者ID:AndresMWeber,项目名称:aw,代码行数:54,代码来源:aw_modelScreenshot.py


示例6: test_RigCtrl

    def test_RigCtrl(self):
        from classRigCtrl import RigCtrl
        from omtk.libs import libSerialization
        log.info("test_RigCtrl")
        foo = RigCtrl()
        foo.build()
        pymel.setKeyframe(foo.node)
        foo.unbuild()

        network = libSerialization.export_network(foo)
        pymel.select(network)
        foo.build()
开发者ID:Leopardob,项目名称:omtk,代码行数:12,代码来源:__init__.py


示例7: bdCleanKeyframes

def bdCleanKeyframes():
    start = pm.playbackOptions(q=1,ast=1)
    end = pm.playbackOptions(q=1,aet=1)

    sel = pm.ls(sl=1,type='transform')

    for i in range(8,end-10,1):
        if not (i%4):
            print i
            pm.currentTime(i)
            pm.setKeyframe(sel,t=i)
        else:
            pm.cutKey(sel,clear=1,an='objects',iub=0,t=(i,i+1))
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:13,代码来源:bdRigUtils.py


示例8: bdSwitchCBLidParent

    def bdSwitchCBLidParent(self,newParent):
        selection = pm.ls(sl=1,type='transform')
        if selection:
            pass
        else:
            pm.warning('Nothing selected !!!')
            return
        if 'candybox_lid' in selection[0].name():
            candyboxLidCtrl = selection[0]
            try:
                currentParent = candyboxLidCtrl.attr('parent').get()
            except:
                pm.warning('Current selection has no Parent attribute, aborting!')
                return
            print currentParent 
            switchFrame = pm.currentTime(q=1)


            pm.currentTime(switchFrame-1,e=1)
            pm.setKeyframe(candyboxLidCtrl)
            pm.currentTime(switchFrame,e=1)

            hatPos = candyboxLidCtrl.getTranslation(space='world')
            hatRot = candyboxLidCtrl.getRotation(space='world')


            #World Parent
            if newParent == 0:
                print 'Candybox new parent: Candybox'
                candyboxLidCtrl.attr('parent').set(0)

            elif newParent == 2:
                print 'Candybox new  parent: Right Hand'

                candyboxLidCtrl.attr('parent').set(2)

            elif newParent == 1:
                print 'Candybox new  parent: Left Hand'

                candyboxLidCtrl.attr('parent').set(1)

            candyboxLidCtrl.setTranslation(hatPos,space='world')
            candyboxLidCtrl.setRotation(hatRot,space='world')


            pm.setKeyframe(candyboxLidCtrl )



        else:
            pm.warning('Select candybox_lid_ctrl')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:51,代码来源:bdSwitchHatParent.py


示例9: animateSpotLights

def animateSpotLights():
    spotLights=cmds.ls(type='spotLight')
    for spotL in spotLights:
        #lights turn off at this time
        randomFrameOff = random.randrange(530,535)
        step = 20
        randomFrameOn = randomFrameOff + step
        #lights turn on at this time
        randomFrameOn2 = random.randrange(900,905)
        randomFrameOff2 = randomFrameOn2 + step
        #set attributes for light turned off
        pm.setAttr(spotL + '.intensity',0)
        pm.setAttr(spotL + '.aiExposure',0)
        pm.setAttr(propLight + '.color',1, 0.897, 0.667)
        keyableAttributes = ['aiExposure','intensity']
        #keyframe it
        pm.setKeyframe(spotL,at=keyableAttributes,t=randomFrameOff)
        #set attributes for light turned on
        pm.setAttr(spotL + '.intensity',1)
        pm.setAttr(spotL + '.aiExposure',10)
        #keyframe it
        pm.setKeyframe(spotL,at=keyableAttributes,t=randomFrameOn)
        #keyframe the other time when it's time to turn off
        pm.setKeyframe(spotL,at=keyableAttributes, t=randomFrameOn2)
        #turn the lights off
        pm.setAttr(spotL + '.intensity',0)
        pm.setAttr(spotL + '.aiExposure',0)
        #keyframe it
        pm.setKeyframe(spotL,at=keyableAttributes, t=randomFrameOff2)
        print 'spot is animated out of this light!!!'
开发者ID:lazicdusan,项目名称:maya,代码行数:30,代码来源:grad.py


示例10: matchIkToFk

def matchIkToFk(ikControl, ikPole, offset=100.0, msgAttr='fkjoints', autoKey=True):
    """
    Matches ikControl and ikPole Vector control to match the current pose of underlying
    fk duplicate joint chains
    Finds the fk joints using a previously created message connection to the attribute msgAttr
    """

    fkJoints = pmc.listConnections('{0}.{1}'.format(ikControl, msgAttr),
                                   destination=False, source=True)

    attr = pmc.listConnections('{0}.ikfk'.format(ikControl), destination=False,
                               source=True, plugs=True, scn=True)[0]
    switchControl = attr.node()
    switchAttr = attr.name(includeNode=False)

    frameBeforeCurrent = pmc.currentTime(q=True) - 1
    if autoKey:
        pmc.setKeyframe(switchControl, attribute=switchAttr, time=frameBeforeCurrent,
                        value=1, outTangentType='step')
        pmc.setKeyframe([ikControl, ikPole], time=frameBeforeCurrent, outTangentType='step')

        pmc.setKeyframe(switchControl, attribute=switchAttr, value=0, outTangentType='step')

    alignObjects(ikControl, fkJoints[-1])
    loc = getPoleVectorPosition(fkJoints, offset, curveGuide=False)
    alignObjects(ikPole, loc, position=True, rotation=False)
    pmc.delete(loc)

    if autoKey:
        pmc.setKeyframe([ikControl, ikPole], time=frameBeforeCurrent)

    pmc.headsUpMessage('BAMF!')
开发者ID:taozenforce,项目名称:cogswelladvancedrigging2014,代码行数:32,代码来源:ikfk.py


示例11: insert_key

 def insert_key(self, attr, value):
     '''
     # this inserts a key at the given position
     # take the attr to key and the position in time
     # attr example: 'pCube1.translateX'
     '''
     print attr, value.getValue(), attr, value.getValue()
     
     pm.setKeyframe('%s' % (attr), time= int(value.getValue()) )
     
     # reinvoking the create to add the uis for the new keys
     print 'recreating'
     pm.deleteUI(self.temp_layout)
     self.create()
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:14,代码来源:AnimUVTool03.py


示例12: amcveRebuild

def amcveRebuild(cvNew, cvSrcProfile):
	"""
	"""
	cvTrimmed = cvSrcProfile['cvTrimmed']
	cvBaseMod = cvSrcProfile['cvBaseMod']
	cvPortray = cvSrcProfile['cvPortray']
	cvFeature = cvSrcProfile['cvFeature']

	''' A. create animCurve '''
	# create same type of animation curve
	cvNew = pm.createNode(cvBaseMod['cvTyp'], n= cvNew)

	''' B. build curve base '''
	# whatever this animationCurve is time-base or float-base,
	# one of lists will be empty, just add them up.
	cvInp = cvPortray['Frame'] + cvPortray['Float']
	# set value to each keyframe
	for i, x in enumerate(cvInp):
		if cvTrimmed and (x < cvTrimmed[0] or x > cvTrimmed[1]):
			continue
		# whatever this animationCurve is time-base or float-base,
		# just set both, the one incorrect will take no effect.
		y = cvPortray['Value'][i]
		isBD = True if x in cvBaseMod['breaD'] else False
		pm.setKeyframe(cvNew, t= x, f= x, v= y, bd= isBD)

	''' C. inject curve feature '''
	cvNew.setPreInfinityType(cvBaseMod['prInf'])
	cvNew.setPostInfinityType(cvBaseMod['poInf'])
	weedT = cvBaseMod['weedT'][0]
	pm.keyTangent(cvNew, wt= weedT)
	if weedT:
		for i, x in enumerate(cvInp):
			if cvTrimmed and (x < cvTrimmed[0] or x > cvTrimmed[1]):
				continue
			WLock = cvFeature['WLock'][i]
			pm.keyTangent(cvNew, index= [i], wl= WLock)
	for i, x in enumerate(cvInp):
		if cvTrimmed and (x < cvTrimmed[0] or x > cvTrimmed[1]):
			continue
		pm.keyTangent(cvNew, index= [i], l= cvFeature['TLock'][i])
		pm.keyTangent(cvNew, index= [i], iw= cvFeature['InWet'][i])
		pm.keyTangent(cvNew, index= [i], ow= cvFeature['OuWet'][i])
		pm.keyTangent(cvNew, index= [i], ia= cvFeature['InAng'][i])
		pm.keyTangent(cvNew, index= [i], oa= cvFeature['OuAng'][i])
		pm.keyTangent(cvNew, index= [i], itt= cvFeature['InTyp'][i])
		pm.keyTangent(cvNew, index= [i], ott= cvFeature['OuTyp'][i])

	return cvNew
开发者ID:davidpower,项目名称:MS_AniRemap,代码行数:49,代码来源:mAnimCurveGen.py


示例13: slice

    def slice(self, slices_in_x, slices_in_y):
        """slices all renderable cameras
        """
        # set render resolution
        self.unslice_scene()
        self.is_sliced = True
        self._store_data()

        sx = self.slices_in_x = slices_in_x
        sy = self.slices_in_y = slices_in_y

        # set render resolution
        d_res = pm.PyNode("defaultResolution")
        h_res = d_res.width.get()
        v_res = d_res.height.get()

        # this system only works when the
        d_res.aspectLock.set(0)
        d_res.pixelAspect.set(1)
        d_res.width.set(h_res / float(sx))
        d_res.pixelAspect.set(1)
        d_res.height.set(v_res / float(sy))
        d_res.pixelAspect.set(1)

        # use h_aperture to calculate v_aperture
        h_aperture = self.camera.getAttr('horizontalFilmAperture')

        # recalculate the other aperture
        v_aperture = h_aperture * v_res / h_res
        self.camera.setAttr('verticalFilmAperture', v_aperture)

        v_aperture = self.camera.getAttr('verticalFilmAperture')

        self.camera.setAttr('zoom', 1.0/float(sx))

        t = 0
        for i in range(sy):
            v_pan = v_aperture / (2.0 * sy) * (1 + 2 * i - sy)
            for j in range(sx):
                h_pan = h_aperture / (2.0 * sx) * (1 + 2 * j - sx)
                pm.currentTime(t)
                pm.setKeyframe(self.camera, at='horizontalPan', v=h_pan)
                pm.setKeyframe(self.camera, at='verticalPan', v=v_pan)
                t += 1

        self.camera.panZoomEnabled.set(1)
        self.camera.renderPanZoom.set(1)

        d_res.pixelAspect.set(1)
开发者ID:sergeneren,项目名称:anima,代码行数:49,代码来源:render_slicer.py


示例14: random

def random():
  sel = pm.selected()
  
  animStartTime = pm.playbackOptions(animationStartTime=1, q=1)
  animEndTime = pm.playbackOptions(animationEndTime=1, q=1)
  
  
  
  while animStartTime<=animEndTime:
    for s in sel:
        s.translateX.set(s.translateX.get()+random.uniform(-.1,.1))
        s.translateY.set(s.translateY.get()+random.uniform(-.1,.1))
        s.translateZ.set(s.translateZ.get()+random.uniform(-.1,.1))
    pm.setKeyframe(attribute="translate", time=animStartTime)
    animStartTime+=1
开发者ID:maitelels,项目名称:maya_scripts,代码行数:15,代码来源:tim_bakeJitter.py


示例15: copyAnim

def copyAnim():
	selection = pm.ls(sl=True)
	if len(selection) != 2:
		pm.warning('Need exactly two objects to copy')
		return
	try:
		namespace = selection[0].namespace()
	except:
		namespace = ''
		
	print namespace
	holders = pm.ls('*_HOLDE*')
	if namespace != '':
		holders = pm.ls('*:*_HOLDE*')
	
	if holders:
		pm.delete(holders)

	source = selection[0]
	target = selection[1]
	
	pm.setKeyframe(source)
	pm.setKeyframe(target)
	
	sourceName = source.name()
	targetName = target.name()
	if namespace != '':
		sourceName =  source.stripNamespace()
		targetName =  target.stripNamespace()
		
	pm.select(cl=True)

	sourceAttr = pm.listAttr(source,k=True)
	sourceHolder = pm.group(n=namespace + sourceName + '_SOURCE_HOLDER')
	for attr in sourceAttr:
		attrType = source.attr(attr).type()
		pm.addAttr(sourceHolder,ln='__' + attr,nn=attr,at = attrType)
		sourceHolder.attr('__' + attr).set(source.attr(attr).get())
	
	pm.select(cl=True)
	targetAttr = pm.listAttr(target,k=True)
	targetHolder = pm.group(n=namespace + targetName + '_TARGET_HOLDER')
	for attr in targetAttr:
		attrType = target.attr(attr).type()
		pm.addAttr(targetHolder,ln='__' + attr,nn=attr,at = attrType)
		targetHolder.attr('__' + attr).set(target.attr(attr).get())
	
	pm.select([target,source])
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:48,代码来源:bdMirrorFeet.py


示例16: amcveProfile

def amcveProfile(cvSrc, trim):
	"""
	"""
	cvSrc = pm.ls(cvSrc)[0]
	tiLen = []

	if trim:
		tiLen.append(pm.playbackOptions(q= 1, min= 1))
		tiLen.append(pm.playbackOptions(q= 1, max= 1))
		pm.undoInfo(ock= 1)
		pm.setKeyframe(cvSrc, insert= 1, t= tiLen, f= tiLen)
		pm.undoInfo(cck= 1)

	cvBaseMod = {
			'cvTyp' : pm.objectType(cvSrc),
			'prInf' : cvSrc.getPreInfinityType().key,
			'poInf' : cvSrc.getPostInfinityType().key,
			'weedT' : pm.keyTangent(cvSrc, q= 1, weightedTangents= 1),
			'breaD' : pm.keyframe(cvSrc, q= 1, breakdown= 1)
	}
	cvPortray = {
			'Frame' : pm.keyframe(cvSrc, q= 1, timeChange= 1),
			'Float' : pm.keyframe(cvSrc, q= 1, floatChange= 1),
			'Value' : pm.keyframe(cvSrc, q= 1, valueChange= 1)
	}
	cvFeature = {
			'TLock' : pm.keyTangent(cvSrc, q= 1, lock= 1),
			'WLock' : pm.keyTangent(cvSrc, q= 1, weightLock= 1),
			'InTyp' : pm.keyTangent(cvSrc, q= 1, inTangentType= 1),
			'OuTyp' : pm.keyTangent(cvSrc, q= 1, outTangentType= 1),
			'InWet' : pm.keyTangent(cvSrc, q= 1, inWeight= 1),
			'OuWet' : pm.keyTangent(cvSrc, q= 1, outWeight= 1),
			'InAng' : pm.keyTangent(cvSrc, q= 1, inAngle= 1),
			'OuAng' : pm.keyTangent(cvSrc, q= 1, outAngle= 1)
	}
	cvSrcProfile = {
			'cvTrimmed' : tiLen,
			'cvBaseMod' : cvBaseMod,
			'cvPortray' : cvPortray,
			'cvFeature' : cvFeature
	}
	if trim:
		pm.undo()

	return cvSrcProfile
开发者ID:davidpower,项目名称:MS_AniRemap,代码行数:45,代码来源:mAnimCurveGen.py


示例17: storeAnimationAttrs

    def storeAnimationAttrs(self):

        name = str(self.cube.name())
        atr = name + ".translateX"
        pm.setKeyframe(
                atr,
                t=1,
                v=10
                )
        pm.setKeyframe(
                atr,
                t=5,
                v=5
                )

        self.store.animationAttrs(
                [atr],
                self.cube
                )
        return name
开发者ID:campbellwmorgan,项目名称:charactercrowd,代码行数:20,代码来源:test_attributeStore.py


示例18: mirrorAnim

def mirrorAnim():
	selection = pm.ls(sl=True)
	if len(selection) != 2:
		pm.warning('Need exactly two objects to mirror')
		return

	try:
		namespace = selection[0].namespace()
	except:
		namespace = ''
		

	try:
		sourceHolder = pm.ls(namespace + '*_SOURCE_HOLDER')[0]
		targetHolder = pm.ls(namespace + '*_TARGET_HOLDER')[0]
	except:
		pm.warning('No holders found to mirror animations')
		return
	source = pm.ls(sourceHolder.name().replace('_SOURCE_HOLDER',''),type='transform')[0]
	target= pm.ls(targetHolder.name().replace('_TARGET_HOLDER',''),type='transform')[0]
	
	sourceHolderAttr = pm.listAttr(sourceHolder,ud=True)
	targetHolderAttr = pm.listAttr(targetHolder,ud=True)
	
	for attr in sourceHolderAttr:
		print attr
		reverse = 1
		if (attr.find('translateX') > 0) or (attr.find('rotateY') > 0) or (attr.find('KneeTwist') > 0) or (attr.find('rotateZ') > 0):
			reverse = -1
		target.attr(attr.replace('__','')).set(sourceHolder.attr(attr).get() * reverse)
		
	for attr in targetHolderAttr:
		reverse = 1
		if (attr.find('translateX') > 0) or (attr.find('rotateY') > 0) or (attr.find('KneeTwist') > 0) or (attr.find('rotateZ') > 0):
			reverse = -1		
		source.attr(attr.replace('__','')).set(targetHolder.attr(attr).get() * reverse)
		
	pm.delete([sourceHolder,targetHolder])

	pm.setKeyframe(source)
	pm.setKeyframe(target)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:41,代码来源:bdMirrorFeet.py


示例19: keys_sequential_visibility

def keys_sequential_visibility(transforms, additive=False):
    ''' Sets visibility keys in order on a given selection of objects, in selection order
    Args:
        transforms [pm.nt.Transform]: transforms to key
        additive (bool): if false we turn off the object again, so they blink in order, not stay on
    Returns (None)
    Usage:
        key_vis_in_sequence(pm.ls(sl=True, type='transform'))
    '''
    start_frame = pm.currentTime()
    current_frame = start_frame + 1
    
    for transform in transforms:
        pm.setKeyframe(transform.visibility,
                       v=0,
                       inTangentType='flat',
                       outTangentType='flat',
                       t=start_frame)
        pm.setKeyframe(transform.visibility,
                       v=1,
                       inTangentType='flat',
                       outTangentType='flat',
                       t=current_frame)
        if not additive:
            pm.setKeyframe(transform.visibility,
                           v=0,
                           inTangentType='flat',
                           outTangentType='flat',
                           t=current_frame+1)
        current_frame += 1
开发者ID:AndresMWeber,项目名称:aw,代码行数:30,代码来源:lib_keys.py


示例20: bdSwitchParent

def bdSwitchParent():
	selection = pm.ls(sl=1,type='transform')
	if selection:
		ctrl = selection[0]
		try:
			currentParent = ctrl.attr('Parent').get()
		except:
			pm.warning('Current selection has no Parent attribute, aborting!')
			return
		print currentParent 
		switchFrame = pm.currentTime(q=1)
		
	
		pm.currentTime(switchFrame-1,e=1)
		pm.setKeyframe(ctrl)
		pm.currentTime(switchFrame,e=1)

		#World Parent
		if currentParent == 1:
			print 'Frow World to hand'
			tempLoc = pm.spaceLocator(n='temp')
			tempCnstr = pm.parentConstraint(ctrl,tempLoc)
			pm.delete(tempCnstr)

			ctrl.attr('Parent').set(0)

			worldPos = tempLoc.getTranslation(space='world')
			worldRot = tempLoc.getRotation(space='world')


			ctrl.setTranslation(worldPos,space='world')
			ctrl.setRotation(worldRot,space='world')
			
			pm.delete(tempLoc)
			pm.setKeyframe(ctrl )

		else :
			print 'From hand to world'
			tempLoc = pm.spaceLocator(n='temp')
			tempCnstr = pm.parentConstraint(ctrl,tempLoc)
			pm.delete(tempCnstr)

			ctrl.attr('Parent').set(1)

			worldPos = tempLoc.getTranslation(space='world')
			worldRot = tempLoc.getRotation(space='world')


			ctrl.setTranslation(worldPos,space='world')
			ctrl.setRotation(worldRot,space='world')
			
			pm.delete(tempLoc)
			pm.setKeyframe(ctrl )


	else:
		pm.warning('Select a ticket ctrl or the pound bill ctrl')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:57,代码来源:bdSwitchParent.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python core.setParent函数代码示例发布时间:2022-05-27
下一篇:
Python core.setAttr函数代码示例发布时间: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