本文整理汇总了Python中pymel.core.spaceLocator函数的典型用法代码示例。如果您正苦于以下问题:Python spaceLocator函数的具体用法?Python spaceLocator怎么用?Python spaceLocator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spaceLocator函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createDynamicChainLocators
def createDynamicChainLocators(self, prefix = ''):
#set instance prefix var
self.setPrefix(prefix)
pm.select(cl = True)
#Create Space locators and translate
self.dynamic_chain_locator_base = pm.spaceLocator(n = self.prefix + '_dynamic_chain_locator_base')
self.dynamic_chain_locator_base.translate.set(0, 0, 0)
pm.select(cl = True)
self.dynamic_chain_locator_tip = pm.spaceLocator(n = self.prefix + '_dynamic_chain_locator_tip')
self.dynamic_chain_locator_tip.translate.set(0, 10, 0)
pm.select(cl = True)
#Create Annotations and rename
self.annotation_dynamic_chain_locator_base = pm.annotate( self.dynamic_chain_locator_base, tx = self.prefix +'_dynamic_chain_base' )
pm.rename(self.annotation_dynamic_chain_locator_base.getParent().name(), self.prefix + '_dynamic_chain_base_annotation')
self.annotation_dynamic_chain_locator_tip = pm.annotate( self.dynamic_chain_locator_tip, tx = self.prefix +'_dynamic_chain_tip' )
pm.rename(self.annotation_dynamic_chain_locator_tip.getParent().name(), self.prefix + '_dynamic_chain_tip_annotation')
pm.select(cl = True)
#Parent constrain annotation transforms
pm.parentConstraint(self.dynamic_chain_locator_base, self.annotation_dynamic_chain_locator_base.getParent(), mo = False)
pm.parentConstraint(self.dynamic_chain_locator_tip, self.annotation_dynamic_chain_locator_tip.getParent(), mo = False)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:30,代码来源:rbDynamicChain.py
示例2: create_planar_locators
def create_planar_locators(nLocators, length=10.0, name='test', size=1):
root = pm.spaceLocator(name='%s_root' %name)
root.add_shape(shape='double_cross', axis='+z', size=size)
locators=[root]
for i in range(nLocators):
spacing = length / (nLocators - 1)
tx = i * spacing
locator = pm.spaceLocator(name='%s_locator_%d' %(name, i+1))
locator.getShape().localScale.set([size,size,size])
#locator.add_parent_group()
pm.parent(locator, root)
locator.translateX.set(tx)
locators.append(locator)
for i in range(2, len(locators)):
pm.aimConstraint(locators[i], locators[i-1], mo=False, aimVector=[1,0,0], upVector=[0,0,1], worldUpType='objectrotation', worldUpVector = [0,0,1], worldUpObject=root)
for locator in locators[1:]:
locator.tz.lock()
locator.rotate.lock()
for locator in locators[1:-1]:
locator.add_rotate_arrows(size=size)
return locators
开发者ID:adamfok,项目名称:afok_toolset,代码行数:31,代码来源:utils_locatorCreation.py
示例3: createNoiseControl
def createNoiseControl(self):
# Create locator
control = '%s%s'%(self.camera, self._CONTROL_SUFIX)
pc.spaceLocator(n=control)
# Create attribute for turning noise on/off
pc.addAttr(ln='NOISE_SWITCH', k=False, at='enum', en='-:')
pc.setAttr('%s.NOISE_SWITCH'%control, lock=True, cb=True)
pc.addAttr(ln='Noise', k=False, at='enum', en='Off:On:')
pc.setAttr('%s.Noise'%control, 1, cb=True)
# Create translation noise attributes: frequency, amplitude (x, y, z), jitter and seed
for noise_type in ['T', 'R']:
nname = 'TRANSLATION' if noise_type == 'T' else 'ROTATION'
pc.addAttr(ln='%s_NOISE'%nname, k=False, at='enum', en='-:')
pc.setAttr('%s.%s_NOISE'%(control, nname), lock=True, cb=True)
for axis in ['X', 'Y', 'Z']:
pc.addAttr(ln='Frequency_%s%s'%(noise_type, axis), k=True, at='double', min=0)
pc.addAttr(ln='Amplitude_%s%s'%(noise_type, axis), k=True, at='double', min=0)
pc.addAttr(ln='Jitter_%s'%noise_type, k=True, at='double', min=0)
pc.addAttr(ln='Seed_%s'%noise_type, k=False, at='short', dv=random.randint(0, 9999))
pc.setAttr('%s.Seed_%s'%(control, noise_type), cb=True)
# Create extra attributes for camera position offset
pc.addAttr(ln='CAM_OFFSET', k=False, at='enum', en='-:')
pc.setAttr('%s.CAM_OFFSET'%control, lock=True, cb=True)
for axis in ['X', 'Y', 'Z']:
pc.addAttr(ln='Offset_%s'%axis, k=True, at='double')
return control
开发者ID:jricker,项目名称:JR_Maya,代码行数:26,代码来源:JR_camera_shake.py
示例4: makeNull
def makeNull():
#pm.melGlobals.initVar( 'string[]', 'KinectSkelNames' )
i=0
for i in range(0,24):
pm.spaceLocator(p=(0, 0, 0),n=KinectSkelNames[i])
pm.spaceLocator(p=(0, 0, 0),n="KINECT_HAND")
for i in range(0,15):
point[i] = [0.0,0.0,0.0]
makeSkel()
for i in range(0,15):
pm.rename('joint'+str(i+1), KinectSkelJoints[i]+'_jt')
for i in range(0,15):
pm.pointConstraint( KinectSkelJoints[i], KinectSkelJoints[i]+'_jt' )
pm.orientConstraint( KinectSkelJoints[i], KinectSkelJoints[i]+'_jt' )
#Create Camera
cam = pm.camera()[1]
#print pm.camera(cam, query=True, aspectRatio=True)
cam.setAspectRatio(3)
print cam.getAspectRatio()
开发者ID:thuskey,项目名称:KinectMoCap_Maya,代码行数:27,代码来源:mayaKinectCaptureTest.py
示例5: createHighlight
def createHighlight(mesh, lightType=mayaLights["Spot"], offset=6):
""" Create Light based on curve drawn on object """
# Get the currently selected curve
curveA = getSelection()
# Get the start and end points of the curve as Vectors
crv_posA = dt.Vector(pm.pointOnCurve(curveA, pr=0))
crv_posB = dt.Vector(pm.pointOnCurve(curveA, pr=curveA.maxValue.get()))
# Calculate the mid point
midPoint = (crv_posA + crv_posB) / 2
# Get closest point & normal on mesh
pointOnMesh_set = mesh.getClosestPointAndNormal(midPoint, space="world")
pointOnMesh = pointOnMesh_set[0]
pointOnMesh_normal = pointOnMesh_set[1]
pm.spaceLocator(p=pointOnMesh) # For debug/vis
# Create dummy camera
cam = pm.camera()
camera = cam[0]
camera.setTranslation(pointOnMesh + pointOnMesh_normal * offset)
pm.viewLookAt(camera, pos=pointOnMesh)
# Create light
createLight(lightType, camera.getTranslation(), camera.getRotation())
# Delete dummy camera
pm.delete(camera)
开发者ID:atvKumar,项目名称:mkUtils,代码行数:30,代码来源:mkUtils.py
示例6: connectJacketLoc
def connectJacketLoc(twistCrv, untwistCrv, param, name='', addCrvs=[]):
'''
'''
mp = pm.createNode('motionPath', n=twistCrv+name+'_mp')
untwistCrv.worldSpace >> mp.geometryPath
mp.u.set(param)
npc = pm.createNode('nearestPointOnCurve', n=twistCrv+name+'_npc')
mp.allCoordinates >> npc.inPosition
twistCrv.worldSpace >> npc.inputCurve
allLocs = []
loc = pm.spaceLocator(n=twistCrv+name+'_loc')
npc.position >> loc.translate
allLocs.append(loc)
for crv in addCrvs:
pci = pm.createNode('pointOnCurveInfo', n=crv+name+'_pci')
npc.parameter >> pci.parameter
crv.worldSpace >> pci.inputCurve
loc = pm.spaceLocator(n=crv+name+'_loc')
pci.position >> loc.translate
allLocs.append(loc)
pm.select(allLocs)
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:25,代码来源:jacket.py
示例7: setNodeAxisVectors
def setNodeAxisVectors(node, oldA1="posY", oldA2="posX", newA1="posY", newA2="posX", orient=True):
node = pm.PyNode(node)
#these are world space vectors
oldV1 = getNodeAxisVector(node, oldA1)
oldV2 = getNodeAxisVector(node, oldA2)
_logger.debug("%s vector: %s; %s vector: %s" % (oldA1, str(oldV1), oldA2, str(oldV2)))
newV1 = g_vectorMap[newA1]
newV2 = g_vectorMap[newA2]
posL = pm.spaceLocator()
aimL = pm.spaceLocator()
upL = pm.spaceLocator()
aimL.setParent(posL)
upL.setParent(posL)
pm.delete(pm.pointConstraint(node, posL, mo=False))
aimL.translate.set(oldV1)
upL.translate.set(oldV2)
pm.delete(pm.aimConstraint(aimL, node, aimVector=newV1, upVector=newV2, worldUpType='object', worldUpObject=upL))
pm.delete(posL)
if orient:
node.jox.set(node.jox.get() + node.rotateX.get())
node.joy.set(node.joy.get() + node.rotateY.get())
node.joz.set(node.joz.get() + node.rotateZ.get())
node.rotate.set([0, 0, 0])
开发者ID:jspatrick,项目名称:beings,代码行数:29,代码来源:GeneralUtils.py
示例8: build
def build(self):
"""builds it self
"""
self.curve = curve(d=1, p=[(1, 0, 0), (-1, 0, 0)], k=(0, 1))
self.corner1_locator = spaceLocator()
self.corner2_locator = spaceLocator()
select(self.curve)
ClusterCurve()
# try to find the clusterHandles
curve_shape = curve.getShape()
clusters = []
handles = []
for node in curve_shape.listHistroy():
if isinstance(node, ClusterHandle):
handles.append(node)
elif isinstance(node, Cluster):
clusters.append(node)
self.cluster1 = clusters[0]
self.cluster2 = clusters[0]
self.cluster_handle1 = handles[0]
self.cluster_handle2 = handles[1]
# set clusters to absolute
self.cluster1.setAttr('relative', 0)
self.cluster2.setAttr('relative', 0)
开发者ID:eoyilmaz,项目名称:anima,代码行数:28,代码来源:light.py
示例9: makeNodeSet
def makeNodeSet(pointValueList, transNodeType):
for x in pointValueList:
if transNodeType == 'locator':
pm.spaceLocator().t.set(x)
else:
pm.createNode(transNodeType).t.set(x)
开发者ID:jiwonchoe,项目名称:mayaPy,代码行数:7,代码来源:posUtil.py
示例10: install_subMetaRig_proxy
def install_subMetaRig_proxy(self):
logger.debug("Function Called ( %s )"%inspect.stack()[0][3])
#retrieve components
prefix = self.prefix.get()
if self.side.get():
prefix = "%s_%s"%(self.prefix.get(), self.side.get())
#build components
proxy_gr = pm.group(empty=True, name='%s_proxy_gr' %prefix)
proxy_1 = pm.spaceLocator(name='%s_proxy_1' %prefix)
proxy_2 = pm.spaceLocator(name='%s_proxy_2' %prefix)
joint_1 = pm.joint(name='%s_joint_1' %prefix)
joint_2 = pm.joint(name='%s_joint_2' %prefix)
pm.parent( proxy_1, proxy_2, joint_1, joint_2, proxy_gr)
#store components
joint_1.message >> self.joint_1
joint_2.message >> self.joint_2
proxy_1.message >> self.proxy_1
proxy_2.message >> self.proxy_2
proxy_gr.message >> self.proxy_gr
pass
开发者ID:adamfok,项目名称:afok_toolset,代码行数:26,代码来源:Single_Joint_MetaRig.py
示例11: _ctrlDBL
def _ctrlDBL(self, controls):
pmc.undoInfo(openChunk=True)
if controls == []:
controls = pmc.ls(sl=True)
for control in controls:
control_roo = pmc.xform(control, q=True, roo=True)
control_mtx = pmc.xform(control, q=True, m=True, ws=True)
control_parent = pmc.listRelatives(control, p=True)
pmc.select(cl=True)
locdbl_parent = pmc.spaceLocator(n='locDBL_parent_' + control)
locdbl_offset = pmc.spaceLocator(n='locDBL_offset_' + control)
pmc.xform(locdbl_parent, ws=True, m=control_mtx)
pmc.xform(locdbl_offset, ws=True, m=control_mtx)
pmc.parent(locdbl_offset, locdbl_parent)
pmc.parent(locdbl_parent, control_parent)
pmc.parent(control, locdbl_offset)
if control_roo == 'xyz':
pmc.xform(locdbl_offset, roo='zyx')
if control_roo == 'yzx':
pmc.xform(locdbl_offset, roo='xzy')
if control_roo == 'zxy':
pmc.xform(locdbl_offset, roo='yxz')
if control_roo == 'xzy':
pmc.xform(locdbl_offset, roo='yzx')
if control_roo == 'yxz':
pmc.xform(locdbl_offset, roo='zxy')
if control_roo == 'zyx':
pmc.xform(locdbl_offset, roo='xyz')
md_trns = pmc.createNode('multiplyDivide', n='mdTRNS_locDBL_' + control)
md_rot = pmc.createNode('multiplyDivide', n='mdROT_locDBL_' + control)
md_scl = pmc.createNode('multiplyDivide', n='mdSCL_locDBL_' + control)
pmc.setAttr(md_trns + '.input1', [-1,-1,-1])
pmc.setAttr(md_rot.input1, [-1,-1,-1])
pmc.setAttr(md_scl.input1, [ 1, 1, 1])
pmc.setAttr(md_scl.operation, 2)
pmc.connectAttr(control + '.translate', md_trns + '.input2')
pmc.connectAttr(control + '.rotate', md_rot + '.input2')
pmc.connectAttr(control + '.scale', md_scl + '.input2')
pmc.connectAttr(md_trns + '.output', locdbl_offset + '.translate')
pmc.connectAttr(md_rot + '.output', locdbl_offset + '.rotate')
pmc.connectAttr(md_scl + '.output', locdbl_offset + '.scale')
pmc.setAttr(locdbl_parent + 'Shape.visibility', 0)
pmc.setAttr(locdbl_offset + 'Shape.visibility', 0)
pmc.undoInfo(closeChunk=True)
开发者ID:scorza,项目名称:variableFK,代码行数:58,代码来源:vfk_UI.py
示例12: jointChainOrient
def jointChainOrient( objs=[] ): # wip
'''
update : 2015-04-29
'''
if objs:
pm.selec(objs)
objs = pm.ls(sl=True, o=True)
if not objs:
raise
joints = pm.ls(sl=True, type='joint')
if not joints:
raise
upMeshs = []
if pm.filterExpand(sm=12):
upMeshs = [pm.PyNode(c) for c in pm.filterExpand(sm=12) ] # 업축으로 사용할 메쉬
# 조인트 오리엔트 조정: 메쉬의 가장 가까운 점의 노말을 조인트의 up으로 설정
if upMeshs:
for jnt in joints:
parentJnt = jnt.getParent()
if parentJnt:
# point에서 가장 가까운 Vertex의 Normal을 up으로 설정
pos = parentJnt.getTranslation( ws=True)
vtx = getClosestVertexOnMesh( upMeshs[0], pos )
pos = vtx.getPosition()
norm = vtx.getNormal()
upPos = pos + norm * 1000000 # 노말 위치가 가까우면 방향이 틀어져 버림.. 그래서 큰 수를 곱함.
upLoc = pm.spaceLocator(n='parentJnt_upLoc#')
upLoc.t.set( upPos )
jntOrient( [parentJnt, jnt, upLoc] )
#pm.joint( parentJnt, edit=True, zso=True, oj='xyz', sao='yup' )
pm.delete( upLoc )
else:
for jnt in joints:
parentJnt = jnt.getParent()
if parentJnt and parentJnt.type()=='joint':
print jnt
up = pm.spaceLocator()
grandParent = parentJnt.getParent()
if grandParent and grandParent.type()=='joint':
pm.delete( pm.parentConstraint( grandParent, up ) )
else:
pm.delete( pm.parentConstraint( parentJnt, up ) )
jntOrient( [parentJnt, jnt, up], worldUpType='objectrotation' )
pm.refresh()
pm.select(jnt)
pm.delete(up)
# 끝 조인트 오리엔트 조정
if len(joints)>1:
pm.joint( joints[-1], edit=True, oj='none' )
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:58,代码来源:joint.py
示例13: bdSwitchParent
def bdSwitchParent():
selection = pm.ls(sl=1,type='transform')
if selection:
ctrl = selection[0]
try:
currentParent = ctrl.attr('Parent').get()
except:
pm.warning('Current selection has no Parent attribute, aborting!')
return
print currentParent
switchFrame = pm.currentTime(q=1)
pm.currentTime(switchFrame-1,e=1)
pm.setKeyframe(ctrl)
pm.currentTime(switchFrame,e=1)
#World Parent
if currentParent == 1:
print 'Frow World to hand'
tempLoc = pm.spaceLocator(n='temp')
tempCnstr = pm.parentConstraint(ctrl,tempLoc)
pm.delete(tempCnstr)
ctrl.attr('Parent').set(0)
worldPos = tempLoc.getTranslation(space='world')
worldRot = tempLoc.getRotation(space='world')
ctrl.setTranslation(worldPos,space='world')
ctrl.setRotation(worldRot,space='world')
pm.delete(tempLoc)
pm.setKeyframe(ctrl )
else :
print 'From hand to world'
tempLoc = pm.spaceLocator(n='temp')
tempCnstr = pm.parentConstraint(ctrl,tempLoc)
pm.delete(tempCnstr)
ctrl.attr('Parent').set(1)
worldPos = tempLoc.getTranslation(space='world')
worldRot = tempLoc.getRotation(space='world')
ctrl.setTranslation(worldPos,space='world')
ctrl.setRotation(worldRot,space='world')
pm.delete(tempLoc)
pm.setKeyframe(ctrl )
else:
pm.warning('Select a ticket ctrl or the pound bill ctrl')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:57,代码来源:bdSwitchParent.py
示例14: curve_drive
def curve_drive(curve):
grp_crv = 'curveDrive_GRP'
sel = pm.ls(sl=True)
for obj in sel:
if curve.getShape().type() == 'nurbsCurve':
CPOC = curve.closestPoint(obj.t.get())
if not pm.objExists(grp_crv):
grp = pm.group(em=True,n=grp_crv)
grp.visibility.set(0)
print curve, CPOC
pm.spaceLocator(p=CPOC)
开发者ID:AndresMWeber,项目名称:aw,代码行数:11,代码来源:aw_curveAttach.py
示例15: create_radian_trigger
def create_radian_trigger(prefix):
prefix = ("%s_radianTrigger") %prefix
display = pm.group(empty=True, name="%s_display" %prefix)
display.overrideEnabled.set(1)
display.overrideDisplayType.set(2)
grp = pm.group(empty=True, name="%s_grp" %prefix)
loc = pm.spaceLocator(name = "%s_target" %prefix)
pm.addAttr(loc, at='double', ln="radical", k=True)
pm.addAttr(loc, at='double', ln="angle", k=True)
pos = pm.spaceLocator(name = "%s_pos" %prefix)
loc.ty.set(1)
loc.tz.set(1)
pos.tz.set(1)
radical_exp = '%s.radical = rad_to_deg( atan2( %s.translateY , %s.translateX ) )' %(loc.name(), loc.name(), loc.name())
angle_exp = "%s.angle = rad_to_deg( acos( %s.translateZ / (sqrt( pow(%s.translateX, 2) + pow(%s.translateY, 2) + pow(%s.translateZ, 2) ) ) ) )" %(loc.name(), loc.name(), loc.name(), loc.name(), loc.name())
pm.expression( o=loc, s= radical_exp, name="%s_radical_exp" %prefix)
pm.expression( o=loc, s= angle_exp, name="%s_angle_exp" %prefix)
planer_curve = "curve -d 1 -p 0 0 0 -p -1 0 0 -p -0.965926 0.258819 0 -p -0.765926 0.258819 0 -p -0.865926 0.258819 0 -p -0.865926 0.358819 0 -p -0.865926 0.158819 0 -p -0.865926 0.258819 0 -p -0.965926 0.258819 0 -p -0.866025 0.5 0 -p -0.707107 0.707107 0 -p -0.353553 0.353553 0 -p -0.707107 0.707107 0 -p -0.5 0.866025 0 -p -0.258819 0.965926 0 -p 0 1 0 -p 0 0.5 0 -p 0 1 0 -p 0.258819 0.965926 0 -p 0.5 0.866025 0 -p 0.707107 0.707107 0 -p 0.353553 0.353553 0 -p 0.707107 0.707107 0 -p 0.866025 0.5 0 -p 0.965926 0.258819 0 -p 1 0 0 -p 0.5 0 0 -p 1 0 0 -p 0.965926 -0.258819 0 -p 0.866025 -0.5 0 -p 0.707107 -0.707107 0 -p 0.353553 -0.353553 0 -p 0.707107 -0.707107 0 -p 0.5 -0.866025 0 -p 0.258819 -0.965926 0 -p 0 -1 0 -p 0 -0.5 0 -p 0 -1 0 -p -0.258819 -0.965926 0 -p -0.5 -0.866025 0 -p -0.707107 -0.707107 0 -p -0.353553 -0.353553 0 -p -0.707107 -0.707107 0 -p -0.866025 -0.5 0 -p -0.965926 -0.258819 0 -p -0.765926 -0.258819 0 -p -0.965926 -0.258819 0 -p -1 0 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 -k 17 -k 18 -k 19 -k 20 -k 21 -k 22 -k 23 -k 24 -k 25 -k 26 -k 27 -k 28 -k 29 -k 30 -k 31 -k 32 -k 33 -k 34 -k 35 -k 36 -k 37 -k 38 -k 39 -k 40 -k 41 -k 42 -k 43 -k 44 -k 45 -k 46 -k 47"
planer = pm.PyNode(pm.mel.eval(planer_curve))
planer.rename("%s_planer" %prefix)
arrow_curve = 'curve -d 1 -p 0 0 0 -p 0 0.377909 0 -p -0.0449662 0.378085 0 -p 0 0.460303 0 -p 0.0449662 0.378085 0 -p 0 0.377909 0 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 ;'
arrow = pm.PyNode(pm.mel.eval(arrow_curve))
pm.makeIdentity(arrow, apply=True, t=True, r=True, s=True)
arrow.rename("%s_arrow" %prefix)
angle_curves = pm.circle(name="%s_angleCurve" %prefix, r=0.5)
pm.aimConstraint(pos, angle_curves[0], mo=False, aimVector=[0,1,0], upVector=[-1,0,0], worldUpType='object', worldUpObject=loc)
pm.parent(arrow, angle_curves)
loc.angle >> angle_curves[-1].sweep
posPointer = pm.curve(name='%s_posPointer'%prefix, d = 1, p = [(0,0,0), (0,0,1)])
pointer = pm.curve(name='%s_targetPointer'%prefix, d = 1, p = [(0,0,0), (0,0,0)])
pointer.inheritsTransform.set(0)
cls1 = pm.cluster(pointer.cv[0], name='%s_pointerClusterStart' %prefix)
cls2 = pm.cluster(pointer.cv[1], name='%s_pointerClusterEnd' %prefix)
pm.parent(pos, planer, angle_curves[0], cls1, pointer, posPointer, display)
pm.parent(display, loc, grp)
pm.parent(cls2, loc, r=True)
cls1[1].v.set(0)
cls2[1].v.set(0)
pos.v.set(0)
开发者ID:adamfok,项目名称:afok_toolset,代码行数:53,代码来源:radian_trigger.py
示例16: createPoleVectorLocatorAndLinkingCurve
def createPoleVectorLocatorAndLinkingCurve(self):
pm.select(cl = True)
#PoleVector
#----------------------------------------------------
#Create leg ik pole vector loc
self.leg_ik_pole_vector_locator = pm.spaceLocator(n = self.prefix +'_leg_ik_pole_vector_locator')
pm.select(cl = True)
#Group leg ik pole vec
self.leg_ik_pole_vector_locator_grp = pm.group(self.leg_ik_pole_vector_locator, n = self.prefix + '_leg_ik_pole_vector_locator_grp')
pm.select(cl = True)
#Translate leg_ik_pole_vector_locator_grp
self.leg_ik_pole_vector_locator_grp.translate.set(self.leg_locator_poleVector_worldCoords)
#LinkingCurve
#----------------------------------------------------
#Create linking curve loc
self.leg_ik_pole_vector_locator_linking_curve_locator = pm.spaceLocator(n = self.prefix +'_leg_ik_pole_vector_locator_linking_curve_locator')
pm.select(cl = True)
#point con linking curve loc to leg ik j base
pm.pointConstraint(self.leg_ik_j_base, self.leg_ik_pole_vector_locator_linking_curve_locator , mo = False)
#Create Pole vector Linking Curve
self.pole_vector_linking_curve = pm.curve(p = [self.leg_locator_base_worldCoords , self.leg_locator_poleVector_worldCoords], d = 1, n = self.prefix +'_pole_vector_linking_curve')
pm.select(cl = True)
#make curve not selectable
pm.setAttr(self.pole_vector_linking_curve.getShape().overrideEnabled, 1)
pm.setAttr(self.pole_vector_linking_curve.getShape().overrideDisplayType, 2)
pm.select(cl = True)
#Connect loc world space coords to curve points
self.leg_ik_pole_vector_locator_linking_curve_locator.getShape().worldPosition[0] >> self.pole_vector_linking_curve.getShape().controlPoints[0]
self.leg_ik_pole_vector_locator.getShape().worldPosition[0] >> self.pole_vector_linking_curve.getShape().controlPoints[1]
pm.select(cl = True)
#Create grp
self.pole_vector_linking_curve_grp = pm.group( n = self.prefix +'_pole_vector_linking_curve_grp')
pm.select(cl = True)
#parent objects in group
pm.parent(self.leg_ik_pole_vector_locator_linking_curve_locator, self.pole_vector_linking_curve ,self.pole_vector_linking_curve_grp)
pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:52,代码来源:rbFootRigB.py
示例17: placeHighLight
def placeHighLight(*args):
### UI setup
global UI_name
UI_name = [ 'txtBtn_light', 'txtBtn_camera', 'txtBtn_object', 'txtBtn_HLitPoint', 'btn_placeHLit', 'chk_interaction' ]
if pm.window( 'winPlaceHLit', exists=True ):
pm.deleteUI( 'winPlaceHLit', window=True )
ui_layout['window'] = pm.window( 'winPlaceHLit', title='Place Highlight', sizeable=False, h=100, w=250 )
ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] )
#// get active camera
activeViewCamera = getActiveCam()
'''loc_light_probe = pm.createNode('locator', name='light_probe')
pm.lockNode(loc_light_probe, lock=False)'''
#// sub layout
#// sub1
ui_layout['ui_sub1'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
pm.textFieldButtonGrp( UI_name[0], label='Light: ', text='', buttonLabel='Pick',editable=False, buttonCommand='pickLit()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub1'] )
pm.button( 'btn_sel_light' ,label='Sel', command=pm.Callback( doSelItem, UI_name[0] ), p=ui_layout['ui_sub1'] )
#// sub2
ui_layout['ui_sub2'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
pm.textFieldButtonGrp( UI_name[1], label='Camera: ', text=activeViewCamera, buttonLabel='Pick', editable=False, buttonCommand='pickCam()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub2'] )
pm.button( 'btn_sel_camera' ,label='Sel', command=pm.Callback( doSelItem, UI_name[1] ), p=ui_layout['ui_sub2'] )
#// sub3
ui_layout['ui_sub3'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
pm.textFieldButtonGrp( UI_name[2], label='Object: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickTgtObj()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub3'] )
pm.button( 'btn_sel_obj' ,label='Sel', command=pm.Callback( doSelItem, UI_name[2] ), p=ui_layout['ui_sub3'] )
#// sub4
ui_layout['ui_sub4'] = pm.rowLayout(nc=2, cw=[(1, 210), (2, 40)], p=ui_layout['mainLayout'] )
pm.textFieldButtonGrp( UI_name[3], label='Point: ', text='', buttonLabel='Pick', editable=False, buttonCommand='pickHLitPt()', cw=[(1,50), (2,120), (3,40)], p=ui_layout['ui_sub4'] )
pm.button( 'btn_sel_point' ,label='Sel', command=pm.Callback( doSelItem, UI_name[3] ), p=ui_layout['ui_sub4'] )
#// sub5
ui_layout['ui_sub5'] = pm.rowLayout(nc=2, cw=[(1, 70), (2, 50)], p=ui_layout['mainLayout'] )
pm.button( UI_name[4] ,label='Place Light!', command='doPlaceHLight()', p=ui_layout['ui_sub5'] )
pm.checkBox( UI_name[5], label='interactive mode', onCommand=pm.Callback( doInteractionON ), offCommand=pm.Callback( doInteractionOFF ), p=ui_layout['ui_sub5'] )
pm.showWindow( ui_layout['window'] )
pm.spaceLocator( name='light_probe' )
pm.lockNode( 'light_probe', lock=True )
pm.textFieldButtonGrp( 'txtBtn_HLitPoint', edit=True, text='light_probe' )
#// clean make live and scriptJob after exit script
pm.scriptJob( uiDeleted=[ ui_layout['window'], pm.Callback( flushScript ) ] )
开发者ID:kzchen,项目名称:Maya_TD_tools,代码行数:52,代码来源:placeHlighLight_v16.py
示例18: getAimUpAxis
def getAimUpAxis( originObj, aimObj, upObj):
'''originObj기준의 aim축과 up축을 리턴함.
자동으로 aimVector와 upVector를 파악
'''
originObj = pm.PyNode(originObj)
aimObj = pm.PyNode(aimObj)
upObj = pm.PyNode(upObj)
o = pm.spaceLocator()
a = pm.spaceLocator()
u = pm.spaceLocator()
snap( originObj, o, type='parent' )
snap( aimObj, a, type='parent' )
snap( upObj, u, type='parent' )
# getAimVec
pm.parent( a, o)
aim_translate = a.t.get() # child의 위치값으로 확인 하려고 함.
pm.parent( a, w=True )
aim_abs = pm.dt.Vector( [abs(item) for item in aim_translate] ) # 절대값으로 조정
aim_id = aim_abs.index( aim_abs.max() )[0] # 절대값중 값이 큰 id
aim_sign = -1.0 if aim_translate[aim_id]<0 else 1 # 음수인지 양수인지 확인
aimVector = pm.dt.Vector(0,0,0)
aimVector[ aim_id ] = aim_sign
# 오리진 축 조정
tmpUpVec = pm.dt.Vector(0,1,0) if not aimVector==pm.dt.Vector(0,1,0) else pm.dt.Vector(0,1,0) # 이부분 다시 생각해볼것
tmpWoldUpObj = pm.spaceLocator()
snap( o, tmpWoldUpObj, type='parent' )
tmpWoldUpObj.translateBy( tmpUpVec , space='preTransform' )
pm.delete( pm.aimConstraint( a, o, aim=aimVector, u=tmpUpVec, wuo=tmpWoldUpObj, wut='object' ) )
# getUpVec
pm.parent( u, o)
up_translate = u.t.get()
pm.parent( u, w=True )
up_translate[aim_id] = 0.0 # aim축 값은 무시, 겹치는 방향은 무용지물.
up_abs = pm.dt.Vector( [abs(item) for item in up_translate] ) # 절대값으로 조정
up_id = up_abs.index( up_abs.max() )[0] # 절대값중 값이 큰 id
up_sign = -1.0 if up_translate[up_id]<0 else 1 # 음수인지 양수인지 확인
upVector = pm.dt.Vector( 0,0,0 )
upVector[ up_id ] = up_sign
# 클린업
pm.delete( o,a,u,tmpWoldUpObj )
return aimVector, upVector
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:50,代码来源:transform.py
示例19: buildGuides
def buildGuides(self):
"""
This function setups our guide system
WILL PROBABLY BE ANOTHER CLASS WHEN WE EXPAND AS IT'S GOING TO BE COMPLEX
"""
self.guides = []
for i,p in enumerate(self.posArray):
name = nameUtils.getUniqueName(self.baseNames[i],self.side,"GUIDE")
loc = pm.spaceLocator(n=name)
loc.t.set(p)
loc.r.set(self.rotArray[i])
self.guides.append(loc)
tempGuides = list(self.guides)
tempGuides.reverse()
for i in range(len(tempGuides)):
if i != (len(tempGuides)-1):
pm.parent(tempGuides[i],tempGuides[i+1])
name = nameUtils.getUniqueName(self.baseName+"_guides",self.side,"grp")
self.guidesGrp = pm.createNode("transform",n=name)
self.guides[0].setParent(self.guidesGrp)
开发者ID:RyugasakiHu,项目名称:AT_Rigging,代码行数:28,代码来源:Template.py
示例20: create_point_on_mesh
def create_point_on_mesh(geo, position, sticky_target, free_rotation=True):
"""
Create point on mesh setup
@param position:
@param geo:
@parem sticky:
@return:
"""
pom = pm.createNode("closestPointOnMesh")
pom.inPosition.set(position)
geo.worldMatrix[0] >> pom.inputMatrix
geo.worldMesh[0] >> pom.inMesh
pom.position >> sticky_target.translate
index = pom.closestVertexIndex.get()
locator = pm.spaceLocator()
libUtilities.snap(locator, geo.vtx[index], rotate=False)
libUtilities.freeze_transform(locator)
pm.pointOnPolyConstraint(geo.vtx[index], locator, maintainOffset=True)
pm.delete(pom)
constraint = pm.listRelatives(locator, type="constraint")[0]
if free_rotation:
for attr in ["rx", "rz", "ry"]:
libUtilities.break_connection(locator, attr)
locator.attr(attr).set(0)
return {"constraint": constraint, "locator": locator}
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:31,代码来源:libGeo.py
注:本文中的pymel.core.spaceLocator函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论