本文整理汇总了Python中maya.cmds.bakeResults函数的典型用法代码示例。如果您正苦于以下问题:Python bakeResults函数的具体用法?Python bakeResults怎么用?Python bakeResults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bakeResults函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: bakeInfinity
def bakeInfinity(sparseKeys=True, smart=True, sim=False):
crvs = cmds.keyframe(q=True, name=True, sl=True)
if crvs:
start = cmds.playbackOptions(q=True, minTime=True)
end = cmds.playbackOptions(q=True, maxTime=True)
objs = cmds.listConnections(crvs, d=True, s=False, plugs=True)
cmds.refresh(suspend=1)
print sim, '________'
cmds.bakeResults(objs, t=(start, end), simulation=sim, pok=True, smart=smart, sac=sparseKeys, sampleBy=1)
cmds.refresh(suspend=0)
message(str(len(objs)) + ' curves baked --' + str(objs), maya=1)
else:
message('no curves are selected', maya=1)
开发者ID:boochos,项目名称:work,代码行数:13,代码来源:animCurve_lib.py
示例2: bd_bakeControllers
def bd_bakeControllers(args):
cmds.select('*_Anim')
animCtrls = cmds.ls(sl=True, type='transform')
minTime = cmds.playbackOptions(q=True,minTime=True)
maxTime = cmds.playbackOptions(q=True,maxTime=True)
cmds.bakeResults(animCtrls,simulation=True, t=(minTime,maxTime) )
cmds.select('*_Anim')
animCtrls = cmds.ls(sl=True, type='transform')
cmds.select(clear=True)
for anim in animCtrls:
constr = cmds.listRelatives(anim, children=True,type = 'constraint')
if constr:
cmds.delete(constr)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:14,代码来源:bd_MultiCopyMocap_UI.py
示例3: bakeDynamicCmd
def bakeDynamicCmd(*args):
'''
Bake the dynamic simulation as key frames on the joints rotations for the specified frame range
'''
# display warning message
result = cmds.confirmDialog(messageAlign="left", title="Bake Simulation", message="Baking simulation will replace the dynamics\nfor keyframe animation. Action is undoable. Do you wish to continue?", button=["Yes", "No"])
if result == "Yes":
# get selected object
selected = cmds.ls(sl=True)
if selected:
# manage the dynamic node
dNode = lpDynamicChain(node=selected[0])
startJoint = dNode.startJoint[0]
endJoint = dNode.endJoint[0]
# get frame range
startFrame = cmds.intFieldGrp("frameRangeIFG", q=True, v1=True)
endFrame = cmds.intFieldGrp("frameRangeIFG", q=True, v2=True)
if cmds.checkBoxGrp("useTimeSliderCBG", q=True, v1=True):
startFrame = cmds.playbackOptions(q=True, minTime=True)
endFrame = cmds.playbackOptions(q=True, maxTime=True)
# get the joints
joints = [startJoint]
joints.extend( findAllJointsFromTo(startJoint, endJoint) )
# bake the simulation for the frame range - this action is undoable
cmds.bakeResults(joints, t=(startFrame, endFrame), dic=False, preserveOutsideKeys=True, simulation=True)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:31,代码来源:lpDynamicChains.py
示例4: exportBake
def exportBake( self, ctls, timeRange ):
cmds.undoInfo( swf=0 )
time = ( timeRange[0], timeRange[1] )
sampleValue = timeRange[2]
cmds.bakeResults( ctls, simulation=True, t=time, sampleBy=sampleValue, disableImplicitControl=True, preserveOutsideKeys=False,
sparseAnimCurveBake=False, removeBakedAttributeFromLayer=False, bakeOnOverrideLayer=False, minimizeRotation=False,
controlPoints=False, shape=False )
timeControl = cmds.createNode( 'timeControl', n='timeControl' )
dgtrAnimCurves = cmds.ls( 'DGTR_*', type='animCurve' )
for anim in dgtrAnimCurves:
cmds.connectAttr( timeControl+'.outTime', anim+'.input' )
for ctl in ctls:
animNodeRx = cmds.listConnections( ctl+'.rx', s=1, d=0, type='animCurve' )[0]
animNodeRy = cmds.listConnections( ctl+'.ry', s=1, d=0, type='animCurve' )[0]
animNodeRz = cmds.listConnections( ctl+'.rz', s=1, d=0, type='animCurve' )[0]
animNodeIrx = cmds.listConnections( ctl+'.irx', s=1, d=0, type='animCurve' )[0]
animNodeIry = cmds.listConnections( ctl+'.iry', s=1, d=0, type='animCurve' )[0]
animNodeIrz = cmds.listConnections( ctl+'.irz', s=1, d=0, type='animCurve' )[0]
self.eulerFilter( [animNodeRx, animNodeRy, animNodeRz] )
self.eulerFilter( [animNodeIrx, animNodeIry, animNodeIrz] )
cmds.undoInfo( swf=1 )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:29,代码来源:bake.py
示例5: bake
def bake(constraint,
start=None,
end=None,
sampleBy=1,
simulation=True):
"""
Bake specified constraint
@param constraint: Constraint to bake animation for.
@type constraint: str
@param start: Start frame of bake animation range
@type start: float or None
@param end: End frame of bake animation range
@type end: float or None
@param sampleBy: Sample every Nth frame
@type sampleBy: int
@param simulation: Simulation option for bakeResults
@type simulation: bool
"""
# ==========
# - Checks -
# ==========
# Check Constraint
if not glTools.utils.constraint.isConstraint(constraint):
raise Exception('Object "' + constraint + '" is not a valid constraint node!')
# Check Start/End Frames
if start == None: start = cmds.playbackOptions(q=True, min=True)
if end == None: end = cmds.playbackOptions(q=True, max=True)
# ====================================
# - Get Slave Transform and Channels -
# ====================================
# Get Slave Transform
slave = glTools.utils.constraint.slave(constraint)
# Get Slave Channels
attrList = cmds.listConnections(constraint, s=False, d=True, p=True) or []
slaveAttrs = [i.split('.')[-1] for i in attrList if i.startswith(slave + '.')] or []
if not slaveAttrs: raise Exception('No slave channels to bake!')
# ===================
# - Bake Constraint -
# ===================
cmds.refresh(suspend=True)
cmds.bakeResults(slave,
at=slaveAttrs,
time=(start, end),
disableImplicitControl=True,
simulation=simulation,
sampleBy=sampleBy)
cmds.refresh(suspend=False)
# =================
# - Return Result -
# =================
return [slave + '.' + i for i in slaveAttrs]
开发者ID:bennymuller,项目名称:glTools,代码行数:60,代码来源:constraint.py
示例6: createFreeCameras
def createFreeCameras(self):
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'self.cameras: %s' % self.cameras, verbose = False)
for camera in self.cameras:
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'Processing camera: %s' % camera, verbose = False)
cmds.select(camera, r= True)
newCamera = cmds.duplicate( rr=True )
newCamera = newCamera[0]
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'newCamera: %s' % newCamera, verbose = False)
for attr in ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz', 'v']:
cmds.setAttr(newCamera + "." + attr, lock=False)
hisObject = cmds.listHistory(newCamera)
for attr in ['hfa', 'vfa', 'fl', 'lsr', 'fs', 'fd', 'sa', 'coi']:
cmds.setAttr(hisObject[0] + "." + attr, lock=False)
parentNode = cmds.listRelatives(camera, p= True)
if parentNode != None:
cmds.parent( newCamera, world= True)
pointConst = cmds.pointConstraint( camera, newCamera )
orientConst = cmds.orientConstraint( camera, newCamera )
cmds.bakeResults( newCamera+'*', t=(self.startFrame, self.endFrame), simulation=True, sparseAnimCurveBake=False, shape=False)
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'newCamera %s baked successfully...' % newCamera, verbose = False)
cmds.delete(pointConst, orientConst, cn=True )
newCameraName = cmds.rename(newCamera, '%s_Cpy' % camera)
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'newCameraName: %s' % newCameraName, verbose = False)
self.newCameras.extend([newCameraName])
debug(app = None, method = 'FromMaya2Nuke.createFreeCameras', message = 'self.newCameras: %s' % self.newCameras, verbose = False)
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:35,代码来源:FromMaya2Nuke.py
示例7: reCenterPivot
def reCenterPivot(obj):
locName = obj + "_loc"
cmds.spaceLocator(n=locName )
cmds.parent( locName, obj )
cmds.setAttr(locName + ".translateX",0)
cmds.setAttr(locName + ".translateY",0)
cmds.setAttr(locName + ".translateZ",0)
cmds.setAttr(locName + ".rotateX",0)
cmds.setAttr(locName + ".rotateY",0)
cmds.setAttr(locName + ".rotateZ",0)
cmds.Unparent(locName)
pConst = cmds.parentConstraint(obj,locName,mo=True,w=1)
cmds.bakeResults(locName,sm=True, t=(0,44),at=["tx","ty","tz","rx","ry","rz"])
cmds.delete(pConst)
newObj = cmds.duplicate(obj,n=obj+"_new")
cmds.xform(newObj[0],cp=True)
nConst = cmds.parentConstraint(locName,newObj, mo=True,w=1)
cmds.bakeResults(newObj,sm=True, t=(0,44),at=["tx","ty","tz","rx","ry","rz"])
cmds.delete(nConst)
cmds.delete(locName)
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:27,代码来源:geo2Lego.py
示例8: export
def export(path_to_save, script_name, namespace):
util.debug("Importing all references, flattening scene.")
scene.importReferences("all")
shots = scene.getShots()
scene_start, scene_end = scene.length()
#util.debug("Selecting all joint hierarchies.")
#cmds.select(all=1, hi=1)
#cmds.select(cmds.ls(sl=1, typ='joint'), r=1)
util.debug("Baking all animations.")
scene_start, scene_end = scene.length()
cmds.select("%s:root" % namespace, hi=1)
cmds.select(cmds.ls(sl=1, typ='joint'), r=1)
cmds.bakeResults(sm=1, t=(scene_start,scene_end), sb=1, sac=0, pok=0,at= ["tx","ty","tz","rx","ry","rz"])
ns.deleteOthers(namespace)
ns.remove()
util.debug("Setting tangent to stepped for keys that occur on cuts: %s" % shots)
cut_frames = []
for shot in shots:
cut_frames.append(shot['end'])
scene.makeCutTangentsStep(cut_frames)
psa_name = "%(script_name)s_%(namespace)s" % {
'script_name': script_name,
'namespace': namespace
}
util.debug("Creating .PSA file: %s" % psa_name)
#for shot in shots:
# ## Unreal xyz
# util.debug("{",shot,"[",\
# -cmds.getAttr("%s:root.translateZ" % namespace,t=shot['start']),\
# cmds.getAttr("%s:root.translateX" % namespace,t=shot['start']),\
# -cmds.getAttr("%s:root.translateY" % namespace,t=shot['start']),\
# "][",\
# -cmds.getAttr("%s:root.rotateZ" % namespace,t=shot['start']),\
# cmds.getAttr("%s:root.rotateX" % namespace,t=shot['start']),\
# -cmds.getAttr("%s:root.rotateY" % namespace,t=shot['start']),\
# "]}")
for shot in shots:
cmds.playbackOptions(min = shot['start'], max = shot['end'])
sequence_name = "%(psa_name)s_%(#)02d" % {
'psa_name' : psa_name,
'#' : shots.index(shot)
}
util.debug("Adding Sequence %s" % sequence_name)
if shots.index(shot) == len(shots)-1 :
if 'command AXExecute executed. ' == cmds.axexecute(path = path_to_save, animfile = psa_name, sequence = sequence_name, rate = scene.GAME_RATE, saveanim = 1):
return True
else:
return False
else:
cmds.axexecute(path = path_to_save, animfile = psa_name, sequence = sequence_name, rate = scene.GAME_RATE)
开发者ID:alteveer,项目名称:cinematics-pipeline-tools,代码行数:59,代码来源:actor.py
示例9: bakeSkinJoints
def bakeSkinJoints():
startTime = cmds.playbackOptions(q=True, min = True)
endTime = cmds.playbackOptions(q=True, max = True)
listJoints = cmds.attributeQuery( 'list', node='listSkinJoints', listEnum=True )
bakeJoints = listJoints[0].rsplit(':')
del bakeJoints[0:1]
print bakeJoints
cmds.bakeResults( bakeJoints , t=(startTime ,endTime), simulation=True )
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:8,代码来源:cleanAndExport12.py
示例10: legIkToFk
def legIkToFk(rigNS,side,start=None,end=None,sampleBy=1):
'''
Bake IK leg animation to FK controls
@param rigNS: IK/FK toggle attribute
@type rigNS: str
@param side: Leg side ("lf" or "rt")
@type side: str
@param start: Transfer animation start frame
@type start: int or None
@param end: Transfer animation end frame
@type end: int or None
@param sampleBy: Bake animation by N frames
@type sampleBy: int
'''
# Get Start/End
if start == None: start = mc.playbackOptions(q=True,min=True)
if end == None: end = mc.playbackOptions(q=True,max=True)
# Set Leg to IK mode
mc.setAttr(rigNS+':config.'+side+'LegIkFkBlend',0) # IK
# Build IK/FK Joint List
ikJntList = [rigNS+':'+side+'_leg_ik'+i+'_jnt' for i in ['A','B']]
ikJntList += [rigNS+':'+side+'_foot_ik'+i+'_jnt' for i in ['A','B']]
fkJntList = [rigNS+':'+side+'_leg_fk'+i+'_jnt' for i in ['A','B']]
fkJntList += [rigNS+':'+side+'_foot_fk'+i+'_jnt' for i in ['A','B']]
# Duplicate FK Joints and Constrain to IK
fkDupList = []
fkOriList = []
for i in range(len(ikJntList)):
fkDupList.append(mc.duplicate(fkJntList[i],po=True)[0])
fkOriList.append(mc.orientConstraint(ikJntList[i],fkDupList[-1])[0])
# Transfer Baked Anim to FK Joints
mc.refresh(suspend=True)
for i in range(len(fkDupList)):
mc.bakeResults( fkDupList[i],
t=(start,end),
at=['rx','ry','rz'],
simulation=True,
preserveOutsideKeys=True,
sampleBy=sampleBy )
mc.copyKey(fkDupList[i],at=['rx','ry','rz'],t=(start,end))
mc.pasteKey(fkJntList[i],at=['rx','ry','rz'],t=(start,end),option='replace')
mc.refresh(suspend=False)
# Delete Duplicate Joints and Constraints
if fkOriList:
try: mc.delete(fkOriList)
except Exception, e: print('Error deleting nodes '+str(fkOriList)+'! Exception Msg: '+str(e))
if fkDupList:
try: mc.delete(fkDupList)
except Exception, e: print('Error deleting nodes '+str(fkDupList)+'! Exception Msg: '+str(e))
# Set to FK mode
mc.setAttr(rigNS+':config.'+side+'LegIkFkBlend',1) # FK
开发者ID:auqeyjf,项目名称:glTools,代码行数:57,代码来源:ikFkMatch.py
示例11: mBakeRigkey
def mBakeRigkey(rigCtrlList, playbackRange):
"""
"""
cmds.bakeResults(rigCtrlList, at= ['.t', '.r', '.s'], t= playbackRange,
sm= 1, s= 0)
for ctrl in rigCtrlList:
findPC = cmds.listRelatives(ctrl, c= 1, typ= 'parentConstraint')
for pc in _xList(findPC):
cmds.delete(pc)
开发者ID:davidpower,项目名称:MS_GeoCache,代码行数:9,代码来源:moGeoCacheMethod.py
示例12: _bakeObj
def _bakeObj(obj):
'''Bake animazione.'''
constrName = _getParentConstraint(obj)
constrExists = cmds.ls(constrName)
# se il constraint non esiste o non contiene keyframe esci
if not constrExists or cmds.keyframe(constrName, q=True, kc=True) == 0:
sys.stdout.write('Nothing to bake\n')
return
# primo frame
currentFrame = cmds.currentTime(q=True)
firstFrame = cmds.playbackOptions(q=True, ast=True)
cmds.currentTime(firstFrame)
# salva come lastFrame l'ultimo frame d'animazione del constraint o dell'oggetto
keyTimes = cmds.keyframe(obj, q=True, tc=True)
if not keyTimes:
keyTimes = cmds.keyframe(constrName, q=True, tc=True)
else:
keyTimes.extend(cmds.keyframe(constrName, q=True, tc=True))
lastFrame = max(keyTimes)
# se all'ultimo frame rimane attached oppure il corpo e' rigido allora usa animation end time
if max(cmds.keyframe(constrName, q=True, ev=True, t=(lastFrame, lastFrame))) > 0.0 or _getRigidBody(obj):
lastFrame = max(lastFrame, cmds.playbackOptions(q=True, aet=True))
# crea il locator
locatorName = obj + _locSfx
_setRootNamespace()
loc = cmds.spaceLocator(n=locatorName)[0]
cmds.hide(loc)
# trova il parent del gruppo PH
parent = cmds.listRelatives(_getParentHandle(obj), p=True)
if parent:
cmds.parent([loc, parent[0]])
# copia l'ordine degli assi
cmds.setAttr(loc + '.rotateOrder', cmds.getAttr(obj + '.rotateOrder'))
# copia matrice e pivot
cmds.xform(loc, m=cmds.xform(obj, q=True, m=True, ws=True), ws=True)
cmds.xform(loc, piv=cmds.xform(obj, q=True, rp=True, ws=True), ws=True)
# costringi il locator
constraint = cmds.parentConstraint(obj, loc, mo=True)[0]
# fai il bake
cmds.bakeResults(loc, at=['t', 'r'], sm=True, t=(firstFrame, lastFrame), dic=True, pok=True)
# cancella il constraint
cmds.delete(constraint)
# ripristina il frame precedente
cmds.currentTime(currentFrame)
开发者ID:jasperges,项目名称:ZvParentMaster,代码行数:57,代码来源:ZvParentMaster.py
示例13: drop_simulation
def drop_simulation():
start = time.time()
cmds.playbackOptions(min = STARTFRAME, max = ENDFRAME)
cmds.currentTime(STARTFRAME)
cmds.select(clear = True)
cmds.select("shirt")
cmds.bakeResults(simulation = True, controlPoints = True, shape = True, time = (STARTFRAME, ENDFRAME))
cmds.currentTime(ENDFRAME)
end = time.time()
return end-start
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:10,代码来源:drop_shirt.py
示例14: bakeMoc
def bakeMoc( mocLoc ):
import sgBFunction_dag
targetLocs = sgBFunction_dag.getChildrenJointExists( mocLoc )
targetLocs.append( mocLoc )
cmds.select( targetLocs )
minFrame = cmds.playbackOptions( q=1, min=1 )
maxFrame = cmds.playbackOptions( q=1, max=1 )
cmds.bakeResults( sm=True, t=(minFrame, maxFrame), sb=1, dic=True, pok=True, sac=False, removeBakedAttributeFromLayer=False, bakeOnOverrideLayer=False, cp=False, s=True)
开发者ID:jonntd,项目名称:mayadev-1,代码行数:11,代码来源:sgBFunction_chRig.py
示例15: bake
def bake(self, controls, frame_range):
"""
Responsible for baking out the dynamic animation to the original rig.
@params:
controls: Controls that you're baking the animation onto.
frame_range: Targeted frame range (int(start), int(end)).
"""
start = frame_range[0]
end = frame_range[1]
# bake
cmds.bakeResults(controls, sm=True, t=(start, end), at=TR_ATTRS)
开发者ID:ABCTD,项目名称:abc_pipe,代码行数:12,代码来源:overlap_tool.py
示例16: bakeCharacterChannels
def bakeCharacterChannels(charSet, start=None, end=None, attrList=[]):
"""
Bake character set channels.
Used to bake trax animation directly to channels
@param charSet: Character set to bake channels for.
@type charSet: str
@param start: Start frame of bake results range. If empty, use timeline start frame.
@type start: int or None
@param end: End frame of bake results range. If empty, use timeline end frame.
@type end: int or None
@param attrList: Override the list of character character set attributes to bake. If empty, use attribute list from character set.
@type attrList: str
"""
# ==========
# - Checks -
# ==========
if not isCharSet(charSet):
raise Exception('Object "' + charSet + '" is not a valid character set!')
# Start/End
if start == None: start = cmds.playbackOptions(min=True)
if end == None: end = cmds.playbackOptions(max=True)
# =========================
# - Character Set Details -
# =========================
# Get Character Set Channels
charChannels = cmds.sets(charSet, q=True)
# Get Character Set Objects
charObjList = cmds.ls(charChannels, o=True)
# Get Character Set Channel Names
if not attrList:
attrList = []
for ch in charChannels:
attr = cmds.attributeName(ch, s=True)
if not attrList.count(attr):
attrList.append(attr)
# ================
# - Bake Results -
# ================
cmds.bakeResults(charObjList, t=(1, 600), at=attrList, simulation=True)
# =================
# - Return Result -
# =================
return charObjList
开发者ID:bennymuller,项目名称:glTools,代码行数:53,代码来源:characterSet.py
示例17: motion_bake
def motion_bake():
# モーションをベイク Root_M以下
endTime = cmds.playbackOptions(q=True, max=True)
cmds.select("Root_M", hi=True)
cmds.select("Knee_R_Locator", hi=True, add=True)
cmds.select("Knee_L_Locator", hi=True, add=True)
cmds.select("foot_R_controller", hi=True, add=True)
cmds.select("foot_L_controller", hi=True, add=True)
cmds.bakeResults(simulation=True, t=(1, endTime), sb=1, at=["rx", "ry", "rz"])
cmds.parent("Root_M", world=True)
if cmds.objExists("main_controller"):
cmds.select("main_controller", hi=True)
cmds.delete()
if cmds.objExists("Knee_R_Locator"):
cmds.select("Knee_R_Locator", hi=True)
cmds.delete()
if cmds.objExists("Knee_L_Locator"):
cmds.select("Knee_L_Locator", hi=True)
cmds.delete()
if cmds.objExists("foot_R_controller"):
cmds.select("foot_R_controller", hi=True)
cmds.delete()
if cmds.objExists("foot_L_controller"):
cmds.select("foot_L_controller", hi=True)
cmds.delete()
# 全選択
cmds.select(ado=True)
cmds.select(hi=True)
deleteObj = cmds.ls(sl=True)
count = 0
matchTxtDeleteCont = re.compile("(_)(.*?)(controller)(.*)")
matchTxtDeleteEffec = re.compile("(_)(.*?)(effector)(.*)")
for n in deleteObj:
matchTrueDeleteCont = matchTxtDeleteCont.search(deleteObj[count])
matchTrueDeleteEffec = matchTxtDeleteEffec.search(deleteObj[count])
if matchTrueDeleteCont != None:
print deleteObj[count]
# cmds.delete(deleteObj[count])
if matchTrueDeleteEffec != None:
cmds.delete(deleteObj[count])
count += 1
开发者ID:akkey,项目名称:maya,代码行数:53,代码来源:LightSkeleton.py
示例18: ctrlBake
def ctrlBake(self):
selTSL = cmds.textScrollList( Win.TSL, q=1, si=1)
selTSLsize = len(selTSL)
selA = cmds.ls(sl=1)
import maya.cmds as cmds
endF = cmds.playbackOptions( q=1, max=1 )
staF = cmds.playbackOptions( q=1, min=1 )
samby = 1
simyl = 0
for y in range(0, selTSLsize):
print 'aa'
cmds.bakeResults( '%s_animkey_Con_xform'%selTSL[y], t=(staF,endF), sb='%s'%samby, simulation=simyl)
cmds.delete('%s_animkey_Con_xform_parentConstraint1'%selTSL[y])
开发者ID:jonntd,项目名称:mayadev-1,代码行数:14,代码来源:ui_basic.py
示例19: alt_b
def alt_b(self):
if self.getSelection() == 'None':
cmds.CycleBackgroundColor() # cycles the background color as per the default
else:
if self.getType(0) == 'face' or self.getType(0) == 'vertex' or self.getType(0) == 'edge':
self.bevelTool()
# switch this over to recognize the animation category later on istead of just fitting to a camera selection. Should be able to work on any object selected
else:
start = cmds.findKeyframe( self.getSelection(), which = "first" )
end = cmds.findKeyframe( self.getSelection(), which = "last" )
if start == end: # this means there's no keyframes
start = cmds.playbackOptions(q=1, minTime=1)
end = cmds.playbackOptions(q=1, maxTime=1)
cmds.bakeResults(self.getSelection(), simulation = True, time =(start,end), sampleBy = 1 )
开发者ID:jricker,项目名称:JR_Maya,代码行数:14,代码来源:JR_hk_cmds.py
示例20: create
def create() :
sel = m.ls(sl=True)
rbn = mel.eval('peelSolve2RigidBody()')
# find the common parent
ret = set()
for n in sel :
p = m.listRelatives(n, p=True)
if p is None : continue
ret.add(p[0])
if len(ret) == 1 :
parent = list(ret)[0]
else :
parent = None
cons = []
locs = []
# for each marker
for i in range (len(sel)) :
input = m.listConnections( rbn + ".input[%d]" % i )[0]
local = m.listConnections( rbn + ".local[%d]" % i )[0]
# create locators and constrain to local rigidbody markers
loc = m.spaceLocator( name=sel[i] + '_temp' )[0]
if parent :
loc = m.parent( loc, parent ) [0]
cons.append( m.pointConstraint( local, loc )[0] )
locs.append( loc )
# link active to weight
src = input + ".active"
dst = local + ".weight"
if m.objExists(src) :
m.connectAttr( src, dst )
# bake
try :
m.refresh(suspend=True)
start = m.playbackOptions(q=True, min=True)
end = m.playbackOptions(q=True, max=True)
m.bakeResults(locs, sm=True, t=(start,end), sb=1, dic=True, pok=True, sac=False, at=('tx', 'ty', 'tz') )
finally :
m.refresh(suspend=False)
m.delete( cons )
开发者ID:mocap-ca,项目名称:cleanup,代码行数:50,代码来源:rigidbody.py
注:本文中的maya.cmds.bakeResults函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论