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

Python cmds.playbackOptions函数代码示例

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

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



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

示例1: setTimelineRange

 def setTimelineRange(self, range=None, *args):  
        
     rangeVisible            = cmds.timeControl( G.playBackSliderPython, query=True, rangeVisible=True )
     
     if not rangeVisible and not range:
         range = [cmds.playbackOptions(query=True, minTime=True), cmds.playbackOptions(query=True, maxTime=True)+1]
     
     if range or rangeVisible:
   
         if not range: range = animMod.getTimelineRange(float=False)
         rFrom   = range[0]
         rTo     = range[1]-1
         
         cmds.playbackOptions(minTime=rFrom, maxTime=rTo)
         
         
         if self.getTimelineRanges() != None: 
             ranges = eval(self.getTimelineRanges()) 
         else: 
             ranges = []
         if not range in ranges:
             ranges.append(range)     
             aToolsMod.saveInfoWithScene(STORE_NODE, RANGE_ATTR, ranges) 
             
     
     utilMod.deselectTimelineRange()
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:tUtilities.py


示例2: exportDeformAnimation

def exportDeformAnimation(folder):
    '''Use MDD file to export defrom animation.'''
    minframe = int( mc.playbackOptions(q = True, min = True) )
    maxframe = int( mc.playbackOptions(q = True, max = True) )
    totalframes = maxframe - minframe + 1
    t = mc.currentUnit(q = True, t = True)
    fps = _mfps[t]
    
    parts = []
    selectionList = mo.MSelectionList()
    mo.MGlobal.getActiveSelectionList(selectionList)
    itList = mo.MItSelectionList(selectionList, mo.MFn.kTransform)
    while not itList.isDone():
        path = mo.MDagPath()
        itList.getDagPath(path)
        partialName = str(path.partialPathName())
        name = partialName.split(":")[-1]
        part = MDD(name, mo.MFnMesh(path), totalframes, fps)
        parts.append(part)
        itList.next()
    # add animation
    for frame in range(minframe, maxframe + 1):
        mc.currentTime(frame, edit = True)
        for p in parts:
            p.addFrame()
            
    # write files
    for p in parts:
        p.writeToFile(folder)
        print "write %s done." % p.name
    print "All is done."
    return True
开发者ID:akoon,项目名称:OldPipeline,代码行数:32,代码来源:masset_bac.py


示例3: go

def go():
    try:
        assetName, assetType, version = geo.decodeFileName()
    except IndexError:
        showErrorDialog()
        return

    if not assetType == 'animation':
        showErrorDialog()
        return

    fileName = mc.file(q=True, sceneName=True)
    dirName = os.path.dirname(fileName)
    source = amu.getCheckinDest(dirName)
    blastPath = os.path.join(os.path.dirname(source), 'playblasts')
    versionNum = amu.getLatestVersion(source)+1
    name = os.path.join(blastPath, assetName+"_v"+("%03d" % versionNum))

    startFrame = mc.playbackOptions(q=True, min=True)
    endFrame = mc.playbackOptions(q=True, max=True)

    choice = mc.confirmDialog( title = 'Playblast Tool'
                              , message       = 'What kind of playblast?'
                              , button        = ['Cancel', 'GL', 'Simple']
                              , defaultButton = 'Simple'
                              , cancelButton  = 'Cancel'
                              , dismissString = 'Cancel')
    if choice == 'Simple':
        simpleBlast(name, startFrame, endFrame)
    elif choice == 'GL':
        glBlast(name, startFrame, endFrame)
开发者ID:byu-animation,项目名称:ramshorn-tools,代码行数:31,代码来源:maya_playblast.py


示例4: initializeBakeRange

def initializeBakeRange():
    """
    Initialize bake anim range based on playback timeline min/max.
    """
    start = cmds.playbackOptions(q=True, min=True)
    end = cmds.playbackOptions(q=True, max=True)
    cmds.intFieldGrp('xferMocap_startEndCBG', e=True, v1=start, v2=end)
开发者ID:bennymuller,项目名称:glTools,代码行数:7,代码来源:mocapTransfer.py


示例5: getMinMax

def getMinMax():            
          
    rangeStart  = cmds.playbackOptions(query=True, minTime=True)
    rangeEnd    = cmds.playbackOptions(query=True, maxTime=True)
    curvesShown = cmds.animCurveEditor( 'graphEditor1GraphEd', query=True, curvesShown=True)
    keysTimes   = []
    keysValues  = []
    keysShown   = []
    
    if curvesShown:
        for aCurve in curvesShown:
            keysTimes.extend(cmds.keyframe(aCurve, query=True, timeChange=True))
            keysValues.extend(cmds.keyframe(aCurve, query=True, valueChange=True))
            for n, key in enumerate(keysTimes):
                if rangeStart <= key <= rangeEnd:
                    keysShown.append(keysValues[n])
                    
        keyMax = max(keysShown)
        keyMin = min(keysShown)
        total  = keyMax - keyMin
        if total == 0: total = 1
        border = total * .1
        
        return [keyMax+border, keyMin-border]
    else:
        return [0, 100]
开发者ID:Italic-,项目名称:maya-prefs,代码行数:26,代码来源:jumpToSelectedKey.py


示例6: getCurrent

 def getCurrent(self):
     self.minframe = int( mc.playbackOptions(q = True, min = True) )
     self.maxframe = int( mc.playbackOptions(q = True, max = True) )
     self.totalframes = self.maxframe - self.minframe + 1
     t = mc.currentUnit(q = True, t = True)
     self.fps = self._mfps[t]
     return True
开发者ID:akoon,项目名称:OldPipeline,代码行数:7,代码来源:masset.py


示例7: __init__

 def __init__(self, shotAssetPath, shot):
     super(CameraExportWidget, self).__init__()
     self.setLayout(QtGui.QVBoxLayout())
     widgetLayout = QtGui.QGridLayout()
     self.layout().addLayout(widgetLayout)
     widgetLayout.addWidget(QtGui.QLabel('Select Camera:'), 0, 0)
     self.cameraBox = QtGui.QComboBox()
     self.populateCameraBox()
     widgetLayout.addWidget(self.cameraBox, 0, 1)
     widgetLayout.addWidget(QtGui.QLabel('Frame Start'), 1, 0)
     self.frameStartEdit = QtGui.QLineEdit()
     self.frameStartEdit.setText(str(cmds.playbackOptions(q=True, minTime=True)))
     widgetLayout.addWidget(self.frameStartEdit, 1, 1)
     widgetLayout.addWidget(QtGui.QLabel('Frame End'), 1, 2)
     self.frameEndEdit = QtGui.QLineEdit()
     self.frameEndEdit.setText(str(cmds.playbackOptions(q=True, maxTime=True)))
     widgetLayout.addWidget(self.frameEndEdit, 1, 3)
     widgetLayout.addWidget(QtGui.QLabel('Frame Step'), 2, 0)
     self.frameStepEdit = QtGui.QLineEdit()
     self.frameStepEdit.setText('1')
     widgetLayout.addWidget(self.frameStepEdit, 2, 1)
     fileLayout = QtGui.QHBoxLayout()
     fileLayout.addWidget(QtGui.QLabel('Output File:'))
     self.outFileEdit = QtGui.QLineEdit()
     camFilePath = ''
     if shotAssetPath and shot:
         camFilePath = self.getOutputFilename(shot, shotAssetPath)
     self.outFileEdit.setText(camFilePath)
     fileLayout.addWidget(self.outFileEdit)
     toolButton = QtGui.QToolButton()
     toolButton.setText('...')
     toolButton.clicked.connect(lambda: self.saveOutputFilename(camFilePath))
     fileLayout.addWidget(toolButton)
     self.layout().addLayout(fileLayout)
开发者ID:afrocircus,项目名称:LVFX-pipeline,代码行数:34,代码来源:exportWidget.py


示例8: parse_active_scene

def parse_active_scene():
    """Parse active scene for arguments for capture()

    *Resolution taken from render settings.

    """

    time_control = mel.eval("$gPlayBackSlider = $gPlayBackSlider")

    return {
        "start_frame": cmds.playbackOptions(minTime=True, query=True),
        "end_frame": cmds.playbackOptions(maxTime=True, query=True),
        "width": cmds.getAttr("defaultResolution.width"),
        "height": cmds.getAttr("defaultResolution.height"),
        "compression": cmds.optionVar(query="playblastCompression"),
        "filename": (cmds.optionVar(query="playblastFile")
                     if cmds.optionVar(query="playblastSaveToFile") else None),
        "format": cmds.optionVar(query="playblastFormat"),
        "off_screen": (True if cmds.optionVar(query="playblastOffscreen")
                       else False),
        "show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
                       else False),
        "quality": cmds.optionVar(query="playblastQuality"),
        "sound": cmds.timeControl(time_control, q=True, sound=True) or None
    }
开发者ID:Bumpybox,项目名称:pyblish-bumpybox,代码行数:25,代码来源:capture.py


示例9: playblast_scene

def playblast_scene():
    """ Playblast the current scene using the min and max playback
    values as the start and end value for the playblast.

    :todo: Add a configuration (json) file that lets the user save
           their file to a particular location.
    :todo: Add a function in the utils folder that time stamps or
           versions the maya file.
    """
    # Get the start and end frames of the animation scene:
    start_frame = cmds.playbackOptions(min=True, query=True)
    end_frame   = cmds.playbackOptions(max=True, query=True)

    # Create the filename of the playblast:
    time_code = time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime())

    filename = cmds.file(query=True, sceneName=True)
    filename += time_code
    filename += ".mov"

    location = os.path.join(_get_images_directory(), filename)

    # Playblast the scene:
    cmds.playblast(filename=location, fmt="qt", offScreen=True)

    # Return
    return
开发者ID:eoghancunneen,项目名称:mayaflipbook,代码行数:27,代码来源:animationflipbook.py


示例10: export_cameras

    def export_cameras(self, assets_path, project):
        valid_cameras = None
        selected_cameras = cmds.ls(sl=True, dag=True, ca=True)

        for cam in selected_cameras:
            if cam != "perspShape" and cam != "topShape" and cam != "frontShape" and cam != "sideShape":
                valid_cameras = True

        if not valid_cameras:
            cmds.inViewMessage(
                amg="No valid cameras selected (default 'persp' camera not supported in FBX export)",
                pos='botCenter', fade=True, fadeOutTime=500)
            return

        start_frame = str(cmds.playbackOptions(query=True, minTime=True))
        end_frame = str(cmds.playbackOptions(query=True, maxTime=True))

        if not os.path.exists(assets_path + "/" + project):
            os.makedirs(assets_path + "/" + project)

        output_file = assets_path + "/" + project + "/" + project + "_cameras.fbx"

        print "Camera file name: " + output_file

        # save the cameras to assets folder
        maya.mel.eval('FBXExportFileVersion "FBX201200"')
        maya.mel.eval('FBXExportInAscii -v true')
        maya.mel.eval("FBXExportCameras -v true")
        cmds.file(output_file, force=True, options='v=0', type='FBX export', pr=True, es=True)

        return [output_file, start_frame, end_frame]
开发者ID:StuTozer,项目名称:mGo-Refactor,代码行数:31,代码来源:mgo_maya.py


示例11: go

def go():
    try:
        assetName, assetType, version = geo.decodeFileName()
    except IndexError:
        showErrorDialog()
        return

    if not assetType == "animation":
        showErrorDialog()
        return

    fileName = mc.file(q=True, sceneName=True)
    dirName = os.path.dirname(fileName)
    source = amu.getCheckinDest(dirName)
    blastPath = os.path.join(os.path.dirname(source), "playblasts")
    name = os.path.join(blastPath, assetName)

    startFrame = mc.playbackOptions(q=True, min=True)
    endFrame = mc.playbackOptions(q=True, max=True)

    choice = mc.confirmDialog(
        title="Playblast Tool",
        message="What kind of playblast?",
        button=["Cancel", "GL", "Simple"],
        defaultButton="Simple",
        cancelButton="Cancel",
        dismissString="Cancel",
    )
    if choice == "Simple":
        simpleBlast(name, startFrame, endFrame)
    elif choice == "GL":
        glBlast(name, startFrame, endFrame)
开发者ID:jtsai01,项目名称:ramshorn-tools,代码行数:32,代码来源:maya_playblast.py


示例12: __init__

    def __init__(self, resolution=[1920, 1080, 1.0], range=[]):
        self.userName = "Max"
        self.resolution = resolution
        self.curPanel = cmds.getPanel(wf=True)

        self.userName = "Unknown"
        self.settings = fn.loadSettings(fileName)
        if "display" in self.settings:
            self.userName = self.settings["display"]

        curDate = time.localtime()
        self.curTime = "%02d:%02d %02d.%02d.%04d" % (
            curDate.tm_hour,
            curDate.tm_min,
            curDate.tm_mday,
            curDate.tm_mon,
            curDate.tm_year,
        )

        if range:
            self.range = range
        else:
            self.range = [cmds.playbackOptions(q=True, min=True), cmds.playbackOptions(q=True, max=True)]
        self.duration = int(self.range[1] - self.range[0] + 1)

        self.getFileName()
        self.getFPS()
开发者ID:kuzubov,项目名称:maya_python_scripts,代码行数:27,代码来源:core.py


示例13: LoadJointMotionPaths

 def LoadJointMotionPaths( self, roots ):
     """ prep the data structure that holds the motion paths """
     animPaths = {}
     for root in roots:
         animPaths[root] = {}
         self.trace[root] = Trajectory("%sTrace"%root)
         # find all nearby joints
         joints = [j for j in mc.listRelatives( root, allDescendents=True ) if j in self.traceableObjs]  # TODO: just get the nearby joints by projecting them all onto the viewing plane and finding the distance
         # get the motion path of each nearby joint
         if len(joints) > 0:
             for j in joints:
                 animPaths[root][j] = Trajectory( "%s_path"%j )
                 if debug > 0:
                     mc.group(name="%sGrp"%j,empty=True)
     
     startFrame = mc.playbackOptions(q=True,minTime=True)
     endFrame = mc.playbackOptions(q=True,maxTime=True)+1
     for t in [float(x)/self.substeps+startFrame for x in range(0, int(endFrame-startFrame)*self.substeps)]:
         mc.currentTime(t)
         for root in roots:
             joints = [j for j in mc.listRelatives( root, allDescendents=True ) if j in self.traceableObjs]
             for j in joints:
                 point = Vector( mc.xform(j, q=True, ws=True, t=True) ) 
                 animPaths[root][j].AddPoint( point, t )
                 if debug > 0:
                     loc = mc.spaceLocator(p=point)
                     mc.parent(loc,"%sGrp"%j)
             self.trace[root].SetSearchList( animPaths[root] )
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:28,代码来源:traceSelectTool.py


示例14: TraceGestureRelease

    def TraceGestureRelease( self ):
        """ when the mouse is released, find the matching joint trajectory """
        if debug>0: print("begin RELEASE")
        releasePosition = Vector( mc.draggerContext( 'TraceGesture', query=True, dragPoint=True) ).projectToPlane( self.trace[self.nearestRoot].normal, planePt=self.trace[self.nearestRoot].planePt )
        if debug>0: print "release! ", releasePosition
        theTrace = self.trace[self.nearestRoot]
        selectedMotion = None
        if theTrace.closestJoint and theTrace.timespan and (theTrace.timespan[1]-theTrace.timespan[0]) > 1 and \
           not mc.draggerContext( 'TraceGesture', query=True, modifier=True) == "ctrl":        
            theDTW = theTrace.dtws[theTrace.closest]
            if debug > 0:
                print "closest = ", theTrace.closestJoint, theTrace.timespan
                if not mc.objExists("DTW_Y"):
                    mc.group(n="DTW_Y",empty=True)
                for pt in theDTW.Y:
                    loc = mc.spaceLocator(p=pt)
                    mc.parent(loc,"DTW_Y")
        ##    ghostJoint(trace[nearestRoot].closestJoint,trace[nearestRoot].timespan)

            # Build the motion curve and store it's name in the selectedMotions dictionary
            duration = [ int(theTrace.timespan[0]), int(theTrace.timespan[1]+1) ]
            keyframes = [ theTrace.searchList[theTrace.closestJoint].points[frame] for frame in range(duration[0],duration[1]) ]
            selectedMotion = bmt.CurveMotionTrace( theTrace.closestJoint, keys=keyframes ) #duration=theTrace.timespan )
            
        else:
            self.ScrubToNearestTimeOnPath( releasePosition, self.nearestRoot, self.nearestPath )
            cam2pop = self.CameraToPopDist()
            path = theTrace.searchList[self.nearestPath]
            pointKey = path.ClosestTimeTo(releasePosition)
            closestPoint = path.points[pointKey]
            closestPtOnPath = closestPoint.projectToPlane( theTrace.normal, planePt=theTrace.planePt )
            mouse2path = (releasePosition - closestPtOnPath).mag()
            # if motion paths are visible and no drag happened
            # and releasePosition is very close to the path,
            # then select the whole motion path
            if self.motionPathsVisible[self.nearestRoot] and mouse2path < 0.3:  
                # Build the motion curve and store it's name in the selectedMotions dictionary
                duration = [ mc.playbackOptions(q=True,min=True),mc.playbackOptions(q=True,max=True)+1 ]
                keyframes = [ theTrace.searchList[self.nearestPath].points[frame] for frame in range(duration[0],duration[1]) ]
                selectedMotion = bmt.CurveMotionTrace( self.nearestPath, keys=keyframes ) #duration=[mc.playbackOptions(q=True,min=True),mc.playbackOptions(q=True,max=True)] )

            # if not scrubbing
            if not mc.draggerContext( 'TraceGesture', query=True, modifier=True) == "ctrl" and \
               cam2pop >= self.viewFitDistance:      # if trucked out, and mouse is clicked (w/ no drag)
                mc.select(self.nearestRoot)     # zoom in on the nearest root for a better view
                mc.viewFit(fitFactor=2.5)            # the invisible parts of the roots can artificially enlarge the BB, so truck in a little extra
                mc.select(clear=True)
        if selectedMotion:
            selectedMotionCurve = selectedMotion.construct(self.nearestPath)
            
            if not self.nearestRoot in self.selectedMotions.keys():
                self.selectedMotions[self.nearestRoot] = []
            mc.setAttr("%s_MotionTraces.visibility"%self.nearestRoot, 0)
            selectedMotionCurve = mc.rename(selectedMotionCurve, "%s_selection%d"%(self.nearestPath,len(self.selectedMotions[self.nearestRoot])))
            self.selectedMotions[self.nearestRoot].append( selectedMotionCurve )
            self.AddCustomAttr( selectedMotionCurve, "isTraceSelection", True )
            self.AddCustomAttr( selectedMotionCurve, "interactTime", time.time()-self.startTime )
            self.AddCustomAttr( selectedMotionCurve, "startFrame", duration[0] )
            self.AddCustomAttr( selectedMotionCurve, "endFrame", duration[1] )
        mc.select(cl=True)
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:60,代码来源:traceSelectTool.py


示例15: exportAlembic

def exportAlembic():
	
	msgText = ""

	SAVE_PATH       = os.path.dirname(cmds.file(q=True,sn=True))
	SAVE_PATH		= SAVE_PATH.replace("WORK", "PUBLISH")
	SAVE_FILE     	= os.path.basename(cmds.file(q=True,sn=True))

	if (len(SAVE_FILE.split('_')) > 2):
		tmpFile = SAVE_FILE.split('_')
		SAVE_FILE = tmpFile[0] + "_" + tmpFile[1]

	SAVE_DIR		= (SAVE_PATH + '\\' + SAVE_FILE.split('.')[0] + ".abc").replace("\\","/")

	FRAME_START		= cmds.playbackOptions( query=True, animationStartTime=True )
	FRAME_END		= cmds.playbackOptions( query=True, animationEndTime=True )


	try:
		mel.eval('select -r ASSETS ;')
		mel.eval('select -add CAM ;')
		mel.eval('AbcExport -j "-frameRange ' + str(FRAME_START) + ' ' + str(FRAME_END) + ' -attr name -dataFormat hdf -root |ASSETS -root |CAM -file ' + SAVE_DIR + '";')
		msgText = "** DONE | ALEMBIC EXPORT: " + SAVE_DIR.replace("/","\\") + " **"
		print(msgText)  

	except:
		msgText = "** FAIL | ALEMBIC EXPORT: No ASSETS & CAM group in the scene **"
		print(msgText)  

	return msgText
开发者ID:Quazo,项目名称:breakingpoint,代码行数:30,代码来源:alembicExport+-+Copy.py


示例16: allFrame

 def allFrame(self,*args):
     min = mc.playbackOptions(q=1, minTime=1)
     max = mc.playbackOptions(q=1, maxTime=1)
     nowFramHub = mc.currentTime( q=1 )
     allFrameHub = max -min
     frameHub = '%d/%d'%(nowFramHub,allFrameHub)
     return frameHub
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:7,代码来源:HUDcaminfoa.py


示例17: set_frame_range

 def set_frame_range(self, startFrame, endFrame):
     if endFrame <= startFrame:
         startFrame = cmds.playbackOptions(query=True, min=True)
         endFrame = cmds.playbackOptions(query=True, max=True)
         
     cmds.setAttr('defaultRenderGlobals.startFrame', startFrame)
     cmds.setAttr('defaultRenderGlobals.endFrame', endFrame)
开发者ID:ahmidou,项目名称:aphid,代码行数:7,代码来源:RenderOps.py


示例18: setAttrsFromModInfo

    def setAttrsFromModInfo(self, animModAttrSettings): 
        allAnimNodes = [] 
        print ' SetAttrFromModInfo'   
        for each in animModAttrSettings:
            
            attribute = each[0]
            value = float(each[1])

            if attribute != 'endFrame':   
                """ Strip the attribute down to the node name""" 
                """so we can verify it exists """           
                animNode = self.stripAttrNameFromGrp(attribute)

                
            
 
                if cmds.objExists(animNode) == True:
                    try:
                        cmds.setAttr(attribute, value)
                    except: 
                        print (attribute + " .........could not be set ")
                    #else:
                        #try:
                            #self.installAnimModFromCsv(animNode)
                        #except:
                            #pass
                        
            else:
                cmds.playbackOptions( minTime='0sec', maxTime=value)
开发者ID:griffinanimator,项目名称:MPR,代码行数:29,代码来源:animationModuleSettings.py


示例19: cacheVP

def cacheVP():
    """
    //Cache viewport geometry for playback

    undoInfo -stateWithoutFlush off;

    string $activePanel = `getPanel -wf`;
    modelEditor -e -grid false $activePanel;
    modelEditor -e -allObjects 0 $activePanel;
    modelEditor -e -polymeshes 1 $activePanel;

    int $rangeStartFrame = `playbackOptions -q -min`;

    currentTime -e $rangeStartFrame;
    playbackOptions -playbackSpeed 0 -loop "once" -by 1;
    playButtonForward;
    playbackOptions -playbackSpeed 1 -loop "continuous";

    undoInfo -stateWithoutFlush on;
    """

    cmds.undoInfo(swf=False)
    panType = cmds.getPanel(wf=True)
    cmds.modelEditor(panType, e=True, gr=False)
    cmds.modelEditor(panType, e=True, alo=False)
    cmds.modelEditor(panType, e=True, pm=True)

    rangeStartFrame = cmds.playbackOptions(q=True, min=True)

    cmds.currentTime = int(rangeStartFrame)
    cmds.playbackOptions(ps=0, l="once", by=1)
    cmds.play(f=True, ps=True)
    cmds.playbackOptions(ps=1, l="continuous")
    cmds.undoInfo(swf=True)
开发者ID:Italic-,项目名称:maya-scripts,代码行数:34,代码来源:ita_snippet_collection.py


示例20: _plotter_avrg

 def _plotter_avrg(self):
     '''plots a locator to a vertice or face per keyframe in a timeline'''
     selObj=cmds.ls(sl=1, fl=1)      
     if len(selObj)>0:
         pass
     else:
         print "Select 1 object" 
         return     
     getTopRange=cmds.playbackOptions(q=1, max=1)+1#get framerange of scene to set keys in iteration 
     getLowRange=cmds.playbackOptions(q=1, min=1)-1#get framerange of scene to set keys in iteration 
     edgeBucket=[]
     getRange=arange(getLowRange,getTopRange, 1 )
     getloc=cmds.spaceLocator(n=selObj[0]+"cnstr_lctr")
     cmds.normalConstraint(selObj[0], getloc[0])
     placeloc=cmds.spaceLocator(n=selObj[0]+"lctr")
     for each in getRange:
         cmds.currentTime(each)            
         transform=cmds.xform(selObj, q=1, ws=1, t=1)
         posBucketx=self.array_median_find(transform[0::3])
         posBuckety=self.array_median_find(transform[1::3])
         posBucketz=self.array_median_find(transform[2::3])
         cmds.xform(getloc[0], ws=1, t=(posBucketx, posBuckety, posBucketz))  
         cmds.SetKeyTranslate(getloc[0])
         cmds.xform(placeloc[0], ws=1, t=(posBucketx, posBuckety, posBucketz))
         cmds.SetKeyTranslate(placeloc[0])               
         rotate=cmds.xform(getloc[0], q=True, ws=1, ro=True)
         cmds.xform(placeloc[0], ws=1, ro=rotate)  
         cmds.SetKeyRotate(placeloc[0])
         cmds.currentTime(each)            
开发者ID:edeglau,项目名称:storage,代码行数:29,代码来源:plot.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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