Merge branch 'hotfix/activate_project_deprecation'

This commit is contained in:
Milan Kolar 2020-09-10 22:40:10 +02:00
commit af993b59db
4 changed files with 22 additions and 55 deletions

View file

@ -88,8 +88,14 @@ class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
instance.data["frameEnd"] - instance.data["frameStart"]
)
if not comp.get('fps'):
comp['fps'] = instance.context.data['fps']
fps = comp.get('fps')
if fps is None:
fps = instance.data.get(
"fps", instance.context.data['fps']
)
comp['fps'] = fps
location = self.get_ftrack_location(
'ftrack.server', ft_session
)

View file

@ -25,7 +25,8 @@ class ExtractBurnin(pype.api.Extractor):
"shell",
"nukestudio",
"premiere",
"standalonepublisher"
"standalonepublisher",
"harmony"
]
optional = True

View file

@ -4,6 +4,7 @@ import subprocess
import pyblish.api
from avalon import harmony
import pype.lib
import clique
@ -43,6 +44,9 @@ class ExtractRender(pyblish.api.InstancePlugin):
frame_start = result[4]
frame_end = result[5]
audio_path = result[6]
if audio_path:
instance.data["audio"] = [{"filename": audio_path}]
instance.data["fps"] = frame_rate
# Set output path to temp folder.
path = tempfile.mkdtemp()
@ -87,17 +91,13 @@ class ExtractRender(pyblish.api.InstancePlugin):
if len(list(col)) > 1:
collection = col
else:
# assert len(collections) == 1, (
# "There should only be one image sequence in {}. Found: {}".format(
# path, len(collections)
# )
# )
collection = collections[0]
# Generate thumbnail.
thumbnail_path = os.path.join(path, "thumbnail.png")
ffmpeg_path = pype.lib.get_ffmpeg_tool_path("ffmpeg")
args = [
"ffmpeg", "-y",
ffmpeg_path, "-y",
"-i", os.path.join(path, list(collections[0])[0]),
"-vf", "scale=300:-1",
"-vframes", "1",
@ -117,57 +117,17 @@ class ExtractRender(pyblish.api.InstancePlugin):
self.log.debug(output.decode("utf-8"))
# Generate mov.
mov_path = os.path.join(path, instance.data["name"] + ".mov")
if os.path.isfile(audio_path):
args = [
"ffmpeg", "-y",
"-i", audio_path,
"-i",
os.path.join(path, collection.head + "%04d" + collection.tail),
mov_path
]
else:
args = [
"ffmpeg", "-y",
"-i",
os.path.join(path, collection.head + "%04d" + collection.tail),
mov_path
]
process = subprocess.Popen(
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdin=subprocess.PIPE
)
output = process.communicate()[0]
if process.returncode != 0:
raise ValueError(output.decode("utf-8"))
self.log.debug(output.decode("utf-8"))
# Generate representations.
extension = collection.tail[1:]
representation = {
"name": extension,
"ext": extension,
"files": list(collection),
"stagingDir": path
}
movie = {
"name": "mov",
"ext": "mov",
"files": os.path.basename(mov_path),
"stagingDir": path,
"frameStart": frame_start,
"frameEnd": frame_end,
"fps": frame_rate,
"preview": True,
"tags": ["review", "ftrackreview"]
"tags": ["review"],
"fps": frame_rate
}
thumbnail = {
"name": "thumbnail",
"ext": "png",
@ -175,7 +135,7 @@ class ExtractRender(pyblish.api.InstancePlugin):
"stagingDir": path,
"tags": ["thumbnail"]
}
instance.data["representations"] = [representation, movie, thumbnail]
instance.data["representations"] = [representation, thumbnail]
# Required for extract_review plugin (L222 onwards).
instance.data["frameStart"] = frame_start

View file

@ -240,7 +240,7 @@ class AssetWidget(QtWidgets.QWidget):
self.combo_projects.clear()
if len(projects) > 0:
self.combo_projects.addItems(projects)
self.dbcon.activate_project(projects[0])
self.dbcon.Session["AVALON_PROJECT"] = projects[0]
def on_project_change(self):
projects = list()
@ -248,7 +248,7 @@ class AssetWidget(QtWidgets.QWidget):
projects.append(project['name'])
project_name = self.combo_projects.currentText()
if project_name in projects:
self.dbcon.activate_project(project_name)
self.dbcon.Session["AVALON_PROJECT"] = project_name
self.refresh()
def _refresh_model(self):