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

Python cmds.warning函数代码示例

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

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



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

示例1: mtt_log

def mtt_log(msg, add_tag=None, msg_type=None, verbose=True):
    """ Format output message '[TAG][add_tag] Message content'

    :param msg: (string) message content
    :param add_tag: (string or list) add extra tag to output
    :param msg_type: define message type. Accept : None, 'warning', 'error'
    :param verbose: (bool) enable headsUpMessage output
    """
    # define tags
    tag_str = '[MTT]'

    # append custom tags
    if add_tag:
        if not isinstance(add_tag, list):
            add_tag = [add_tag]

        for tag in add_tag:
            tag_str += '[%s]' % tag.upper()

    # output message the right way
    if msg_type == 'warning':
        cmds.warning('%s %s' % (tag_str, msg))
    elif msg_type == 'error':
        cmds.error('%s %s' % (tag_str, msg))
    else:
        print '%s %s\n' % (tag_str, msg),

    if verbose and MTTSettings.value('showHeadsUp'):
        cmds.headsUpMessage(msg)
开发者ID:Bioeden,项目名称:dbMayaTextureToolkit,代码行数:29,代码来源:mttCmd.py


示例2: keyToOn

def keyToOn():
    controller = mc.ls(sl=True)[0]

    channelBox = mel.eval('global string $gChannelBoxName; $temp=$gChannelBoxName;')	#fetch maya's main channelbox
    attrs = mc.channelBox(channelBox, q=True, sma=True)

    if attrs:
        channel = controller + "." + attrs[0]
        constraint = mc.listConnections(channel, type="constraint")[0]
        currentTime = mc.currentTime( query=True )

        # save rest pose on constraint
        # mc.currentTime(currentTime-1)
        constraintChannels = mc.listConnections(constraint, type="animCurve")
        mc.parentConstraint(controller, constraint, edit=True, maintainOffset=True)
        for i in constraintChannels:
            value = mc.getAttr(mc.listConnections(i, plugs=True)[0])
            setKeyframe(mc.listConnections(i, plugs=True)[0], currentTime, value)

        # set key on 1 for controller
        setKeyframe(channel, currentTime-1, value=0)
        setKeyframe(channel, currentTime, value=1)

        # mc.currentTime( currentTime )
    else:
        mc.warning("Select constrain channel!")
开发者ID:robertvari,项目名称:ShotManager_dev,代码行数:26,代码来源:keyConstraint.py


示例3: _get_recommended_pivot_bank

    def _get_recommended_pivot_bank(self, geometries, tm_ref, tm_ref_dir, pos_toes, direction=1):
        """
        Determine recommended position using ray-cast from the toes.
        TODO: If the ray-case fail, use a specified default value.
        return: The recommended position as a world pymel.datatypes.Vector
        """
        # Sanity check, ensure that at least one point is in the bounds of geometries.
        # This can prevent rays from being fired from outside a geometry.
        # TODO: Make it more robust.
        filtered_geometries = []
        for geometry in geometries:
            xmin, ymin, zmin, xmax, ymax, zmax = cmds.exactWorldBoundingBox(geometry.__melobject__())
            bound = pymel.datatypes.BoundingBox((xmin, ymin, zmin), (xmax, ymax, zmax))
            if bound.contains(pos_toes):
                filtered_geometries.append(geometry)

        dir = pymel.datatypes.Point(direction, 0, 0) * tm_ref_dir
        pos = libRigging.ray_cast_nearest(pos_toes, dir, filtered_geometries)
        if not pos:
            cmds.warning("Can't automatically solve FootRoll bank inn pivot.")
            pos = pos_toes

        pos.y = 0

        return pos
开发者ID:renaudll,项目名称:omtk,代码行数:25,代码来源:rigLeg.py


示例4: get_num_cvs

    def get_num_cvs(self, curve):
        '''
        Desc:
        Get cvs lenght from a curve

        Parameter:
        curve = curve to get cvs positin list from
        coords_space = the coordinat space, can be "world" (default), or "local"

        Return:
        list with positions
        '''

        # If curve is nod define or not correct release error
        if curve:
            # Get curve shape
            curve_shape = KstMaya.get_shape_node(curve)

            # Get degree
            degree = cmds.getAttr(curve_shape+".degree")

            # Get spans
            spans = cmds.getAttr(curve_shape+".spans")

            # Calulating ncvs with formula spans+degree
            ncvs = spans+degree

            # Return the list
            return ncvs
        else:
            cmds.warning("Curve %s,  is not defined, or is not a curve, double check!" % curve)
            return None
开发者ID:Leopardob,项目名称:Kistie,代码行数:32,代码来源:KstMaya.py


示例5: saveFileToPublish

 def saveFileToPublish(self):
     self.currentFilePath = cmds.file(q=1, sn=1)
     if self.currentFilePath:
         if '/work/' in self.currentFilePath:
             self.baseName = os.path.basename(self.currentFilePath)
             self.publishPath = self.currentFilePath.split(self.baseName)[0].replace('/work/', '/publish/')
             self.publishFilePath = os.path.join(self.publishPath, self.baseName)
             if os.listdir(self.publishPath):
                 fileName = sorted(os.listdir(self.publishPath))[-1].replace('.ma', '.mb')
                 newPublishFilePath = os.path.join(self.publishPath, fileName)
                 curVersion = os.path.splitext(fileName)[0].split('.v')[-1]
                 newVersion = int(curVersion) + 1
                 newVersionStr = '.v%03d' % newVersion
                 self.publishFilePath = newPublishFilePath.replace('.v%03d' % int(curVersion), newVersionStr)
                 cmds.file(f=1, save=1)
                 cmds.file(rename=self.publishFilePath)
                 cmds.file(f=1, save=1, type = 'mayaBinary')
                 cmds.file(self.currentFilePath, f=1, open=1)
                 return self.publishFilePath
             else:
                 fileName = self.baseName.replace('.ma', '.mb')
                 newPublishFilePath = os.path.join(self.publishPath, fileName)
                 self.publishFilePath = newPublishFilePath
                 cmds.file(f=1, save=1)
                 cmds.file(rename=self.publishFilePath)
                 cmds.file(f=1, save=1, type = 'mayaBinary')
                 cmds.file(self.currentFilePath, f=1, open=1)
                 return self.publishFilePath
         else:
             cmds.confirmDialog(m="File is not in work directory.. Kindly save your file in work directory and run this script", b="Ok")
     else:
         cmds.warning('Cannot find proper file. Please save our file and proceed....')
开发者ID:vipul-rathod,项目名称:AppleTree,代码行数:32,代码来源:fxPublishOffline.py


示例6: offsetCurveDragCmd

 def offsetCurveDragCmd(self, *args ):
     
     if not self._dragStart:
         
         selCurves = cmds.ls( sl=1 )
     
         self._targetCurves = []
         self._keepTargetCurveValues = []
         for curve in selCurves:
             if cmds.attributeQuery( 'centerRate' , node = curve, ex=1 ):
                 self._targetCurves.append( curve )
                 self._keepTargetCurveValues.append( cmds.getAttr( curve+'.centerRate' ) )
         
         if not self._targetCurves:
             cmds.warning( "Select VolumeCurves" )
             return None
         
         self._dragStart = True
         cmds.undoInfo( swf=0 )
         
     multRate = cmds.floatSliderGrp( self._offsetCurve, q=1, v=1 )
         
     for i in range( len( self._targetCurves ) ):
         targetCurve = self._targetCurves[i]
         value       = self._keepTargetCurveValues[i]
         
         cmds.setAttr( targetCurve+'.centerRate', value*multRate )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:volume.py


示例7: publish

def publish():
	# Import Modules
	import shutil

	# Get SceneName and Root
	fullName = cmds.file(sceneName=True, q=True)
	paths = fullName.split("/")

	taskName = paths[-2].split("_")[2]
	assetCode = paths[-2].split("_")[1]
	assetName = Assets.getFullName(assetCode)

	outFolder =  "/".join(paths[:-1]) + "/" + assetCode + "_" + taskName + "_OUT"
	outName = assetName + "_" + taskName

	cmds.file( save=True, type='mayaAscii' )					# Save File
	shutil.copy2(fullName, outFolder + "/" + outName + ".ma")	# Copy File to MASTER
	cmds.warning("[Kroentlied Pipeline] Published !")

	# Copy File to BackUp
	oldFolder = outFolder + "/" + assetCode + "_" + taskName + "_OUT_OLD"
	backup = VersionControl.getLatest(oldFolder, 1)

	if not backup:	# No Backup found yet
	    backup = outName + "_BackUp_v001.ma"

	shutil.copy2(fullName, oldFolder + "/" + backup)
	print "[Kroentlied Pipeline] PublishBackup: " + backup
	return
开发者ID:Loqy,项目名称:Kroetenlied_Pipeline,代码行数:29,代码来源:mayaCommands.py


示例8: cb_drawLines

 def cb_drawLines(self, x=None) :
     if None in [ self.markerset, self.prefix ] : 
         m.warning("No markerset or prefix")
         return
     
     print "drawing lines for " + str(self.prefix)
     self.markerset.drawLines( self.prefix )
开发者ID:mocap-ca,项目名称:cleanup,代码行数:7,代码来源:labeler.py


示例9: doIt

    def doIt(self, argList):
        # get only the first object from argument list
        try:
            obj = misc.getArgObj(self.syntax(), argList)[0]
        except:
            cmds.warning("No object selected!")
            return
        if (cmds.objectType(obj) != 'transform'):
            cmds.error("Object is not of type transform!")
            return
        # parse arguments and get flags
        argData = om.MArgParser (self.syntax(), argList)
        axisOrder = argData.flagArgumentString('axisOrder', 0) if (argData.isFlagSet('axisOrder')) else 'yzx'
        fast = argData.flagArgumentBool('fast', 0) if (argData.isFlagSet('fast')) else False
        # get eigenvectors as matrix (column-wise), reshape matrix and append extra row/column
        eig = np.matrix(cmds.eigenvector(obj, ao = axisOrder, f = fast))
        eig.shape = (3,3)
        eig = np.append(eig, [[0,0,0]], axis = 0)
        eig = np.append(eig.transpose(), [[0,0,0,1]], axis = 0).transpose()

        # return 4x4 matrix as 16 float values
        util = om.MScriptUtil()
        util.createFromList(eig.getA1().tolist(), eig.size)

        self.setResult(om.MDoubleArray(util.asDoublePtr(), eig.size))
开发者ID:EnReich,项目名称:ProKlaue,代码行数:25,代码来源:alignObj.py


示例10: prepare

def prepare(setname="cache_set", groupname="cache_group", prefix="cache_"):
    selection = cmds.ls(sl=True, l=True)
    
    if len(selection) == 0:
        cmds.warning("Please select objects!")
        return
        
    cmds.duplicate()
    dup = cmds.ls(sl=True, l=True)
    
    if cmds.objExists(groupname):
        cmds.parent(dup, groupname)
    else:
        cmds.group(w=True, n=groupname)
    
    cmds.select(groupname)
    dup = get_shapes()
    add_to_set_of_shapes(setname, dup)
    
    i = 0
    for obj in dup:
        cmds.blendShape([selection[i], obj], w=(0, 1),o="world", foc=True)
        objects = []
        objects.append(obj)
        addattr(objects, prefix+str(i))
        i=i+1
开发者ID:ivanzotov,项目名称:mdc,代码行数:26,代码来源:mdc.py


示例11: on_getObjectRegion_pressed

 def on_getObjectRegion_pressed(self):
     
     sel=cmds.ls(selection=True)
     
     #checking selection for meshes
     check=False
     for node in sel:
         
         shape=cmds.listRelatives(node,shapes=True)
         if shape:
             
             if cmds.nodeType(shape)=='mesh':
                 
                 check=True
     
     if check:
     
         regions=utils.getMeshAnimation()
         
         regionNode=self.getSelectedRegionNode()
         
         for r in regions:
             
             utils.setRegionNode(regionNode, r)
     
     else:
         
         cmds.warning('Nothing selected. Please select one or more meshes!')
开发者ID:Bumpybox,项目名称:Tapp,代码行数:28,代码来源:gui.py


示例12: rootsOnPath

def rootsOnPath(path='X:/_image/_projects/SI/HOL/_Assets/ScareCrow/scenes/Anim_Asset/Path_v01.ma', reverse=False):
    allLocs = []
    roots = rootList()
    if not nsPaths():
        cn.uiEnable(controls='modelPanel')
        roots = nsHollow(roots)
        for root in roots:
            nsA = nsPaths()
            cmds.file(path, r=True, type="mayaAscii", gl=True, loadReferenceDepth="all", mergeNamespacesOnClash=False, namespace="Path_v01")
            nsB = nsPaths()
            ns = list(set(nsB) - set(nsA))[0]
            # segments off
            segmentsOff(ns=ns)
            cmds.select(root)
            cmds.select(ns + ':path', add=True)
            # pose the path
            pathPose(root=root, ns=ns)
            # attach
            allLocs.append(attach(up=ns + ':up', reverse=reverse))
            # break
        cn.uiEnable(controls='modelPanel')
        for locs in allLocs:
            cmds.select(locs, add=True)
    else:
        cmds.warning('--  remove all path rigs before starting  --')
开发者ID:boochos,项目名称:work,代码行数:25,代码来源:hollowRootsOnPath.py


示例13: window

 def window(dismiss):
     if dismiss == "load":                 
         self.loadData()
     else:                 
         cmds.warning("If you want to load later, go to aTools menu/Animation Crash Recovery option box")
     
     self.saveBackup()           
开发者ID:Italic-,项目名称:maya-prefs,代码行数:7,代码来源:animationCrashRecovery.py


示例14: loadSel

 def loadSel(self,tF,loadNum):
     sels = cmds.ls(sl = True)
     if len(sels) == loadNum:
         sel = sels[0]
         cmds.textField(tF,e = True,text = str(sel))
     else:
         cmds.warning ('place Load --' + str(loadNum)  + ' --objects')
开发者ID:wangqinghuaTudou,项目名称:test,代码行数:7,代码来源:weightEdit.py


示例15: TappInstall_browse

def TappInstall_browse(*args):
    repoPath=cmds.fileDialog2(dialogStyle=1,fileMode=3)
    
    if repoPath:
        repoPath=repoPath[0].replace('\\','/')
        
        check=False
        #checking all subdirectories
        for name in os.listdir(repoPath):
            
            #confirm that this is the Tapp directory
            if name=='Tapp':
                check=True
        
        if check:
            #create the text file that contains the Tapp directory path
            path=cmds.internalVar(upd=True)+'Tapp.yml'
            
            f=open(path,'w')
            data='{launchWindowAtStartup: False, repositoryPath: \''+repoPath+'\'}'
            f.write(data)
            f.close()
    
            #run setup
            sys.path.append(repoPath)
            
            cmds.evalDeferred('import Tapp')
            
            #delete ui
            cmds.deleteUI('TappInstall_UI')
            
        else:
            cmds.warning('Selected directory is not the \'Tapp\' directory. Please try again')
开发者ID:baitstudio,项目名称:CodeRepo,代码行数:33,代码来源:tapp_maya.py


示例16: symmetry

def symmetry():

    #getting nodes
    sel = cmds.ls(selection=True)
    if len(sel) == 1:
        cmds.warning('Select the edited mesh first, then the original mesh last!')
        return
    if len(sel) > 2:
        cmds.warning('Select the edited mesh first, then the original mesh last!')
        return

    edit = sel[0]
    original = sel[1]

    #creating symmetry mesh
    mirror = mirrorBlendshape([edit], original)[0]
    copy = cmds.duplicate(original)[0]
    bldShp = cmds.blendShape(edit, mirror, copy)[0]
    cmds.setAttr('%s.%s' % (bldShp, edit), 1)
    cmds.setAttr('%s.%s' % (bldShp, mirror), 1)
    symmetry = cmds.duplicate(copy)[0]
    symmetry = cmds.rename(symmetry, edit + '_symmetry')

    cmds.delete(copy, mirror)

    return symmetry
开发者ID:Bumpybox,项目名称:Tapp,代码行数:26,代码来源:blendshapes.py


示例17: setPlanes

def setPlanes(*args):
    """sets clipping planes for cameras based on float fields in UI. Depending on radio button, it will either do all camera or only selected"""

    all = cmds.radioButtonGrp("camRBG", q=True, sl=True)
    far = cmds.floatFieldGrp("farFFG", q=True, v1=True)
    near = cmds.floatFieldGrp("nearFFG", q=True, v1=True)

    cams = []
    if all==1:
        cams.extend(cmds.ls(type="camera"))
    elif all==2:
        transf = cmds.ls(sl=True, type="transform")
        for each in transf:
            shape = cmds.listRelatives(each, s=True)
            if shape:
                if cmds.objectType(shape) == "camera":
                    cams.extend(shape)
    #for each, set shape.farClipPlane 100000
    if cams:
        print cams
        for cam in cams:
            try:
                cmds.setAttr("%s.farClipPlane"%cam, far)
                cmds.setAttr("%s.nearClipPlane"%cam, near)

            except:
                cmds.warning("Couldn't change the farClipPlane of %s"%cam)
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:27,代码来源:zbw_setClipPlanes.py


示例18: getNodeType

def getNodeType(node=cmds.ls(sl=True, long=True)):
    if node:
        nodeShape = cmds.listRelatives(node[0], shapes=True, f=True)[0]
        return cmds.nodeType(nodeShape)
    else:
        cmds.warning('Please select a node')
        return None
开发者ID:jonntd,项目名称:dmptools,代码行数:7,代码来源:mayaCommands.py


示例19: smarterActivateSet

def smarterActivateSet(*args):
    set = GetSetOptions()
    # print set.options, '_________'
    opt = str(len(set.options) - 1)
    if len(set.sel) != 0:
        if len(set.sel) > 1:  # multi object selection
            activateSet(set.sel)
            cmds.warning('-- multiple objects set as character set --')
            return set.sel
        if set.current:
            if set.current in set.options:
                idx = set.options.index(set.current)
                if idx != len(set.options) - 1:
                    activateSet(set.options[idx + 1])
                    message('set --   ' + set.options[idx + 1] + '     -- ' + str(idx + 1) + ' of ' + opt, maya=True)
                else:
                    activateSet(set.options[0])
                    message('set --   ' + set.options[0] + '     -- ' + str(0) + ' of ' + opt, maya=True)
            else:
                activateSet(set.options[1])
                message('set --   ' + set.options[1] + '     -- ' + str(1) + ' of ' + opt, maya=True)
        else:
            activateSet(set.options[1])
            message('set --   ' + set.options[1] + '     -- ' + str(1) + ' of ' + opt, maya=True)
    else:
        activateSet(set.options[0])
开发者ID:boochos,项目名称:work,代码行数:26,代码来源:characterSet_lib.py


示例20: buttonReplacePhClicked

 def buttonReplacePhClicked(self):
     itemList = self.ui.placeholderList.selectedItems()
     selection = cmds.ls(sl=True, tr=True)
     if len(itemList) > 0 and len(selection) > 0:
         replacePHs(str(itemList[0].text()))
     else:
         cmds.warning("Please select a placeholder from the list.")
开发者ID:Svegarn,项目名称:Tron3k_Exporter,代码行数:7,代码来源:Gui.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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