当前位置: 首页>>代码示例>>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;未经允许,请勿转载。