本文整理汇总了Python中maya.cmds.playblast函数的典型用法代码示例。如果您正苦于以下问题:Python playblast函数的具体用法?Python playblast怎么用?Python playblast使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了playblast函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: playblastStart
def playblastStart(cameraList):
for x in cameraList:
i = cmds.listRelatives( x, p=True )
cmds.select(i)
start = cmds.findKeyframe( i, which="first" )
end = cmds.findKeyframe( i, which="last" )
sceneNameFull = cmds.file(query = True, shortName = True, sceneName = True)
if '.mb' in sceneNameFull or '.ma' in sceneNameFull:
sceneName = sceneNameFull[:-3]
else:
sceneName = sceneNameFull
cmds.select(cl = 1)
focus = cmds.getPanel( withFocus=True )
cmds.modelPanel( focus, edit=True, camera = x )
cmds.modelEditor( focus, edit = True, cameras = False, locators = False)
print start, end
if start == end: # this means there's no keyframes
print 'no keyframes on this one, playblasting timeline duration'
cmds.playblast (format = "qt", compression = "Sorenson Video 3", filename = desktop + sceneName + '_' + str(i[0]) + '.mov', clearCache = 1 , viewer = 0, showOrnaments = 1, fp = 4, percent = 100, quality = 100, widthHeight = [1280, 720])
else:
print 'keyframes found, playblasting their start to end'
cmds.playblast (startTime = start, endTime = end, format = "qt", compression = "Sorenson Video 3", filename = desktop + sceneName + '_' + str(i[0]) + '.mov', sequenceTime = 0, clearCache = 1 , viewer = 0, showOrnaments = 1, fp = 4, percent = 100, quality = 100, widthHeight = [1280, 720])
#cmds.playblast( completeFilename = str(i) + '.mov', startTime = start, endTime = end, viewer = True, clearCache = True, percent = 100, quality = 100, format = "qt", framePadding = 20 )
cmds.modelEditor( focus, edit = True, cameras = True, locators = True)
print ' moving to the next one '
开发者ID:jricker,项目名称:JR_Maya,代码行数:25,代码来源:JR_skratch.py
示例2: playblast
def playblast(self, filename, **kwargs):
'''Playblasting with reasonable default arguments. Automatically sets
this viewport to the active view, ensuring that we playblast the
correct view.
:param filename: Absolute path to output file
:param kwargs: Same kwargs as :func:`maya.cmds.playblast`'''
playblast_kwargs = {
'filename': filename,
'offScreen': False,
'percent': 100,
'quality': 100,
'viewer': True,
'width': 960,
'height': 540,
'framePadding': 4,
'format': 'qt',
'compression': 'H.264',
'forceOverwrite': True,
}
playblast_kwargs.update(kwargs)
if not self.focus:
self.focus = True
cmds.playblast(**playblast_kwargs)
开发者ID:mkolar,项目名称:mvp,代码行数:26,代码来源:viewport.py
示例3: blast
def blast(*args):
"""Playblast and settings. Change to your liking."""
fileNameLong = cmds.file(query=True, sceneName=True, shortName=True)
if fileNameLong == "":
fileNameLong = "untitled"
else:
fileNameLong = cmds.file(query=True, sceneName=True, shortName=True)
fileNameShort = fileNameLong.split(".")
TimeRange = mel.eval('$tmpVar=$gPlayBackSlider')
SoundNode = cmds.timeControl(TimeRange, query=True, sound=True)
# Disable 2D Pan & Zoom in current viewport
activepanel = cmds.getPanel(withFocus=True)
cam = cmds.modelEditor(activepanel, query=True, camera=True)
# camShape = cmds.listRelatives(cam, shapes=True)[0]
cmds.setAttr(cam + '.panZoomEnabled', False)
if cmds.ls(renderResolutions=True):
ResX = cmds.getAttr("defaultResolution.width")
ResY = cmds.getAttr("defaultResolution.height")
cmds.playblast(
filename=("movies/" + fileNameShort[0] + ".mov"),
forceOverwrite=True, format="qt", compression="png",
offScreen=True, width=ResX, height=ResY, quality=100,
percent=100, sound=SoundNode
)
else:
cmds.error("No resolution data in file. \
Please set resolution and save.")
开发者ID:Italic-,项目名称:maya-prefs,代码行数:33,代码来源:ita_DefaultCameraChecker.py
示例4: save_scene
def save_scene(search_key, context, description, all_process):
# add info about particular scene
skey_link = 'skey://{0}&context={1}'.format(search_key, context)
if not cmds.attributeQuery('tacticHandler_skey', node='defaultObjectSet', exists=True):
cmds.addAttr('defaultObjectSet', longName='tacticHandler_skey', dataType='string')
cmds.setAttr('defaultObjectSet.tacticHandler_skey', skey_link, type='string')
# get template names for scene and playblast image
temp_dir = env.Env().get_temp_dir()
random_uuid = uuid.uuid4()
types = {
'mayaBinary': 'mb',
'mayaAscii': 'ma',
}
temp_file = '{0}/{1}.ma'.format(temp_dir, random_uuid)
temp_playblast = '{0}/{1}.jpg'.format(temp_dir, random_uuid)
# rename file, save scene, playblast, get saving format
cmds.file(rename=temp_file)
cmds.file(save=True, type='mayaAscii')
current_frame = cmds.currentTime(query=True)
cmds.playblast(
forceOverwrite=True,
format='image',
completeFilename=temp_playblast,
showOrnaments=False,
widthHeight=[960, 540],
sequenceTime=False,
frame=[current_frame],
compression='jpg',
offScreen=True,
viewer=False,
percent=100
)
# check in snapshot
snapshot = tc.checkin_snapshot(search_key, context, temp_file, file_type='maya', is_current=True,
description=description)
# from pprint import pprint
# pprint(snapshot)
# retrieve checked in snapshot file info
asset_dir = env.Env().get_asset_dir()
file_sobject = snapshot['__file_sobjects__'][0]
relative_dir = file_sobject['relative_dir']
file_name = file_sobject['file_name']
# make proper file path, and dir path to set workspace
new_file = '{0}/{1}/{2}'.format(asset_dir, relative_dir, file_name)
split_path = relative_dir.split('/')
dir_path = '{0}/{1}'.format(asset_dir, '{0}/{1}/{2}'.format(*split_path))
set_workspace(dir_path, all_process)
# check in playblast
tc.checkin_playblast(snapshot['code'], temp_playblast)
# set proper scene name
cmds.file(rename=new_file)
开发者ID:heylenz,项目名称:TACTIC-Handler,代码行数:60,代码来源:maya_functions.py
示例5: ScreenCapture
def ScreenCapture(filename,resolution, color = 0.361):
cmds.undoInfo(stateWithoutFlush = False)
try:
oldFormat = cmds.getAttr("defaultRenderGlobals.imageFormat")
cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
#Store the current display colors
colors = [cmds.displayRGBColor("background", query = True),
cmds.displayRGBColor("backgroundTop", query = True),
cmds.displayRGBColor("backgroundBottom", query = True)]
#To make the UI prettier
cmds.displayRGBColor("background", color, color, color)
cmds.displayRGBColor("backgroundTop", color, color, color)
cmds.displayRGBColor("backgroundBottom", color, color, color)
#Take a snap for the UI
cmds.playblast(frame=0,fmt="image",viewer=0,fp=4,orn=0,p=100,wh=resolution,ifz=0,fo=1,offScreen=1,cf=filename)
#Revert to the old colors
cmds.displayRGBColor("background", colors[0][0], colors[0][1], colors[0][2])
cmds.displayRGBColor("backgroundTop", colors[1][0], colors[1][1], colors[1][2])
cmds.displayRGBColor("backgroundBottom", colors[2][0], colors[2][1], colors[2][2])
cmds.setAttr("defaultRenderGlobals.imageFormat", oldFormat)
except:
pass
cmds.undoInfo(stateWithoutFlush = True)
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:30,代码来源:ScreenCapture.py
示例6: playblastLocal
def playblastLocal(blastFilename, format, start, end, offscreen, width, height):
'''
Perform a playblast.
'''
# Check
if format not in IMAGE_FORMAT_DICT:
raise ImageFormatException, 'Invalid image format: %s' % format
# Set the image format from the list and backup the old one
oldRenderFormat = cmds.getAttr('defaultRenderGlobals.imageFormat')
cmds.setAttr('defaultRenderGlobals.imageFormat', IMAGE_FORMAT_DICT[format])
# Do the blast
cmds.playblast(filename=blastFilename,
format='image',
startTime=start,
endTime=end,
forceOverwrite=True,
viewer=False,
offScreen=offscreen,
widthHeight=[int(width), int(height)],
percent=100
)
# Restore the old render globals image format
cmds.setAttr('defaultRenderGlobals.imageFormat', oldRenderFormat)
开发者ID:davidkaplan,项目名称:tippett-codesamples,代码行数:26,代码来源:playblast.py
示例7: recordPlayblastForSequenceN
def recordPlayblastForSequenceN(self, tab, level1, level2, level3, width , height , fileName ,sframe , eframe , folder = 'devFolder' ):
# "/Users/higgsdecay/test"
playblastFile = os.path.join(str(self.getFileName(tab, level1, level2, level3, folder , 0, 1)), "preview", os.path.splitext(str(fileName))[0], str(fileName))
# create the preview folder
previewFolder = os.path.dirname(playblastFile)
if not os.path.exists(previewFolder):
os.makedirs(previewFolder)
os.chmod( previewFolder , 0777 )
# startFrame = cmds.getAttr("defaultRenderGlobals.startFrame")
# endFrame = cmds.getAttr("defaultRenderGlobals.endFrame")
format = cmds.getAttr("defaultRenderGlobals.imageFormat")
# width = cmds.getAttr("defaultResolution.width")
# height = cmds.getAttr("defaultResolution.height")
ratio = cmds.getAttr("defaultResolution.deviceAspectRatio")
cams = [ x for x in cmds.ls(typ='camera') if cmds.getAttr(x+'.renderable')]
thecam = cmds.listRelatives( cams[0] , p = 1) if cams != [] else None
cmds.setAttr("defaultRenderGlobals.imageFormat", 8)
# playblast -startTime 1 -endTime 10 -format iff -filename "/Users/higgsdecay/output/ACR_rig_v02_w03"
#-forceOverwrite -sequenceTime 0 -clearCache 0 -viewer 1 -showOrnaments 1 -fp 4 -percent 50 -widthHeight 1920 1080;
cmds.playblast(startTime=sframe, endTime=eframe, format="image",percent = 100 , qlt = 100,
filename=os.path.splitext(str(playblastFile))[0], showOrnaments=False, viewer=False, os=1,
sequenceTime=False, forceOverwrite=True,
widthHeight=[int(width), int(height)] )
for x in glob.glob( previewFolder+os.sep+'*.*' ):
print 'glob : ' , x
os.chmod(x , 0777)
cmds.setAttr("defaultRenderGlobals.imageFormat", format)
return (playblastFile, ratio)
开发者ID:onetera,项目名称:ip_gj,代码行数:31,代码来源:iPipelineActions.py
示例8: playblast_scene
def playblast_scene():
""" Playblast the current scene using the min and max playback
values as the start and end value for the playblast.
:todo: Add a configuration (json) file that lets the user save
their file to a particular location.
:todo: Add a function in the utils folder that time stamps or
versions the maya file.
"""
# Get the start and end frames of the animation scene:
start_frame = cmds.playbackOptions(min=True, query=True)
end_frame = cmds.playbackOptions(max=True, query=True)
# Create the filename of the playblast:
time_code = time.strftime("%Y_%m_%d_%H_%M_%S", time.localtime())
filename = cmds.file(query=True, sceneName=True)
filename += time_code
filename += ".mov"
location = os.path.join(_get_images_directory(), filename)
# Playblast the scene:
cmds.playblast(filename=location, fmt="qt", offScreen=True)
# Return
return
开发者ID:eoghancunneen,项目名称:mayaflipbook,代码行数:27,代码来源:animationflipbook.py
示例9: recordPlayblastForSequence
def recordPlayblastForSequence(self, tab, level1, level2, level3, offset=0, archive=0):
# "/Users/higgsdecay/test"
playblastFile = self.getFileName(tab, level1, level2, level3, "playblastFile2", offset, archive)
# create the preview folder
previewFolder = os.path.dirname(playblastFile)
if not os.path.exists(previewFolder):
os.makedirs(previewFolder)
os.chmod( previewFolder , 0777 )
else :
os.chmod( previewFolder , 0777 )
startFrame = cmds.getAttr("defaultRenderGlobals.startFrame")
endFrame = cmds.getAttr("defaultRenderGlobals.endFrame")
format = cmds.getAttr("defaultRenderGlobals.imageFormat")
width = cmds.getAttr("defaultResolution.width")
height = cmds.getAttr("defaultResolution.height")
ratio = cmds.getAttr("defaultResolution.deviceAspectRatio")
cmds.setAttr("defaultRenderGlobals.imageFormat", 8)
# playblast -startTime 1 -endTime 10 -format iff -filename "/Users/higgsdecay/output/ACR_rig_v02_w03"
#-forceOverwrite -sequenceTime 0 -clearCache 0 -viewer 1 -showOrnaments 1 -fp 4 -percent 50 -widthHeight 1920 1080;
cmds.playblast(startTime=startFrame, endTime=endFrame, format="image",
filename=str(playblastFile), showOrnaments=False, viewer=False, percent=100,os=1,
sequenceTime=False, forceOverwrite=True,
widthHeight=[int(width), int(height)])
cmds.setAttr("defaultRenderGlobals.imageFormat", format)
return (playblastFile+".####.jpg", int(startFrame), int(endFrame), int(width), int(height), ratio)
开发者ID:onetera,项目名称:ip_gj,代码行数:29,代码来源:iPipelineActions.py
示例10: doPlayblast
def doPlayblast(self, camera):
G.TU_movie = None
G.TU_audioFile = None
G.TU_audioOffsetSec = None
winName = 'playblastWindow'
overscan = cmds.getAttr("%s.overscan"%camera)
audioTrack = cmds.timeControl(G.playBackSliderPython, query=True, sound=True)
rangeVisible = cmds.timeControl(G.playBackSliderPython, query=True, rangeVisible=True )
widthHeight = utilMod.getRenderResolution()
if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName)
window = cmds.window(winName, widthHeight=widthHeight)
form = cmds.formLayout()
editor = cmds.modelEditor()
column = cmds.columnLayout('true')
cmds.formLayout( form, edit=True, attachForm=[(column, 'top', 0), (column, 'left', 0), (editor, 'top', 0), (editor, 'bottom', 0), (editor, 'right', 0)], attachNone=[(column, 'bottom'), (column, 'right')], attachControl=(editor, 'left', 0, column))
cmds.modelEditor(editor, edit=True, camera=camera, activeView=True)
cmds.showWindow( window )
cmds.window( winName, edit=True, topLeftCorner=(0, 0), widthHeight=[200,200])
utilMod.cameraViewMode(editor)
cmds.setAttr("%s.overscan"%camera, 1)
if rangeVisible:
range = animMod.getTimelineRange(float=False)
rFrom = range[0]
rTo = range[1]-1
else:
rFrom = cmds.playbackOptions(query=True, minTime=True)
rTo = cmds.playbackOptions(query=True, maxTime=True)
if G.currentStudio == None:
G.TU_movie = cmds.playblast(format="qt", sound=audioTrack, startTime=rFrom ,endTime=rTo , viewer=1, showOrnaments=0, offScreen=True, fp=4, percent=50, compression="png", quality=70, widthHeight=widthHeight, clearCache=True)
else:
fps = mel.eval("currentTimeUnitToFPS")
if audioTrack:
G.TU_audioFile = cmds.sound(audioTrack, query=True, file=True)
audioOffset = cmds.sound(audioTrack, query=True, offset=True)
G.TU_audioOffsetSec = str((rFrom - audioOffset)/-fps)
movieName = cmds.playblast(format="image", startTime=rFrom ,endTime=rTo , viewer=0, showOrnaments=0, offScreen=True, fp=4, percent=50, compression="jpg", quality=70, widthHeight=widthHeight, clearCache=True)
if movieName:
G.TU_movie = "%s.%s-%s#.jpg"%(movieName.split(".")[0], int(rFrom), int(rTo))
if audioTrack: G.TU_audioOffsetSec = audioOffset
self.playMovie(G.TU_movie, G.TU_audioFile, G.TU_audioOffsetSec)
if cmds.window(winName, query=True, exists=True): cmds.deleteUI(winName)
cmds.setAttr("%s.overscan"%camera, overscan)
if not G.TU_movie: return
save = aToolsMod.getUserPref("saveAfterPlayblasting", default=True)
if save and not rangeVisible: cmds.file(save=True)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:59,代码来源:tUtilities.py
示例11: createThumbnailN
def createThumbnailN(self, tab, level1, level2, level3, fileName):
fileName = self.getFileName(tab, level1, level2, level3, "sceneFolder", 0, 1)+fileName
currFrame = cmds.currentTime(query=True)
format = cmds.getAttr("defaultRenderGlobals.imageFormat")
cmds.setAttr("defaultRenderGlobals.imageFormat", 8)
cmds.playblast(frame=currFrame, format="image", completeFilename=str(fileName), showOrnaments=False, viewer=False, widthHeight=[164, 105], percent=100 , os=1)
cmds.setAttr("defaultRenderGlobals.imageFormat", format)
return fileName
开发者ID:onetera,项目名称:ip_gj,代码行数:8,代码来源:iPipelineActions.py
示例12: writeFile
def writeFile(self,*args):
self.infoDict = {} #redefines self.infoDict
self.selection = cmds.ls(sl = True) #gets names of selected objects
poseQuery = cmds.textFieldGrp(self.fileName, q = True, text = True) #queries the pose name text field
charQuery = cmds. textScrollList(self.folderName, q = True, selectItem = True) #queries the folder name text scroll list
if self.selection == []: #if selection is empty, raises a warning
cmds.warning('Please make a selection!!')
elif not poseQuery: #if pose is not named, raises a warning
cmds.warning('Please name the pose!!')
if not charQuery: #if a character is not selected, raises a warning
cmds.warning('Please select a character!!')
poses = os.listdir(self.fileLoc + '/Characters/'+ charQuery[0]) #gets files in directory
poseFile =('POSE_' + poseQuery + '.txt') #gets pose name
if poseFile in poses: # if a file with the same name already exists, raises a warning.
cmds.warning('There is already a pose with that name!!')
return False
else: #else: runs writeFile
cmds.select(cl=True) #clears selection
self.outputDict()
# Get file name from user and write to file
self.fileNameQuery = cmds.textFieldGrp(self.fileName,query=True,text=True) #queries the file name
if (self.fileNameQuery =='') or (self.fileNameQuery == 'Please enter desired file name'):
cmds.warning('Please name the file!') #if the text box is empy, requests input.
else:
self.folderQuery = cmds.textScrollList(self.folderName, q = True, selectItem = True) #Queries the text scroll list for character name
self.listFiles = os.listdir(self.fileLoc + "/Characters") #lists files in the characters directory
if not self.folderQuery: #if there's nothing selected, raises a warning
cmds.warning('Select a character!!')
else:
self.listSubFiles = os.listdir(self.fileLoc + '/Characters/' + self.folderQuery[0]) #lists the files in the character folder
self.listToAdd = [] #defines listToAdd
cmds.textScrollList(self.poseToLoad, e= True, removeAll = True) #empties the textScrollList
with open(self.fileLoc + '/Characters/' +self.folderQuery[0] + '/POSE_' + self.fileNameQuery + '.txt', "w+") as fileOpen: #opens the file
fileOpen.write(cPickle.dumps (self.infoDict)) #dumps cpickle into file
fileOpen.close() #closes file
charQuery = cmds.textScrollList(self.folderName, q = True, selectItem = True) #Queries the character name
poseQuery = cmds.textFieldGrp(self.fileName, q = True, text = True) #queries the pose name
picName = (self.fileLoc + '/Images/'+ charQuery[0] + '/POSE_' + poseQuery) # defines pic name
picNameB = (picName) #is useless
cmds.playblast(format = 'image', frame = 1, f = picNameB) #creates image for preview
self.listDir = os.listdir(self.fileLoc + "/Characters/" + self.folderQuery[0]) # lists the directory
# Update option Menu
#if item is not in the list, adds it to directory
if not self.folderQuery:
cmds.warning('Please select a character!!')
else:
for items in os.listdir(self.fileLoc + "/Characters/"+ self.folderQuery[0]):# for every item in the pose directory
if items not in self.listToAdd:#if the item is not in the list to add
self.listToAdd.append(items) #adds it to the list
cmds.deleteUI(self.poseToLoad) # delete the UI element
self.poseToLoad = cmds.textScrollList(parent = self.refreshLayout, numberOfRows=8, allowMultiSelection= False, append = self.listToAdd, sc = self.refreshPic, en = True) #recreates the UI element
else:
cmds.warning('There is already a pose with that name!') #raises a warning
if not self.folderQuery:
cmds.warning('Please Select a character') #raises a warning
开发者ID:ercluhn,项目名称:Scripts,代码行数:58,代码来源:elPoser2.py
示例13: get_thumbnail
def get_thumbnail(self):
for camera in mc.listCameras():
if camera == "persp":
pass
else:
mm.eval("viewFit -all;")
mc.lookThru(camera)
mc.playblast( cf= "H:\\Image Test\\" + camera + ".jpg" , fr=1, fmt="image", v=False, wh=[500, 300], orn=False,
compression="jpg", quality=100, percent=100 )
开发者ID:ThibH,项目名称:software_scripts,代码行数:9,代码来源:thumbnail_without_camera.py
示例14: snapshot
def snapshot(path = None, width = 96, height = 96):
current_image_format = cmds.getAttr("defaultRenderGlobals.imageFormat")
cmds.setAttr("defaultRenderGlobals.imageFormat", 32) # *.png
#path = "/Users/liorbenhorin/Library/Preferences/Autodesk/maya/2015-x64/scripts/pipeline/thumb.png"
cmds.playblast(cf = path, fmt="image", frame = cmds.currentTime( query=True ), orn=False, wh = [width,height], p=100, v=False)
cmds.setAttr("defaultRenderGlobals.imageFormat", current_image_format)
if os.path.isfile(path):
return path
else:
return False
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:11,代码来源:maya_warpper.py
示例15: _generate_quicktime
def _generate_quicktime(quicktime_path):
"""
Returns a Quicktime object with info about the generated quicktime.
"""
quicktime_dir = os.path.dirname(quicktime_path)
if not os.path.exists(quicktime_dir):
try:
os.makedirs(quicktime_dir)
except os.error as e:
return Quicktime(
success=False,
error_msg=str(e),
frame_count=None,
frame_range=None,
first_frame=None,
last_frame=None,
path=None,
)
# use the min/max frames from frame slider
first_frame = int(cmds.playbackOptions(query=True, minTime=True))
last_frame = int(cmds.playbackOptions(query=True, maxTime=True))
# initiate the playblast
try:
cmds.playblast(
compression="jpeg",
endTime=last_frame,
filename=quicktime_path,
forceOverwrite=True,
format="movie",
offScreen=True,
startTime=first_frame,
viewer=False,
)
except Exception as e:
error_msg = str(e)
success = False
else:
error_msg = None
success = True
# return all the info for the new quicktime
return Quicktime(
success=success,
error_msg=error_msg,
frame_count=int(last_frame - first_frame + 1),
frame_range="{f}-{l}".format(f=first_frame, l=last_frame),
first_frame=first_frame,
last_frame=last_frame,
path=quicktime_path,
)
开发者ID:loneyliu,项目名称:tk-app-demo,代码行数:54,代码来源:action.py
示例16: playblast
def playblast(path = None,format = None, compression = None, hud = None, offscreen = None, range=None, scale = None):
if range is None:
range = playback_selection_range()
print range
if range is None:
start = cmds.playbackOptions( q=True,min=True )
end = cmds.playbackOptions( q=True,max=True )
range = [start, end]
cmds.playblast(startTime =range[0] ,endTime =range[1], f = path, fmt=format, orn=hud, os=offscreen, wh = scene_resolution(), p=scale, qlt=90,c=compression, v=True, s = qeury_active_sound_node())
开发者ID:liorbenhorin,项目名称:pipeline,代码行数:12,代码来源:maya_warpper.py
示例17: SundayWarehouseViewPortCreateIcon
def SundayWarehouseViewPortCreateIcon():
iconFile = cmds.internalVar(userTmpDir = True) + 'SundayWarehouseIcon_' + time.strftime('%a-%d-%b-%Y_%H-%M-%S', gmtime()) + '.png'
iconSize = [
512,
512]
curRenderImage = cmds.getAttr('defaultRenderGlobals.imageFormat')
cmds.setAttr('defaultRenderGlobals.imageFormat', 32)
cmds.playblast(forceOverwrite = True, framePadding = 0, viewer = False, showOrnaments = False, frame = cmds.currentTime(query = True), widthHeight = iconSize, percent = 100, format = 'iff', compression = 'png', filename = iconFile)
cmds.setAttr('defaultRenderGlobals.imageFormat', curRenderImage)
icon = iconFile + '.0.png'
cmds.iconTextButton('iconImage', edit = True, image = icon)
cmds.button('whCreateIcon', edit = True, label = 'Re-Create Icon')
开发者ID:elliottjames,项目名称:jeeves,代码行数:12,代码来源:SundayWarehousePy.py
示例18: capture
def capture(s, pixels, camera, frame):
"""
Capture a thumbnail
"""
# Validate our inputs
if not cmds.objExists(camera):
raise RuntimeError, "%s does not exist." % camera
if not pixels or type(pixels) != int:
raise RuntimeError, "No valid size provided"
# Collect information:
view = cmds.playblast(activeEditor=True) # Panel to capture from
state = cmds.modelEditor(view, q=True, sts=True)
oldFrame = cmds.currentTime(q=True) # Get current time
imgFormat = cmds.getAttr("defaultRenderGlobals.imageFormat")
selection = cmds.ls(sl=True) # Current selection
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as f: path = Temp_Path(f.name)
# Capture our thumbnail
try:
cmds.currentTime(frame)
cmds.select(cl=True) # Clear selection for pretty image
cmds.setAttr("defaultRenderGlobals.imageFormat", 32)
cmds.modelEditor( # Tweak nice default visuals
view,
e=True,
grid=False,
camera=camera,
da="smoothShaded",
allObjects=False,
nurbsSurfaces=True,
polymeshes=True,
subdivSurfaces=True,
displayTextures=True,
)
cmds.playblast(
frame=frame, # Frame range
fo=True, # Force override the file if it exists
viewer=False, # Don't popup window during render
width=pixels*2, # Width in pixels, duh
height=pixels*2, # Height in pixels. Who knew
showOrnaments=False, # Hide tools, ie move tool etc
format="image", # We just want a single image
completeFilename=f.name.replace("\\", "/") # Output file
)
# # Put everything back as we found it.
finally:
# Reset options
cmds.currentTime(oldFrame)
cmds.select(selection, r=True)
cmds.setAttr("defaultRenderGlobals.imageFormat", imgFormat)
mel.eval("$editorName = \"%s\"" % view)
mel.eval(state)
return path
开发者ID:internetimagery,项目名称:clipStore,代码行数:52,代码来源:thumb.py
示例19: thumbnailFromPlayBlast
def thumbnailFromPlayBlast(filepath, width, height):
'''
Generate a ThumbNail of the screen
Note: 'cf' flag is broken in 2012
:param filepath: path to Thumbnail
:param width: width of capture
:param height: height of capture
'''
filepath=os.path.splitext(filepath)[0]
filename=os.path.basename(filepath)
filedir=os.path.dirname(filepath)
#get modelPanel and camera
win = cmds.playblast(activeEditor=True).split('|')[-1]
cam = cmds.modelPanel(win, q=True, camera=True)
if not cmds.nodeType(cam) == 'camera':
cam = cmds.listRelatives(cam)[0]
storedformat = cmds.getAttr('defaultRenderGlobals.imageFormat')
storedResolutionGate = cmds.getAttr('%s.filmFit' % cam)
cmds.setAttr('defaultRenderGlobals.imageFormat', 20)
cmds.setAttr('%s.filmFit' % cam, 2) # set to Vertical so we don't get so much overscan
cmds.playblast(frame=cmds.currentTime(q=True), # startTime=cmds.currentTime(q=True),
# endTime=cmds.currentTime(q=True),
format="image",
filename=filepath,
width=width,
height=height,
percent=100,
quality=90,
forceOverwrite=True,
framePadding=0,
showOrnaments=False,
compression="BMP",
viewer=False)
cmds.setAttr('defaultRenderGlobals.imageFormat', storedformat)
cmds.setAttr('%s.filmFit' % cam, storedResolutionGate)
#Why do this rename? In Maya2012 the 'cf' flag fails which means you have to use
#the 'f' flag and that adds framePadding, crap I know! So we strip it and rename
#the file after it's made.
try:
newfile=[f for f in os.listdir(filedir)
if f.split('.bmp')[0].split('.')[0] == filename and not
'.pose' in f]
log.debug('Original Playblast file : %s' % newfile)
os.rename(os.path.join(filedir, newfile[0]), '%s.bmp' % filepath)
log.debug('Thumbnail Renamed : %s' % ('%s.bmp' % filepath))
return '%s.bmp' % filepath
except:
pass
开发者ID:satishgoda,项目名称:Red9_StudioPack,代码行数:52,代码来源:Red9_General.py
示例20: viewportSnapshot
def viewportSnapshot():
"""
This definition does a viewport snapshot.
"""
filter = "Tif files (*.tif)"
file = cmds.fileDialog2(fileFilter=filter, fm=0, dialogStyle=2)
if file:
imageFormat = cmds.getAttr("defaultRenderGlobals.imageFormat")
cmds.setAttr("defaultRenderGlobals.imageFormat", 3)
cmds.playblast(frame=[cmds.getAttr("time1.outTime")], format="image", os=True, quality=100, p=100, cf=file[0])
cmds.setAttr("defaultRenderGlobals.imageFormat", imageFormat)
开发者ID:maximveksler,项目名称:Snippets,代码行数:13,代码来源:viewportSnapshot.py
注:本文中的maya.cmds.playblast函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论