当前位置: 首页>>代码示例>>Python>>正文


Python cmds.refresh函数代码示例

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


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

示例1: doEditPivotDriver

    def doEditPivotDriver(self, *args):

        newValue = mc.floatSliderButtonGrp(self.floatSlider, query=True, value=True)
        try:
            mc.deleteUI(self.pivotDriverWindow)
        except:
            pass

        currentValue = mc.getAttr(self.pivotDriver)
        if newValue == currentValue:
            return

        oldRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, newValue)
        newRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, currentValue)

        parentPosition = mc.group(em=True)
        offsetPosition = mc.group(em=True)
        offsetPosition = mc.parent(offsetPosition, parentPosition)[0]
        mc.setAttr(offsetPosition+'.translate', newRP[0]-oldRP[0], newRP[1]-oldRP[1], newRP[2]-oldRP[2])

        mc.delete(mc.parentConstraint(self.node, parentPosition))

        utl.matchBake(source=[self.node], destination=[parentPosition], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False)

        mc.cutKey(self.pivotDriver)
        mc.setAttr(self.pivotDriver, newValue)
        mc.refresh()
        utl.matchBake(source=[offsetPosition], destination=[self.node], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False, rotate=False)

        mc.delete(parentPosition)
开发者ID:liudger,项目名称:ml_tools,代码行数:32,代码来源:ml_pivot.py

示例2: addCount

def addCount():
    global progressCurrent
    global progressLength
    
    progressCurrent += 1
    
    row, left, right = uiInst._progressBarList[ progressIndex ]
    
    percent = progressCurrent/float(progressLength)
        
    leftWidth = percent*200
    rightWidth = 200-leftWidth
    
    if leftWidth < 1:
        leftWidth = 1
        rightWidth = 199
    if rightWidth < 1:
        leftWidth = 199
        rightWidth = 1
    
    cmds.rowColumnLayout( row, e=1, cw=[ (1,leftWidth),(2,rightWidth)] )
    if progressCurrent == 1: cmds.text( left, e=1, bgc=[1,1,0] )
    elif progressCurrent == progressLength: cmds.text( right, e=1, bgc=[1,1,0] )
    
    cmds.refresh()
开发者ID:jonntd,项目名称:mayadev-1,代码行数:25,代码来源:progress.py

示例3: refresh

def refresh():
    cmds.undoInfo(stateWithoutFlush=False)
    # cmds.refresh(force=True)
    # print "refresh"
    cmds.refresh(suspend=False)
    cmds.currentTime(cmds.currentTime(query=True), edit=True)
    cmds.undoInfo(stateWithoutFlush=True)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:animMod.py

示例4: drag

 def drag(self, *args):
     
     self.dragPoint = mc.draggerContext(self.draggerContext, query=True, dragPoint=True)
     
     #if this doesn't work, try getmodifier
     self.modifier = mc.draggerContext(self.draggerContext, query=True, modifier=True)
     
     self.x = ((self.dragPoint[0] - self.anchorPoint[0]) * self.multiplier) + self.defaultValue
     self.y = ((self.dragPoint[1] - self.anchorPoint[1]) * self.multiplier) + self.defaultValue
     
     if self.minValue is not None and self.x < self.minValue:
         self.x = self.minValue
     if self.maxValue is not None and self.x > self.maxValue:
         self.x = self.maxValue
     
     #dragString
     if self.modifier == 'control':
         if self.button == 1:
             self.dragControlLeft(*args)
         elif self.button == 2:
             self.dragControlMiddle(*args)
     elif self.modifier == 'shift':
         if self.button == 1:
             self.dragShiftLeft(*args)
         elif self.button == 2:
             self.dragShiftMiddle(*args)
     else:
         if self.button == 1:
             self.dragLeft()
         elif self.button == 2:
             self.dragMiddle()
     
     mc.refresh()
开发者ID:Bumpybox,项目名称:Tapp,代码行数:33,代码来源:ml_utilities.py

示例5: importAovs

	def importAovs(self):
		"""import aovs into scene"""
		LayersInfo = pickle.load( open( self.aovsPath.path, "rb") )
		mc.refresh( su = 1 )
		for ao in LayersInfo.keys():
			aov.create( ao, LayersInfo[ao]['name'], LayersInfo[ao]['type'], LayersInfo[ao]['enabled'] )
		mc.refresh( su = 0 )
开发者ID:skarone,项目名称:PipeL,代码行数:7,代码来源:renderLayerExporter.py

示例6: bake

def bake(constraint,
         start=None,
         end=None,
         sampleBy=1,
         simulation=True):
    """
    Bake specified constraint
    @param constraint: Constraint to bake animation for.
    @type constraint: str
    @param start: Start frame of bake animation range
    @type start: float or None
    @param end: End frame of bake animation range
    @type end: float or None
    @param sampleBy: Sample every Nth frame
    @type sampleBy: int
    @param simulation: Simulation option for bakeResults
    @type simulation: bool
    """
    # ==========
    # - Checks -
    # ==========

    # Check Constraint
    if not glTools.utils.constraint.isConstraint(constraint):
        raise Exception('Object "' + constraint + '" is not a valid constraint node!')

    # Check Start/End Frames
    if start == None: start = cmds.playbackOptions(q=True, min=True)
    if end == None: end = cmds.playbackOptions(q=True, max=True)

    # ====================================
    # - Get Slave Transform and Channels -
    # ====================================

    # Get Slave Transform
    slave = glTools.utils.constraint.slave(constraint)

    # Get Slave Channels
    attrList = cmds.listConnections(constraint, s=False, d=True, p=True) or []
    slaveAttrs = [i.split('.')[-1] for i in attrList if i.startswith(slave + '.')] or []
    if not slaveAttrs: raise Exception('No slave channels to bake!')

    # ===================
    # - Bake Constraint -
    # ===================

    cmds.refresh(suspend=True)
    cmds.bakeResults(slave,
                   at=slaveAttrs,
                   time=(start, end),
                   disableImplicitControl=True,
                   simulation=simulation,
                   sampleBy=sampleBy)
    cmds.refresh(suspend=False)

    # =================
    # - Return Result -
    # =================

    return [slave + '.' + i for i in slaveAttrs]
开发者ID:bennymuller,项目名称:glTools,代码行数:60,代码来源:constraint.py

示例7: onDrag

    def onDrag(self):
        baseDraggerCtx.onDrag(self)

        cntrl, alt, shift = self.mods
        if self.btn ==1:
            if not cntrl and not alt and not shift:
                self.paintOnDrag()
            elif cntrl and not shift and not alt:
                self.paintOnPolyOnDrag()

            #curve(self.crv, append=1, p=[pnt])
        elif self.btn==2:
            if not cntrl and not shift and not alt:
                self.moveOpOnDrag()
            elif cntrl and not shift and not alt:
                self.moveOpOnDrag()
            elif cntrl and shift and not alt:
                self.moveOpOnDrag()
            elif not cntrl and shift and not alt:
                self.moveOpOnDrag()

            elif cntrl and shift and alt:
                self.moveEndsOpDrag()            


        mc.refresh(cv=True)
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:26,代码来源:ysvCurveTweakerCtx.py

示例8: fix

def fix(self):
    import os
    if os.name == 'posix':
        viewport.hide()
        cmds.refresh()
        viewport.show()
    pass
开发者ID:safronov3d,项目名称:SAF_TCB,代码行数:7,代码来源:SAF_TCB.py

示例9: suspend_refresh

def suspend_refresh():
    """A context mananger that stops the graph from running or the view
    updating.

    Can be nested, where only the outermost context manager will resume
    refresing.

    ::

        >>> with suspend_refresh():
        ...     do_something_with_high_drawing_cost()


    .. seealso::

        There are caveats with disabling the refresh cycle. Be sure to 
        read about :cmds:`refresh`.

    """

    global _suspend_depth
    try:
        if not _suspend_depth:
            cmds.refresh(suspend=True)
        _suspend_depth += 1
        yield
    finally:
        _suspend_depth -= 1
        if not _suspend_depth:
            cmds.refresh(suspend=False)
开发者ID:felixzxf,项目名称:mayatools,代码行数:30,代码来源:context.py

示例10: duplicateObj

 def duplicateObj( self, targetObj, skinNode, addName='_add' ):
     
     if cmds.nodeType( targetObj ) != 'transform':
         targetObj = cmds.listRelatives( targetObj, p=1 )
         
         if targetObj: targetObj = targetObj [0]
         else: return None
     targetShape = cmds.listRelatives( targetObj, s=1 )[0]
     targetAttr = targetShape+'.outMesh'
     outputAttr = cmds.listConnections( skinNode+'.input[0].inputGeometry', s=1, d=0, p=1, c=1 )[1]
     
     secondMesh = cmds.createNode( 'mesh' )
     thirdMesh  = cmds.createNode( 'mesh' )
     
     secondObj = cmds.listRelatives( secondMesh, p=1 )[0]
     thirdObj  = cmds.listRelatives( thirdMesh, p=1 )[0]
     
     cmds.connectAttr( targetAttr, secondMesh+'.inMesh' )
     cmds.connectAttr( outputAttr, thirdMesh +'.inMesh' )
     
     cmds.refresh()
     
     cmds.disconnectAttr( targetAttr, secondMesh+'.inMesh' )
     cmds.disconnectAttr( outputAttr, thirdMesh +'.inMesh' )
     
     secondObj = cmds.rename( secondObj, targetObj+addName )
     thirdObj  = cmds.rename( thirdObj , targetObj+addName+'_inv' )
     
     return secondObj, thirdObj
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:simpleAddShape.py

示例11: copyWorld

    def copyWorld(self, *args):
        #print "copyworld"
        self.selection   = cmds.ls(selection=True)
        
        if len(self.selection) < 1: return
        
        if len(self.selection) > 20: 
            message         = "Too many objects selected, continue?"
            confirm         = cmds.confirmDialog( title='Confirm', message=message, button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
            if confirm != 'Yes': return  
        
        cmds.refresh(suspend=True)
        cmds.undoInfo(stateWithoutFlush=False)
        
        self.flushCopyCache(force=True)        
        self.scriptJob()       
        
        self.sourceObjs = self.selection
        self.targetObj  = "world"
        
        for loopObj in self.sourceObjs:        
            matrix     = cmds.xform(loopObj, query=True, ws=True, matrix=True)

            self.copyCache.append(matrix)

        
        cmds.iconTextButton("fakeConstrainBtn", edit=True, image= uiMod.getImagePath("specialTools_fake_constrain_active"),         highlightImage= uiMod.getImagePath("specialTools_fake_constrain_active copy"))
       
        cmds.refresh(suspend=False)
        cmds.undoInfo(stateWithoutFlush=True)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:30,代码来源:fakeConstrain.py

示例12: putObjects

 def putObjects(self, atCurrentFrame=False):
     # print self.sel
     # print self.putObjectList
     autoKey = cmds.autoKeyframe(q=True, state=True)
     cmds.autoKeyframe(state=False)
     # current #NO LONGER USED, REMOVE ONCE MERGED WITH WORK COPY OF KET
     # CLASS
     if atCurrentFrame:
         current = cmds.currentTime(q=True)
         if self.start > current:
             self.offset = current - self.start
         else:
             self.offset = ((self.start - current) * -1.0) + 0.0
         # print self.offset
     # put
     num = len(self.objects)
     i = 1
     uiEnable()
     for obj in self.objects:
         if cmds.objExists(obj.name):
             message(str(i) + ' of ' + str(num) + ' --  ' + obj.name, maya=True)
             cmds.refresh(f=1)
             obj.offset = self.offset
             obj.putAttribute()
         else:
             cmds.warning(
                 'Object   ' + obj.name + '   does not exist, skipping.')
         i = i + 1
     uiEnable()
     cmds.autoKeyframe(state=autoKey)
开发者ID:boochos,项目名称:work,代码行数:30,代码来源:clipPickle_lib.py

示例13: duplicateOnlyCurve

def duplicateOnlyCurve( curves ):
    
    import sgBFunction_dag
    curves = sgBFunction_dag.getChildrenCurveExists( curves )
    
    newCurves = []
    for curve in curves:
        curveP = sgBFunction_dag.getParent( curve )
        if curveP:
            newCurveParent = sgBFunction_dag.makeCloneObject( curveP )
        else:
            newCurveParent = None
        
        newCurveShape = cmds.createNode( 'nurbsCurve' )
        curveShape = sgBFunction_dag.getShape( curve )
        cmds.connectAttr( curveShape+'.local', newCurveShape+'.create' )
        
        newCurve = sgBFunction_dag.getTransform( newCurveShape )
        newCurve = cmds.rename( newCurve, 'du_' + curve.split( '|' )[-1] )
        if newCurveParent:
            newCurve = cmds.parent( newCurve, newCurveParent )[0]
        newCurves.append( newCurve )
    
    cmds.refresh()
    
    for i in range( len( newCurves ) ):
        curveShape = sgBFunction_dag.getShape( curves[i] )
        newCurveShape = sgBFunction_dag.getShape( newCurves[i] )
        if cmds.isConnected( curveShape+'.local', newCurveShape+'.create' ):
            cmds.disconnectAttr( curveShape+'.local', newCurveShape+'.create' )
    
    return newCurves
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:sgBFunction_curve.py

示例14: drag

 def drag(self, *args):
     '''Called continuously when holding the mouse button down, updates self.x and self.y with the mouse position,
     and runs the corresponding method for whichever button is being pressed.'''
     self.dragPoint = mc.draggerContext(self.draggerContext, query=True, dragPoint=True)
     
     self.x = ((self.dragPoint[0] - self.anchorPoint[0]) * self.multiplier) + self.defaultValue
     self.y = ((self.dragPoint[1] - self.anchorPoint[1]) * self.multiplier) + self.defaultValue
     
     if self.minValue is not None and self.x < self.minValue:
         self.x = self.minValue
     if self.maxValue is not None and self.x > self.maxValue:
         self.x = self.maxValue
     
     #dragString
     if self.modifier == 'control':
         if self.button == 1:
             self.dragControlLeft()
         elif self.button == 2:
             self.dragControlMiddle()
     elif self.modifier == 'shift':
         if self.button == 1:
             self.dragShiftLeft()
         elif self.button == 2:
             self.dragShiftMiddle()
     else:
         if self.button == 1:
             self.dragLeft()
         elif self.button == 2:
             self.dragMiddle()
     
     mc.refresh()
开发者ID:Bumpybox,项目名称:Tapp,代码行数:31,代码来源:ml_breakdownDragger.py

示例15: createInCurveFromCurve

def createInCurveFromCurve( numCurve ):
    
    import sgBFunction_surface
    import sgBFunction_dag
    
    def optimizeConnection( targetObject ):
        targetShape = sgBFunction_dag.getShape( targetObject )
        src = cmds.listConnections( targetShape + '.create', p=1 )[0]
        dst = cmds.listConnections( targetShape, d=1, s=0, p=1,type="volumeCurvesOnSurface" )[0]
        cmds.connectAttr( src, dst, f=1 )
        cmds.delete( targetObject )
    
    curves = sgBFunction_dag.getChildrenShapeExists( cmds.ls( sl=1 ) )

    surface = sgBFunction_surface.getLoftSurfaceFromSelCurves( curves, True )
    curves = sgBFunction_surface.createInCurve( surface, numCurve )
    
    surfShape = cmds.listRelatives( surface, s=1, f=1 )[0]
    reverseNode = cmds.listConnections( surfShape, s=1, type='reverseSurface' )[0]
    cmds.setAttr( reverseNode+'.direction', 0  )
    cmds.refresh()
    cmds.setAttr( reverseNode+'.direction', 3  )
    cmds.refresh()
    cmds.select( curves )
    #cmds.setAttr( surfShape+'.io', 1 )
    optimizeConnection( surfShape )
    
    return curves
开发者ID:jonntd,项目名称:mayadev-1,代码行数:28,代码来源:sgBFunction_curve.py


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