Merged in feature/PYPE-300-maya-viewport-playblast-presets (pull request #171)

add preset loading to extractin quicktime and thumbnail from maya

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Milan Kolar 2019-06-11 20:35:27 +00:00
commit 7aefc66f66
3 changed files with 29 additions and 14 deletions

View file

@ -2106,12 +2106,15 @@ def bake_to_world_space(nodes,
return world_space_nodes
def load_capture_preset(path):
def load_capture_preset(path=None, data=None):
import capture_gui
import capture
path = path
preset = capture_gui.lib.load_json(path)
if data:
preset = data
else:
path = path
preset = capture_gui.lib.load_json(path)
print preset
options = dict()
@ -2164,8 +2167,8 @@ def load_capture_preset(path):
for key in preset[id]:
if key == 'high_quality':
temp_options2['multiSampleEnable'] = True
temp_options2['multiSampleCount'] = 4
temp_options2['textureMaxResolution'] = 512
temp_options2['multiSampleCount'] = 8
temp_options2['textureMaxResolution'] = 1024
temp_options2['enableTextureMaxRes'] = True
if key == 'alphaCut' :

View file

@ -9,9 +9,11 @@ import pype.maya.lib as lib
import pype.api
import avalon.maya
from pypeapp import config
from maya import cmds, mel
import pymel.core as pm
from pype.vendor import ffmpeg
# from pype.scripts import otio_burnin
reload(ffmpeg)
@ -51,9 +53,10 @@ class ExtractQuicktime(pype.api.Extractor):
# get cameras
camera = instance.data['review_camera']
capture_preset = ""
capture_preset = instance.context.data['presets']['maya']['capture']
try:
preset = lib.load_capture_preset(capture_preset)
preset = lib.load_capture_preset(data=capture_preset)
except:
preset = {}
self.log.info('using viewport preset: {}'.format(capture_preset))
@ -106,7 +109,9 @@ class ExtractQuicktime(pype.api.Extractor):
self.log.info("input {}".format(input_path))
movieFile = filename + ".mov"
full_movie_path = os.path.join(stagingdir, movieFile)
# movieFileBurnin = filename + "Burn" + ".mov"
movieFilefull_movie_path = os.path.join(stagingdir, movieFile)
self.log.info("output {}".format(full_movie_path))
with avalon.maya.suspended_refresh():
try:
@ -123,12 +128,21 @@ class ExtractQuicktime(pype.api.Extractor):
self.log.error(ffmpeg_error)
raise RuntimeError(ffmpeg_error)
# burnin_data = {
# "username": 'milan.kolar',
# "shot": 'sh010',
# "task": 'layout'
# }
#
# full_burnin_path = os.path.join(stagingdir, movieFileBurnin)
# otio_burnin.burnins_from_data(full_movie_path, full_burnin_path, burnin_data)
if "representations" not in instance.data:
instance.data["representations"] = []
representation = {
'name': 'mov',
'ext': '.mov',
'ext': 'mov',
'files': movieFile,
"stagingDir": stagingdir,
'startFrame': start,
@ -139,7 +153,6 @@ class ExtractQuicktime(pype.api.Extractor):
instance.data["representations"].append(representation)
@contextlib.contextmanager
def maintained_time():
ct = cmds.currentTime(query=True)

View file

@ -50,7 +50,6 @@ class ExtractThumbnail(pype.api.Extractor):
members = instance.data['setMembers']
camera = instance.data['review_camera']
# project_code = ftrack_data['Project']['code']
# task_type = ftrack_data['Task']['type']
#
@ -82,13 +81,14 @@ class ExtractThumbnail(pype.api.Extractor):
# preset_to_use = default_preset_path
capture_preset = ""
capture_preset = instance.context.data['presets']['maya']['capture']
try:
preset = lib.load_capture_preset(capture_preset)
preset = lib.load_capture_preset(data=capture_preset)
except:
preset = {}
self.log.info('using viewport preset: {}'.format(capture_preset))
#preset["off_screen"] = False
# preset["off_screen"] = False
preset['camera'] = camera
preset['format'] = "image"
@ -145,7 +145,6 @@ class ExtractThumbnail(pype.api.Extractor):
instance.data["representations"].append(representation)
@contextlib.contextmanager
def maintained_time():
ct = cmds.currentTime(query=True)