From f44ff17f8fd54d4b4c7ea9802585953ca5ebf5b0 Mon Sep 17 00:00:00 2001 From: Derek Severin Date: Tue, 1 Jun 2021 14:32:35 +0700 Subject: [PATCH] Maya capture 'isolate_view' fix --- openpype/hosts/maya/api/lib.py | 20 +++---------------- .../maya/plugins/publish/extract_playblast.py | 8 ++++++-- .../maya/plugins/publish/extract_thumbnail.py | 13 ++++++------ 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/openpype/hosts/maya/api/lib.py b/openpype/hosts/maya/api/lib.py index 909993a173..1502642d31 100644 --- a/openpype/hosts/maya/api/lib.py +++ b/openpype/hosts/maya/api/lib.py @@ -2139,11 +2139,7 @@ def load_capture_preset(path=None, data=None): # GENERIC id = 'Generic' for key in preset[id]: - if key.startswith('isolate'): - pass - # options['isolate'] = preset[id][key] - else: - options[str(key)] = preset[id][key] + options[str(key)] = preset[id][key] # RESOLUTION id = 'Resolution' @@ -2153,9 +2149,9 @@ def load_capture_preset(path=None, data=None): # DISPLAY OPTIONS id = 'Display Options' disp_options = {} - for key in preset['Display Options']: + for key in preset[id]: if key.startswith('background'): - disp_options[key] = preset['Display Options'][key] + disp_options[key] = preset[id][key] else: disp_options['displayGradient'] = True @@ -2220,16 +2216,6 @@ def load_capture_preset(path=None, data=None): # use active sound track scene = capture.parse_active_scene() options['sound'] = scene['sound'] - cam_options = dict() - cam_options['overscan'] = 1.0 - cam_options['displayFieldChart'] = False - cam_options['displayFilmGate'] = False - cam_options['displayFilmOrigin'] = False - cam_options['displayFilmPivot'] = False - cam_options['displayGateMask'] = False - cam_options['displayResolution'] = False - cam_options['displaySafeAction'] = False - cam_options['displaySafeTitle'] = False # options['display_options'] = temp_options diff --git a/openpype/hosts/maya/plugins/publish/extract_playblast.py b/openpype/hosts/maya/plugins/publish/extract_playblast.py index 0dc91d67a9..adc630aa26 100644 --- a/openpype/hosts/maya/plugins/publish/extract_playblast.py +++ b/openpype/hosts/maya/plugins/publish/extract_playblast.py @@ -45,7 +45,11 @@ class ExtractPlayblast(openpype.api.Extractor): # get cameras camera = instance.data['review_camera'] - preset = lib.load_capture_preset(data=self.capture_preset) + try: + preset = lib.load_capture_preset(data=self.capture_preset) + except KeyError as ke: + self.log.error('Error loading capture presets: {}'.format(str(ke))) + preset = {} preset['camera'] = camera @@ -75,7 +79,7 @@ class ExtractPlayblast(openpype.api.Extractor): # Isolate view is requested by having objects in the set besides a # camera. - if instance.data.get("isolate"): + if preset.pop("isolate_view", False) or instance.data.get("isolate"): preset["isolate"] = instance.data["setMembers"] # Show/Hide image planes on request. diff --git a/openpype/hosts/maya/plugins/publish/extract_thumbnail.py b/openpype/hosts/maya/plugins/publish/extract_thumbnail.py index 016efa6499..c321023e85 100644 --- a/openpype/hosts/maya/plugins/publish/extract_thumbnail.py +++ b/openpype/hosts/maya/plugins/publish/extract_thumbnail.py @@ -12,10 +12,10 @@ import pymel.core as pm class ExtractThumbnail(openpype.api.Extractor): - """Extract a Camera as Alembic. + """Extract viewport thumbnail. - The cameras gets baked to world space by default. Only when the instance's - `bakeToWorldSpace` is set to False it will include its full hierarchy. + Takes review camera and creates a thumbnail based on viewport + capture. """ @@ -35,9 +35,10 @@ class ExtractThumbnail(openpype.api.Extractor): try: preset = lib.load_capture_preset(data=capture_preset) - except: + except KeyError as ke: + self.log.error('Error loading capture presets: {}'.format(str(ke))) preset = {} - self.log.info('using viewport preset: {}'.format(capture_preset)) + self.log.info('Using viewport preset: {}'.format(preset)) # preset["off_screen"] = False @@ -78,7 +79,7 @@ class ExtractThumbnail(openpype.api.Extractor): # Isolate view is requested by having objects in the set besides a # camera. - if instance.data.get("isolate"): + if preset.pop("isolate_view", False) or instance.data.get("isolate"): preset["isolate"] = instance.data["setMembers"] with maintained_time():