From af39c49c7018f18bb102281e83134e13ac6ac2f8 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Tue, 11 Jun 2019 22:33:00 +0200 Subject: [PATCH] add preset loading to extractin quicktime and thumbnail from maya --- pype/maya/lib.py | 13 +++++++---- .../plugins/maya/publish/extract_quicktime.py | 23 +++++++++++++++---- .../plugins/maya/publish/extract_thumbnail.py | 7 +++--- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/pype/maya/lib.py b/pype/maya/lib.py index 818e490764..f45ca3000b 100644 --- a/pype/maya/lib.py +++ b/pype/maya/lib.py @@ -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' : diff --git a/pype/plugins/maya/publish/extract_quicktime.py b/pype/plugins/maya/publish/extract_quicktime.py index caabf9560c..868abdc3cd 100644 --- a/pype/plugins/maya/publish/extract_quicktime.py +++ b/pype/plugins/maya/publish/extract_quicktime.py @@ -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) diff --git a/pype/plugins/maya/publish/extract_thumbnail.py b/pype/plugins/maya/publish/extract_thumbnail.py index 355aa2b08b..4bc1d91174 100644 --- a/pype/plugins/maya/publish/extract_thumbnail.py +++ b/pype/plugins/maya/publish/extract_thumbnail.py @@ -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)