本文整理汇总了Python中maya.cmds.playbackOptions方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.playbackOptions方法的具体用法?Python cmds.playbackOptions怎么用?Python cmds.playbackOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.cmds
的用法示例。
在下文中一共展示了cmds.playbackOptions方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: playblast_snapshot
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def playblast_snapshot(path = None,format = None, compression = None, hud = None, offscreen = None, range=None, scale = None):
current_image_format = cmds.getAttr("defaultRenderGlobals.imageFormat")
cmds.setAttr("defaultRenderGlobals.imageFormat", 32) # *.png
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(frame =int((range[0] + range[1])/2), cf = path, fmt="image", orn=hud, os=offscreen, wh = scene_resolution(), p=scale, v=False)
cmds.setAttr("defaultRenderGlobals.imageFormat", current_image_format)
示例2: parse_active_scene
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def parse_active_scene():
"""Parse active scene for arguments for capture()
*Resolution taken from render settings.
"""
time_control = mel.eval("$gPlayBackSlider = $gPlayBackSlider")
return {
"start_frame": cmds.playbackOptions(minTime=True, query=True),
"end_frame": cmds.playbackOptions(maxTime=True, query=True),
"width": cmds.getAttr("defaultResolution.width"),
"height": cmds.getAttr("defaultResolution.height"),
"compression": cmds.optionVar(query="playblastCompression"),
"filename": (cmds.optionVar(query="playblastFile")
if cmds.optionVar(query="playblastSaveToFile") else None),
"format": cmds.optionVar(query="playblastFormat"),
"off_screen": (True if cmds.optionVar(query="playblastOffscreen")
else False),
"show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
else False),
"quality": cmds.optionVar(query="playblastQuality"),
"sound": cmds.timeControl(time_control, q=True, sound=True) or None
}
示例3: test_parse_active_scene
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def test_parse_active_scene():
"""parse_active_scene() works"""
parsed = capture.parse_active_scene()
reference = {
"start_frame": cmds.playbackOptions(minTime=True, query=True),
"end_frame": cmds.playbackOptions(maxTime=True, query=True),
"width": cmds.getAttr("defaultResolution.width"),
"height": cmds.getAttr("defaultResolution.height"),
"compression": cmds.optionVar(query="playblastCompression"),
"filename": (cmds.optionVar(query="playblastFile")
if cmds.optionVar(query="playblastSaveToFile") else None),
"format": cmds.optionVar(query="playblastFormat"),
"off_screen": (True if cmds.optionVar(query="playblastOffscreen")
else False),
"show_ornaments": (True if cmds.optionVar(query="playblastShowOrnaments")
else False),
"quality": cmds.optionVar(query="playblastQuality")
}
for key, value in reference.items():
assert parsed[key] == value
示例4: frameRange
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def frameRange(start=None, end=None):
'''
Returns the frame range based on the highlighted timeslider,
or otherwise the playback range.
'''
if not start and not end:
gPlayBackSlider = mm.eval('$temp=$gPlayBackSlider')
if mc.timeControl(gPlayBackSlider, query=True, rangeVisible=True):
frameRange = mc.timeControl(gPlayBackSlider, query=True, rangeArray=True)
start = frameRange[0]
end = frameRange[1]-1
else:
start = mc.playbackOptions(query=True, min=True)
end = mc.playbackOptions(query=True, max=True)
return start,end
示例5: draw
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def draw(self):
"""
Take all the marker information and fill in the utils.QWidget covering the
timeline. This function will be called by the update and paintEvent
function.
"""
# get animation range
self.start = cmds.playbackOptions(query=True, min=True)
self.end = cmds.playbackOptions(query=True, max=True)
# calculate frame width
self.total = self.width()
self.step = (self.total - (self.total*0.01)) / (self.end-self.start+1)
# validate marker information
if not self.frames or not self.colors:
return
# setup painter and pen
painter = utils.QPainter(self)
pen = utils.QPen()
pen.setWidth(self.step)
# draw Lines for each frame
for f, c in zip(self.frames, self.colors):
pen.setColor(utils.QColor(c[0], c[1], c[2], 50))
# calculate line position
pos = (f-self.start+0.5) * self.step + (self.total*0.005)
line = utils.QLineF(utils.QPointF(pos, 0), utils.QPointF(pos, 100))
painter.setPen( pen )
painter.drawLine( line )
# ------------------------------------------------------------------------
示例6: rewind
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def rewind():
cmds.currentTime(1)
cmds.playbackOptions(minTime=1)
示例7: playblast
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
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())
示例8: getTimeRange
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def getTimeRange(self):
""""""
if self.isStartEnd():
start = int(self.getStartTime())
end = int(self.getEndTime())
return start, end
start = int(cmds.playbackOptions(q=1, min=1))
end = int(cmds.playbackOptions(q=1, max=1))
return start, end
#----------------------------------------------------------------------
示例9: createMush
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def createMush(self):
mesh = self.sourceField.text()
if not mesh:
return
if cmds.objExists(mesh + '_Mush'):
print(mesh + '_Mush already exists!')
return
cmds.currentTime(cmds.playbackOptions(q=True, min=True))
dup = cmds.duplicate(mesh, inputConnections=True, n=mesh + '_Mush')
cmds.deltaMush(dup, smoothingIterations=20, smoothingStep=0.5, pinBorderVertices=True, envelope=1)
示例10: get_time_slider_range
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def get_time_slider_range(highlighted=True,
withinHighlighted=True,
highlightedOnly=False):
"""Return the time range from Maya's time slider.
Arguments:
highlighted (bool): When True if will return a selected frame range
(if there's any selection of more than one frame!) otherwise it
will return min and max playback time.
withinHighlighted (bool): By default Maya returns the highlighted range
end as a plus one value. When this is True this will be fixed by
removing one from the last number.
Returns:
list: List of two floats of start and end frame numbers.
"""
if highlighted is True:
gPlaybackSlider = mel.eval("global string $gPlayBackSlider; "
"$gPlayBackSlider = $gPlayBackSlider;")
if cmds.timeControl(gPlaybackSlider, query=True, rangeVisible=True):
highlightedRange = cmds.timeControl(gPlaybackSlider,
query=True,
rangeArray=True)
if withinHighlighted:
highlightedRange[-1] -= 1
return highlightedRange
if not highlightedOnly:
return [cmds.playbackOptions(query=True, minTime=True),
cmds.playbackOptions(query=True, maxTime=True)]
示例11: reset_frame_range
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def reset_frame_range():
"""Set frame range to current asset"""
shot = api.Session["AVALON_ASSET"]
shot = io.find_one({"name": shot, "type": "asset"})
try:
frame_start = shot["data"].get(
"frameStart",
# backwards compatibility
shot["data"].get("edit_in")
)
frame_end = shot["data"].get(
"frameEnd",
# backwards compatibility
shot["data"].get("edit_out")
)
except KeyError:
cmds.warning("No edit information found for %s" % shot["name"])
return
fps = {15: 'game',
24: 'film',
25: 'pal',
30: 'ntsc',
48: 'show',
50: 'palf',
60: 'ntscf',
23.98: '23.976fps',
23.976: '23.976fps',
29.97: '29.97fps',
47.952: '47.952fps',
47.95: '47.952fps',
59.94: '59.94fps',
44100: '44100fps',
48000: '48000fps'
}.get(float(api.Session.get("AVALON_FPS", 25)), "pal")
cmds.currentUnit(time=fps)
cmds.playbackOptions(minTime=frame_start)
cmds.playbackOptions(maxTime=frame_end)
cmds.playbackOptions(animationStartTime=frame_start)
cmds.playbackOptions(animationEndTime=frame_end)
cmds.playbackOptions(minTime=frame_start)
cmds.playbackOptions(maxTime=frame_end)
cmds.currentTime(frame_start)
示例12: apply_scene
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def apply_scene(**options):
"""Apply options from scene
Example:
>>> apply_scene({"start_frame": 1009})
Arguments:
options (dict): Scene options
"""
if "start_frame" in options:
cmds.playbackOptions(minTime=options["start_frame"])
if "end_frame" in options:
cmds.playbackOptions(maxTime=options["end_frame"])
if "width" in options:
cmds.setAttr("defaultResolution.width", options["width"])
if "height" in options:
cmds.setAttr("defaultResolution.height", options["height"])
if "compression" in options:
cmds.optionVar(
stringValue=["playblastCompression", options["compression"]])
if "filename" in options:
cmds.optionVar(
stringValue=["playblastFile", options["filename"]])
if "format" in options:
cmds.optionVar(
stringValue=["playblastFormat", options["format"]])
if "off_screen" in options:
cmds.optionVar(
intValue=["playblastFormat", options["off_screen"]])
if "show_ornaments" in options:
cmds.optionVar(
intValue=["show_ornaments", options["show_ornaments"]])
if "quality" in options:
cmds.optionVar(
floatValue=["playblastQuality", options["quality"]])
示例13: setExportFlags
# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import playbackOptions [as 别名]
def setExportFlags(self, uNode):
# set export properties from the fbxExportPropertiesDict of the uNode
fbxDict = uNode.fbxExportProperties
if fbxDict['triangulation'] == True:
mel.eval("FBXExportTriangulate -v true")
else:
mel.eval("FBXExportTriangulate -v false")
# Mesh
mel.eval("FBXExportSmoothingGroups -v true")
mel.eval("FBXExportHardEdges -v false")
mel.eval("FBXExportTangents -v true")
mel.eval("FBXExportInstances -v false")
mel.eval("FBXExportInAscii -v true")
mel.eval("FBXExportSmoothMesh -v false")
# Animation
mel.eval("FBXExportBakeResampleAnimation -v true")
mel.eval("FBXExportBakeComplexAnimation -v true")
mel.eval("FBXExportBakeComplexStart -v "+str(cmds.playbackOptions(minTime=1, q=1)))
mel.eval("FBXExportBakeComplexEnd -v "+str(cmds.playbackOptions(maxTime=1, q=1)))
mel.eval("FBXExportReferencedAssetsContent -v true")
mel.eval("FBXExportBakeComplexStep -v 1")
mel.eval("FBXExportUseSceneName -v false")
mel.eval("FBXExportQuaternion -v quaternion")
mel.eval("FBXExportShapes -v true")
mel.eval("FBXExportSkins -v true")
if fbxDict['animInterpolation'] == 'euler':
mel.eval("FBXExportQuaternion -v euler")
elif fbxDict['animInterpolation'] == 'resample':
mel.eval("FBXExportQuaternion -v resample")
if fbxDict['upAxis'].lower() == 'y':
print 'FBX EXPORT OVERRIDE: setting y up axis'
mel.eval("FBXExportUpAxis y")
elif fbxDict['upAxis'].lower() == 'z':
print 'FBX EXPORT OVERRIDE: setting Z up axis'
mel.eval("FBXExportUpAxis z")
#garbage we don't want
# Constraints
mel.eval("FBXExportConstraints -v false")
# Cameras
mel.eval("FBXExportCameras -v false")
# Lights
mel.eval("FBXExportLights -v false")
# Embed Media
mel.eval("FBXExportEmbeddedTextures -v false")
# Connections
mel.eval("FBXExportInputConnections -v false")