Skip to content

Commit

Permalink
added new entry-point render_and_submit_path()
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Brainerd committed Dec 16, 2017
1 parent f4fedd6 commit ee874b0
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,40 @@ def render_and_submit_version(self, template, fields, first_frame, last_frame, s
:param progress_cb: A callback to report progress with.
:param color_space: The colorspace of the rendered frames
:returns: The Version Shotgun entity dictionary that was created.
"""
# Make sure we don't overwrite the caller's fields
fields = copy.copy(fields)

# Tweak fields so that we'll be getting nuke formated sequence markers (%03d, %04d etc):
for key_name in [key.name for key in template.keys.values() if isinstance(key, sgtk.templatekey.SequenceKey)]:
fields[key_name] = "FORMAT: %d"

# Get our input path for frames to convert to movie
path = template.apply_fields(fields)

# call new version
return self.render_and_submit_path(path, fields, first_frame, last_frame, sg_publishes, sg_task,
comment, thumbnail_path, progress_cb, color_space, *args, **kwargs)


def render_and_submit_path(self, path, fields, first_frame, last_frame, sg_publishes, sg_task,
comment, thumbnail_path, progress_cb, color_space=None, *args, **kwargs):
"""
Main application entry point to be called by other applications / hooks.
:param path: The path where frames should be found.
:param fields: Dictionary of fields to be used to fill out the template with.
:param first_frame: The first frame of the sequence of frames.
:param last_frame: The last frame of the sequence of frames.
:param sg_publishes: A list of shotgun published file objects to link the publish against.
:param sg_task: A Shotgun task object to link against. Can be None.
:param comment: A description to add to the Version in Shotgun.
:param thumbnail_path: The path to a thumbnail to use for the version when the movie isn't
being uploaded to Shotgun (this is set in the config)
:param progress_cb: A callback to report progress with.
:param color_space: The colorspace of the rendered frames
:returns: The Version Shotgun entity dictionary that was created.
"""
tk_multi_reviewsubmission = self.import_module("tk_multi_reviewsubmission")
Expand All @@ -85,13 +119,6 @@ def render_and_submit_version(self, template, fields, first_frame, last_frame, s
# Make sure we don't overwrite the caller's fields
fields = copy.copy(fields)

# Tweak fields so that we'll be getting nuke formated sequence markers (%03d, %04d etc):
for key_name in [key.name for key in template.keys.values() if isinstance(key, sgtk.templatekey.SequenceKey)]:
fields[key_name] = "FORMAT: %d"

# Get our input path for frames to convert to movie
path = template.apply_fields(fields)

# Movie output width and height
width = self.get_setting("movie_width")
height = self.get_setting("movie_height")
Expand Down

0 comments on commit ee874b0

Please sign in to comment.