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


Python core.createNode方法代码示例

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


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

示例1: _duplicate_shape

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def _duplicate_shape(old_shape):
    new_shape = pymel.createNode('nurbsCurve')

    # Transfert various attributes
    mel_dst = '{0}.create'.format(new_shape) # prevent annoying pymel warning
    pymel.connectAttr(old_shape.local, mel_dst)
    new_shape.create.evaluate() # Force maya to cache the shape before unconnecting
    pymel.disconnectAttr(old_shape.local, mel_dst)

    # Transfert various attributes
    for att_name in transferable_shape_attrs:
        att_old = old_shape.attr(att_name)
        att_new = new_shape.attr(att_name)
        att_new.set(att_old.get())

    return new_shape 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:18,代码来源:sqCopyPasteShapes.py

示例2: gear_intmatrix_op

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def gear_intmatrix_op(mA, mB, blend=0):
    """
    create mGear interpolate Matrix node.

    Arguments:
        mA (matrix): Input matrix A.
        mB (matrix): Input matrix A.
        blend (float or connection): Blending value.

    Returns:
        pyNode: Newly created mGear_intMatrix node
    """
    node = pm.createNode("mgear_intMatrix")

    pm.connectAttr(mA, node + ".matrixA")
    pm.connectAttr(mB, node + ".matrixB")

    if (isinstance(blend, str)
        or isinstance(blend, unicode)
            or isinstance(blend, pm.Attribute)):
        pm.connectAttr(blend, node + ".blend")
    else:
        pm.setAttr(node + ".blend", blend)

    return node 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:27,代码来源:applyop.py

示例3: gear_inverseRotorder_op

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def gear_inverseRotorder_op(out_obj, in_obj):
    """
    Apply a sn_inverseRotorder_op operator

    Arguments:
        out_obj (dagNode): Output object.
        in_obj (dagNode): Input object.

    Returns:
        pyNode: The newly created operator.
    """
    node = pm.createNode("mgear_inverseRotOrder")

    pm.connectAttr(in_obj + ".ro", node + ".ro")
    pm.connectAttr(node + ".output", out_obj + ".ro")

    return node 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:19,代码来源:applyop.py

示例4: createDecomposeMatrixNode

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def createDecomposeMatrixNode(m):
    """
    Create and connect a decomposeMatrix node.

    Arguments:
        m(str or attr): The matrix attribute name.

    Returns:
        pyNode: the newly created node.

    >>> dm_node = nod.createDecomposeMatrixNode(mulmat_node+".output")

    """
    node = pm.createNode("decomposeMatrix")

    pm.connectAttr(m, node + ".inputMatrix")

    return node 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:20,代码来源:node.py

示例5: createCurveInfoNode

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def createCurveInfoNode(crv):
    """Create and connect a curveInfo node.

    Arguments:
        crv (dagNode): The curve.

    Returns:
        pyNode: the newly created node.

    >>> crv_node = nod.createCurveInfoNode(self.slv_crv)

    """
    node = pm.createNode("curveInfo")

    shape = pm.listRelatives(crv, shapes=True)[0]

    pm.connectAttr(shape + ".local", node + ".inputCurve")

    return node


# TODO: update using plusMinusAverage node 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:24,代码来源:node.py

示例6: createVertexPositionNode

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def createVertexPositionNode(inShape,
                             vId=0,
                             output=None,
                             name="mgear_vertexPosition"):
    """Creates a mgear_vertexPosition node"""
    node = pm.createNode("mgear_vertexPosition", n=name)
    inShape.worldMesh.connect(node.inputShape)
    node.vertex.set(vId)
    if output:
        pm.connectAttr(output.parentInverseMatrix,
                       node.drivenParentInverseMatrix)
        pm.connectAttr(node.output, output.translate)

    return node


#############################################
# CREATE MULTI NODES
############################################# 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:21,代码来源:node.py

示例7: create_shot

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def create_shot(self, name='', handle=default_handle_count):
        """Creates a new shot.

        :param str name: A string value for the newly created shot name, if
          skipped or given empty, the next empty shot name will be generated.
        :param int handle: An integer value for the handle attribute. Default
          is 10.
        :returns: The created :class:`~pm.nt.Shot` instance
        """
        shot = pm.createNode('shot')
        shot.shotName.set(name)
        shot.set_handle(handle=handle)
        shot.set_output('')

        # connect to the sequencer
        shot.message >> self.shots.next_available
        return shot 
开发者ID:eoyilmaz,项目名称:anima,代码行数:19,代码来源:extension.py

示例8: create_arnold_stand_in

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def create_arnold_stand_in(path=None):
    """A fixed version of original arnold script of SolidAngle Arnold core API
    """
    if not pm.objExists('ArnoldStandInDefaultLightSet'):
        pm.createNode(
            "objectSet",
            name="ArnoldStandInDefaultLightSet",
            shared=True
        )
        pm.lightlink(
            object='ArnoldStandInDefaultLightSet',
            light='defaultLightSet'
        )

    stand_in = pm.createNode('aiStandIn', n='ArnoldStandInShape')
    # temp fix until we can correct in c++ plugin
    stand_in.setAttr('visibleInReflections', True)
    stand_in.setAttr('visibleInRefractions', True)

    pm.sets('ArnoldStandInDefaultLightSet', add=stand_in)
    if path:
        stand_in.setAttr('dso', path)

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

示例9: setup_stretchy_spline_ik_curve

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [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

示例10: test_next_available_with_all_connected_attribute

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def test_next_available_with_all_connected_attribute(self):
        """testing if the next available attribute will be returned when no
        empty plugs are present
        """
        sequence_manager = pm.ls(type=pm.nt.SequenceManager)[0]
        # connect new sequences
        seq1 = pm.createNode('sequence')
        seq2 = pm.createNode('sequence')
        seq3 = pm.createNode('sequence')

        seq1.message >> sequence_manager.sequences[0]
        seq2.message >> sequence_manager.sequences[1]
        seq3.message >> sequence_manager.sequences[2]

        attr = sequence_manager.sequences.next_available
        self.assertIsInstance(
            attr,
            pm.general.Attribute
        )
        self.assertEqual(
            3,
            sequence_manager.sequences.next_available.index()
        ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:25,代码来源:maya.py

示例11: createFollicle

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def createFollicle(target=None, param=[0.5,0.5], name="follicle"):
    """
    Create follicle.
    :param target: `PyNode` target that the follicle connected to
    :param param: `list` [u, v] follicle uv parameter
    :param name: `string` follicle name
    :return: `PyNode` follicle ransform node
    """
    follicle = pm.createNode("follicle")
    follicle.parameterU.set(param[0])
    follicle.parameterV.set(param[1])

    if target:
        targetShape = target.getShape()
        targetShape.worldMatrix.connect(follicle.inputWorldMatrix)
        if targetShape.nodeType() == "nurbsSurface":
            targetShape.local.connect(follicle.inputSurface)
        elif targetShape.nodeType() == "mesh":
            targetShape.outMesh.connect(follicle.inputMesh)

    folTransform = follicle.getParent()
    follicle.outRotate.connect(folTransform.rotate)
    follicle.outTranslate.connect(folTransform.translate)
    pm.rename(folTransform, name)
    return folTransform 
开发者ID:raina-wu,项目名称:DynRigBuilder,代码行数:27,代码来源:rigutils.py

示例12: createParentTransform

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def createParentTransform(suffix="grp", targetNode=None):
    """
    Create a parent transform of the node that matches the node position.
    :param suffix: `string` parent node name
    :param targetNode: `PyNode` node to add parent transform
    :return: `PyNode` result transform node
    """
    if not targetNode:
        try:
            targetNode = pm.ls(sl=True)[0]
        except:
            print "No target node is specified."
            return None

    grpNode = pm.createNode("transform", n="{0}_{1}".format(targetNode.name(),suffix))
    pm.delete(pm.parentConstraint(targetNode, grpNode, mo=False))
    grpNode.setParent(targetNode.getParent())
    targetNode.setParent(grpNode)
    return grpNode 
开发者ID:raina-wu,项目名称:DynRigBuilder,代码行数:21,代码来源:mayautils.py

示例13: create

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def create(cls, name):
        """
        Create a new Metanode.

        :param string name: The name for the created node.
        :return: Metanode class wrapping the newly created node.
        """
        network_node = pm.createNode(NODE_TYPE)
        network_node.rename(name)

        for coreAttrName, coreAttrArgs in cls.attr_core().iteritems():
            value = coreAttrArgs.pop('value')
            network_node.addAttr(coreAttrName, **coreAttrArgs)
            network_node.attr(coreAttrName).set(value)
            network_node.attr(coreAttrName).setLocked(True)

        for coreAttrName, coreAttrArgs in cls.attr_class().iteritems():
            network_node.addAttr(coreAttrName, **coreAttrArgs)

        return cls(network_node) 
开发者ID:arenanet,项目名称:metanode,代码行数:22,代码来源:core.py

示例14: get

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def get(create=True):
    '''
    Returns the shared shape if it exists and makes it if it doesn't if create=True (default).
    '''
    obj = core.findNode.mainGroup()
    if not obj:
        return None
    
    shape = find(obj)
    if shape:
        return shape
    
    if create:
        return _makeSharedShape(obj, 'sharedShape', 'sharedShape')
    else:
        return None

    '''
    shape = cmds.createNode( 'nurbsCurve', p=obj.longName() )
    cmds.addAttr( shape, ln='sharedShape', at='message' )
    cmds.rename( shape, 'sharedShape' )
    return obj.longName() + '|sharedShape'
    ''' 
开发者ID:patcorwin,项目名称:fossil,代码行数:25,代码来源:sharedShape.py

示例15: getConditionNode

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import createNode [as 别名]
def getConditionNode(plug, level):
    '''
    '''
    
    conditions = PyNode(plug).listConnections(type='condition', p=True, d=True, s=False)
    for condition in conditions:
        if condition.attrName() == 'ft' and condition.node().secondTerm.get() == level:
            return condition.node()
    
    condition = createNode('condition', n=plug.split('.')[1] + '_%i' % level)
    condition.secondTerm.set(level)
    condition.operation.set(3)
    connectAttr( plug, condition.firstTerm, f=True )
    
    
    condition.colorIfTrue.set(1, 1, 1)
    condition.colorIfFalse.set(0, 0, 0)
    
    return condition 
开发者ID:patcorwin,项目名称:fossil,代码行数:21,代码来源:sharedShape.py


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