Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya capture 'isolate_view' fix + minor corrections #1614

Merged
merged 3 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions pype/hosts/maya/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2126,15 +2126,13 @@ def _get_attrs(node):
return world_space_nodes


def load_capture_preset(path=None, data=None):
import capture_gui
def load_capture_preset(data=None):
import capture

if data:
preset = data
else:
path = path
preset = capture_gui.lib.load_json(path)
return {}
print(preset)

options = dict()
Expand All @@ -2147,11 +2145,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'
Expand All @@ -2161,9 +2155,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

Expand Down Expand Up @@ -2231,16 +2225,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

Expand Down
14 changes: 7 additions & 7 deletions pype/plugins/maya/publish/extract_playblast.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ def process(self, instance):

# get cameras
camera = instance.data['review_camera']
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = instance.context.data.get(
'presets', {}).get('maya', {}).get('capture')

try:
preset = lib.load_capture_preset(data=capture_preset)
except Exception:
except Exception as exc:
self.log.error(
'Error loading capture presets: {}'.format(str(exc)))
preset = {}
self.log.info('using viewport preset: {}'.format(preset))
self.log.info('Using viewport preset: {}'.format(preset))

preset['camera'] = camera
preset['format'] = "image"
Expand Down Expand Up @@ -78,7 +81,7 @@ def process(self, instance):

# 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.
Expand All @@ -96,9 +99,6 @@ def process(self, instance):
# playblast and viewer
preset['viewer'] = False

# Remove panel key since it's internal value to capture_gui
preset.pop("panel", None)

path = capture.capture(**preset)


Expand Down
22 changes: 11 additions & 11 deletions pype/plugins/maya/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@


class ExtractThumbnail(pype.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.

"""

Expand All @@ -28,13 +28,16 @@ def process(self, instance):

camera = instance.data['review_camera']

capture_preset = ""
capture_preset = instance.context.data['presets']['maya']['capture']
capture_preset = instance.context.data.get(
'presets', {}).get('maya', {}).get('capture')

try:
preset = lib.load_capture_preset(data=capture_preset)
except:
except Exception as exc:
self.log.error(
'Error loading capture presets: {}'.format(str(exc)))
preset = {}
self.log.info('using viewport preset: {}'.format(capture_preset))
self.log.info('Using viewport preset: {}'.format(preset))

# preset["off_screen"] = False

Expand Down Expand Up @@ -75,7 +78,7 @@ def process(self, instance):

# 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():
Expand All @@ -86,9 +89,6 @@ def process(self, instance):
# playblast and viewer
preset['viewer'] = False

# Remove panel key since it's internal value to capture_gui
preset.pop("panel", None)

path = capture.capture(**preset)
playblast = self._fix_playblast_output_path(path)

Expand Down
29 changes: 0 additions & 29 deletions pype/vendor/capture_gui/__init__.py

This file was deleted.

Loading