本文整理汇总了Python中pymel.core.makeIdentity函数的典型用法代码示例。如果您正苦于以下问题:Python makeIdentity函数的具体用法?Python makeIdentity怎么用?Python makeIdentity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeIdentity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createPad
def createPad(cls, *args):
if args:
inputObject = args[0]
else:
inputObject = pm.selected()
if type(inputObject) != list:
inputObject = [inputObject]
pads = []
for obj in inputObject:
pm.select(cl = True)
paddingGroup = pm.group(em = True)
upperPaddingGroup = pm.group(em = True)
pm.parent(paddingGroup, upperPaddingGroup)
movePivot = pm.parentConstraint(obj, upperPaddingGroup, mo = False)
pm.delete(movePivot)
pm.parent(obj, paddingGroup)
pm.makeIdentity(apply = True, t = True, r = True, s = True, n = 0)
pm.rename(paddingGroup, obj + '_sdkPad')
pm.rename(upperPaddingGroup, obj + '_offsetPad')
pads.append(upperPaddingGroup)
return pads
开发者ID:kudiaborm,项目名称:mkScripts,代码行数:27,代码来源:Common.py
示例2: rig_makeCtrlLabel
def rig_makeCtrlLabel(label):
'''Creates a control that is displayed in customized choice of letters
Args:
label (string): the name of the desired control/visual display text
Returns (pm.nt.Transform): returns the display control object
Example Usage:
rig_makeCtrlLabel("display")
'''
if not pm.objExists(label + "_CTRL"):
txt_crv=pm.PyNode( pm.textCurves(ch=0,t=label,f="Courier")[0] )
curves=[]
i=1
for crvShp in pm.ls(txt_crv.getChildren(ad=True), et="nurbsCurve"):
crvTrm = crvShp.getParent()
crvShp.getParent().setParent(w=True)
pm.makeIdentity(crvShp.getParent(),apply=True,s=1,r=1,t=1,n=0)
crvTrm.rename("display_%02d_CRV" % i)
curves.append(crvTrm)
i+=1
displayCtrl=rig_combineCurves(curves,label+'_CTRL')
pm.delete(txt_crv)
displayCtrl.centerPivots()
pm.move(displayCtrl, (0,0,0), rpr=True)
pm.makeIdentity(displayCtrl,apply=True,s=1,r=1,t=1,n=0)
displayGrp=pm.group(em=1,n=(label + "Offset_GRP"))
displayCtrl.setParent(displayGrp)
for displayCtrlShape in displayCtrl.listRelatives(shapes=True, fullPath=True):
pm.setAttr(displayCtrlShape + ".overrideEnabled", 1)
pm.setAttr(displayCtrlShape + ".overrideColor",17)
rig_ctrlLock([displayCtrl], ["tx","ty","tz","rx","ry","rz","sx","sy","sz","v"], setKeyable=False, lock=True)
return displayCtrl
else:
pm.error("That control already exists smarty pants!\n")
开发者ID:AndresMWeber,项目名称:aw,代码行数:34,代码来源:lib_mpc.py
示例3: AlignBindNode
def AlignBindNode(self, **kws):
'''
Overwrite the default behaviour: Align the newly made BindNode as required for this bind
'''
parentNode = self.SourceNode.listRelatives(p=True)[0]
if parentNode:
#Parent the BindNode to the Source Driver Node
pm.parent(self.BindNode['Root'], self.SourceNode.listRelatives(p=True)[0])
else:
pm.parent(self.BindNode['Root'], self.SourceNode)
self.BindNode['Main'].rotateOrder.set(self.SourceNode.rotateOrder.get())
self.BindNode['Root'].rotateOrder.set(self.DestinationNode.rotateOrder.get())
#Positional Alignment
if self.Settings.AlignToControlTrans:
pm.delete(pm.pointConstraint(self.SourceNode, self.BindNode['Root']))
pm.makeIdentity(self.BindNode['Root'], apply=True, t=1, r=0, s=0)
pm.delete(pm.pointConstraint(self.DestinationNode, self.BindNode['Root']))
if self.Settings.AlignToSourceTrans:
pm.delete(pm.pointConstraint(self.SourceNode, self.BindNode['Root']))
pm.makeIdentity(self.BindNode['Root'], apply=True, t=1, r=0, s=0)
#Rotation Alignment
if parentNode:
pm.orientConstraint(self.SourceNode, self.BindNode['Root'])
if self.Settings.AlignToControlRots:
pm.delete(pm.orientConstraint(self.DestinationNode, self.BindNode['Main']))
if self.Settings.AlignToSourceRots:
pm.delete(pm.orientConstraint(self.SourceNode, self.BindNode['Main']))
开发者ID:miketon,项目名称:SymLink,代码行数:33,代码来源:AnimationBinder.py
示例4: arrows4
def arrows4(name, radius, normal, color):
r = radius
points = [(0.25*r, 0*r, 0.75*r),
(0*r, 0*r, 1*r),
(-.25*r, 0*r, 0.75*r),
(0.25*r, 0*r, 0.75*r),
(0*r, 0*r, 1*r),
(0*r, 0*r, -1*r),
(0.25*r, 0*r, -.75*r),
(-.25*r, 0*r, -.75*r),
(0*r, 0*r, -1*r),
(0*r, 0*r, 0*r),
(-1*r, 0*r, 0*r),
(-.75*r, 0*r, 0.25*r),
(-.75*r, 0*r, -.25*r),
(-1*r, 0*r, 0*r),
(1*r, 0*r, 0*r),
(0.75*r, 0*r, -.25*r),
(0.75*r, 0*r, 0.25*r),
(1*r, 0*r, 0)]
a = pm.curve(point=points, name=name, degree=1, worldSpace=True)
u.aimNormal(a, normal=normal)
pm.makeIdentity(a,apply=True)
a.getShape().overrideEnabled.set(True)
a.getShape().overrideColor.set(color)
return a
开发者ID:bensledge,项目名称:dparigbuilder,代码行数:27,代码来源:blocks.py
示例5: transfer_shape
def transfer_shape(source, target, snap_to_target=True, fix_name=False):
"""
Reparent a shape node from one parent to another
@param source: The source dag which contains the shape
@param target: The source dag which will have the new shape the shape
@param snap_to_target: Should be we reparent with world space or object space
@param fix_name: Should we match the name of the shape to the new target
@return:
"""
source = force_pynode(source)
target = force_pynode(target)
if snap_to_target:
snap(source, target)
pm.makeIdentity(source, apply=1)
if source.getShape().type() != "locator":
try:
pm.cluster(source)
pm.delete(source, ch=1)
except RuntimeError:
logger.warning("Cannot cluster {}".format(source))
oldShape = source.getShape()
pm.parent(oldShape, target, shape=1, relative=1)
if fix_name:
fix_shape_name(target)
return oldShape
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:26,代码来源:libUtilities.py
示例6: gimbal
def gimbal(**kwargs):
final = pm.nt.Transform(name = 'Gimbal')
circle1 = pm.modeling.circle(
constructionHistory = False,
normal = kwargs['normal'] if 'normal' in kwargs else [0, 1, 0],
radius = kwargs['radius'] if 'radius' in kwargs else 1
)[0]
circle2 = pm.duplicate(circle1, returnRootsOnly = True)[0]
circle2.rotateBy((90, 0, 0))
circle3 = pm.duplicate(circle1, returnRootsOnly = True)[0]
circle3.rotateBy((0, 0, 90))
for circle in [circle1, circle2, circle3]:
pm.makeIdentity(circle, apply = True)
shape = circle.getShape()
pm.parent(shape, final, shape = True, relative = True)
shape.rename('{0}Circle1Shape'.format(final.nodeName()))
pm.delete(circle)
return final
开发者ID:jenosavel,项目名称:jhRigBuilder,代码行数:28,代码来源:controls.py
示例7: build_flexi_jnts
def build_flexi_jnts(self, follicles):
"""
Args:
None
Returns (None)
"""
follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
jntGRP_name = self.flexiPlaneNameField.getText() + '_flexiPlane_JNT_GRP'
pm.group( em = True, name = jntGRP_name )
for index,follicle in enumerate(follicles):
jnt_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_jnt%03d' % (index+1),
SUFFIX = 'JNT')
jnt_offset_name = jnt_name.replace('_JNT','Offset_GRP')
tweek_ctrlCon_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
INDEX = 'flexiPlane_tweak%03d' % (index+1),
SUFFIX = 'CTRLCon_GRP')
pm.joint( p = ( follicle.translateX.get(), 0, 0 ), n = jnt_name )
pm.select(jnt_name, r=True)
offSetGRP.add_offset_grps()
pm.parent( jnt_offset_name, jntGRP_name )
pm.select( clear = True )
tweak_ctrl_con = pm.PyNode(tweek_ctrlCon_name)
joint_offset = pm.PyNode(jnt_offset_name)
pm.parentConstraint( tweek_ctrlCon_name, jnt_offset_name )
pm.setAttr(jnt_name + '.rotateZ', -90)
pm.makeIdentity( jnt_name, apply=True, translate=True, rotate=True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:34,代码来源:flexi_plane.py
示例8: locatorGrid
def locatorGrid(width, height, depth, offset, centered=True):
'''Create a grid of locators to test upon
Args:
width (int): Width of the grid
height (int): Height of the grid
offset (float): Adds an offset multiplier to the locator positions
centered (bool): determines whether it's centered in world space
Returns (pm.PyNode): The top group of the locator grid
Usage: locatorGrid(5,5,5,2)
'''
if not pm.objExists('locatorGrid'):
grp=pm.group(em=True,n='locatorGrid')
for d in range(0,depth):
for w in range(0,width):
for h in range(0,height):
loc = pm.polyCube(w=.5, h=.5, d=.5, ch=0)[0]
pm.move(loc,(w*offset,h*offset,d*offset), rpr=True)
loc.setParent(grp)
if loc.getShape().type() == "locator":
loc.localScale.set(.2,.2,.2)
if centered:
pm.xform(grp, cp=1)
pm.move(grp, (0, 0, 0), rpr=1)
pm.makeIdentity(grp, apply=True, r=1,s=1,t=1)
return grp
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:aw_influenceGrid.py
示例9: _create_label
def _create_label(self):
labels = pm.textCurves(ch=0, f="Arial", t=self.label, name="TEMP")
label = pm.duplicate(labels[0])[0]
pm.delete(labels)
label.scale.set([self.label_scale, self.label_scale, self.label_scale])
pm.makeIdentity(label, apply=True, t=True)
shapes = label.listRelatives(ad=True, s=True)
for shape in shapes:
shape.rename("%s_%s" % (self.prefix, shape.name()))
pm.parent(shapes, label, shape=True, relative=True)
label.centerPivots()
label.rename("Text_%s" % self.prefix)
label.overrideEnabled.set(1)
self.control_group.display >> label.overrideDisplayType
self.control_group.display >> label.visibility
pm.delete(label.listRelatives(ad=True, type="transform"))
temp_loc = pm.spaceLocator()
temp_loc.tx.set(self.label_offset[0])
temp_loc.ty.set(self.label_offset[1])
pm.delete(pm.pointConstraint(temp_loc, label, maintainOffset=False))
pm.delete(temp_loc)
pm.parent(label, self.control_group, absolute=True)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:26,代码来源:facial_control_creator.py
示例10: addCurlJnt
def addCurlJnt(side, finger):
# create curl jnt
baseJnt = pm.PyNode(side+finger+'_a_jnt')
loc = pm.PyNode(baseJnt.replace('_a_jnt', 'Cup_loc'))
parJnt = baseJnt.getParent()
# orient loc so x is aimed to baseJnt
if '_rt' in side:
temp_con = pm.aimConstraint(baseJnt, loc, aim=(-1,0,0), u=(0,0,1), wuo=parJnt, wut='objectrotation')
else:
temp_con = pm.aimConstraint(baseJnt, loc, aim=(1,0,0), u=(0,0,1), wuo=parJnt, wut='objectrotation')
pm.delete(temp_con)
# create jnt
pm.select(cl=True)
curlJnt = pm.joint(n=side+finger+'Cup_jnt')
curlJnt.radius.set(baseJnt.radius.get())
mat = loc.getMatrix(ws=True)
curlJnt.setMatrix(mat, ws=True)
parJnt | curlJnt
pm.makeIdentity(curlJnt, r=True, a=True)
# find offset matrix for baseJnt
currMat = baseJnt.getMatrix()
offMat = currMat * curlJnt.getMatrix().inverse()
txOffset = offMat.translate[0]
# change parent for baseJnt
curlJnt | baseJnt
txMd = baseJnt.tx.inputs()[0]
txMd.input2X.set(txOffset)
return curlJnt
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:28,代码来源:fixFingerRotates.py
示例11: bdMirrorRight
def bdMirrorRight(self):
print "Mirroring left to right"
leftGroup = pm.ls("left:" + self.templateType + "*grp")[0]
rightGroup = pm.ls("right:" + self.templateType + "*grp")[0]
leftGroupPos = leftGroup.getRotatePivot(space="world")
leftGroupPos[0] = -1.0 * leftGroupPos[0]
rightGroup.setTranslation(leftGroupPos, space="world")
leftGrpChildren = leftGroup.listRelatives(f=True, ad=True, type="transform")
rightGrpChildren = rightGroup.listRelatives(f=True, ad=True, type="transform")
i = 0
for target in leftGrpChildren:
targetPos = target.getRotatePivot(space="object")
targetPos = [-2.0 * targetPos[0], 0, 0]
rightGrpChildren[i].translateBy(targetPos, space="object")
pm.makeIdentity(rightGrpChildren[i], apply=True, translate=True, rotate=True, scale=True)
i += 1
i = 0
for target in leftGrpChildren:
mdNode = pm.createNode("multiplyDivide", name=target + "_X_MD")
mdNode.input2X.set(-1)
target.translateX.connect(mdNode.input1X)
mdNode.outputX.connect(rightGrpChildren[i].translateX)
target.translateY.connect(rightGrpChildren[i].translateY)
target.translateZ.connect(rightGrpChildren[i].translateZ)
target.scaleX.connect(rightGrpChildren[i].scaleX)
target.scaleY.connect(rightGrpChildren[i].scaleY)
target.scaleZ.connect(rightGrpChildren[i].scaleZ)
i += 1
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:31,代码来源:bdRigTemplate.py
示例12: create_background_sphere
def create_background_sphere(name):
'''Create a sphere aligned to aiSkyDomeLight shape'''
xform, _ = pmc.polySphere(radius=995)
shape = xform.getShape()
xform.rename('HDR_Reflector')
# align sphere to aiSkyDomeLight
xform.rotateY.set(71.5)
uv_count = pmc.polyEvaluate(shape, uv=True)
pmc.polyFlipUV(
'{}.map[0:{}]'.format(str(shape), uv_count),
flipType=0,
local=True
)
pmc.delete(xform, ch=True)
pmc.makeIdentity(xform, apply=True)
# set defaults
shape.doubleSided.set(False)
shape.castsShadows.set(False)
shape.receiveShadows.set(False)
shape.opposite.set(True)
shape.aiSelfShadows.set(0)
shape.aiOpaque.set(0)
shape.aiVisibleInDiffuse.set(0)
shape.aiVisibleInGlossy.set(0)
return xform, shape
开发者ID:danbradham,项目名称:mtoatools,代码行数:29,代码来源:hdr.py
示例13: makeCube
def makeCube():
squareCrv = dtLib.makeSquare()
squareCrv2 = dtLib.makeSquare()
squareCrv2.setRotation([90, 0,0])
squareCrv2.setTranslation([0,0.5,-0.5])
pm.makeIdentity(apply=True, translate=True, rotate=True, scale=True, normal=1)
crvs = squareCrv2.getShapes()
for current in crvs:
pm.parent(current, squareCrv, relative=True, shape=True)
pm.delete(squareCrv2)
pm.select(squareCrv)
dupCrv = pm.duplicate()
dupCrv[0].setRotation([180, 0, 0])
dupCrv[0].setTranslation([0,0,-1])
pm.makeIdentity(apply=True, translate=True, rotate=True, scale=True, normal=1)
crvs = dupCrv[0].getShapes()
for current in crvs:
pm.parent(current, squareCrv, relative=True, shape=True)
pm.delete(dupCrv)
#中央にピポットを移動
pm.select(squareCrv)
pm.xform(cp=True)
return pm.selected()
开发者ID:Hare8563,项目名称:MayaProgramming,代码行数:27,代码来源:dtLib.py
示例14: _build
def _build(self, *args):
"""
Builds the joints on the curve.
"""
# naming convention
asset = self.asset
side = self.side
part = self.part
joints = self.joints
suffix = self.suffix
if self.gui:
asset = self.asset_name.text()
side = self.side.currentText()
part = self.part_name.text()
joints = self.joints_box.value()
suffix = self.suffix.currentText()
try:
curve = pm.ls(sl=True)[0]
curve_name = NameUtils.get_unique_name(asset, side, part, "crv")
self.curve = pm.rename(curve, curve_name)
except IndexError:
pm.warning("Please select a curve")
return
length_of_curve = pm.arclen(self.curve)
equal_spacing = length_of_curve / float(joints)
# clear the selection
pm.select(cl=True)
# # create the joints
curve_joints = list()
for x in xrange(int(joints) + 1):
name = NameUtils.get_unique_name(asset, side, part, suffix)
joint = pm.joint(n=name)
curve_joints.append(joint)
joint_position = (x * equal_spacing)
pm.move(0, joint_position, 0)
# rename last joint
last_joint = curve_joints[-1]
pm.rename(last_joint, last_joint + "End")
root_joint = pm.selected()[0].root()
end_joint = pm.ls(sl=True)[0]
solver = 'ikSplineSolver'
# attach joints to curve
ik_name = NameUtils.get_unique_name(asset, side, part, "ikHandle")
self.ikHandle = pm.ikHandle(sj=root_joint, ee=end_joint, sol=solver,
c=self.curve, pcv=True, roc=True, ccv=False, n=ik_name)
joint_chain = pm.ls(root_joint, dag=True)
# delete history
pm.makeIdentity(root_joint, apply=True)
# cleanup
self._cleanup()
开发者ID:satishgoda,项目名称:telims_pipe,代码行数:60,代码来源:curve_joint_generator.py
示例15: create_curveSphere
def create_curveSphere(name, radius):
circGrp = pm.group(n=name, em=True)
circ1 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circ2 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circ3 = pm.circle(nr=[1, 0, 0], ch=True)[0]
circs = [circ1, circ2, circ3]
circGrp.overrideEnabled.set(1)
circGrp.overrideColorRGB.set(1, 1, 0)
circGrp.overrideRGBColors.set(1)
pm.xform(circGrp, s=[radius, radius, radius])
pm.xform(circ2, ro=[0, 90, 0])
pm.xform(circ3, ro=[0, 0, 90])
pm.makeIdentity([circ1, circ2, circ3], a=True, t=True, r=True, s=True, n=False)
circ1_shape = pm.listRelatives(circ1, s=True)[0]
circ2_shape = pm.listRelatives(circ2, s=True)[0]
circ3_shape = pm.listRelatives(circ3, s=True)[0]
pm.parent([circ1_shape, circ2_shape, circ3_shape], circGrp, r=True, s=True)
pm.delete([circ1, circ2, circ3])
return circGrp
开发者ID:Huston94,项目名称:Orbital_Light_Previewer,代码行数:25,代码来源:orbitLights_cmds.py
示例16: FootCrv
def FootCrv ( size=1, name='footCrv') :
ctrlName = pm.curve (d = 1 , p = (
(0.00443704, -0.677552, 0)
,(0.144546, -0.530692, 0)
,(0.352021, 0.0542797, 0)
,(0.348132, 0.276213, 0)
,(0.448607, 0.414713, 0)
,(0.322616, 0.478526, 0)
,(0.256431, 0.302266, 0)
,(0.180984, 0.356473, 0)
,(0.32057, 0.570811, 0)
,(0.17346, 0.659144, 0)
,(0.0855168, 0.404945, 0)
,(0.0139709, 0.433904, 0)
,(0.106305, 0.743462, 0)
,(-0.107758, 0.761677, 0)
,(-0.0858926, 0.450201, 0)
,(-0.16749, 0.440366, 0)
,(-0.230299, 0.787238, 0)
,(-0.496683, 0.690941, 0)
,(-0.336863, 0.360119, 0)
,(-0.394508, 0.133506, 0)
,(-0.159134, -0.138775, 0)
,(-0.28817, -0.523902, 0)
,(-0.195119, -0.663426, 0)
,(0.00443704, -0.677552, 0)
),
k = (0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23) , name = name)
ctrlName.scale.set(size,size,size)
pm.makeIdentity (ctrlName , apply=True , s=True)
return ctrlName
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:34,代码来源:footCrv.py
示例17: createShapeFromPoints
def createShapeFromPoints(points, knots = None, degree = 1, radius = None, **kwargs):
"""
Creates a new shape from a list of points.
:param list points: list of tuple of float
:param list knots: list of int
:param uint degree:
:param int radius:
:returns: :py:class:`pm.nt.Transform`
"""
curveArgs = {}
curveArgs['point'] = points
curveArgs['degree'] = degree
if knots:
curveArgs['knot'] = knots
curve = pm.modeling.curve(**curveArgs)
if radius:
curve.setScale(radius, radius, radius)
pm.makeIdentity(curve, apply = True)
return curve
开发者ID:jenosavel,项目名称:jhRigBuilder,代码行数:28,代码来源:controls.py
示例18: makeDuplicateJointTree
def makeDuplicateJointTree(topJoint, toReplace=None, replaceWith=None, freeze=True):
"""
make a duplicate of the hierarhcy starting at topJoint, delete any non-joint
nodes, and ensure joints are properly connected.
Return a dictionary of {parentJoint:[branchJnt1, branchJnt2...]} for all branches
in the tree. The topmost node branch's key is None
"""
topJoint = pm.PyNode(topJoint)
result = []
dups = pm.duplicate(topJoint, rc=True)
#parent to world
if dups[0].getParent():
dups[0].setParent(world=True)
for node in dups[0].listRelatives(ad=True):
if not isinstance(node, pm.nodetypes.Joint):
pm.delete(node)
else:
if toReplace and replaceWith:
replaceInName(node, toReplace, replaceWith)
if freeze:
pm.makeIdentity(node, apply=True, r=True, s=True, t=True, n=True)
result.append(node)
#ensure joints are connected
fixInverseScale(result)
#the top node isn't in the result list yet
result.append(dups[0])
#usually it's in reverse order
result.reverse()
return result
开发者ID:jspatrick,项目名称:beings,代码行数:31,代码来源:GeneralUtils.py
示例19: crv_combine
def crv_combine(toggles=False, rename=None):
'''Combines a curve and gives you the ability to have combinations of shapes
Args:
toggles (boolean): allows you to have attributes to toggle the shapes nodes on and off
rename (boolean): determines whether you rename the resulting curve+shapes or not
Returns:
(pm.nt.Transform): transform of the resulting curve
Usage:
crv_combine(toggles=True)
crv_combine(toggles=True, rename='global')
crv_combine(rename='halo')
'''
sel=pm.ls(sl=True)
master=sel[0]
for obj in sel[1:]:
obj.setParent(None)
pm.makeIdentity(obj, apply=True, t=True,r=True,s=True,n=False)
obj.getShape().setParent(master,s=True,r=True)
if toggles:
crv_shapeToggle(master, map(str,sel))
pm.delete(sel[1:])
if rename is not None:
print 'Renaming resulting object!'
master.rename(rename+'_CTRL')
for shape,i in zip(master.getShapes(),range(len(master.getShapes()))):
shape.rename(rename+'%02d'%i+'Shape')
return master
开发者ID:creuter23,项目名称:tools,代码行数:27,代码来源:lib_crv.py
示例20: main
def main():
sel = pm.ls(os=True, fl=True)
if len(sel) != 3:
pm.warning("Select 3 vertices in order of origin, z, and x")
return
shape = sel[0].node()
transformNode = pm.listRelatives(shape, parent=True)[0]
piv = pm.xform(transformNode, q=True, ws=True, rp=True)
p0 = sel[0].getPosition()
p1 = sel[1].getPosition()
p2 = sel[2].getPosition()
Z = p1 - p0
X = p2 - p0
Y = Z ^ X
Z.normalize()
X.normalize()
Y.normalize()
P = pm.datatypes.Point(piv[0], piv[1], piv[2])
M = pm.datatypes.Matrix(
X.x, X.y, X.z, 0,
Y.x, Y.y, Y.z, 0,
Z.x, Z.y, Z.z, 0,
P.x, P.y, P.z, 1)
pm.xform(transformNode, matrix=M.inverse())
pm.select(transformNode, r=True)
pm.makeIdentity(apply=True, t=True, r=True, s=False, n=False)
pm.xform(transformNode, ws=True, piv=(0, 0, 0))
pm.xform(transformNode, matrix=M)
开发者ID:minoue,项目名称:miMayaUtils,代码行数:30,代码来源:retrieveTransform.py
注:本文中的pymel.core.makeIdentity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论