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

Maya: Re-use maintained_time from lib #3460

Merged
merged 4 commits into from
Jul 5, 2022
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
11 changes: 1 addition & 10 deletions openpype/hosts/maya/plugins/publish/extract_playblast.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def process(self, instance):
else:
preset["viewport_options"] = {"imagePlane": image_plane}

with maintained_time():
with lib.maintained_time():
filename = preset.get("filename", "%TEMP%")

# Force viewer to False in call to capture because we have our own
Expand Down Expand Up @@ -178,12 +178,3 @@ def process(self, instance):
'camera_name': camera_node_name
}
instance.data["representations"].append(representation)


@contextlib.contextmanager
def maintained_time():
ct = cmds.currentTime(query=True)
try:
yield
finally:
cmds.currentTime(ct, edit=True)
15 changes: 1 addition & 14 deletions openpype/hosts/maya/plugins/publish/extract_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import contextlib
import glob

import capture
Expand Down Expand Up @@ -28,7 +27,6 @@ def process(self, instance):

camera = instance.data['review_camera']

capture_preset = ""
capture_preset = (
instance.context.data["project_settings"]['maya']['publish']['ExtractPlayblast']['capture_preset']
)
Expand Down Expand Up @@ -103,9 +101,7 @@ def process(self, instance):
if preset.pop("isolate_view", False) and instance.data.get("isolate"):
preset["isolate"] = instance.data["setMembers"]

with maintained_time():
filename = preset.get("filename", "%TEMP%")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this unused variable was also removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it was copy->pasted from extract_playplast.


with lib.maintained_time():
# Force viewer to False in call to capture because we have our own
# viewer opening call to allow a signal to trigger between
# playblast and viewer
Expand Down Expand Up @@ -174,12 +170,3 @@ def _fix_playblast_output_path(self, filepath):
filepath = max(files, key=os.path.getmtime)

return filepath


@contextlib.contextmanager
def maintained_time():
ct = cmds.currentTime(query=True)
try:
yield
finally:
cmds.currentTime(ct, edit=True)