fixing host directory
- converting single quotation to double - converting py2 prints to py3
|
|
@ -6,7 +6,7 @@ def add_implementation_envs(env, _app):
|
|||
# Add requirements to HIERO_PLUGIN_PATH
|
||||
pype_root = os.environ["OPENPYPE_REPOS_ROOT"]
|
||||
new_hiero_paths = [
|
||||
os.path.join(pype_root, "openpype", "hosts", "hiero", "startup")
|
||||
os.path.join(pype_root, "openpype", "hosts", "hiero", "api", "startup")
|
||||
]
|
||||
old_hiero_path = env.get("HIERO_PLUGIN_PATH") or ""
|
||||
for path in old_hiero_path.split(os.pathsep):
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import avalon.api as avalon
|
|||
import avalon.io
|
||||
from openpype.api import (Logger, Anatomy, get_anatomy_settings)
|
||||
from . import tags
|
||||
from compiler.ast import flatten
|
||||
|
||||
try:
|
||||
from PySide.QtCore import QFile, QTextStream
|
||||
|
|
@ -39,6 +38,13 @@ AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")
|
|||
|
||||
|
||||
def get_current_project(remove_untitled=False):
|
||||
def flatten(l):
|
||||
for i in l:
|
||||
if isinstance(i, (list, tuple)):
|
||||
yield from flatten(i)
|
||||
else:
|
||||
yield i
|
||||
|
||||
projects = flatten(hiero.core.projects())
|
||||
if not remove_untitled:
|
||||
return next(iter(projects))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import os
|
|||
import re
|
||||
import sys
|
||||
import ast
|
||||
from compiler.ast import flatten
|
||||
import opentimelineio as otio
|
||||
from . import utils
|
||||
import hiero.core
|
||||
|
|
@ -29,6 +28,14 @@ self.timeline = None
|
|||
self.include_tags = True
|
||||
|
||||
|
||||
def flatten(l):
|
||||
for i in l:
|
||||
if isinstance(i, (list, tuple)):
|
||||
yield from flatten(i)
|
||||
else:
|
||||
yield i
|
||||
|
||||
|
||||
def get_current_hiero_project(remove_untitled=False):
|
||||
projects = flatten(hiero.core.projects())
|
||||
if not remove_untitled:
|
||||
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 8 KiB After Width: | Height: | Size: 8 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
|
|
@ -18,7 +18,7 @@ except:
|
|||
### Magic Widget Finding Methods - This stuff crawls all the PySide widgets, looking for an answer
|
||||
def findWidget(w):
|
||||
global foundryWidgets
|
||||
if 'Foundry' in w.metaObject().className():
|
||||
if "Foundry" in w.metaObject().className():
|
||||
foundryWidgets += [w]
|
||||
|
||||
for c in w.children():
|
||||
|
|
@ -49,7 +49,7 @@ def activeSpreadsheetTreeView():
|
|||
Does some PySide widget Magic to detect the Active Spreadsheet TreeView.
|
||||
"""
|
||||
spreadsheetViews = getFoundryWidgetsWithClassName(
|
||||
filter='SpreadsheetTreeView')
|
||||
filter="SpreadsheetTreeView")
|
||||
for spreadSheet in spreadsheetViews:
|
||||
if spreadSheet.hasFocus():
|
||||
activeSpreadSheet = spreadSheet
|
||||
|
|
@ -77,23 +77,23 @@ class SpreadsheetExportCSVAction(QAction):
|
|||
spreadsheetTreeView = activeSpreadsheetTreeView()
|
||||
|
||||
if not spreadsheetTreeView:
|
||||
return 'Unable to detect the active TreeView.'
|
||||
return "Unable to detect the active TreeView."
|
||||
seq = hiero.ui.activeView().sequence()
|
||||
if not seq:
|
||||
print 'Unable to detect the active Sequence from the activeView.'
|
||||
print("Unable to detect the active Sequence from the activeView.")
|
||||
return
|
||||
|
||||
# The data model of the QTreeView
|
||||
model = spreadsheetTreeView.model()
|
||||
|
||||
csvSavePath = os.path.join(QDir.homePath(), 'Desktop',
|
||||
seq.name() + '.csv')
|
||||
csvSavePath = os.path.join(QDir.homePath(), "Desktop",
|
||||
seq.name() + ".csv")
|
||||
savePath, filter = QFileDialog.getSaveFileName(
|
||||
None,
|
||||
caption="Export Spreadsheet to .CSV as...",
|
||||
dir=csvSavePath,
|
||||
filter="*.csv")
|
||||
print 'Saving To: ' + str(savePath)
|
||||
print("Saving To: {}".format(savePath))
|
||||
|
||||
# Saving was cancelled...
|
||||
if len(savePath) == 0:
|
||||
|
|
@ -101,12 +101,12 @@ class SpreadsheetExportCSVAction(QAction):
|
|||
|
||||
# Get the Visible Header Columns from the QTreeView
|
||||
|
||||
#csvHeader = ['Event', 'Status', 'Shot Name', 'Reel', 'Track', 'Speed', 'Src In', 'Src Out','Src Duration', 'Dst In', 'Dst Out', 'Dst Duration', 'Clip', 'Clip Media']
|
||||
#csvHeader = ["Event", "Status", "Shot Name", "Reel", "Track", "Speed", "Src In", "Src Out","Src Duration", "Dst In", "Dst Out", "Dst Duration", "Clip", "Clip Media"]
|
||||
|
||||
# Get a CSV writer object
|
||||
f = open(savePath, 'w')
|
||||
f = open(savePath, "w")
|
||||
csvWriter = csv.writer(
|
||||
f, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
||||
f, delimiter=',', quotechar="|", quoting=csv.QUOTE_MINIMAL)
|
||||
|
||||
# This is a list of the Column titles
|
||||
csvHeader = []
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__author__ = "Daniel Flehner Heen"
|
||||
|
|
@ -9,7 +8,7 @@ import hiero.core
|
|||
from hiero.core import util
|
||||
|
||||
import opentimelineio as otio
|
||||
from openpype.hosts.hiero.otio import hiero_export
|
||||
from openpype.hosts.hiero.api.otio import hiero_export
|
||||
|
||||
class OTIOExportTask(hiero.core.TaskBase):
|
||||
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__author__ = "Daniel Flehner Heen"
|
||||
__credits__ = ["Jakub Jezek", "Daniel Flehner Heen"]
|
||||
|
||||
import hiero.ui
|
||||
import OTIOExportTask
|
||||
from .OTIOExportTask import (
|
||||
OTIOExportTask,
|
||||
OTIOExportPreset
|
||||
)
|
||||
|
||||
try:
|
||||
# Hiero >= 11.x
|
||||
|
|
@ -20,14 +22,14 @@ except ImportError:
|
|||
|
||||
FormLayout = QFormLayout # lint:ok
|
||||
|
||||
from openpype.hosts.hiero.otio import hiero_export
|
||||
from openpype.hosts.hiero.api.otio import hiero_export
|
||||
|
||||
class OTIOExportUI(hiero.ui.TaskUIBase):
|
||||
def __init__(self, preset):
|
||||
"""Initialize"""
|
||||
hiero.ui.TaskUIBase.__init__(
|
||||
self,
|
||||
OTIOExportTask.OTIOExportTask,
|
||||
OTIOExportTask,
|
||||
preset,
|
||||
"OTIO Exporter"
|
||||
)
|
||||
|
|
@ -67,6 +69,6 @@ class OTIOExportUI(hiero.ui.TaskUIBase):
|
|||
|
||||
|
||||
hiero.ui.taskUIRegistry.registerTaskUI(
|
||||
OTIOExportTask.OTIOExportPreset,
|
||||
OTIOExportPreset,
|
||||
OTIOExportUI
|
||||
)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
from .OTIOExportTask import OTIOExportTask
|
||||
from .OTIOExportUI import OTIOExportUI
|
||||
|
||||
__all__ = [
|
||||
"OTIOExportTask",
|
||||
"OTIOExportUI"
|
||||
]
|
||||
|
|
@ -21,7 +21,7 @@ def __trackActiveProjectHandler(event):
|
|||
global gTrackedActiveProject
|
||||
selection = event.sender.selection()
|
||||
binSelection = selection
|
||||
if len(binSelection) > 0 and hasattr(binSelection[0], 'project'):
|
||||
if len(binSelection) > 0 and hasattr(binSelection[0], "project"):
|
||||
proj = binSelection[0].project()
|
||||
|
||||
# We only store this if its a valid, active User Project
|
||||
|
|
@ -30,18 +30,18 @@ def __trackActiveProjectHandler(event):
|
|||
|
||||
|
||||
hiero.core.events.registerInterest(
|
||||
'kSelectionChanged/kBin', __trackActiveProjectHandler)
|
||||
"kSelectionChanged/kBin", __trackActiveProjectHandler)
|
||||
hiero.core.events.registerInterest(
|
||||
'kSelectionChanged/kTimeline', __trackActiveProjectHandler)
|
||||
"kSelectionChanged/kTimeline", __trackActiveProjectHandler)
|
||||
hiero.core.events.registerInterest(
|
||||
'kSelectionChanged/Spreadsheet', __trackActiveProjectHandler)
|
||||
"kSelectionChanged/Spreadsheet", __trackActiveProjectHandler)
|
||||
|
||||
|
||||
def activeProject():
|
||||
"""hiero.ui.activeProject() -> returns the current Project
|
||||
|
||||
Note: There is not technically a notion of a 'active' Project in Hiero/NukeStudio, as it is a multi-project App.
|
||||
This method determines what is 'active' by going down the following rules...
|
||||
Note: There is not technically a notion of a "active" Project in Hiero/NukeStudio, as it is a multi-project App.
|
||||
This method determines what is "active" by going down the following rules...
|
||||
|
||||
# 1 - If the current Viewer (hiero.ui.currentViewer) contains a Clip or Sequence, this item is assumed to give the active Project
|
||||
# 2 - If nothing is currently in the Viewer, look to the active View, determine project from active selection
|
||||
|
|
@ -54,7 +54,7 @@ def activeProject():
|
|||
|
||||
# Case 1 : Look for what the current Viewr tells us - this might not be what we want, and relies on hiero.ui.currentViewer() being robust.
|
||||
cv = hiero.ui.currentViewer().player().sequence()
|
||||
if hasattr(cv, 'project'):
|
||||
if hasattr(cv, "project"):
|
||||
activeProject = cv.project()
|
||||
else:
|
||||
# Case 2: We can't determine a project from the current Viewer, so try seeing what's selected in the activeView
|
||||
|
|
@ -66,16 +66,16 @@ def activeProject():
|
|||
|
||||
# Handle the case where nothing is selected in the active view
|
||||
if len(selection) == 0:
|
||||
# It's possible that there is no selection in a Timeline/Spreadsheet, but these views have 'sequence' method, so try that...
|
||||
# It's possible that there is no selection in a Timeline/Spreadsheet, but these views have "sequence" method, so try that...
|
||||
if isinstance(hiero.ui.activeView(), (hiero.ui.TimelineEditor, hiero.ui.SpreadsheetView)):
|
||||
activeSequence = activeView.sequence()
|
||||
if hasattr(currentItem, 'project'):
|
||||
if hasattr(currentItem, "project"):
|
||||
activeProject = activeSequence.project()
|
||||
|
||||
# The active view has a selection... assume that the first item in the selection has the active Project
|
||||
else:
|
||||
currentItem = selection[0]
|
||||
if hasattr(currentItem, 'project'):
|
||||
if hasattr(currentItem, "project"):
|
||||
activeProject = currentItem.project()
|
||||
|
||||
# Finally, Cases 3 and 4...
|
||||
|
|
@ -156,9 +156,14 @@ class SaveAllProjects(QAction):
|
|||
for proj in allProjects:
|
||||
try:
|
||||
proj.save()
|
||||
print 'Saved Project: %s to: %s ' % (proj.name(), proj.path())
|
||||
print("Saved Project: {} to: {} ".format(
|
||||
proj.name(), proj.path()
|
||||
))
|
||||
except:
|
||||
print 'Unable to save Project: %s to: %s. Check file permissions.' % (proj.name(), proj.path())
|
||||
print((
|
||||
"Unable to save Project: {} to: {}. "
|
||||
"Check file permissions.").format(
|
||||
proj.name(), proj.path()))
|
||||
|
||||
def eventHandler(self, event):
|
||||
event.menu.addAction(self)
|
||||
|
|
@ -190,32 +195,38 @@ class SaveNewProjectVersion(QAction):
|
|||
v = None
|
||||
prefix = None
|
||||
try:
|
||||
(prefix, v) = version_get(path, 'v')
|
||||
except ValueError, msg:
|
||||
print msg
|
||||
(prefix, v) = version_get(path, "v")
|
||||
except ValueError as msg:
|
||||
print(msg)
|
||||
|
||||
if (prefix is not None) and (v is not None):
|
||||
v = int(v)
|
||||
newPath = version_set(path, prefix, v, v + 1)
|
||||
try:
|
||||
proj.saveAs(newPath)
|
||||
print 'Saved new project version: %s to: %s ' % (oldName, newPath)
|
||||
print("Saved new project version: {} to: {} ".format(
|
||||
oldName, newPath))
|
||||
except:
|
||||
print 'Unable to save Project: %s. Check file permissions.' % (oldName)
|
||||
print((
|
||||
"Unable to save Project: {}. Check file permissions."
|
||||
).format(oldName))
|
||||
else:
|
||||
newPath = path.replace(".hrox", "_v01.hrox")
|
||||
answer = nuke.ask(
|
||||
'%s does not contain a version number.\nDo you want to save as %s?' % (proj, newPath))
|
||||
"%s does not contain a version number.\nDo you want to save as %s?" % (proj, newPath))
|
||||
if answer:
|
||||
try:
|
||||
proj.saveAs(newPath)
|
||||
print 'Saved new project version: %s to: %s ' % (oldName, newPath)
|
||||
print("Saved new project version: {} to: {} ".format(
|
||||
oldName, newPath))
|
||||
except:
|
||||
print 'Unable to save Project: %s. Check file permissions.' % (oldName)
|
||||
print((
|
||||
"Unable to save Project: {}. Check file "
|
||||
"permissions.").format(oldName))
|
||||
|
||||
def eventHandler(self, event):
|
||||
self.selectedProjects = []
|
||||
if hasattr(event.sender, 'selection') and event.sender.selection() is not None and len(event.sender.selection()) != 0:
|
||||
if hasattr(event.sender, "selection") and event.sender.selection() is not None and len(event.sender.selection()) != 0:
|
||||
selection = event.sender.selection()
|
||||
self.selectedProjects = uniquify(
|
||||
[item.project() for item in selection])
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
"""Puts the selection project into "hiero.selection"""
|
||||
|
||||
import hiero
|
||||
|
||||
|
||||
def selectionChanged(event):
|
||||
hiero.selection = event.sender.selection()
|
||||
|
||||
hiero.core.events.registerInterest("kSelectionChanged", selectionChanged)
|
||||
|
|
@ -23,7 +23,7 @@ class SetFrameRateDialog(QDialog):
|
|||
self._itemSelection = itemSelection
|
||||
|
||||
self._frameRateField = QLineEdit()
|
||||
self._frameRateField.setToolTip('Enter custom frame rate here.')
|
||||
self._frameRateField.setToolTip("Enter custom frame rate here.")
|
||||
self._frameRateField.setValidator(QDoubleValidator(1, 99, 3, self))
|
||||
self._frameRateField.textChanged.connect(self._textChanged)
|
||||
layout.addRow("Enter fps: ",self._frameRateField)
|
||||
|
|
@ -35,13 +35,13 @@ class SetFrameRateDialog(QDialog):
|
|||
self._buttonbox.button(QDialogButtonBox.Ok).setEnabled(False)
|
||||
layout.addRow("",self._buttonbox)
|
||||
self.setLayout(layout)
|
||||
|
||||
|
||||
def _updateOkButtonState(self):
|
||||
# Cancel is always an option but only enable Ok if there is some text.
|
||||
currentFramerate = float(self.currentFramerateString())
|
||||
enableOk = False
|
||||
enableOk = ((currentFramerate > 0.0) and (currentFramerate <= 250.0))
|
||||
print 'enabledOk',enableOk
|
||||
print("enabledOk", enableOk)
|
||||
self._buttonbox.button(QDialogButtonBox.Ok).setEnabled(enableOk)
|
||||
|
||||
def _textChanged(self, newText):
|
||||
|
|
@ -50,32 +50,32 @@ class SetFrameRateDialog(QDialog):
|
|||
# Returns the current frame rate as a string
|
||||
def currentFramerateString(self):
|
||||
return str(self._frameRateField.text())
|
||||
|
||||
|
||||
# Presents the Dialog and sets the Frame rate from a selection
|
||||
def showDialogAndSetFrameRateFromSelection(self):
|
||||
|
||||
|
||||
if self._itemSelection is not None:
|
||||
if self.exec_():
|
||||
# For the Undo loop...
|
||||
|
||||
|
||||
# Construct an TimeBase object for setting the Frame Rate (fps)
|
||||
fps = hiero.core.TimeBase().fromString(self.currentFramerateString())
|
||||
|
||||
|
||||
|
||||
# Set the frame rate for the selected BinItmes
|
||||
for item in self._itemSelection:
|
||||
item.setFramerate(fps)
|
||||
item.setFramerate(fps)
|
||||
return
|
||||
|
||||
# This is just a convenience method for returning QActions with a title, triggered method and icon.
|
||||
def makeAction(title, method, icon = None):
|
||||
action = QAction(title,None)
|
||||
action.setIcon(QIcon(icon))
|
||||
|
||||
|
||||
# We do this magic, so that the title string from the action is used to set the frame rate!
|
||||
def methodWrapper():
|
||||
method(title)
|
||||
|
||||
|
||||
action.triggered.connect( methodWrapper )
|
||||
return action
|
||||
|
||||
|
|
@ -88,13 +88,13 @@ class SetFrameRateMenu:
|
|||
|
||||
|
||||
# ant: Could use hiero.core.defaultFrameRates() here but messes up with string matching because we seem to mix decimal points
|
||||
self.frameRates = ['8','12','12.50','15','23.98','24','25','29.97','30','48','50','59.94','60']
|
||||
self.frameRates = ["8","12","12.50","15","23.98","24","25","29.97","30","48","50","59.94","60"]
|
||||
hiero.core.events.registerInterest("kShowContextMenu/kBin", self.binViewEventHandler)
|
||||
|
||||
|
||||
self.menuActions = []
|
||||
|
||||
def createFrameRateMenus(self,selection):
|
||||
selectedClipFPS = [str(bi.activeItem().framerate()) for bi in selection if (isinstance(bi,hiero.core.BinItem) and hasattr(bi,'activeItem'))]
|
||||
selectedClipFPS = [str(bi.activeItem().framerate()) for bi in selection if (isinstance(bi,hiero.core.BinItem) and hasattr(bi,"activeItem"))]
|
||||
selectedClipFPS = hiero.core.util.uniquify(selectedClipFPS)
|
||||
sameFrameRate = len(selectedClipFPS)==1
|
||||
self.menuActions = []
|
||||
|
|
@ -106,39 +106,41 @@ class SetFrameRateMenu:
|
|||
self.menuActions+=[makeAction(fps,self.setFrameRateFromMenuSelection, icon="icons:remove active.png")]
|
||||
else:
|
||||
self.menuActions+=[makeAction(fps,self.setFrameRateFromMenuSelection, icon=None)]
|
||||
|
||||
|
||||
# Now add Custom... menu
|
||||
self.menuActions+=[makeAction('Custom...',self.setFrameRateFromMenuSelection, icon=None)]
|
||||
|
||||
self.menuActions += [makeAction(
|
||||
"Custom...", self.setFrameRateFromMenuSelection, icon=None)
|
||||
]
|
||||
|
||||
frameRateMenu = QMenu("Set Frame Rate")
|
||||
for a in self.menuActions:
|
||||
frameRateMenu.addAction(a)
|
||||
|
||||
|
||||
return frameRateMenu
|
||||
|
||||
def setFrameRateFromMenuSelection(self, menuSelectionFPS):
|
||||
|
||||
selectedBinItems = [bi.activeItem() for bi in self._selection if (isinstance(bi,hiero.core.BinItem) and hasattr(bi,'activeItem'))]
|
||||
|
||||
selectedBinItems = [bi.activeItem() for bi in self._selection if (isinstance(bi,hiero.core.BinItem) and hasattr(bi,"activeItem"))]
|
||||
currentProject = selectedBinItems[0].project()
|
||||
|
||||
|
||||
with currentProject.beginUndo("Set Frame Rate"):
|
||||
if menuSelectionFPS == 'Custom...':
|
||||
if menuSelectionFPS == "Custom...":
|
||||
self._frameRatesDialog = SetFrameRateDialog(itemSelection = selectedBinItems )
|
||||
self._frameRatesDialog.showDialogAndSetFrameRateFromSelection()
|
||||
|
||||
else:
|
||||
for b in selectedBinItems:
|
||||
b.setFramerate(hiero.core.TimeBase().fromString(menuSelectionFPS))
|
||||
|
||||
|
||||
return
|
||||
|
||||
# This handles events from the Project Bin View
|
||||
def binViewEventHandler(self,event):
|
||||
if not hasattr(event.sender, 'selection'):
|
||||
if not hasattr(event.sender, "selection"):
|
||||
# Something has gone wrong, we should only be here if raised
|
||||
# by the Bin view which gives a selection.
|
||||
return
|
||||
|
||||
|
||||
# Reset the selection to None...
|
||||
self._selection = None
|
||||
s = event.sender.selection()
|
||||
|
|
@ -151,9 +153,9 @@ class SetFrameRateMenu:
|
|||
if len(self._selection)==0:
|
||||
return
|
||||
# Creating the menu based on items selected, to highlight which frame rates are contained
|
||||
|
||||
|
||||
self._frameRateMenu = self.createFrameRateMenus(self._selection)
|
||||
|
||||
|
||||
# Insert the Set Frame Rate Button before the Set Media Colour Transform Action
|
||||
for action in event.menu.actions():
|
||||
if str(action.text()) == "Set Media Colour Transform":
|
||||
|
|
@ -16,29 +16,29 @@ except:
|
|||
from PySide2.QtCore import *
|
||||
|
||||
|
||||
def whereAmI(self, searchType='TrackItem'):
|
||||
def whereAmI(self, searchType="TrackItem"):
|
||||
"""returns a list of TrackItem or Sequnece objects in the Project which contain this Clip.
|
||||
By default this will return a list of TrackItems where the Clip is used in its project.
|
||||
You can also return a list of Sequences by specifying the searchType to be 'Sequence'.
|
||||
You can also return a list of Sequences by specifying the searchType to be "Sequence".
|
||||
Should consider putting this into hiero.core.Clip by default?
|
||||
|
||||
Example usage:
|
||||
|
||||
shotsForClip = clip.whereAmI('TrackItem')
|
||||
sequencesForClip = clip.whereAmI('Sequence')
|
||||
shotsForClip = clip.whereAmI("TrackItem")
|
||||
sequencesForClip = clip.whereAmI("Sequence")
|
||||
"""
|
||||
proj = self.project()
|
||||
|
||||
if ('TrackItem' not in searchType) and ('Sequence' not in searchType):
|
||||
print "searchType argument must be 'TrackItem' or 'Sequence'"
|
||||
if ("TrackItem" not in searchType) and ("Sequence" not in searchType):
|
||||
print("searchType argument must be \"TrackItem\" or \"Sequence\"")
|
||||
return None
|
||||
|
||||
# If user specifies a TrackItem, then it will return
|
||||
searches = hiero.core.findItemsInProject(proj, searchType)
|
||||
|
||||
if len(searches) == 0:
|
||||
print 'Unable to find %s in any items of type: %s' % (str(self),
|
||||
str(searchType))
|
||||
print("Unable to find {} in any items of type: {}".format(
|
||||
str(self), searchType))
|
||||
return None
|
||||
|
||||
# Case 1: Looking for Shots (trackItems)
|
||||
|
|
@ -110,7 +110,7 @@ class VersionAllMenu(object):
|
|||
for shot in sequenceShotManifest[seq]:
|
||||
updateReportString += ' %s\n (New Version: %s)\n' % (
|
||||
shot.name(), shot.currentVersion().name())
|
||||
updateReportString += '\n'
|
||||
updateReportString += "\n"
|
||||
|
||||
infoBox = QMessageBox(hiero.ui.mainWindow())
|
||||
infoBox.setIcon(QMessageBox.Information)
|
||||
|
|
@ -202,7 +202,7 @@ class VersionAllMenu(object):
|
|||
if len(bins) > 0:
|
||||
# Grab the Clips inside of a Bin and append them to a list
|
||||
for bin in bins:
|
||||
clips = hiero.core.findItemsInBin(bin, 'Clip')
|
||||
clips = hiero.core.findItemsInBin(bin, "Clip")
|
||||
for clip in clips:
|
||||
if clip not in clipItems:
|
||||
clipItems.append(clip)
|
||||
|
|
@ -291,7 +291,7 @@ class VersionAllMenu(object):
|
|||
for clip in clipSelection:
|
||||
|
||||
# Look to see if it exists in a TrackItem somewhere...
|
||||
shotUsage = clip.whereAmI('TrackItem')
|
||||
shotUsage = clip.whereAmI("TrackItem")
|
||||
|
||||
# Next, depending on the versionOption, make the appropriate update
|
||||
# There's probably a more neat/compact way of doing this...
|
||||
|
|
@ -326,7 +326,7 @@ class VersionAllMenu(object):
|
|||
# This handles events from the Project Bin View
|
||||
def binViewEventHandler(self, event):
|
||||
|
||||
if not hasattr(event.sender, 'selection'):
|
||||
if not hasattr(event.sender, "selection"):
|
||||
# Something has gone wrong, we should only be here if raised
|
||||
# by the Bin view which gives a selection.
|
||||
return
|
||||
|
|
@ -15,55 +15,55 @@ except:
|
|||
from PySide2.QtWidgets import *
|
||||
from PySide2.QtCore import *
|
||||
|
||||
# Set to True, if you wat 'Set Status' right-click menu, False if not
|
||||
# Set to True, if you wat "Set Status" right-click menu, False if not
|
||||
kAddStatusMenu = True
|
||||
|
||||
# Set to True, if you wat 'Assign Artist' right-click menu, False if not
|
||||
# Set to True, if you wat "Assign Artist" right-click menu, False if not
|
||||
kAssignArtistMenu = True
|
||||
|
||||
# Global list of Artist Name Dictionaries
|
||||
# Note: Override this to add different names, icons, department, IDs.
|
||||
gArtistList = [{
|
||||
'artistName': 'John Smith',
|
||||
'artistIcon': 'icons:TagActor.png',
|
||||
'artistDepartment': '3D',
|
||||
'artistID': 0
|
||||
"artistName": "John Smith",
|
||||
"artistIcon": "icons:TagActor.png",
|
||||
"artistDepartment": "3D",
|
||||
"artistID": 0
|
||||
}, {
|
||||
'artistName': 'Savlvador Dali',
|
||||
'artistIcon': 'icons:TagActor.png',
|
||||
'artistDepartment': 'Roto',
|
||||
'artistID': 1
|
||||
"artistName": "Savlvador Dali",
|
||||
"artistIcon": "icons:TagActor.png",
|
||||
"artistDepartment": "Roto",
|
||||
"artistID": 1
|
||||
}, {
|
||||
'artistName': 'Leonardo Da Vinci',
|
||||
'artistIcon': 'icons:TagActor.png',
|
||||
'artistDepartment': 'Paint',
|
||||
'artistID': 2
|
||||
"artistName": "Leonardo Da Vinci",
|
||||
"artistIcon": "icons:TagActor.png",
|
||||
"artistDepartment": "Paint",
|
||||
"artistID": 2
|
||||
}, {
|
||||
'artistName': 'Claude Monet',
|
||||
'artistIcon': 'icons:TagActor.png',
|
||||
'artistDepartment': 'Comp',
|
||||
'artistID': 3
|
||||
"artistName": "Claude Monet",
|
||||
"artistIcon": "icons:TagActor.png",
|
||||
"artistDepartment": "Comp",
|
||||
"artistID": 3
|
||||
}, {
|
||||
'artistName': 'Pablo Picasso',
|
||||
'artistIcon': 'icons:TagActor.png',
|
||||
'artistDepartment': 'Animation',
|
||||
'artistID': 4
|
||||
"artistName": "Pablo Picasso",
|
||||
"artistIcon": "icons:TagActor.png",
|
||||
"artistDepartment": "Animation",
|
||||
"artistID": 4
|
||||
}]
|
||||
|
||||
# Global Dictionary of Status Tags.
|
||||
# Note: This can be overwritten if you want to add a new status cellType or custom icon
|
||||
# Override the gStatusTags dictionary by adding your own 'Status':'Icon.png' key-value pairs.
|
||||
# Add new custom keys like so: gStatusTags['For Client'] = 'forClient.png'
|
||||
# Override the gStatusTags dictionary by adding your own "Status":"Icon.png" key-value pairs.
|
||||
# Add new custom keys like so: gStatusTags["For Client"] = "forClient.png"
|
||||
gStatusTags = {
|
||||
'Approved': 'icons:status/TagApproved.png',
|
||||
'Unapproved': 'icons:status/TagUnapproved.png',
|
||||
'Ready To Start': 'icons:status/TagReadyToStart.png',
|
||||
'Blocked': 'icons:status/TagBlocked.png',
|
||||
'On Hold': 'icons:status/TagOnHold.png',
|
||||
'In Progress': 'icons:status/TagInProgress.png',
|
||||
'Awaiting Approval': 'icons:status/TagAwaitingApproval.png',
|
||||
'Omitted': 'icons:status/TagOmitted.png',
|
||||
'Final': 'icons:status/TagFinal.png'
|
||||
"Approved": "icons:status/TagApproved.png",
|
||||
"Unapproved": "icons:status/TagUnapproved.png",
|
||||
"Ready To Start": "icons:status/TagReadyToStart.png",
|
||||
"Blocked": "icons:status/TagBlocked.png",
|
||||
"On Hold": "icons:status/TagOnHold.png",
|
||||
"In Progress": "icons:status/TagInProgress.png",
|
||||
"Awaiting Approval": "icons:status/TagAwaitingApproval.png",
|
||||
"Omitted": "icons:status/TagOmitted.png",
|
||||
"Final": "icons:status/TagFinal.png"
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -78,17 +78,17 @@ class CustomSpreadsheetColumns(QObject):
|
|||
|
||||
# Ideally, we'd set this list on a Per Item basis, but this is expensive for a large mixed selection
|
||||
standardColourSpaces = [
|
||||
'linear', 'sRGB', 'rec709', 'Cineon', 'Gamma1.8', 'Gamma2.2',
|
||||
'Panalog', 'REDLog', 'ViperLog'
|
||||
"linear", "sRGB", "rec709", "Cineon", "Gamma1.8", "Gamma2.2",
|
||||
"Panalog", "REDLog", "ViperLog"
|
||||
]
|
||||
arriColourSpaces = [
|
||||
'Video - Rec709', 'LogC - Camera Native', 'Video - P3', 'ACES',
|
||||
'LogC - Film', 'LogC - Wide Gamut'
|
||||
"Video - Rec709", "LogC - Camera Native", "Video - P3", "ACES",
|
||||
"LogC - Film", "LogC - Wide Gamut"
|
||||
]
|
||||
r3dColourSpaces = [
|
||||
'Linear', 'Rec709', 'REDspace', 'REDlog', 'PDlog685', 'PDlog985',
|
||||
'CustomPDlog', 'REDgamma', 'SRGB', 'REDlogFilm', 'REDgamma2',
|
||||
'REDgamma3'
|
||||
"Linear", "Rec709", "REDspace", "REDlog", "PDlog685", "PDlog985",
|
||||
"CustomPDlog", "REDgamma", "SRGB", "REDlogFilm", "REDgamma2",
|
||||
"REDgamma3"
|
||||
]
|
||||
gColourSpaces = standardColourSpaces + arriColourSpaces + r3dColourSpaces
|
||||
|
||||
|
|
@ -97,52 +97,52 @@ class CustomSpreadsheetColumns(QObject):
|
|||
# This is the list of Columns available
|
||||
gCustomColumnList = [
|
||||
{
|
||||
'name': 'Tags',
|
||||
'cellType': 'readonly'
|
||||
"name": "Tags",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Colourspace',
|
||||
'cellType': 'dropdown'
|
||||
"name": "Colourspace",
|
||||
"cellType": "dropdown"
|
||||
},
|
||||
{
|
||||
'name': 'Notes',
|
||||
'cellType': 'readonly'
|
||||
"name": "Notes",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'FileType',
|
||||
'cellType': 'readonly'
|
||||
"name": "FileType",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Shot Status',
|
||||
'cellType': 'dropdown'
|
||||
"name": "Shot Status",
|
||||
"cellType": "dropdown"
|
||||
},
|
||||
{
|
||||
'name': 'Thumbnail',
|
||||
'cellType': 'readonly'
|
||||
"name": "Thumbnail",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'MediaType',
|
||||
'cellType': 'readonly'
|
||||
"name": "MediaType",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Width',
|
||||
'cellType': 'readonly'
|
||||
"name": "Width",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Height',
|
||||
'cellType': 'readonly'
|
||||
"name": "Height",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Pixel Aspect',
|
||||
'cellType': 'readonly'
|
||||
"name": "Pixel Aspect",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
{
|
||||
'name': 'Artist',
|
||||
'cellType': 'dropdown'
|
||||
"name": "Artist",
|
||||
"cellType": "dropdown"
|
||||
},
|
||||
{
|
||||
'name': 'Department',
|
||||
'cellType': 'readonly'
|
||||
"name": "Department",
|
||||
"cellType": "readonly"
|
||||
},
|
||||
]
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ class CustomSpreadsheetColumns(QObject):
|
|||
"""
|
||||
Return the name of a custom column
|
||||
"""
|
||||
return self.gCustomColumnList[column]['name']
|
||||
return self.gCustomColumnList[column]["name"]
|
||||
|
||||
def getTagsString(self, item):
|
||||
"""
|
||||
|
|
@ -173,7 +173,7 @@ class CustomSpreadsheetColumns(QObject):
|
|||
"""
|
||||
Convenience method for returning all the Notes in a Tag as a string
|
||||
"""
|
||||
notes = ''
|
||||
notes = ""
|
||||
tags = item.tags()
|
||||
for tag in tags:
|
||||
note = tag.note()
|
||||
|
|
@ -186,67 +186,67 @@ class CustomSpreadsheetColumns(QObject):
|
|||
Return the data in a cell
|
||||
"""
|
||||
currentColumn = self.gCustomColumnList[column]
|
||||
if currentColumn['name'] == 'Tags':
|
||||
if currentColumn["name"] == "Tags":
|
||||
return self.getTagsString(item)
|
||||
|
||||
if currentColumn['name'] == 'Colourspace':
|
||||
if currentColumn["name"] == "Colourspace":
|
||||
try:
|
||||
colTransform = item.sourceMediaColourTransform()
|
||||
except:
|
||||
colTransform = '--'
|
||||
colTransform = "--"
|
||||
return colTransform
|
||||
|
||||
if currentColumn['name'] == 'Notes':
|
||||
if currentColumn["name"] == "Notes":
|
||||
try:
|
||||
note = self.getNotes(item)
|
||||
except:
|
||||
note = ''
|
||||
note = ""
|
||||
return note
|
||||
|
||||
if currentColumn['name'] == 'FileType':
|
||||
fileType = '--'
|
||||
if currentColumn["name"] == "FileType":
|
||||
fileType = "--"
|
||||
M = item.source().mediaSource().metadata()
|
||||
if M.hasKey('foundry.source.type'):
|
||||
fileType = M.value('foundry.source.type')
|
||||
elif M.hasKey('media.input.filereader'):
|
||||
fileType = M.value('media.input.filereader')
|
||||
if M.hasKey("foundry.source.type"):
|
||||
fileType = M.value("foundry.source.type")
|
||||
elif M.hasKey("media.input.filereader"):
|
||||
fileType = M.value("media.input.filereader")
|
||||
return fileType
|
||||
|
||||
if currentColumn['name'] == 'Shot Status':
|
||||
if currentColumn["name"] == "Shot Status":
|
||||
status = item.status()
|
||||
if not status:
|
||||
status = "--"
|
||||
return str(status)
|
||||
|
||||
if currentColumn['name'] == 'MediaType':
|
||||
if currentColumn["name"] == "MediaType":
|
||||
M = item.mediaType()
|
||||
return str(M).split('MediaType')[-1].replace('.k', '')
|
||||
return str(M).split("MediaType")[-1].replace(".k", "")
|
||||
|
||||
if currentColumn['name'] == 'Thumbnail':
|
||||
if currentColumn["name"] == "Thumbnail":
|
||||
return str(item.eventNumber())
|
||||
|
||||
if currentColumn['name'] == 'Width':
|
||||
if currentColumn["name"] == "Width":
|
||||
return str(item.source().format().width())
|
||||
|
||||
if currentColumn['name'] == 'Height':
|
||||
if currentColumn["name"] == "Height":
|
||||
return str(item.source().format().height())
|
||||
|
||||
if currentColumn['name'] == 'Pixel Aspect':
|
||||
if currentColumn["name"] == "Pixel Aspect":
|
||||
return str(item.source().format().pixelAspect())
|
||||
|
||||
if currentColumn['name'] == 'Artist':
|
||||
if currentColumn["name"] == "Artist":
|
||||
if item.artist():
|
||||
name = item.artist()['artistName']
|
||||
name = item.artist()["artistName"]
|
||||
return name
|
||||
else:
|
||||
return '--'
|
||||
return "--"
|
||||
|
||||
if currentColumn['name'] == 'Department':
|
||||
if currentColumn["name"] == "Department":
|
||||
if item.artist():
|
||||
dep = item.artist()['artistDepartment']
|
||||
dep = item.artist()["artistDepartment"]
|
||||
return dep
|
||||
else:
|
||||
return '--'
|
||||
return "--"
|
||||
|
||||
return ""
|
||||
|
||||
|
|
@ -262,10 +262,10 @@ class CustomSpreadsheetColumns(QObject):
|
|||
Return the tooltip for a cell
|
||||
"""
|
||||
currentColumn = self.gCustomColumnList[column]
|
||||
if currentColumn['name'] == 'Tags':
|
||||
if currentColumn["name"] == "Tags":
|
||||
return str([item.name() for item in item.tags()])
|
||||
|
||||
if currentColumn['name'] == 'Notes':
|
||||
if currentColumn["name"] == "Notes":
|
||||
return str(self.getNotes(item))
|
||||
return ""
|
||||
|
||||
|
|
@ -296,24 +296,24 @@ class CustomSpreadsheetColumns(QObject):
|
|||
Return the icon for a cell
|
||||
"""
|
||||
currentColumn = self.gCustomColumnList[column]
|
||||
if currentColumn['name'] == 'Colourspace':
|
||||
if currentColumn["name"] == "Colourspace":
|
||||
return QIcon("icons:LUT.png")
|
||||
|
||||
if currentColumn['name'] == 'Shot Status':
|
||||
if currentColumn["name"] == "Shot Status":
|
||||
status = item.status()
|
||||
if status:
|
||||
return QIcon(gStatusTags[status])
|
||||
|
||||
if currentColumn['name'] == 'MediaType':
|
||||
if currentColumn["name"] == "MediaType":
|
||||
mediaType = item.mediaType()
|
||||
if mediaType == hiero.core.TrackItem.kVideo:
|
||||
return QIcon("icons:VideoOnly.png")
|
||||
elif mediaType == hiero.core.TrackItem.kAudio:
|
||||
return QIcon("icons:AudioOnly.png")
|
||||
|
||||
if currentColumn['name'] == 'Artist':
|
||||
if currentColumn["name"] == "Artist":
|
||||
try:
|
||||
return QIcon(item.artist()['artistIcon'])
|
||||
return QIcon(item.artist()["artistIcon"])
|
||||
except:
|
||||
return None
|
||||
return None
|
||||
|
|
@ -322,9 +322,9 @@ class CustomSpreadsheetColumns(QObject):
|
|||
"""
|
||||
Return the size hint for a cell
|
||||
"""
|
||||
currentColumnName = self.gCustomColumnList[column]['name']
|
||||
currentColumnName = self.gCustomColumnList[column]["name"]
|
||||
|
||||
if currentColumnName == 'Thumbnail':
|
||||
if currentColumnName == "Thumbnail":
|
||||
return QSize(90, 50)
|
||||
|
||||
return QSize(50, 50)
|
||||
|
|
@ -335,7 +335,7 @@ class CustomSpreadsheetColumns(QObject):
|
|||
with the default cell painting.
|
||||
"""
|
||||
currentColumn = self.gCustomColumnList[column]
|
||||
if currentColumn['name'] == 'Tags':
|
||||
if currentColumn["name"] == "Tags":
|
||||
if option.state & QStyle.State_Selected:
|
||||
painter.fillRect(option.rect, option.palette.highlight())
|
||||
iconSize = 20
|
||||
|
|
@ -348,14 +348,14 @@ class CustomSpreadsheetColumns(QObject):
|
|||
painter.setClipRect(option.rect)
|
||||
for tag in item.tags():
|
||||
M = tag.metadata()
|
||||
if not (M.hasKey('tag.status')
|
||||
or M.hasKey('tag.artistID')):
|
||||
if not (M.hasKey("tag.status")
|
||||
or M.hasKey("tag.artistID")):
|
||||
QIcon(tag.icon()).paint(painter, r, Qt.AlignLeft)
|
||||
r.translate(r.width() + 2, 0)
|
||||
painter.restore()
|
||||
return True
|
||||
|
||||
if currentColumn['name'] == 'Thumbnail':
|
||||
if currentColumn["name"] == "Thumbnail":
|
||||
imageView = None
|
||||
pen = QPen()
|
||||
r = QRect(option.rect.x() + 2, (option.rect.y() +
|
||||
|
|
@ -409,35 +409,35 @@ class CustomSpreadsheetColumns(QObject):
|
|||
self.currentView = view
|
||||
|
||||
currentColumn = self.gCustomColumnList[column]
|
||||
if currentColumn['cellType'] == 'readonly':
|
||||
if currentColumn["cellType"] == "readonly":
|
||||
cle = QLabel()
|
||||
cle.setEnabled(False)
|
||||
cle.setVisible(False)
|
||||
return cle
|
||||
|
||||
if currentColumn['name'] == 'Colourspace':
|
||||
if currentColumn["name"] == "Colourspace":
|
||||
cb = QComboBox()
|
||||
for colourspace in self.gColourSpaces:
|
||||
cb.addItem(colourspace)
|
||||
cb.currentIndexChanged.connect(self.colourspaceChanged)
|
||||
return cb
|
||||
|
||||
if currentColumn['name'] == 'Shot Status':
|
||||
if currentColumn["name"] == "Shot Status":
|
||||
cb = QComboBox()
|
||||
cb.addItem('')
|
||||
cb.addItem("")
|
||||
for key in gStatusTags.keys():
|
||||
cb.addItem(QIcon(gStatusTags[key]), key)
|
||||
cb.addItem('--')
|
||||
cb.addItem("--")
|
||||
cb.currentIndexChanged.connect(self.statusChanged)
|
||||
|
||||
return cb
|
||||
|
||||
if currentColumn['name'] == 'Artist':
|
||||
if currentColumn["name"] == "Artist":
|
||||
cb = QComboBox()
|
||||
cb.addItem('')
|
||||
cb.addItem("")
|
||||
for artist in gArtistList:
|
||||
cb.addItem(artist['artistName'])
|
||||
cb.addItem('--')
|
||||
cb.addItem(artist["artistName"])
|
||||
cb.addItem("--")
|
||||
cb.currentIndexChanged.connect(self.artistNameChanged)
|
||||
return cb
|
||||
return None
|
||||
|
|
@ -479,15 +479,15 @@ class CustomSpreadsheetColumns(QObject):
|
|||
status = self.sender().currentText()
|
||||
project = selection[0].project()
|
||||
with project.beginUndo("Set Status"):
|
||||
# A string of '--' characters denotes clear the status
|
||||
if status != '--':
|
||||
# A string of "--" characters denotes clear the status
|
||||
if status != "--":
|
||||
for trackItem in selection:
|
||||
trackItem.setStatus(status)
|
||||
else:
|
||||
for trackItem in selection:
|
||||
tTags = trackItem.tags()
|
||||
for tag in tTags:
|
||||
if tag.metadata().hasKey('tag.status'):
|
||||
if tag.metadata().hasKey("tag.status"):
|
||||
trackItem.removeTag(tag)
|
||||
break
|
||||
|
||||
|
|
@ -500,15 +500,15 @@ class CustomSpreadsheetColumns(QObject):
|
|||
name = self.sender().currentText()
|
||||
project = selection[0].project()
|
||||
with project.beginUndo("Assign Artist"):
|
||||
# A string of '--' denotes clear the assignee...
|
||||
if name != '--':
|
||||
# A string of "--" denotes clear the assignee...
|
||||
if name != "--":
|
||||
for trackItem in selection:
|
||||
trackItem.setArtistByName(name)
|
||||
else:
|
||||
for trackItem in selection:
|
||||
tTags = trackItem.tags()
|
||||
for tag in tTags:
|
||||
if tag.metadata().hasKey('tag.artistID'):
|
||||
if tag.metadata().hasKey("tag.artistID"):
|
||||
trackItem.removeTag(tag)
|
||||
break
|
||||
|
||||
|
|
@ -518,7 +518,7 @@ def _getArtistFromID(self, artistID):
|
|||
global gArtistList
|
||||
artist = [
|
||||
element for element in gArtistList
|
||||
if element['artistID'] == int(artistID)
|
||||
if element["artistID"] == int(artistID)
|
||||
]
|
||||
if not artist:
|
||||
return None
|
||||
|
|
@ -530,7 +530,7 @@ def _getArtistFromName(self, artistName):
|
|||
global gArtistList
|
||||
artist = [
|
||||
element for element in gArtistList
|
||||
if element['artistName'] == artistName
|
||||
if element["artistName"] == artistName
|
||||
]
|
||||
if not artist:
|
||||
return None
|
||||
|
|
@ -542,8 +542,8 @@ def _artist(self):
|
|||
artist = None
|
||||
tags = self.tags()
|
||||
for tag in tags:
|
||||
if tag.metadata().hasKey('tag.artistID'):
|
||||
artistID = tag.metadata().value('tag.artistID')
|
||||
if tag.metadata().hasKey("tag.artistID"):
|
||||
artistID = tag.metadata().value("tag.artistID")
|
||||
artist = self.getArtistFromID(artistID)
|
||||
return artist
|
||||
|
||||
|
|
@ -554,30 +554,30 @@ def _updateArtistTag(self, artistDict):
|
|||
artistTag = None
|
||||
tags = self.tags()
|
||||
for tag in tags:
|
||||
if tag.metadata().hasKey('tag.artistID'):
|
||||
if tag.metadata().hasKey("tag.artistID"):
|
||||
artistTag = tag
|
||||
break
|
||||
|
||||
if not artistTag:
|
||||
artistTag = hiero.core.Tag('Artist')
|
||||
artistTag.setIcon(artistDict['artistIcon'])
|
||||
artistTag.metadata().setValue('tag.artistID',
|
||||
str(artistDict['artistID']))
|
||||
artistTag.metadata().setValue('tag.artistName',
|
||||
str(artistDict['artistName']))
|
||||
artistTag.metadata().setValue('tag.artistDepartment',
|
||||
str(artistDict['artistDepartment']))
|
||||
artistTag = hiero.core.Tag("Artist")
|
||||
artistTag.setIcon(artistDict["artistIcon"])
|
||||
artistTag.metadata().setValue("tag.artistID",
|
||||
str(artistDict["artistID"]))
|
||||
artistTag.metadata().setValue("tag.artistName",
|
||||
str(artistDict["artistName"]))
|
||||
artistTag.metadata().setValue("tag.artistDepartment",
|
||||
str(artistDict["artistDepartment"]))
|
||||
self.sequence().editFinished()
|
||||
self.addTag(artistTag)
|
||||
self.sequence().editFinished()
|
||||
return
|
||||
|
||||
artistTag.setIcon(artistDict['artistIcon'])
|
||||
artistTag.metadata().setValue('tag.artistID', str(artistDict['artistID']))
|
||||
artistTag.metadata().setValue('tag.artistName',
|
||||
str(artistDict['artistName']))
|
||||
artistTag.metadata().setValue('tag.artistDepartment',
|
||||
str(artistDict['artistDepartment']))
|
||||
artistTag.setIcon(artistDict["artistIcon"])
|
||||
artistTag.metadata().setValue("tag.artistID", str(artistDict["artistID"]))
|
||||
artistTag.metadata().setValue("tag.artistName",
|
||||
str(artistDict["artistName"]))
|
||||
artistTag.metadata().setValue("tag.artistDepartment",
|
||||
str(artistDict["artistDepartment"]))
|
||||
self.sequence().editFinished()
|
||||
return
|
||||
|
||||
|
|
@ -588,8 +588,9 @@ def _setArtistByName(self, artistName):
|
|||
|
||||
artist = self.getArtistFromName(artistName)
|
||||
if not artist:
|
||||
print 'Artist name: %s was not found in the gArtistList.' % str(
|
||||
artistName)
|
||||
print((
|
||||
"Artist name: {} was not found in "
|
||||
"the gArtistList.").format(artistName))
|
||||
return
|
||||
|
||||
# Do the update.
|
||||
|
|
@ -602,8 +603,8 @@ def _setArtistByID(self, artistID):
|
|||
|
||||
artist = self.getArtistFromID(artistID)
|
||||
if not artist:
|
||||
print 'Artist name: %s was not found in the gArtistList.' % str(
|
||||
artistID)
|
||||
print("Artist name: {} was not found in the gArtistList.".format(
|
||||
artistID))
|
||||
return
|
||||
|
||||
# Do the update.
|
||||
|
|
@ -625,15 +626,15 @@ def _status(self):
|
|||
status = None
|
||||
tags = self.tags()
|
||||
for tag in tags:
|
||||
if tag.metadata().hasKey('tag.status'):
|
||||
status = tag.metadata().value('tag.status')
|
||||
if tag.metadata().hasKey("tag.status"):
|
||||
status = tag.metadata().value("tag.status")
|
||||
return status
|
||||
|
||||
|
||||
def _setStatus(self, status):
|
||||
"""setShotStatus(status) -> Method to set the Status of a Shot.
|
||||
Adds a special kind of status Tag to a TrackItem
|
||||
Example: myTrackItem.setStatus('Final')
|
||||
Example: myTrackItem.setStatus("Final")
|
||||
|
||||
@param status - a string, corresponding to the Status name
|
||||
"""
|
||||
|
|
@ -641,25 +642,25 @@ def _setStatus(self, status):
|
|||
|
||||
# Get a valid Tag object from the Global list of statuses
|
||||
if not status in gStatusTags.keys():
|
||||
print 'Status requested was not a valid Status string.'
|
||||
print("Status requested was not a valid Status string.")
|
||||
return
|
||||
|
||||
# A shot should only have one status. Check if one exists and set accordingly
|
||||
statusTag = None
|
||||
tags = self.tags()
|
||||
for tag in tags:
|
||||
if tag.metadata().hasKey('tag.status'):
|
||||
if tag.metadata().hasKey("tag.status"):
|
||||
statusTag = tag
|
||||
break
|
||||
|
||||
if not statusTag:
|
||||
statusTag = hiero.core.Tag('Status')
|
||||
statusTag = hiero.core.Tag("Status")
|
||||
statusTag.setIcon(gStatusTags[status])
|
||||
statusTag.metadata().setValue('tag.status', status)
|
||||
statusTag.metadata().setValue("tag.status", status)
|
||||
self.addTag(statusTag)
|
||||
|
||||
statusTag.setIcon(gStatusTags[status])
|
||||
statusTag.metadata().setValue('tag.status', status)
|
||||
statusTag.metadata().setValue("tag.status", status)
|
||||
|
||||
self.sequence().editFinished()
|
||||
return
|
||||
|
|
@ -743,7 +744,7 @@ class SetStatusMenu(QMenu):
|
|||
|
||||
# This handles events from the Project Bin View
|
||||
def eventHandler(self, event):
|
||||
if not hasattr(event.sender, 'selection'):
|
||||
if not hasattr(event.sender, "selection"):
|
||||
# Something has gone wrong, we should only be here if raised
|
||||
# by the Timeline/Spreadsheet view which gives a selection.
|
||||
return
|
||||
|
|
@ -781,9 +782,9 @@ class AssignArtistMenu(QMenu):
|
|||
for artist in self.artists:
|
||||
self.menuActions += [
|
||||
titleStringTriggeredAction(
|
||||
artist['artistName'],
|
||||
artist["artistName"],
|
||||
self.setArtistFromMenuSelection,
|
||||
icon=artist['artistIcon'])
|
||||
icon=artist["artistIcon"])
|
||||
]
|
||||
|
||||
def setArtistFromMenuSelection(self, menuSelectionArtist):
|
||||
|
|
@ -818,7 +819,7 @@ class AssignArtistMenu(QMenu):
|
|||
|
||||
# This handles events from the Project Bin View
|
||||
def eventHandler(self, event):
|
||||
if not hasattr(event.sender, 'selection'):
|
||||
if not hasattr(event.sender, "selection"):
|
||||
# Something has gone wrong, we should only be here if raised
|
||||
# by the Timeline/Spreadsheet view which gives a selection.
|
||||
return
|
||||
|
|
@ -833,7 +834,7 @@ class AssignArtistMenu(QMenu):
|
|||
event.menu.addMenu(self)
|
||||
|
||||
|
||||
# Add the 'Set Status' context menu to Timeline and Spreadsheet
|
||||
# Add the "Set Status" context menu to Timeline and Spreadsheet
|
||||
if kAddStatusMenu:
|
||||
setStatusMenu = SetStatusMenu()
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ class PurgeUnusedAction(QAction):
|
|||
self.triggered.connect(self.PurgeUnused)
|
||||
hiero.core.events.registerInterest("kShowContextMenu/kBin",
|
||||
self.eventHandler)
|
||||
self.setIcon(QIcon('icons:TagDelete.png'))
|
||||
self.setIcon(QIcon("icons:TagDelete.png"))
|
||||
|
||||
# Method to return whether a Bin is empty...
|
||||
def binIsEmpty(self, b):
|
||||
|
|
@ -67,19 +67,19 @@ class PurgeUnusedAction(QAction):
|
|||
msgBox.setDefaultButton(QMessageBox.Ok)
|
||||
ret = msgBox.exec_()
|
||||
if ret == QMessageBox.Cancel:
|
||||
print 'Not purging anything.'
|
||||
print("Not purging anything.")
|
||||
elif ret == QMessageBox.Ok:
|
||||
with proj.beginUndo('Purge Unused Clips'):
|
||||
with proj.beginUndo("Purge Unused Clips"):
|
||||
BINS = []
|
||||
for clip in CLIPSTOREMOVE:
|
||||
BI = clip.binItem()
|
||||
B = BI.parentBin()
|
||||
BINS += [B]
|
||||
print 'Removing:', BI
|
||||
print("Removing: {}".format(BI))
|
||||
try:
|
||||
B.removeItem(BI)
|
||||
except:
|
||||
print 'Unable to remove: ' + BI
|
||||
print("Unable to remove: {}".format(BI))
|
||||
return
|
||||
|
||||
# For each sequence, iterate through each track Item, see if the Clip is in the CLIPS list.
|
||||
|
|
@ -104,24 +104,24 @@ class PurgeUnusedAction(QAction):
|
|||
ret = msgBox.exec_()
|
||||
|
||||
if ret == QMessageBox.Cancel:
|
||||
print 'Cancel'
|
||||
print("Cancel")
|
||||
return
|
||||
elif ret == QMessageBox.Ok:
|
||||
BINS = []
|
||||
with proj.beginUndo('Purge Unused Clips'):
|
||||
with proj.beginUndo("Purge Unused Clips"):
|
||||
# Delete the rest of the Clips
|
||||
for clip in CLIPSTOREMOVE:
|
||||
BI = clip.binItem()
|
||||
B = BI.parentBin()
|
||||
BINS += [B]
|
||||
print 'Removing:', BI
|
||||
print("Removing: {}".format(BI))
|
||||
try:
|
||||
B.removeItem(BI)
|
||||
except:
|
||||
print 'Unable to remove: ' + BI
|
||||
print("Unable to remove: {}".format(BI))
|
||||
|
||||
def eventHandler(self, event):
|
||||
if not hasattr(event.sender, 'selection'):
|
||||
if not hasattr(event.sender, "selection"):
|
||||
# Something has gone wrong, we shouldn't only be here if raised
|
||||
# by the Bin view which will give a selection.
|
||||
return
|
||||
|
|
@ -13,21 +13,22 @@ except:
|
|||
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Import File(s)...')
|
||||
# Note: You probably best to make this 'Ctrl+R' - currently conflicts with 'Red' in the Viewer!
|
||||
a.setShortcut(QKeySequence('R'))
|
||||
# Note: You probably best to make this 'Ctrl+R' - currently conflicts with "Red" in the Viewer!
|
||||
a.setShortcut(QKeySequence("R"))
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Import Folder(s)...')
|
||||
a.setShortcut(QKeySequence('Shift+R'))
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Import EDL/XML/AAF...')
|
||||
a = hiero.ui.findMenuAction("Import EDL/XML/AAF...")
|
||||
a.setShortcut(QKeySequence('Ctrl+Shift+O'))
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Metadata View')
|
||||
a.setShortcut(QKeySequence('I'))
|
||||
a = hiero.ui.findMenuAction("Metadata View")
|
||||
a.setShortcut(QKeySequence("I"))
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Edit Settings')
|
||||
a.setShortcut(QKeySequence('S'))
|
||||
a = hiero.ui.findMenuAction("Edit Settings")
|
||||
a.setShortcut(QKeySequence("S"))
|
||||
#----------------------------------------------
|
||||
a = hiero.ui.findMenuAction('Monitor Output')
|
||||
a.setShortcut(QKeySequence('Ctrl+U'))
|
||||
a = hiero.ui.findMenuAction("Monitor Output")
|
||||
if a:
|
||||
a.setShortcut(QKeySequence('Ctrl+U'))
|
||||
#----------------------------------------------
|
||||
|
|
@ -44,16 +44,16 @@ def get_transition_type(otio_item, otio_track):
|
|||
_out = None
|
||||
|
||||
if _in and _out:
|
||||
return 'dissolve'
|
||||
return "dissolve"
|
||||
|
||||
elif _in and not _out:
|
||||
return 'fade_out'
|
||||
return "fade_out"
|
||||
|
||||
elif not _in and _out:
|
||||
return 'fade_in'
|
||||
return "fade_in"
|
||||
|
||||
else:
|
||||
return 'unknown'
|
||||
return "unknown"
|
||||
|
||||
|
||||
def find_trackitem(name, hiero_track):
|
||||
|
|
@ -84,10 +84,10 @@ def apply_transition(otio_track, otio_item, track):
|
|||
|
||||
# Figure out track kind for getattr below
|
||||
if isinstance(track, hiero.core.VideoTrack):
|
||||
kind = ''
|
||||
kind = ""
|
||||
|
||||
else:
|
||||
kind = 'Audio'
|
||||
kind = "Audio"
|
||||
|
||||
try:
|
||||
# Gather TrackItems involved in trasition
|
||||
|
|
@ -98,7 +98,7 @@ def apply_transition(otio_track, otio_item, track):
|
|||
)
|
||||
|
||||
# Create transition object
|
||||
if transition_type == 'dissolve':
|
||||
if transition_type == "dissolve":
|
||||
transition_func = getattr(
|
||||
hiero.core.Transition,
|
||||
'create{kind}DissolveTransition'.format(kind=kind)
|
||||
|
|
@ -111,7 +111,7 @@ def apply_transition(otio_track, otio_item, track):
|
|||
otio_item.out_offset.value
|
||||
)
|
||||
|
||||
elif transition_type == 'fade_in':
|
||||
elif transition_type == "fade_in":
|
||||
transition_func = getattr(
|
||||
hiero.core.Transition,
|
||||
'create{kind}FadeInTransition'.format(kind=kind)
|
||||
|
|
@ -121,7 +121,7 @@ def apply_transition(otio_track, otio_item, track):
|
|||
otio_item.out_offset.value
|
||||
)
|
||||
|
||||
elif transition_type == 'fade_out':
|
||||
elif transition_type == "fade_out":
|
||||
transition_func = getattr(
|
||||
hiero.core.Transition,
|
||||
'create{kind}FadeOutTransition'.format(kind=kind)
|
||||
|
|
@ -150,11 +150,11 @@ def apply_transition(otio_track, otio_item, track):
|
|||
def prep_url(url_in):
|
||||
url = unquote(url_in)
|
||||
|
||||
if url.startswith('file://localhost/'):
|
||||
return url.replace('file://localhost/', '')
|
||||
if url.startswith("file://localhost/"):
|
||||
return url.replace("file://localhost/", "")
|
||||
|
||||
url = '{url}'.format(
|
||||
sep=url.startswith(os.sep) and '' or os.sep,
|
||||
sep=url.startswith(os.sep) and "" or os.sep,
|
||||
url=url.startswith(os.sep) and url[1:] or url
|
||||
)
|
||||
|
||||
|
|
@ -228,8 +228,8 @@ def add_metadata(metadata, hiero_item):
|
|||
continue
|
||||
|
||||
if value is not None:
|
||||
if not key.startswith('tag.'):
|
||||
key = 'tag.' + key
|
||||
if not key.startswith("tag."):
|
||||
key = "tag." + key
|
||||
|
||||
hiero_item.metadata().setValue(key, str(value))
|
||||
|
||||
|
|
@ -371,10 +371,10 @@ def build_sequence(
|
|||
|
||||
if not sequence:
|
||||
# Create a Sequence
|
||||
sequence = hiero.core.Sequence(otio_timeline.name or 'OTIOSequence')
|
||||
sequence = hiero.core.Sequence(otio_timeline.name or "OTIOSequence")
|
||||
|
||||
# Set sequence settings from otio timeline if available
|
||||
if hasattr(otio_timeline, 'global_start_time'):
|
||||
if hasattr(otio_timeline, "global_start_time"):
|
||||
if otio_timeline.global_start_time:
|
||||
start_time = otio_timeline.global_start_time
|
||||
sequence.setFramerate(start_time.rate)
|
||||
|
|
@ -414,7 +414,7 @@ def build_sequence(
|
|||
if isinstance(otio_clip, otio.schema.Stack):
|
||||
bar = hiero.ui.mainWindow().statusBar()
|
||||
bar.showMessage(
|
||||
'Nested sequences are created separately.',
|
||||
"Nested sequences are created separately.",
|
||||
timeout=3000
|
||||
)
|
||||
build_sequence(otio_clip, project, otio_track.kind)
|
||||
|
|
@ -9,19 +9,19 @@ import hiero.core
|
|||
|
||||
import PySide2.QtWidgets as qw
|
||||
|
||||
from openpype.hosts.hiero.otio.hiero_import import load_otio
|
||||
from openpype.hosts.hiero.api.otio.hiero_import import load_otio
|
||||
|
||||
|
||||
class OTIOProjectSelect(qw.QDialog):
|
||||
|
||||
def __init__(self, projects, *args, **kwargs):
|
||||
super(OTIOProjectSelect, self).__init__(*args, **kwargs)
|
||||
self.setWindowTitle('Please select active project')
|
||||
self.setWindowTitle("Please select active project")
|
||||
self.layout = qw.QVBoxLayout()
|
||||
|
||||
self.label = qw.QLabel(
|
||||
'Unable to determine which project to import sequence to.\n'
|
||||
'Please select one.'
|
||||
"Unable to determine which project to import sequence to.\n"
|
||||
"Please select one."
|
||||
)
|
||||
self.layout.addWidget(self.label)
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ def get_sequence(view):
|
|||
|
||||
elif isinstance(view, hiero.ui.BinView):
|
||||
for item in view.selection():
|
||||
if not hasattr(item, 'acitveItem'):
|
||||
if not hasattr(item, "acitveItem"):
|
||||
continue
|
||||
|
||||
if isinstance(item.activeItem(), hiero.core.Sequence):
|
||||
|
|
@ -57,13 +57,13 @@ def get_sequence(view):
|
|||
def OTIO_menu_action(event):
|
||||
# Menu actions
|
||||
otio_import_action = hiero.ui.createMenuAction(
|
||||
'Import OTIO...',
|
||||
"Import OTIO...",
|
||||
open_otio_file,
|
||||
icon=None
|
||||
)
|
||||
|
||||
otio_add_track_action = hiero.ui.createMenuAction(
|
||||
'New Track(s) from OTIO...',
|
||||
"New Track(s) from OTIO...",
|
||||
open_otio_file,
|
||||
icon=None
|
||||
)
|
||||
|
|
@ -80,19 +80,19 @@ def OTIO_menu_action(event):
|
|||
otio_add_track_action.setEnabled(True)
|
||||
|
||||
for action in event.menu.actions():
|
||||
if action.text() == 'Import':
|
||||
if action.text() == "Import":
|
||||
action.menu().addAction(otio_import_action)
|
||||
action.menu().addAction(otio_add_track_action)
|
||||
|
||||
elif action.text() == 'New Track':
|
||||
elif action.text() == "New Track":
|
||||
action.menu().addAction(otio_add_track_action)
|
||||
|
||||
|
||||
def open_otio_file():
|
||||
files = hiero.ui.openFileBrowser(
|
||||
caption='Please select an OTIO file of choice',
|
||||
pattern='*.otio',
|
||||
requiredExtension='.otio'
|
||||
caption="Please select an OTIO file of choice",
|
||||
pattern="*.otio",
|
||||
requiredExtension=".otio"
|
||||
)
|
||||
|
||||
selection = None
|
||||
|
|
@ -117,7 +117,7 @@ def open_otio_file():
|
|||
else:
|
||||
bar = hiero.ui.mainWindow().statusBar()
|
||||
bar.showMessage(
|
||||
'OTIO Import aborted by user',
|
||||
"OTIO Import aborted by user",
|
||||
timeout=3000
|
||||
)
|
||||
return
|
||||
|
|
@ -10,15 +10,15 @@ except:
|
|||
|
||||
|
||||
def setPosterFrame(posterFrame=.5):
|
||||
'''
|
||||
"""
|
||||
Update the poster frame of the given clipItmes
|
||||
posterFrame = .5 uses the centre frame, a value of 0 uses the first frame, a value of 1 uses the last frame
|
||||
'''
|
||||
"""
|
||||
view = hiero.ui.activeView()
|
||||
|
||||
selectedBinItems = view.selection()
|
||||
selectedClipItems = [(item.activeItem()
|
||||
if hasattr(item, 'activeItem') else item)
|
||||
if hasattr(item, "activeItem") else item)
|
||||
for item in selectedBinItems]
|
||||
|
||||
for clip in selectedClipItems:
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import pyblish
|
||||
import openpype
|
||||
from openpype.hosts.hiero import api as phiero
|
||||
from openpype.hosts.hiero.otio import hiero_export
|
||||
from openpype.hosts.hiero.api.otio import hiero_export
|
||||
import hiero
|
||||
|
||||
from compiler.ast import flatten
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import hiero.ui
|
|||
from openpype.hosts.hiero import api as phiero
|
||||
from avalon import api as avalon
|
||||
from pprint import pformat
|
||||
from openpype.hosts.hiero.otio import hiero_export
|
||||
from openpype.hosts.hiero.api.otio import hiero_export
|
||||
from Qt.QtGui import QPixmap
|
||||
import tempfile
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
from pyblish import api
|
||||
import hiero
|
||||
import math
|
||||
from openpype.hosts.hiero.otio.hiero_export import create_otio_time_range
|
||||
from openpype.hosts.hiero.api.otio.hiero_export import create_otio_time_range
|
||||
|
||||
class PrecollectRetime(api.InstancePlugin):
|
||||
"""Calculate Retiming of selected track items."""
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
from OTIOExportTask import OTIOExportTask
|
||||
from OTIOExportUI import OTIOExportUI
|
||||
|
||||
__all__ = [
|
||||
'OTIOExportTask',
|
||||
'OTIOExportUI'
|
||||
]
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
"""Puts the selection project into 'hiero.selection'"""
|
||||
|
||||
import hiero
|
||||
|
||||
|
||||
def selectionChanged(event):
|
||||
hiero.selection = event.sender.selection()
|
||||
|
||||
hiero.core.events.registerInterest('kSelectionChanged', selectionChanged)
|
||||