Skip to content

Commit

Permalink
Rewrite to tk-multi-reviewsubmission2
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximumFX committed Jun 15, 2023
1 parent feec782 commit 14b1901
Show file tree
Hide file tree
Showing 35 changed files with 2,527 additions and 6,767 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ pip-log.txt

#Mr Developer
.mr.developer.cfg

# Jetbrains Pycharm
.idea
venv
167 changes: 21 additions & 146 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,146 +1,21 @@
SHOTGUN PIPELINE TOOLKIT SOURCE CODE LICENSE

Version: 7/07/2013

Shotgun Software Inc. ("Company") provides the Shotgun Pipeline Toolkit,
software, including source code, in this package or repository folder (the
"Shotgun Toolkit Code") subject to your acceptance of and compliance with
the following terms and conditions (the "License Terms"). By accessing,
downloading, copying, using or modifying any of the Shotgun Toolkit Code,
you agree to these License Terms.

Eligibility

The following license to the Shotgun Toolkit Code is valid only if and while
you are a customer of Company in good standing with either: (a) a current,
paid-up (or free-for-evaluation) subscription or fixed-term license for
Company's Shotgun Platform; or (b) a perpetual license and current, paid-up
maintenance and support contract for the Shotgun Platform.

Shotgun Toolkit Code License

Subject to the eligibility criteria above and your compliance with these
License Terms, Company grants to you a non-exclusive, limited license to
reproduce, use, and make derivative works of (including by compiling object
code versions of) the Shotgun Toolkit Code solely for your non-commercial or
internal business purposes in connection with your authorized use of the
Shotgun Platform.

Company reserves all rights in the Shotgun Toolkit Code not expressly granted
above. These License Terms do not grant or require Company to grant, by
implication, estoppel, or otherwise, any other licenses or rights with respect
to the Shotgun Toolkit Code or any of Company's other software or intellectual
property rights. You agree not to take any action with respect to the Shotgun
Toolkit Code that is not expressly authorized above.

You must keep intact (and, in the case of copies, reproduce) all copyright
and other proprietary notices, including all references to and copies of these
License Terms, as originally included on, in, or with the Shotgun Toolkit
Code. You must ensure that all derivative works you make of the Shotgun
Toolkit Code contain or are accompanied by comparable and conspicuous notices
that the underlying Shotgun Toolkit Code is the confidential information of
Company and is subject to Company's copyrights and these License Terms.

No Redistribution or Disclosure

You acknowledge that the Shotgun Toolkit Code is and contains proprietary and
trade-secret information of Company. You may not distribute, disclose to any
third party, operate for the benefit of third parties (for example, on a
hosted basis), or otherwise commercially exploit the Shotgun Toolkit Code or
any portion or derivative work thereof without Company's separate and express
written consent. For purposes of this restriction, third parties do not
include your employees or agents acting on your behalf who are bound to abide
by these License Terms.

No Warranties or Support

The Shotgun Toolkit Code is provided "AS IS" and with all faults. Company
makes no warranties whatsoever, whether express, implied, or otherwise,
concerning the Shotgun Toolkit Code. Company has no obligation to provide
maintenance or technical support for the Shotgun Toolkit Code (unless
otherwise expressly agreed in a separate written agreement between you and
Company).

Liability

You agree to be solely responsible for your use and modifications of the
Shotgun Toolkit Code, and for any harm or liability arising out of such use
or modifications, including but not limited to any liability for infringement
of third-party intellectual property rights.

To the fullest extent permitted under applicable law, you agree that: (a)
Company will not be liable under these License Terms or otherwise for any
direct, indirect, incidental, special, consequential, or exemplary damages,
including but not limited to damages for loss of profits, goodwill, use, data
or other intangible losses, in relation to the Shotgun Toolkit Code or your
use or inability to use the Shotgun Toolkit Code, even if Company has been
advised of the possibility of such damages; and (b) in any event, Company's
aggregate liability under these License Terms or in connection with the
Shotgun Toolkit Code, regardless of the form of action and under any theory
(whether in contract, tort, statutory, or otherwise), will not exceed the
greater of $50 or the amount (if any) that you actually paid for access to
the Shotgun Toolkit Code.

Ownership

Company retains sole and exclusive ownership of the Shotgun Toolkit Code and
all copyright and other intellectual property rights therein. You will own any
derivative works you make to the Shotgun Toolkit Code, subject to: (a) the
preceding sentence; and (b) the provisions below regarding ownership of any
code you elect to contribute to Company.

Contributions

The following terms apply to any derivative works of the Shotgun Toolkit Code
(or any other materials) that you choose to contribute to Company.

For good and valuable consideration, receipt of which is acknowledged, you
hereby transfer and assign to Company your entire right, title, and interest
(including all rights under copyright) in: (a) any software code,
documentation, and/or other materials that you deliver to Company for
inclusion in, improvement of, use with, or documentation of Company's software
program(s), including but not limited to any code, documentation, and/or other
materials identified in a contribution form you submit to Company in an
applicable form designated by Company; and (b) any future revisions of such
code, documentation, and/or other materials that you make hereafter. The code,
documentation, other materials, and future revisions described above are
collectively referred to below as the "Contribution."

As used below, the "Company Programs" means and includes the Company software
program(s) identified on any contribution form you submit to Company, and any
other software into which Company incorporates or with which Company uses or
distributes the Contribution or any version or portion thereof.

Company grants you a non-exclusive right to continue to modify, make
derivative works of, reproduce, and use the Contribution for your
non-commercial or internal business purposes, and to further Company's
development of Company Programs. This grant does not: (a) limit Company's
rights, (b) grant you any rights with respect to the Company Programs; nor
(c) permit you to distribute, operate for the benefit of third parties (for
example, on a hosted basis), or otherwise commercially exploit the
Contribution.

You acknowledge that if Company elects to distribute the Contribution or any
version or portion thereof, it may do so on any basis that it chooses
(including under any proprietary or open-source licensing terms), without
further compensation to you.

You agree that if you have or acquire hereafter any patent or interface
copyright or other intellectual property interest dominating the Contribution
or any Company Programs (or use thereof), such dominating interest will not be
used to undermine the effect of the assignment set forth above. Accordingly,
Company and its direct and indirect licensees are licensed to make, use, sell,
distribute, and otherwise exploit, in the Company Programs and their future
versions and derivative works, without royalty or limitation, the subject
matter of the dominating interest. This license provision will be binding on
you and on any assignees of, or other successors to, the dominating interest.

You hereby represent and warrant that you are the sole copyright holder for
the Contribution and that you have the right and power to enter into this
contract. You shall indemnify and hold harmless Company and its officers,
employees, and agents against any and all claims, actions or damages
(including attorney's reasonable fees) asserted by or paid to any party on
account of a breach or alleged breach of the foregoing warranty. You make no
other express or implied warranty (including without limitation any warranty
of merchantability or fitness for a particular purpose) regarding the
Contribution.
MIT License

Copyright (c) 2023 MaximumFX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 56 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,62 @@
[![Python 2.6 2.7 3.7](https://img.shields.io/badge/python-2.6%20%7C%202.7%20%7C%203.7-blue.svg)](https://www.python.org/)
[![Build Status](https://dev.azure.com/shotgun-ecosystem/Toolkit/_apis/build/status/Apps/tk-multi-reviewsubmission?branchName=master)](https://dev.azure.com/shotgun-ecosystem/Toolkit/_build/latest?definitionId=64&branchName=master)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Linting](https://img.shields.io/badge/PEP8%20by-Hound%20CI-a873d1.svg)](https://houndci.com)
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/maximumfx/tk-multi-reviewsubmission2?include_prereleases)
[![GitHub issues](https://img.shields.io/github/issues/maximumfx/tk-multi-reviewsubmission2)](https://github.com/maximumfx/tk-multi-reviewsubmission2/issues)

## Documentation
This repository is a part of the Shotgun Pipeline Toolkit.
# tk-multi-reviewsubmission2

- For more information about this app and for release notes, *see the wiki section*.
- For general information and documentation, click here: https://support.shotgunsoftware.com/entries/95441257
- For information about Shotgun in general, click here: http://www.shotgunsoftware.com/toolkit
Easily create and publish mp4 preview renders (flipbooks/playblasts) from the ShotGrid menu.

## Using this app in your Setup
All the apps that are part of our standard app suite are pushed to our App Store.
This is where you typically go if you want to install an app into a project you are
working on. For an overview of all the Apps and Engines in the Toolkit App Store,
click here: https://support.shotgunsoftware.com/entries/95441247.
Supported toolkits: `tk-houdini`, `tk-maya`

## Have a Question?
Don't hesitate to contact us! You can find us on [email protected]
_Requires Nuke for creating slates._

| Houdini | Maya |
|:----------------------------------------------------------------:|:-------------------------------------------------------:|
| ![Houdini Dialog](resources/dialog_houdini.png "Houdini Dialog") | ![Maya Dialog](resources/dialog_maya.png "Maya Dialog") |

![Slate](resources/slate.jpg "Slate")
Slate

![Review](resources/review.jpg "Review")
Review

## Configuration

### Strings

| Key | Description |
|------------------|------------------------------------------------------------|
| `company_name` | Specify the company name that should be on the slates |
| `display_name` | Specify the name that should be used in menus and the main |
| `cut_in_field` | ShotGrid field name of cut in frame |
| `cut_out_field` | ShotGrid field name of cut out frame |
| `fps_field` | ShotGrid field name of fps |

### Paths

| Key | Description |
|---------------------|-------------------------------------------------------------|
| `nuke_path_linux` | Linux path to your Nuke installation for creating slates. |
| `nuke_path_mac` | Mac path to your Nuke installation for creating slates. |
| `nuke_path_windows` | Windows path to your Nuke installation for creating slates. |
| `slate_logo` | Relative app path to the logo displayed on the slate |

### Templates

| Key | Description |
|------------------------|----------------------------------------|
| `work_file_template` | Template for your current work file. |
| `review_file_template` | Template for the exported review file. |

### Hooks

| Key | Description |
|---------------------|---------------------------------------------------------------|
| `helper_hook` | Implements helper functions. |
| `progress_hook` | Implements progress bar functions. |
| `render_media_hook` | Implements how media get generated while this app is running. |

## License

[MIT](https://choosealicense.com/licenses/mit/)
111 changes: 48 additions & 63 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
Sgtk Application for handling Quicktime generation and review submission
"""

import sgtk
import sgtk.templatekey
import copy
import os
import pathlib

import sgtk.templatekey

from PySide2 import QtCore
from PySide2.QtWidgets import QMessageBox


class MultiReviewSubmissionApp(sgtk.platform.Application):
Expand All @@ -31,17 +34,17 @@ def init_app(self):
provided through it's API.
"""

app = self.import_module("tk_multi_reviewsubmission")
self.reviewsubmission2 = self.import_module("tk_multi_reviewsubmission2")

display_name = self.get_setting("display_name")

# Only register the command to the engine if the display name is explicitely added to the config.
# Only register the command to the engine if the display name is explicitly added to the config.
# There's cases where someone would want to have this app in his environment without the menu item.
if display_name:
menu_caption = "%s..." % display_name
menu_options = {
"short_name": "send_for_review",
"description": "Send a version for review using Shotgun Create",
"short_name": "create_review",
"description": "Render a version for review",
# dark themed icon for engines that recognize this format
"icons": {
"dark": {
Expand All @@ -50,63 +53,45 @@ def init_app(self):
},
}

self.engine.register_command(
menu_caption, lambda: app.send_for_review(), menu_options
)
self.engine.register_command(menu_caption, self.__show_dialog, menu_options)

@property
def context_change_allowed(self):
"""
Specifies that context changes are allowed.
def __show_dialog(self):
"""
return True

def render_and_submit_version(
self,
template,
fields,
first_frame,
last_frame,
sg_publishes,
sg_task,
comment,
thumbnail_path,
progress_cb,
color_space=None,
*args,
**kwargs
):
Launch the UI for the flipbook settings.
"""
Main application entry point to be called by other applications / hooks.
:param template: The template defining 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.
:rtype: dict
"""
app = self.import_module("tk_multi_reviewsubmission")

return app.render_and_submit_version(
template,
fields,
first_frame,
last_frame,
sg_publishes,
sg_task,
comment,
thumbnail_path,
progress_cb,
color_space=None,
*args,
**kwargs
main_window = self.execute_hook_method(
key="helper_hook",
method_name="get_main_window",
base_class=None,
)

if main_window is not None:
work_file_template = self.get_template("work_file_template")
review_file_template = self.get_template("review_file_template")

fields = work_file_template.get_fields(
self.execute_hook_method(
key="helper_hook",
method_name="get_file_path",
)
)
self.review_file_path = review_file_template.apply_fields(fields)

# Check if review file already exists
if pathlib.Path(self.review_file_path).is_file():
reply = QMessageBox.question(
main_window,
"Override preview",
"A preview for this file already exists, do you want to override it?",
QMessageBox.Yes | QMessageBox.No,
QMessageBox.No,
)
if reply == QMessageBox.No:
return

review_dialog = self.reviewsubmission2.ReviewDialog(self)
review_dialog.setParent(main_window, QtCore.Qt.Window)
review_dialog.setModal(True)
review_dialog.show()
else:
self.logger.error("Can't find main window.")
Loading

0 comments on commit 14b1901

Please sign in to comment.