本文整理汇总了Python中maya.cmds.setAttr函数的典型用法代码示例。如果您正苦于以下问题:Python setAttr函数的具体用法?Python setAttr怎么用?Python setAttr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setAttr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_line_from_2_obj
def create_line_from_2_obj(self, obja, objb, crv_name='_curve_CRV'):
'''
Desc:
Make a line between 2 objects
Parameter:
crv_name = name of curve
pta = first object
ptb = second object
Return: Curve name
'''
# Define generic curve
curve=cmds.curve(d=1, p=[(0,0,0),(0,0,0)], k=[0,1], n=crv_name)
cmds.setAttr(curve+'.overrideEnabled',1)
cmds.setAttr(curve+'.overrideColor', 13)
# Making connection in worldSpace using decomposeMatrix
dMa=cmds.createNode('decomposeMatrix', n='_DMAT')
dMb=cmds.createNode('decomposeMatrix', n='_DMAT')
# Connect control worldMatrix to decomposeMatrix.inputMatrix
KstMaya.node_op(obja+'.worldMatrix','>>', dMa+'.inputMatrix')
KstMaya.node_op(dMa+'.outputTranslate','>>',curve+'.controlPoints[0]')
KstMaya.node_op(objb+'.worldMatrix','>>', dMb+'.inputMatrix')
KstMaya.node_op(dMb+'.outputTranslate','>>',curve+'.controlPoints[1]')
return curve
开发者ID:Leopardob,项目名称:Kistie,代码行数:28,代码来源:KstRig.py
示例2: spaceSwitchToken
def spaceSwitchToken(self, obj, args):
objects, attr, switchTo = args
enumTokens = animMod.getTokens(obj, attr)
value = 0
switchToNum = None
for loopToken in enumTokens:
splitValue = loopToken.split("=")
if splitValue:
if len(splitValue) > 1:
loopToken = splitValue[0]
value = eval(splitValue[1])
if switchTo == loopToken:
switchToNum = value
break
value += 1
if switchToNum != None:
cmds.setAttr("%s.%s"%(obj, attr), switchToNum)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:25,代码来源:spaceSwitch.py
示例3: removeFloatVariable
def removeFloatVariable(self, nodeAttr, varslayout, index):
# Remove variable
children = cmds.columnLayout(varslayout, query=1, childArray=1)
if len(children) <= index:
return
baseNameAttr = nodeAttr
baseValueAttr = nodeAttr.replace("fparam_name", "fparam_value");
for i in xrange(index+1, len(children)):
rembtn, namefld, _, valfld = cmds.formLayout(children[i], query=1, childArray=1)
indexStr = "[%d]" % (i - 1)
nextIndexStr = "[%d]" % i
nameAttr = baseNameAttr + indexStr
valueAttr = baseValueAttr + indexStr
cmds.setAttr(nameAttr, cmds.getAttr(baseNameAttr + nextIndexStr), type="string")
cmds.setAttr(valueAttr, cmds.getAttr(baseValueAttr + nextIndexStr));
self.setupVariableNameCallback(nameAttr, namefld)
self.setupFloatVariableValueCallback(valueAttr, valfld)
cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, i-1))
cmds.deleteUI(children[index])
cmds.removeMultiInstance("%s[%d]" % (baseNameAttr, len(children)-1), b=True)
cmds.removeMultiInstance("%s[%d]" % (baseValueAttr, len(children)-1), b=True)
开发者ID:mousekoz,项目名称:SeExprArnold,代码行数:30,代码来源:aiSeexprTemplate.py
示例4: set_color
def set_color(self, position):
"""Change display color of shapes"""
color = common.get_color_index(position)
for shape in self.nodes:
cmds.setAttr("%s.overrideEnabled" % shape, 1)
cmds.setAttr("%s.overrideColor" % shape, color)
开发者ID:eddiehoyle,项目名称:link,代码行数:7,代码来源:shape.py
示例5: createLocators
def createLocators(self):
#create list of loc names (self.name)
for i in range(len(self.jointList)):
self.locList.append("%s_%s_Loc"%(self.jointList[i],self.limbName))
#check that these don't exist already
if (cmds.objExists(self.locList[0])):
cmds.error("these limb locators exists already!")
else:
#fill dictionary - assign values from list
self.locPos = {}
for j in range(len(self.locList)):
self.locPos[self.locList[j]] = self.locPosValues[j]
#create the locs
for key in self.locPos.keys():
thisLoc = cmds.spaceLocator(n=key)
cmds.move(self.locPos[key][0], self.locPos[key][1], self.locPos[key][2], thisLoc)
#parent them together (from list of loc names)
for k in range((len(self.locList)-1),0,-1):
cmds.parent(self.locList[k], self.locList[k-1])
######### make this true only for the arms. . . or figure out how to extract which rot this should be
#rotate second joint to just get a preferred angle
cmds.setAttr("%s.ry"%self.locList[1], -5)
开发者ID:zethwillie,项目名称:python_rigger,代码行数:27,代码来源:baseLimb.py
示例6: connectBind
def connectBind(self):
#Create opposite node to blend
blendOpposite = rc.create1MinusNode(
"%s.%s" %(self.m_blendControl, self.m_blendAttr),
"%s_IKFKBlendOpp_CTRL" %(self.m_name)
)
for i in range(len(self.m_bindJoints)):
const1 = cmds.parentConstraint(
self.m_ikJoints[i],
self.m_bindJoints[i],
st = ["x", "y", "z"]
)[0]
const2 = cmds.parentConstraint(
self.m_fkJoints[i],
self.m_bindJoints[i],
st = ["x", "y", "z"]
)[0]
cmds.connectAttr(
blendOpposite,
"%s.blendParent2" %(self.m_bindJoints[i])
)
# Change to quarternion
pairBlend = cmds.listConnections(
"%s.constraintRotateX" %(const1),
d=1
)[0]
cmds.setAttr("%s.rotInterpolation" %(pairBlend), 1)
开发者ID:jaredauty,项目名称:Rigging,代码行数:27,代码来源:FootRig.py
示例7: stampCompiled
def stampCompiled(self, audioNodes):
'''
Used by the compiler - stamp the audioNodes from which this audio
track was compiled from
'''
cmds.addAttr(self.audioNode, longName='compiledAudio', dt='string')
cmds.setAttr('%s.compiledAudio' % self.audioNode, ','.join(audioNodes), type="string")
开发者ID:jeanim,项目名称:Red9_StudioPack,代码行数:7,代码来源:Red9_Audio.py
示例8: _mirror_setFollowValues
def _mirror_setFollowValues(self):
for target in self.__followTargets:
if target.find( 'Collar' ) != -1:
otherTarget = target.replace( 'Collar_L', 'Arm_L_PoleV' ).replace( 'Collar_R', 'Arm_R_PoleV' )
mtxList = cmds.getAttr( otherTarget+'.wm' )
elif target.find( 'Leg' ) != -1:
poleVTarget = target.replace( 'Switch_CTL', 'PoleV_CTL' )
poleVMtxList = cmds.getAttr( poleVTarget+'.wm' )
mtxList = cmds.getAttr( target.replace( 'Switch', 'IK' )+'.wm' )
else:
mtxList = cmds.getAttr( target.replace( 'Switch', 'IK' )+'.wm' )
index = self.__followTargets.index( target )
udAttrs = cmds.listAttr( target, ud=1 )
for attr in udAttrs:
if attr.find( 'Follow' ) != -1:
cmds.setAttr( target+'.'+attr, self.__followValues[index].pop(0) )
if target.find( 'Switch' ) != -1: target = target.replace( 'Switch', 'IK' )
elif target.find( 'Collar' ) != -1:
target = target.replace( 'Collar_L', 'Arm_L_PoleV' ).replace( 'Collar_R', 'Arm_R_PoleV' )
cmds.xform( target, ws=1, matrix = mtxList )
if cmds.nodeType( target ) == 'joint':
rigbase.setRotate_keepJointOrient( mtxList, target )
if target.find( 'Leg' ) != -1:
cmds.xform( poleVTarget, ws=1, matrix = poleVMtxList )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:allCtlsCmd.py
示例9: goToObject
def goToObject(self, first, second, *args ):
if cmds.nodeType( first ) == 'joint':
jo = cmds.getAttr( first+'.jo' )[0]
mpxTransform = mpx.MPxTransformationMatrix()
rotVector = om.MVector( math.radians( jo[0] ), math.radians( jo[1] ), math.radians( jo[2] ) )
mpxTransform.rotateTo( om.MEulerRotation( rotVector ) )
joMtx = mpxTransform.asMatrix()
fMtx = om.MMatrix()
fPMtx = om.MMatrix()
fMtxList = cmds.getAttr( first+'.wm' )
fPMtxList = cmds.getAttr( first+'.pm' )
sMtx = om.MMatrix()
sMtxList = cmds.getAttr( second+'.wm' )
om.MScriptUtil.createMatrixFromList( fMtxList, fMtx )
om.MScriptUtil.createMatrixFromList( fPMtxList, fPMtx )
om.MScriptUtil.createMatrixFromList( sMtxList, sMtx )
sMtxPose = [ sMtx(3,0), sMtx(3,1), sMtx(3,2) ]
rMtx = sMtx*(joMtx*fPMtx).inverse()
rTransform = mpx.MPxTransformationMatrix( rMtx )
rVector = rTransform.eulerRotation().asVector()
rot = [ math.degrees( rVector.x ), math.degrees( rVector.y ), math.degrees( rVector.z ) ]
cmds.setAttr( first+'.r', *rot )
cmds.move( sMtxPose[0], sMtxPose[1], sMtxPose[2], first, ws=1 )
else:
rigbase.goToSamePosition( first, second )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:34,代码来源:allCtlsCmd.py
示例10: setupScene
def setupScene():
'''
Setup some scene attributes we want to be common to all Spinifex car scenes
TODO:
make width over height as float
'''
# Check if we haven't done this before
if cmds.objExists('vraySettings.setupSceneHasBeenRun'):
# Check that everything is setup correctly before continuing.
dialogMessage = 'setupScene has already been run. Do you wish to continue? Some of your render settings will be reset.'
result = cmds.confirmDialog( title='spckSetupScene', message=dialogMessage, button=['YES','NO'], defaultButton='NO', cancelButton='NO', dismissString='NO' )
if result == 'NO' :
print("Aborted. We\'ve done this before...\n")
return
else:
# Check that everything is setup correctly before continuing.
dialogMessage = 'Have you set up your workspace.mel?'
result = cmds.confirmDialog( title='spckSetupScene', message=dialogMessage, button=['YES','NO'], defaultButton='YES', cancelButton='NO', dismissString='NO' )
if result == 'NO' :
print('Go setup your workspace and run again.\n')
return
# Units for working in metric and 30fps
cmds.currentUnit (linear='cm')
cmds.currentUnit (angle='deg')
cmds.currentUnit (time='ntsc')
# Load VRAY if not active
cmds.loadPlugin ('vrayformaya', quiet=True)
cmds.pluginInfo ('vrayformaya', edit=True, autoload=True)
cmds.setAttr ('defaultRenderGlobals.ren', 'vray', type='string')
cmds.evalDeferred ( 'createBaseRenderSettings()' , lowestPriority=True )
print('Success.\n')
开发者ID:mybikeislost,项目名称:studio_pipeline,代码行数:35,代码来源:setupScene.py
示例11: _mirror_setFollowDefault
def _mirror_setFollowDefault(self):
for target in self.__followTargets:
if target.find( 'Collar' ) != -1:
otherTarget = target.replace( 'Collar_L', 'Arm_L_PoleV' ).replace( 'Collar_R', 'Arm_R_PoleV' )
mtxList = cmds.getAttr( otherTarget+'.wm' )
elif target.find( 'Leg' ) != -1:
poleVTarget = target.replace( 'Switch_CTL', 'PoleV_CTL' )
poleVMtxList = cmds.getAttr( poleVTarget+'.wm' )
mtxList = cmds.getAttr( target.replace( 'Switch', 'IK' ) +'.wm' )
else:
mtxList = cmds.getAttr( target.replace( 'Switch', 'IK' ) +'.wm' )
udAttrs = cmds.listAttr( target, ud=1 )
for attr in udAttrs:
if attr.find( 'Follow' ) != -1:
case1 = target.find( 'Arm' ) != -1 and attr == 'collarFollow'
case2 = target.find( 'Leg' ) != -1 and attr == 'hipFollow'
case3 = attr == 'neckFollow'
if case1 or case2 or case3:
cmds.setAttr( target+'.'+attr, 10 )
else:
cmds.setAttr( target+'.'+attr, 0 )
if target.find( 'Switch' ) != -1: target = target.replace( 'Switch', 'IK' )
elif target.find( 'Collar' ) != -1:
target = target.replace( 'Collar_L', 'Arm_L_PoleV' ).replace( 'Collar_R', 'Arm_R_PoleV' )
cmds.xform( target, ws=1, matrix = mtxList )
if cmds.nodeType( target ) == 'joint':
rigbase.setRotate_keepJointOrient(mtxList, target)
if target.find( 'Leg' ) != -1:
cmds.xform( poleVTarget, ws=1, matrix = poleVMtxList )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:32,代码来源:allCtlsCmd.py
示例12: main
def main(selectedChannels=True, transformsOnly=False):
'''
Resets selected channels in the channel box to default, or if nothing's
selected, resets all keyable channels to default.
'''
gChannelBoxName = mm.eval('$temp=$gChannelBoxName')
sel = mc.ls(sl=True)
if not sel:
return
chans = None
if selectedChannels:
chans = mc.channelBox(gChannelBoxName, query=True, sma=True)
testList = ['translateX','translateY','translateZ','rotateX','rotateY','rotateZ','scaleX','scaleY','scaleZ',
'tx','ty','yz','rx','ry','rz','sx','sy','sz']
for obj in sel:
attrs = chans
if not chans:
attrs = mc.listAttr(obj, keyable=True, unlocked=True)
if transformsOnly:
attrs = [x for x in attrs if x in testList]
if attrs:
for attr in attrs:
try:
default = mc.attributeQuery(attr, listDefault=True, node=obj)[0]
mc.setAttr(obj+'.'+attr, default)
except StandardError:
pass
utl.deselectChannels()
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:32,代码来源:ml_resetChannels.py
示例13: followAttrVis
def followAttrVis(self, ctlNameList, attrName, onOff, *args ):
if onOff == True:
for ctlName in ctlNameList:
cmds.setAttr( ctlName+'.'+attrName, e=1, k=1 )
else:
for ctlName in ctlNameList:
cmds.setAttr( ctlName+'.'+attrName, e=1, k=0 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:7,代码来源:ui.py
示例14: modifiy_joint_chain_axis
def modifiy_joint_chain_axis(joint_chain, orient_chain='xyz', up_axis_chain='yup'):
'''
Desc:
Modify specified joint chain orientation
Parameter:
joint_chain = chain to affect
orient_chain = axis to orient
up_axis_chain = chain up axis
Return:
None
'''
for i in range(0, len(joint_chain)):
KstOut.debug(KstRig._debug, 'Reorient current joint:' )
KstOut.debug(KstRig._debug, 'joint: %s' % joint_chain[i])
try:
cmds.joint(joint_chain[i], e=True, zso=True, oj=orient_chain, sao=up_axis_chain, ch=True)
except:
print('Error on reorient, check the rotations')
# If it's the last joint reset rotation axis
if i == len(joint_chain)-1:
rot_axis = ['X','Y','Z']
for axis in rot_axis:
cmds.setAttr(joint_chain[i]+'.jointOrient'+axis, 0)
开发者ID:Leopardob,项目名称:Kistie,代码行数:26,代码来源:KstRig.py
示例15: addVrayObjectIds
def addVrayObjectIds(shapes=None):
""" Add a vray_objectID attribute to selected meshes
:param shapes: Shapes to apply the attribute to. If shapes is None it will get
the shapes related to the current selection.
"""
if shapes is None:
shapes = mc.ls(sl=1, s=1, dag=1, lf=1, o=1, long=True)
if shapes:
# Can only add objectIds to mesh, nurbsSurface so lets filter it
shapes = mc.ls(shapes, type=("mesh", "nurbsSurface"))
if shapes:
result = mc.promptDialog(
title="Object ID value",
message="Object ID:",
button=["OK", "Cancel"],
defaultButton="OK",
cancelButton="Cancel",
dismissString="Cancel",
)
if result == "OK":
value = int(mc.promptDialog(query=True, text=True))
for shape in shapes:
mc.vray("addAttributesFromGroup", shape, "vray_objectID", 1)
mc.setAttr("{0}.{1}".format(shape, "vrayObjectID"), value)
开发者ID:BigRoy,项目名称:mayaVrayCommandDocs,代码行数:29,代码来源:addVrayObjectIds.py
示例16: create_base_rig
def create_base_rig(cog, rig_region_name):
# create curve and scale it to the correct size
base_curve, base_curve_group = jt_ctl_curve.create(None, 'star_30')
cmds.select(base_curve)
cmds.setAttr(base_curve + '.scale', 5,5,5)
cmds.makeIdentity(apply=True, t=0, r=1, s=1, n=0)
# unparent the curve from the default group it is given so its a child of the world
base_curve = cmds.rename('base')
cmds.parent(w=True)
cmds.select(base_curve_group, r=True)
cmds.delete()
# add a string attribute to keep track of all the nodes that are used for easy de-rigging
# NOTE: text is stored in the attr as a string formatted like a python dict with the key being
# the name of the body region and the value being a list of the nodes involved this makes
# de-rigging nice and easy as you just need to find the entry in the dict and delete all the nodes
cmds.select(base_curve)
cmds.addAttr(ln='rig_nodes', dt='string')
cmds.setAttr(base_curve + '.rig_nodes', '{}', type='string')
# add base_curve to base curve attr list
add_node_to_rig_nodes(base_curve, 'base', base_curve)
# update ui base_curve_field
cmds.textField('jt_autorig_base_name_select_text', e=True, tx=base_curve)
开发者ID:MaxIsJames,项目名称:jt_tools,代码行数:27,代码来源:jt_autorig.py
示例17: _publish_gpu_for_item
def _publish_gpu_for_item(self, item, output, work_template, primary_publish_path, sg_task, comment, thumbnail_path, progress_cb):
"""
Export a gpu cache for the specified item and publish it to Shotgun.
"""
group_name = item["name"].strip("|")
debug(app = None, method = '_publish_gpu_for_item', message = 'group_name: %s' % group_name, verbose = False)
tank_type = output["tank_type"]
publish_template = output["publish_template"]
# get the current scene path and extract fields from it using the work template:
scene_path = os.path.abspath(cmds.file(query=True, sn= True))
fields = work_template.get_fields(scene_path)
publish_version = fields["version"]
# update fields with the group name:
fields["grp_name"] = group_name
## create the publish path by applying the fields with the publish template:
publish_path = publish_template.apply_fields(fields)
#'@asset_root/publish/gpu/{name}[_{grp_name}].v{version}.abc'
gpuFileName = os.path.splitext(publish_path)[0].split('\\')[-1]
fileDir = '/'.join(publish_path.split('\\')[0:-1])
debug(app = None, method = '_publish_gpu_for_item', message = 'gpuFileName: %s' % gpuFileName, verbose = False)
## Now fix the shaders
shd.fixDGForGPU()
if cmds.objExists('CORE_ARCHIVES_hrc'):
cmds.setAttr('CORE_ARCHIVES_hrc.visiblity', 0)
if cmds.objExists('ROOT_ARCHIVES_DNT_hrc'):
cmds.setAttr('ROOT_ARCHIVES_DNT_hrc.visiblity', 0)
## build and execute the gpu cache export command for this item:
try:
print '====================='
print 'Exporting gpu now to %s\%s' % (fileDir, gpuFileName)
#PUT THE FILE EXPORT COMMAND HERE
cmds.select(clear = True)
for geo in cmds.listRelatives(group_name, children = True):
if 'geo_hrc' in geo:
geoGroup = str(group_name)
debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
cmds.select(geoGroup)
debug(app = None, method = '_publish_gpu_for_item', message = 'geoGroup: %s' % geoGroup, verbose = False)
debug(app = None, method = '_publish_gpu_for_item', message = "gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup), verbose = False)
mel.eval("gpuCache -startTime 1 -endTime 1 -optimize -optimizationThreshold 40000 -directory \"%s\" -fileName %s %s;" % (fileDir, gpuFileName, geoGroup))
print 'Finished gpu export...'
print '====================='
if cmds.objExists('dgSHD'):
## Now reconnect the FileIn nodes
for key, var in filesDict.items():
cmds.connectAttr('%s.outColor' % key, '%s.color' % var)
except Exception, e:
raise TankError("Failed to export gpu cache file")
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:60,代码来源:maya_asset_secondary_publish.py
示例18: create_spine_rig
def create_spine_rig(base_curve, rig_region_name, pelvis, cog, spine_1, spine_2, spine_3, spine_4, neck):
# create group to contain all rigging nodes
cmds.select(cl=True)
spine_group = cmds.group(em=True, n=rig_region_name + '_group')
cmds.select(spine_group, base_curve, r=True)
cmds.parent()
# add the arm group node to the base curve rig nodes attr
add_node_to_rig_nodes(base_curve, rig_region_name, spine_group)
cog_curve, cog_curve_group = jt_ctl_curve.create(cog, 'star_5', lock_unused=False)
cmds.setAttr(cog_curve + '.scale', 3,3,3)
cmds.select(cog_curve, r=True)
cmds.makeIdentity(apply=True, t=0, r=0, s=1, n=0)
cmds.select(cog_curve, cog, r=True)
cmds.parentConstraint(mo=True, weight=1)
cmds.scaleConstraint(mo=True, weight=1)
cmds.select(cog_curve_group, base_curve, r=True)
cmds.parent()
pelvis_curve, pelvis_curve_group = jt_ctl_curve.create(pelvis, 'waist', True, True, True, True)
spine_1_curve, spine_1_curve_group = jt_ctl_curve.create(spine_1, 'circle', True, True, True, True)
spine_2_curve, spine_2_curve_group = jt_ctl_curve.create(spine_2, 'circle', True, True, True, True)
spine_3_curve, spine_3_curve_group = jt_ctl_curve.create(spine_3, 'circle', True, True, True, True)
spine_4_curve, spine_4_curve_group = jt_ctl_curve.create(spine_4, 'circle', True, True, True, True)
neck_curve, neck_curve_group = jt_ctl_curve.create(neck, 'circle', True, True, True, True)
# parent fk controlls to spine group
cmds.select(cog_curve_group, pelvis_curve_group, spine_1_curve_group, spine_2_curve_group, spine_3_curve_group, spine_4_curve_group, neck_curve_group, spine_group, r=True)
cmds.parent()
开发者ID:MaxIsJames,项目名称:jt_tools,代码行数:33,代码来源:jt_autorig.py
示例19: importPose
def importPose(filePath):
"""Import the pose data stored in filePath"""
# try to open the file
newRootControl = cmds.ls(sl=True, type='transform')[0]
newNodeAttr = newRootControl.rpartition('_root_')[0]
try: f = open(filePath, 'r')
except:
cmds.confirmDialog(
t='Error', b=['OK'],
m='Unable to open file: %s'%filePath
)
raise
# uncPickle the data
pose = cPickle.load(f)
# close the file
f.close()
# set the attributes to the stored pose
errAttrs = []
for attrValue in pose:
try:
cmds.setAttr('%s%s'%(newNodeAttr, attrValue[0]), attrValue[1])
except:
try: errAttrs.append(attrValue[0])
except: errAttrs.append(attrValue)
# display error message if needed
if len(errAttrs) > 0:
importErrorWindow(errAttrs)
sys.stderr.write('Not all attributes could be loaded.')
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:28,代码来源:poseMachine_03.py
示例20: reset_pack
def reset_pack():
# pack is global
global pack
# IF pack exists
if( len( pack ) ):
# Loop through the pack
for agent in pack:
# Reset local position and heading to initial values
cmds.setAttr( agent.animalName+".translateX", cmds.getAttr( agent.animalName+".initialPositionX" ) )
cmds.setAttr( agent.animalName+".translateY", cmds.getAttr( agent.animalName+".initialPositionY" ) )
cmds.setAttr( agent.animalName+".translateZ", cmds.getAttr( agent.animalName+".initialPositionZ" ) )
cmds.setAttr( agent.animalName+".rotateY", cmds.getAttr( agent.animalName+".initialHeading" ) )
cmds.setAttr( agent.animalName+".speed", cmds.getAttr( agent.animalName+".initialSpeed" ) )
# Reset class specific variables
agent.target = 0
agent.wingAngle = 0
# Reset awareness state
agent.state = HuntingState.prowling
# Reset state based attributes
agent.set_speed_and_colour()
开发者ID:McBainC,项目名称:Portfolio,代码行数:27,代码来源:Main.py
注:本文中的maya.cmds.setAttr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论