Skip to content

Commit

Permalink
Merge pull request #10 from nfa-vfxim/feature/issue-8/add-sound-to-ma…
Browse files Browse the repository at this point in the history
…ya-playblast-publishes

Feature/issue 8/add sound to maya playblast publishes
  • Loading branch information
mervinvb authored Jan 10, 2025
2 parents 22e9ce8 + 962d4ff commit 16d20a7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hooks/tk-maya/render_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def render(
description,
version,
engine_settings,
sound_path = None,
sound_offset = None,
):
"""
Render the media
Expand Down Expand Up @@ -65,6 +67,8 @@ def render(
description,
version,
engine_settings,
sound_path,
sound_offset,
)

old_motion_blur = maya.mel.eval('getAttr "hardwareRenderingGlobals.motionBlurEnable";')
Expand Down Expand Up @@ -131,6 +135,8 @@ def get_default_playblastlast_args(
description,
version,
engine_settings,
sound_path,
sound_offset,
):
"""
Build the playblast command arguments. This implementation grab the playblast arguments from Maya.
Expand All @@ -148,6 +154,7 @@ def get_default_playblastlast_args(
:param str description: Description to use in the slate for the output movie
:param int version: Version number to use for the output movie slate and burn-in
:param dict engine_settings: Engine specific settings to use for rendering
:param
:returns: Playblast arguments
:rtype: dict
Expand Down
5 changes: 5 additions & 0 deletions python/tk_multi_reviewsubmission2/create_slate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def run_slate(self, inputFile, outputFile, projectFile, settings):
if sgtk.util.is_windows():
logo_path = logo_path.replace(os.sep, "/")

sound_path = settings["sound_path"]
sound_offset = settings["sound_offset"]

# ensure output path exists
self.app.ensure_folder_exists(os.path.dirname(os.path.abspath(outputFile)))

Expand Down Expand Up @@ -102,6 +105,8 @@ def run_slate(self, inputFile, outputFile, projectFile, settings):
description,
str(fps),
logo_path,
str(sound_path),
str(sound_offset),
],
shell=True,
stdout=subprocess.PIPE,
Expand Down
12 changes: 12 additions & 0 deletions python/tk_multi_reviewsubmission2/review_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@ def __init__(self, app, parent=None):
maya.cmds.getAttr("defaultResolution.height")
)


audio_nodes = maya.cmds.ls(type="audio")
self.audio_filename = None
for audio_node in audio_nodes:
if audio_node is None: # Skip if the audio_node is None
continue
self.audio_filename = maya.cmds.getAttr(f"{audio_node}.filename")
self.audio_offset = maya.cmds.getAttr(f"{audio_node}.offset")


self.use_antialiasing = QtWidgets.QCheckBox("Anti-aliasing", self)
self.show_ornaments = QtWidgets.QCheckBox("Show ornaments", self)
self.show_ornaments.setChecked(True)
Expand Down Expand Up @@ -291,6 +301,8 @@ def run(progress):
input_settings["resolution"] = self.validate_resolution()
input_settings["description"] = self.validate_description()
input_settings["version"] = self.file_fields.get("version")
input_settings["sound_path"] = self.audio_filename
input_settings["sound_offset"] = self.audio_offset

if self.current_engine.name == "tk-houdini":
engine_settings["mplay"] = self.validate_mplay()
Expand Down
6 changes: 6 additions & 0 deletions python/tk_multi_reviewsubmission2/slate.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
description = sys.argv[13]
fps = float(sys.argv[14])
logo_path = sys.argv[15]
sound_path = sys.argv[16]
sound_offset = int(float(sys.argv[17]))

output_node = None

Expand Down Expand Up @@ -106,6 +108,10 @@ def __get_quicktime_settings():
settings["mov64_codec"] = 14
settings["mov64_quality_max"] = "3"
settings["mov64_fps"] = fps
if os.path.isfile(sound_path):
settings["mov64_audiofile"] = sound_path
settings["mov64_audio_offset"] = sound_offset - 1000
settings["mov64_units"] = "Frames"

# setting output colorspace
settings["colorspace"] = colorspace
Expand Down

0 comments on commit 16d20a7

Please sign in to comment.