當前位置: 首頁>>代碼示例>>Python>>正文


Python cmds.sets方法代碼示例

本文整理匯總了Python中maya.cmds.sets方法的典型用法代碼示例。如果您正苦於以下問題:Python cmds.sets方法的具體用法?Python cmds.sets怎麽用?Python cmds.sets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.sets方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_to_set_members

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def add_to_set_members():
    selection = cmds.ls(sl=True)
    
    if selection:
        setCount = 0
        for node in selection:
            if cmds.nodeType(node) != 'objectSet':
                continue
            for sel in selection:
                if sel == node:
                    continue
                try:
                    cmds.sets(sel, add=node)
                except Exception as e:
                    print e.message
            setCount += 1
        if setCount == 0:
            cmds.confirmDialog( title='Error',message='Please select set_node')

#選択セットのノード、コンポーネントを削除 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:22,代碼來源:sets.py

示例2: remove_set_members

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def remove_set_members():
    selection = cmds.ls(sl=True)
    if selection:
        setCount = 0
        for node in selection:
            if cmds.nodeType(node) != 'objectSet':
                continue
            setMembers = cmds.sets(node, int=node)
            for removeNode in selection:
                if removeNode == node:
                    continue
                try:
                    print 'Remove from set :', node, ': Object :', removeNode
                    cmds.sets(removeNode, rm=node)
                except:
                    pass
            setCount += 1
        if setCount == 0:
            cmds.confirmDialog( title='Error',message='Please select set_node') 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:21,代碼來源:sets.py

示例3: set_pixel_error

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def set_pixel_error(progress_controller=None):
    """Set aiSubdivPixelError to 0

    sets the pixel error on objects which have a linear subdiv
    """
    if progress_controller is None:
        progress_controller = ProgressControllerBase()

    all_meshes = pm.ls(type='mesh')
    progress_controller.maximum = len(all_meshes)
    for node in all_meshes:
        try:
            pixel_error = node.getAttr('aiSubdivPixelError')
            if pixel_error > 0:
                node.setAttr('aiSubdivPixelError', 0)
        except pm.MayaAttributeError as e:
            pass
        progress_controller.increment()
    progress_controller.complete() 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:21,代碼來源:publish.py

示例4: copySkinComponents

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def copySkinComponents(source, destinationVerts):

    if not mc.listRelatives(source, shapes=True):
        raise RuntimeError('Source object must be geometry.')

    sourceSkin = utl.getSkinCluster(source)

    if not sourceSkin:
        raise RuntimeError("Source mesh doesn't have a skinCluster to copy from.")

    destMesh = mc.ls(destinationVerts[0], o=True)[0]
    destMesh = mc.listRelatives(destMesh, parent=True)[0]
    destSkin = copySkinInfluences(source, destMesh)

    tempSet = mc.sets(destinationVerts)

    mc.select(source, tempSet)

    mc.copySkinWeights(noMirror=True,
                       surfaceAssociation='closestPoint',
                       influenceAssociation='closestJoint',
                       normalize=True)

    mc.delete(tempSet)
    mc.select(destinationVerts) 
開發者ID:morganloomis,項目名稱:ml_tools,代碼行數:27,代碼來源:ml_copySkin.py

示例5: get_outputs

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def get_outputs(self):
        """
        Retrieve all settings of each available sub widgets
        :return: 
        """

        inputs = self.get_inputs(as_preset=False)
        outputs = dict()
        outputs['off_screen'] = inputs['off_screen']

        import capture_gui.lib

        # Get isolate view members of the active panel
        if inputs['isolate_view']:
            panel = capture_gui.lib.get_active_editor()
            filter_set = mc.modelEditor(panel, query=True, viewObjects=True)
            isolate = mc.sets(filter_set, query=True) if filter_set else None
            outputs['isolate'] = isolate

        return outputs 
開發者ID:Colorbleed,項目名稱:maya-capture-gui,代碼行數:22,代碼來源:genericplugin.py

示例6: remove

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def remove(container):
    """Remove an existing `container` from Maya scene

    Deprecated; this functionality is replaced by `api.remove()`

    Arguments:
        container (avalon-core:container-1.0): Which container
            to remove from scene.

    """

    node = container["objectName"]

    # Assume asset has been referenced
    reference_node = next((node for node in cmds.sets(node, query=True)
                          if cmds.nodeType(node) == "reference"), None)

    assert reference_node, ("Imported container not supported; "
                            "container must be referenced.")

    log.info("Removing '%s' from Maya.." % container["name"])

    namespace = cmds.referenceQuery(reference_node, namespace=True)
    fname = cmds.referenceQuery(reference_node, filename=True)
    cmds.file(fname, removeReference=True)

    try:
        cmds.delete(node)
    except ValueError:
        # Already implicitly deleted by Maya upon removing reference
        pass

    try:
        # If container is not automatically cleaned up by May (issue #118)
        cmds.namespace(removeNamespace=namespace, deleteNamespaceContent=True)
    except RuntimeError:
        pass 
開發者ID:getavalon,項目名稱:core,代碼行數:39,代碼來源:compat.py

示例7: update_hierarchy

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def update_hierarchy(containers):
    """Hierarchical container support

    This is the function to support Scene Inventory to draw hierarchical
    view for containers.

    We need both parent and children to visualize the graph.

    """
    container_names = set(_ls())  # lookup set

    for container in containers:
        # Find parent
        parent = cmds.listSets(object=container["objectName"]) or []
        for node in parent:
            if node in container_names:
                container["parent"] = node
                break

        # List children
        children = cmds.ls(cmds.sets(container["objectName"], query=True),
                           type="objectSet")
        container["children"] = [child for child in children
                                 if child in container_names]

        yield container 
開發者ID:getavalon,項目名稱:core,代碼行數:28,代碼來源:pipeline.py

示例8: process

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def process(self):
        nodes = list()

        with lib.undo_chunk():
            if (self.options or {}).get("useSelection"):
                nodes = cmds.ls(selection=True)

            instance = cmds.sets(nodes, name=self.name)
            lib.imprint(instance, self.data)

        return instance 
開發者ID:getavalon,項目名稱:core,代碼行數:13,代碼來源:pipeline.py

示例9: apply_shaders

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def apply_shaders(relationships, namespace=None):
    """Given a dictionary of `relationships`, apply shaders to meshes

    Arguments:
        relationships (avalon-core:shaders-1.0): A dictionary of
            shaders and how they relate to meshes.

    """

    if namespace is not None:
        # Append namespace to shader group identifier.
        # E.g. `blinn1SG` -> `Bruce_:blinn1SG`
        relationships = {
            "%s:%s" % (namespace, shader): relationships[shader]
            for shader in relationships
        }

    for shader, ids in relationships.items():
        print("Looking for '%s'.." % shader)
        shader = next(iter(cmds.ls(shader)), None)
        assert shader, "Associated shader not part of asset, this is a bug"

        for id_ in ids:
            mesh, faces = (id_.rsplit(".", 1) + [""])[:2]

            # Find all meshes matching this particular ID
            # Convert IDs to mesh + id, e.g. "nameOfNode.f[1:100]"
            meshes = list(".".join([mesh, faces])
                          for mesh in lsattr("mbID", value=mesh))

            if not meshes:
                continue

            print("Assigning '%s' to '%s'" % (shader, ", ".join(meshes)))
            cmds.sets(meshes, forceElement=shader) 
開發者ID:getavalon,項目名稱:core,代碼行數:37,代碼來源:lib.py

示例10: checkMultiUVSet

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def checkMultiUVSet(self):
        self.set = cmds.ls('Multi_UV_Set')
        if not self.set:
            self.set = cmds.sets(em=True,n='Multi_UV_Set')
        else:
            self.set = self.set[0]
            #セットメンバーを検索してマルチUVでない場合は取り除く
            setMembers = []
            setMembers = cmds.sets(self.set, int=self.set)
            for menber in setMembers:
                uvSet = cmds.polyUVSet(menber, q=True, allUVSets=True)
                if len(uvSet) < 2:
                    cmds.sets(menber,rm='Multi_UV_Set')   #setに追加 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:15,代碼來源:uv.py

示例11: removeZeroSet

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def removeZeroSet(self):
        memberTemp = cmds.sets(self.set , int=self.set)
        if len(memberTemp)==0:
            cmds.delete(self.set) 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:6,代碼來源:uv.py

示例12: crenupMultiUV

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def crenupMultiUV(self):
        self.defaultName = 'map'#デフォルト名
        #print self.mesh
        shapes = cmds.listRelatives(self.mesh, s=True, pa=True)
        self.shapes = shapes[0]
        #ヒストリ削除
        cmds.bakePartialHistory(self.shapes,ppt=True)
        #cmds.bakePartialHistory(self.shapes,preCache=True)
        
        self.uvSetAll = cmds.polyUVSet(self.mesh, q=True, allUVSets=True)
        self.currentSet = cmds.polyUVSet(self.mesh, q=True, currentUVSet=True)
        
        #現在のUVが空かどうか調べてスキップフラグがTrueなら関數抜ける
        if not self.checkCurrentUV():
            print 'Skip (No UV in Current UVSet) : ' + self.mesh
            return
        self.delUVFlag = True
        self.uvNum = 1#マルチUVリネーム用
        #マルチUVの指定名があれば削除フラグをFalseに
        if 'Multi_UV' in self.mesh or self.delMultiUV is False:
            self.delUVFlag = False
            self.uvNum = len(self.uvSetAll)#マルチUVリネーム用
        
        if len(self.uvSetAll) > 0:#UVセットがあったら
            self.deleteUV()
            #UVセットの名前を変更、マルチUVの場合は繰り返し処理
            self.renameUVSet()
        if self.groupMultiUV is True and len(self.uvSetAll) > 1:#UVセットが複數の場合セットに追加する
            cmds.sets(self.mesh,add='Multi_UV_Set')   #setに追加 
開發者ID:ShikouYamaue,項目名稱:SISideBar,代碼行數:31,代碼來源:uv.py

示例13: envFog

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def envFog():
    node = cmds.shadingNode('envFog', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
開發者ID:minoue,項目名稱:rush,代碼行數:8,代碼來源:MayaNodes.py

示例14: fluidShape

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def fluidShape():
    node = cmds.shadingNode('fluidShape', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True)
    cmds.connectAttr("time1.outTime", node + ".currentTime") 
開發者ID:minoue,項目名稱:rush,代碼行數:9,代碼來源:MayaNodes.py

示例15: lightFog

# 需要導入模塊: from maya import cmds [as 別名]
# 或者: from maya.cmds import sets [as 別名]
def lightFog():
    node = cmds.shadingNode('lightFog', asShader=True)
    shaderGroup = cmds.sets(renderable=True, noSurfaceShader=True,
                            empty=True, name=node + "SG")
    cmds.connectAttr(
        node + '.outColor', shaderGroup + '.volumeShader', force=True) 
開發者ID:minoue,項目名稱:rush,代碼行數:8,代碼來源:MayaNodes.py


注:本文中的maya.cmds.sets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。