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


Python core.ls方法代码示例

本文整理汇总了Python中pymel.core.ls方法的典型用法代码示例。如果您正苦于以下问题:Python core.ls方法的具体用法?Python core.ls怎么用?Python core.ls使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymel.core的用法示例。


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

示例1: freeze

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def freeze():
    cmds.selectMode(o=True)
    selection = cmds.ls(sl=True, type = 'transform')
    dummy = common.TemporaryReparent().main(mode='create')#モジュールでダミーの親作成
    clusterCopy = modeling.ClusterCopy()
    for sel in selection:
        allChildren = [sel] + cmds.listRelatives(sel, ad=True)#子供を取得して1つのリストにする
        polyMesh = common.search_polygon_mesh(allChildren)
        if polyMesh:
            for mesh in polyMesh:
                common.TemporaryReparent().main(mesh, dummyParent=dummy, mode='cut')
                defCls = clusterCopy.copy(mesh)
                cmds.bakePartialHistory(mesh,pc=True)
                if defCls:
                    clusterCopy.paste(mesh)
                common.TemporaryReparent().main(mesh, dummyParent=dummy, mode='parent')#コピーのおわったメッシュの子供を元に戻す
    common.TemporaryReparent().main(dummyParent=dummy, mode='delete')#ダミー親削除
    cmds.select(selection, r=True) 
开发者ID:ShikouYamaue,项目名称:SISideBar,代码行数:20,代码来源:freeze.py

示例2: select_all_child_controls

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def select_all_child_controls(control, *args):  # @unusedVariable
    """ Selects all child controls from the given control

    This function uses Maya's controller nodes and commands to find relevant
    dependencies between controls

    Args:
        control (str): parent animation control (transform node)
        *args: State of the menu item (if existing) send by mgear's dagmenu
    """

    # gets controller node from the given control. Returns if none is found
    tag = cmds.ls(cmds.listConnections(control), type="controller")
    if not tag:
        return

    # query child controls
    children = get_all_tag_children(tag)

    # adds to current selection the children elements
    cmds.select(children, add=True) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:23,代码来源:anim_utils.py

示例3: process

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def process(self, context, plugin):
        import pymel.core as pm

        # Get the errored instances
        failed = []
        for result in context.data["results"]:
            if (result["error"] is not None and result["instance"] is not None
               and result["instance"] not in failed):
                failed.append(result["instance"])

        # Apply pyblish.logic to get the instances for the plug-in
        instances = api.instances_by_plugin(failed, plugin)

        for instance in instances:
            for node in instance[0].members():
                io = pm.ls(node.getShapes(), intermediateObjects=True)
                pm.delete(io) 
开发者ID:bumpybox,项目名称:pyblish-bumpybox,代码行数:19,代码来源:validate_intermediate_shapes.py

示例4: all_shots

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def all_shots(self):
        """return all the shots connected to this sequencer
        """
        return pm.ls(self.shots.get(), typ='shot')

    # @extends(pm.nodetypes.Sequencer)
    # @all_shots.setter
    # def all_shots(self, shots):
    #     """setter for the all_shots property
    #     """
    #     # remove the current shots first
    #     # then append the new ones
    #     for s in self.all_shots:
    #         t = s // self.shots
    #
    #     for s in shots:
    #         t = s.message >> self.shots.next_available 
开发者ID:eoyilmaz,项目名称:anima,代码行数:19,代码来源:extension.py

示例5: rivet_per_face

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def rivet_per_face():
    """creates hair follicles per selected face
    """
    sel_list = pm.ls(sl=1, fl=1)

    follicles = []
    locators = []
    for face in sel_list:
        # use the center of the face as the follicle position
        p = reduce(lambda x, y: x + y, face.getPoints()) / face.numVertices()
        obj = pm.spaceLocator(p=p)
        locators.append(obj)
        shape = face.node()
        uv = face.getUVAtPoint(p, space='world')

        follicle_transform, follicle = create_follicle(shape, uv)

        pm.parent(obj, follicle_transform)
        follicles.append(follicle)

    return follicles, locators 
开发者ID:eoyilmaz,项目名称:anima,代码行数:23,代码来源:auxiliary.py

示例6: check_sequence_name

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def check_sequence_name(self):
        """checks sequence name and asks the user to set one if maya is in UI
        mode and there is no sequence name set
        """
        sequencer = pm.ls(type='sequencer')[0]
        sequence_name = sequencer.getAttr('sequence_name')
        if sequence_name == '' and not pm.general.about(batch=1) \
           and not self.batch_mode:
            result = pm.promptDialog(
                title='Please enter a Sequence Name',
                message='Sequence Name:',
                button=['OK', 'Cancel'],
                defaultButton='OK',
                cancelButton='Cancel',
                dismissString='Cancel'
            )

            if result == 'OK':
                sequencer.setAttr(
                    'sequence_name',
                    pm.promptDialog(query=True, text=True)
                ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:24,代码来源:auxiliary.py

示例7: setup_stretchy_spline_ik_curve

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def setup_stretchy_spline_ik_curve(cls):
        """
        """
        selection = pm.ls(sl=1)
        curve = selection[0]
        curve_info = pm.createNode("curveInfo")
        mult_div = pm.createNode("multiplyDivide")
        curve_shape = pm.listRelatives(curve, s=1)

        curve_shape[0].worldSpace >> curve_info.ic
        curve_info.arcLength >> mult_div.input1X

        curve_length = curve_info.arcLength.get()
        mult_div.input2X.set(curve_length)
        mult_div.operation.set(2)
        pm.select(mult_div, curve_info, curve_shape[0], add=True) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:18,代码来源:rigging.py

示例8: reset_tweaks

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def reset_tweaks(cls):
        """Resets the tweaks on the selected deformed objects
        """
        for obj in pm.ls(sl=1):
            for tweak_node in pm.ls(obj.listHistory(), type=pm.nt.Tweak):

                try:
                    for i in tweak_node.pl[0].cp.get(mi=1):
                        tweak_node.pl[0].cv[i].vx.set(0)
                        tweak_node.pl[0].cv[i].vy.set(0)
                        tweak_node.pl[0].cv[i].vz.set(0)
                except TypeError:
                    try:
                        for i in tweak_node.vl[0].vt.get(mi=1):
                            tweak_node.vl[0].vt[i].vx.set(0)
                            tweak_node.vl[0].vt[i].vy.set(0)
                            tweak_node.vl[0].vt[i].vz.set(0)
                    except TypeError:
                        pass 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:rigging.py

示例9: get_pin_shader

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def get_pin_shader(self):
        """this creates or returns the existing pin shader
        """
        shaders = pm.ls("%s*" % self.pin_shader_prefix)
        if shaders:
            # try to find the shader with the same color
            for shader in shaders:
                if list(shader.color.get()) == self.color:
                    return shader

        # so we couldn't find a shader
        # lets create one
        shader = pm.shadingNode("lambert", asShader=1)
        shader.rename("%s#" % self.pin_shader_prefix)
        shader.color.set(self.color)

        # also create the related shadingEngine
        shading_engine = pm.nt.ShadingEngine()
        shading_engine.rename("%sSG#" % self.pin_shader_prefix)
        shader.outColor >> shading_engine.surfaceShader

        return shader 
开发者ID:eoyilmaz,项目名称:anima,代码行数:24,代码来源:rigging.py

示例10: set_finalGatherHide

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def set_finalGatherHide(cls, value):
        """sets the finalGatherHide to on or off for the given list of objects
        """
        attr_name = "miFinalGatherHide"
        objects = pm.ls(sl=1)

        for obj in objects:

            shape = obj

            if isinstance(obj, pm.nt.Transform):
                shape = obj.getShape()

            if not isinstance(shape, (pm.nt.Mesh, pm.nt.NurbsSurface)):
                continue

            # add the attribute if it doesn't already exists
            if not shape.hasAttr(attr_name):
                pm.addAttr(shape, ln=attr_name, at="long", min=0, max=1, k=1)

            obj.setAttr(attr_name, value) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:23,代码来源:render.py

示例11: populateJoints

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def populateJoints(self, *args):
        """ This function is responsable to list all joints or only dpAR joints in the interface in order to use in skinning.
        """
        # get current jointType (all or just dpAutoRig joints):
        jntSelectedRadioButton = cmds.radioCollection(self.allUIs["jntCollection"], query=True, select=True)
        chooseJnt = cmds.radioButton(jntSelectedRadioButton, query=True, annotation=True)
        
        # list joints to be populated:
        jointList, sortedJointList = [], []
        allJointList = cmds.ls(selection=False, type="joint")
        if chooseJnt == "allJoints":
            jointList = allJointList
            cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=False)
            cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=False)
        elif chooseJnt == "dpARJoints":
            cmds.checkBox(self.allUIs["_JntCB"], edit=True, enable=True)
            cmds.checkBox(self.allUIs["_JisCB"], edit=True, enable=True)
            displayJnt = cmds.checkBox(self.allUIs["_JntCB"], query=True, value=True)
            displayJis = cmds.checkBox(self.allUIs["_JisCB"], query=True, value=True)
            for jointNode in allJointList:
                if cmds.objExists(jointNode+'.'+BASE_NAME+'joint'):
                    if displayJnt:
                        if "_Jnt" in jointNode:
                            jointList.append(jointNode)
                    if displayJis:
                        if "_Jis" in jointNode:
                            jointList.append(jointNode)
        
        # sort joints by name filter:
        jointName = cmds.textField(self.allUIs["jointNameTF"], query=True, text=True)
        if jointList:
            if jointName:
                sortedJointList = utils.filterName(jointName, jointList, " ")
            else:
                sortedJointList = jointList
        
        # populate the list:
        cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, removeAll=True)
        cmds.textScrollList( self.allUIs["jntTextScrollLayout"], edit=True, append=sortedJointList)
        # atualize of footerB text:
        self.atualizeSkinFooter() 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:43,代码来源:dpAutoRig.py

示例12: __init__

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def __init__(self):
        self.aDrivers = []  # List of parent in the system
        self.nDriven = None  # Base constrained objet (The constraint will no be set on this object
        self.nSwConst = None  # SpaceSwitch constraint for the system
        self.nSwConstRecept = None  # Constrained node
        self.aFreeIndex = []  # List of free index (Can only happen when a item is removed) in the parent constraint
        self.sSysName = "SpaceSwitcher_"  # Name of the system

        tempWorld = pymel.ls(self.WORLD_NODE_NAME)
        if tempWorld:
            self.worldNode = tempWorld[0]
        else:
            self.worldNode = None 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:15,代码来源:sqSpaceSwitcher.py

示例13: get_all_ctrls

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def get_all_ctrls():
    ctrls = pymel.ls('*_Ctrl')
    ctrls = filter(_is_ctrl, ctrls)
    return ctrls 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:6,代码来源:sqCopyPasteShapes.py

示例14: get_all_ctrlsnapshots

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def get_all_ctrlsnapshots():
    snapshots = pymel.ls('*_CtrlSnapshot')
    snapshots = filter(_is_ctrl, snapshots)
    return snapshots 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:6,代码来源:sqCopyPasteShapes.py

示例15: ls_ex

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import ls [as 别名]
def ls_ex(*args, **kwargs):
    return PyNodeChain(pymel.ls(*args, **kwargs))

# Wrapper for pymel.ls that return only objects without parents. 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:6,代码来源:libPymel.py


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