本文整理匯總了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
示例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
示例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
示例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
示例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
示例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
#############################################
示例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
示例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
示例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)
示例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()
)
示例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
示例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
示例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)
示例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'
'''
示例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