本文整理汇总了Python中pymel.core.currentTime函数的典型用法代码示例。如果您正苦于以下问题:Python currentTime函数的具体用法?Python currentTime怎么用?Python currentTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了currentTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: duplicateSequence
def duplicateSequence(objects):
'''duplicates the given objects as groups per frame with properly named objects
Args:
objects (list(pm.PyNode)): list of objects to be duplicated every frame
Returns:
nothing...yet.
Usage:
duplicateSequence(pm.ls(sl=True))
'''
for obj in objects:
topGrp = obj.getParent().name().replace('GRP','ANIM_GRP')
if pm.objExists(topGrp):
topGrp = pm.PyNode(topGrp)
else:
topGrp = pm.group(em=True,n=topGrp)
startFrame = pm.playbackOptions(q=True,ast=True)
endFrame = pm.playbackOptions(q=True,aet=True)
incr = 1
grp = pm.group(em=True, n=obj.name().replace('GEO','ANIM_GRP'), p=topGrp)
i=0
for frame in range (startFrame, endFrame+1, incr):
pm.currentTime(frame)
dup=pm.duplicate(obj, n=obj.name().replace('GEO','%d_GEO'%i))
dup[0].setParent(grp)
i+=1
开发者ID:creuter23,项目名称:tools,代码行数:25,代码来源:duplicateSequence.py
示例2: viewOutHide
def viewOutHide():
transNodeList = []
startTime = pm.playbackOptions(q=1, min=1)
endTime = pm.playbackOptions(q=1, max=1)
for x in range(int(startTime), int(endTime + 1)):
pm.currentTime(x)
transNodeList += viewObjectList(False)
transNodeListS = set(transNodeList)
allTransNodeList = set()
for x in pm.ls(type='mesh'):
allTransNodeList.add(x.getParent().name())
hideList = allTransNodeList - transNodeListS
for x in hideList:
try:
pm.setAttr(x + '.v', 0)
except:
pass
pm.currentTime(startTime)
开发者ID:jiwonchoe,项目名称:mayaPy,代码行数:27,代码来源:viewMeshHide.py
示例3: set_fps
def set_fps(self, fps=25):
"""sets the fps of the environment
"""
# get the current time, current playback min and max (because maya
# changes them, try to restore the limits)
current_time = pm.currentTime(q=1)
pMin = pm.playbackOptions(q=1, min=1)
pMax = pm.playbackOptions(q=1, max=1)
pAst = pm.playbackOptions(q=1, ast=1)
pAet = pm.playbackOptions(q=1, aet=1)
# set the time unit, do not change the keyframe times
# use the timeUnit as it is
time_unit = u"pal"
# try to find a timeUnit for the given fps
# TODO: set it to the closest one
for key in self.time_to_fps:
if self.time_to_fps[key] == fps:
time_unit = key
break
pm.currentUnit(t=time_unit, ua=0)
# to be sure
pm.optionVar['workingUnitTime'] = time_unit
# update the playback ranges
pm.currentTime(current_time)
pm.playbackOptions(ast=pAst, aet=pAet)
pm.playbackOptions(min=pMin, max=pMax)
开发者ID:dshlai,项目名称:oyprojectmanager,代码行数:32,代码来源:mayaEnv.py
示例4: convertLightmapSequence
def convertLightmapSequence(ast, aet, res, occres, fileFormat, falloff=0.0):
'''The first selected object will bake occlusion to it, with all other selected as inputs
It automatically bakes to the "maya/sourcimages/occlusionBake/" folder and auto-versions
Args:
ast (int): animation start time
aet (int): animation end time
res (int): resolution for the map to bake
occres (int): resolution for the occlusion
fileFormat (string): accepts: TIFF,IFF,JPG,RGB,RLA,TGA,BMP,HDR
falloff (float): float for controlling AO falloff
Returns (None)
Example: convertLightmapSequence(1,5,256,32)
'''
sel=pm.ls(sl=True, type='transform')
extension = {'TIFF':0,'IFF':1,'JPG':2,'RGB':3,'RLA':4,'TGA':5,'BMP':6,'HDR':7}
pathBase = "/jobs/{JOB}/{SHOT}/{MAYA}/{OBJ}".format(JOB = os.getenv('JOB'),
SHOT = os.getenv('SHOT'),
MAYA='maya/sourceimages/occlusionBake',
OBJ=sel[0])
#Create and add objects to the bakeSet
if len(sel)>0:
if not pm.objExists('tmpBakeSet'):
bakeSet = pm.createNode('textureBakeSet', n='tmpBakeSet')
else:
bakeSet = pm.PyNode('tmpBakeSet')
else:
pm.error('No objects selected...')
for obj in sel:
bakeSet.add(obj.getShape())
#Set the shit for the bakeSet
bakeSet.xResolution.set(res)
bakeSet.yResolution.set(res)
bakeSet.colorMode.set(3)
bakeSet.occlusionRays.set(occres)
bakeSet.bakeToOneMap.set(1)
bakeSet.fileFormat.set(extension[fileFormat])
bakeSet.occlusionFalloff.set(falloff)
#Version up the folder and now that's the pathBase
if not os.path.exists(pathBase):
os.makedirs(pathBase)
folders = [folder for folder in os.listdir(pathBase) if os.path.isdir(os.path.join(pathBase, folder))]
version = 'v%03d'% (len(folders)+1)
if len(folders)==0:
version = 'v001'
pathLgt = os.path.join(pathBase,version)
pathBase = os.path.join(pathBase,version,'lightMap')
if not os.path.exists(pathBase):
os.makedirs(pathBase)
#Now finally bake
for frame in range(ast,aet+1):
bakeSet.prefix.set('occBake%04d'%frame)
pm.currentTime(frame)
pm.convertLightmap('initialShadingGroup', sel[0], camera='persp', prj=pathLgt, sh=True, bo=bakeSet)
#Get dat selection bak
pm.select(sel, r=True)
开发者ID:AndresMWeber,项目名称:aw,代码行数:60,代码来源:aw_convertLightmapSequence.py
示例5: testCircler
def testCircler(self):
xform, circ = self.make_circler_nodes()
circ.scale.set(4)
circ.frames.set(12)
pmc.currentTime(3)
self.assertTrans(xform, [4, 0, 66])
pmc.currentTime(6)
self.assertTrans(xform, [0, -4, 66])
开发者ID:AdricEpic,项目名称:practicalmayapython,代码行数:8,代码来源:plugintests.py
示例6: stopSimulation
def stopSimulation(self):
mel.eval("playButtonForward;")
self.updateDynState(2)
for x in range(0, 3, 1):
pm.currentTime(pm.currentTime() + 1)
self.ui.simulationContinue_bt.setEnabled(True)
self.ui.updateRadius_gb.setHidden(False)
self.ui.bake_qw.setHidden(False)
开发者ID:nicolasboselli,项目名称:test,代码行数:8,代码来源:forestGenerator.py
示例7: createRig
def createRig(self):
pm.currentTime(0, e=True)
global sel_objects
sel_objects = pm.ls(sl=True, tr=True)
if sel_objects == []:
print '\n# Error: Please select an object first'
pm.confirmDialog(title = 'Error: Nothing Selected',
m = 'Please select an object to create the light rig around.',
button = 'Ok',
db = 'Ok')
self.close()
gui(dock=False)
else:
global light_name
light_name = 'light1'
name_request = pm.promptDialog(
t='Light Name',
m='Enter Your New Light\'s Name',
ma='left',
tx='Ex: key_light',
st='text',
b=['Ok', 'Cancel'],
db='Ok',
cb='Cancel',
ds='Cancel')
if name_request == 'Ok':
light_name = pm.promptDialog(query=True, text=True)
global sel_center
sel_center = command.averageCoords(sel_objects)
global rigOrbit, rigInterv, rigLight
rigOrbit = pm.group(n='olp_orbitsGrp1', em=True)
rigInterv = pm.group(n='olp_intervalsGrp1', em=True)
rigLight = self.createLight(sel_center)
self.setExpression()
pm.createRenderLayer([sel_objects, rigOrbit, rigInterv, rigLight], noRecurse=True, name='{0}_layer'.format(light_name))
self.createVis()
pm.xform(rigOrbit, a=True, t=sel_center)
pm.xform(rigInterv, a=True, t=sel_center)
pm.parent(rigLight, rigInterv)
pm.parent(rigInterv, rigOrbit)
pm.select(sel_objects, r=True)
# GUI Components enable/disable
self.enableDisable_component(self.createRig_btn, enabled=False)
self.enableDisable_component(self.deleteRig_btn, enabled=True)
self.enableDisable_component(self.distance_label, enabled=True)
self.enableDisable_component(self.distance_float, enabled=True)
self.enableDisable_component(self.orbit_label, enabled=True)
self.enableDisable_component(self.orbit_int, enabled=True)
self.enableDisable_component(self.interv_label, enabled=True)
self.enableDisable_component(self.interv_int, enabled=True)
self.enableDisable_component(self.showVis_ckbx, enabled=True)
开发者ID:Huston94,项目名称:Orbital_Light_Previewer,代码行数:58,代码来源:orbitLights_UI.py
示例8: 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
示例9: loopTime
def loopTime():
for time in range(int(timeMin),int(timeMax)):
count = pm.particle(part,q = 1,ct = 1)
for num in range(0,count):
pt = part + '.pt[' + str(num) + ']'
if pt not in ptList:
ptList.append(pt)
createCurve(pt)
else :
addCurvePoint(pt,curveList[num])
pm.currentTime(time + 1)
开发者ID:RyugasakiHu,项目名称:Maya-tools,代码行数:11,代码来源:rh_particle2curve.py
示例10: switch
def switch(space, timeRange=False, start=0, end=0):
#undo enable
pm.undoInfo(openChunk=True)
sel = pm.ls(selection=True)
for node in sel:
cnt = getConnectedNodes(node, 'control')[0]
controls = []
for obj in getConnectedNodes(cnt, 'message'):
#IK switch
if space == 'IK':
if obj.space.get() == space:
if timeRange:
for count in xrange(start, end):
pm.currentTime(count)
switch = getConnectedNodes(obj, 'switch')[0]
Snap(obj, switch)
cnt.blend.set(1)
else:
switch = getConnectedNodes(obj, 'switch')[0]
Snap(obj, switch)
cnt.blend.set(1)
#FK control finding
if space == 'FK':
if obj.space.get() == space:
controls.append(obj)
#FK switch
controls.sort(key=lambda x: x.chain.get())
if timeRange:
for count in xrange(start, end):
pm.currentTime(count)
for obj in controls:
switch = getConnectedNodes(obj, 'switch')[0]
Snap(obj, switch)
cnt.blend.set(0)
else:
for obj in controls:
switch = getConnectedNodes(obj, 'switch')[0]
Snap(obj, switch)
cnt.blend.set(0)
pm.undoInfo(closeChunk=True)
开发者ID:leandropim,项目名称:Tapp,代码行数:52,代码来源:utils.py
示例11: _exportHandleFr
def _exportHandleFr(self, obj):
#If it's a frame range, enable going through it
if self.framesCheck.getValue():
for frame in range(int(self.fr_st.getText()), int(self.fr_end.getText())+1):
pm.currentTime(frame)
self._updateDirectory()
filePath = os.path.join( self.folder_path, obj + '.' + self.extension )
self._update_path_tf
self._exportHandle(filePath)
else:
filePath = os.path.join( self.folder_path, obj + '.' + self.extension )
self._exportHandle(filePath,obj)
开发者ID:creuter23,项目名称:tools,代码行数:13,代码来源:aw_exporter.py
示例12: bdCleanKeyframes
def bdCleanKeyframes():
start = pm.playbackOptions(q=1,ast=1)
end = pm.playbackOptions(q=1,aet=1)
sel = pm.ls(sl=1,type='transform')
for i in range(8,end-10,1):
if not (i%4):
print i
pm.currentTime(i)
pm.setKeyframe(sel,t=i)
else:
pm.cutKey(sel,clear=1,an='objects',iub=0,t=(i,i+1))
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:13,代码来源:bdRigUtils.py
示例13: restDynamics
def restDynamics( restTime=100 ):
"""Positions particles at their goal objects."""
pm.waitCursor( state=True )
currentFrame = pm.currentTime()
for i in range( restTime ):
pm.currentTime( currentFrame+.1 )
pm.currentTime( currentFrame )
pm.waitCursor( state=False )
print '// Result: Particle states rested.'
开发者ID:kinetifex,项目名称:maya-kinetifex,代码行数:13,代码来源:dynamics.py
示例14: bdSwitchCBLidParent
def bdSwitchCBLidParent(self,newParent):
selection = pm.ls(sl=1,type='transform')
if selection:
pass
else:
pm.warning('Nothing selected !!!')
return
if 'candybox_lid' in selection[0].name():
candyboxLidCtrl = selection[0]
try:
currentParent = candyboxLidCtrl.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(candyboxLidCtrl)
pm.currentTime(switchFrame,e=1)
hatPos = candyboxLidCtrl.getTranslation(space='world')
hatRot = candyboxLidCtrl.getRotation(space='world')
#World Parent
if newParent == 0:
print 'Candybox new parent: Candybox'
candyboxLidCtrl.attr('parent').set(0)
elif newParent == 2:
print 'Candybox new parent: Right Hand'
candyboxLidCtrl.attr('parent').set(2)
elif newParent == 1:
print 'Candybox new parent: Left Hand'
candyboxLidCtrl.attr('parent').set(1)
candyboxLidCtrl.setTranslation(hatPos,space='world')
candyboxLidCtrl.setRotation(hatRot,space='world')
pm.setKeyframe(candyboxLidCtrl )
else:
pm.warning('Select candybox_lid_ctrl')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:51,代码来源:bdSwitchHatParent.py
示例15: stageMouseRelease
def stageMouseRelease(self, event):
#delete recordAttr nodes
self.isRecording = False;
if self.recordingMode:
pm.play(state=False)
for i in range(0,2):
for mAttr in self.attrs[i]:
pm.select(mAttr.nodeName())
pm.recordAttr(at = mAttr.longName(), delete=1)
pm.currentTime(self._startTime)
else:
for i in range(0,2):
for j in range(0,len(self.attrs[i])):
pm.setAttr(self.attrs[i][j], self._startAttrs[i][j])
开发者ID:etic,项目名称:mayabox,代码行数:14,代码来源:mouseCap.py
示例16: slice
def slice(self, slices_in_x, slices_in_y):
"""slices all renderable cameras
"""
# set render resolution
self.unslice_scene()
self.is_sliced = True
self._store_data()
sx = self.slices_in_x = slices_in_x
sy = self.slices_in_y = slices_in_y
# set render resolution
d_res = pm.PyNode("defaultResolution")
h_res = d_res.width.get()
v_res = d_res.height.get()
# this system only works when the
d_res.aspectLock.set(0)
d_res.pixelAspect.set(1)
d_res.width.set(h_res / float(sx))
d_res.pixelAspect.set(1)
d_res.height.set(v_res / float(sy))
d_res.pixelAspect.set(1)
# use h_aperture to calculate v_aperture
h_aperture = self.camera.getAttr('horizontalFilmAperture')
# recalculate the other aperture
v_aperture = h_aperture * v_res / h_res
self.camera.setAttr('verticalFilmAperture', v_aperture)
v_aperture = self.camera.getAttr('verticalFilmAperture')
self.camera.setAttr('zoom', 1.0/float(sx))
t = 0
for i in range(sy):
v_pan = v_aperture / (2.0 * sy) * (1 + 2 * i - sy)
for j in range(sx):
h_pan = h_aperture / (2.0 * sx) * (1 + 2 * j - sx)
pm.currentTime(t)
pm.setKeyframe(self.camera, at='horizontalPan', v=h_pan)
pm.setKeyframe(self.camera, at='verticalPan', v=v_pan)
t += 1
self.camera.panZoomEnabled.set(1)
self.camera.renderPanZoom.set(1)
d_res.pixelAspect.set(1)
开发者ID:sergeneren,项目名称:anima,代码行数:49,代码来源:render_slicer.py
示例17: bdMultiMotionPath
def bdMultiMotionPath(crvPath, objects,interval=2,speed=20):
numObjects = len(objects)
startTime = pm.playbackOptions(q=1,minTime=1)
endTime = pm.playbackOptions(q=1,maxTime=1)
allMotionPath = []
for i in range(numObjects):
#motionPath = pm.pathAnimation(objects[i],c=crvPath,n=objects[i].name() + '_mp',stu = i*interval , etu = i*interval + speed,follow = 1, followAxis = 'x', upAxis = 'y',fractionMode =1)
pm.currentTime(0)
motionPath = pm.pathAnimation(objects[i],c=crvPath,n=objects[i].name() + '_mp',follow = 1, followAxis = 'x', upAxis = 'y',fractionMode =1)
allMotionPath.append(motionPath)
pm.setAttr(motionPath + '.worldUpType',1)
bdSetStartMp(allMotionPath)
startCycleFrame = i*interval + speed + 2
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:15,代码来源:bdRigUtils.py
示例18: test_slice_will_set_the_vertical_pan_attribute_of_the_camera_properly
def test_slice_will_set_the_vertical_pan_attribute_of_the_camera_properly(self):
"""testing if calling the slice() method will set the verticalPan
attribute of the camera properly
"""
rs = RenderSlicer(camera=self.camera)
rs.slice(2, 3)
expected_values = [
-0.2657475, -0.2657475, 0, 0, 0.2657475, 0.2657475
]
for i in range(6):
pm.currentTime(i)
self.assertAlmostEqual(
self.camera.verticalPan.get(),
expected_values[i]
)
开发者ID:eoyilmaz,项目名称:anima,代码行数:15,代码来源:test_render_slicer.py
示例19: createCtrl
def createCtrl(fol, clusterHandle, name):
masterGrp = pm.group(em=1, name="{0}_MASTER".format(name))
locCtrl = pm.group(em=1, name="{0}_LOC".format(name))
upCtrl = pm.group(em=1, name="{0}_UP".format(name))
ctrl = pm.group(em=1, name="{0}_Ctrl".format(name))
ctrl.setParent(upCtrl)
upCtrl.setParent(locCtrl)
locCtrl.setParent(fol)
locCtrl.t.set(0, 0, 0)
md = pm.createNode("multiplyDivide", name="{0}_MD".format(name))
clusterHandle.t >> md.input1
md.input2.set(-1, -1, -1)
md.output >> upCtrl.t
ctrl.t >> clusterHandle.t
ctrl.r >> clusterHandle.r
ctrl.displayHandle.set(1)
fol.setParent(masterGrp)
clusterHandle.setParent(masterGrp)
currentTime = pm.currentTime(q=1)
ctrl.t.setKey(t=currentTime)
ctrl.t.setKey(t=currentTime + 5)
ctrl.t.setKey(t=currentTime - 5)
ctrl.r.setKey(t=currentTime)
ctrl.r.setKey(t=currentTime + 5)
ctrl.r.setKey(t=currentTime - 5)
return ctrl
开发者ID:TianD,项目名称:TianD_KX_TOOL,代码行数:31,代码来源:BeautifyClothTool.py
示例20: createTrail
def createTrail():
if pm.window('trailUI',ex=1):
pm.deleteUI('trailUI')
pm.window('trailUI')
pm.columnLayout(adj=1)
fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1)
pm.separator (height=4,style="in")
startFrame = pm.playbackOptions(q=1,min=1)
currentFrame = pm.currentTime(q=1)
if currentFrame > startFrame:
startFrame = currentFrame
pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame)
pm.popupMenu(button=3,pmc = functools.partial(setTime,'start'))
pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30)
pm.popupMenu(button=3,pmc = functools.partial(setTime,'end'))
pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40)
pm.separator (height=4,style="in")
cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1)
pm.separator (height=4,style="in")
rowBtn = pm.rowColumnLayout(numberOfRows=1)
pm.button(l='Create Trail',command=functools.partial(createTrailMesh))
pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,''))
pm.button(l='ELP !!!',c=openHelpPage)
pm.showWindow('trailUI')
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:26,代码来源:bdTrailUV.py
注:本文中的pymel.core.currentTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论