Merged in feature/PYPE-551_standalone_publish_lite (pull request #332)

Feature/PYPE-551 standalone publish lite
This commit is contained in:
Jakub Trllo 2019-10-25 09:04:46 +00:00 committed by Jakub Ježek
commit a2bab256a5
6 changed files with 38 additions and 27 deletions

View file

@ -26,4 +26,6 @@ class CollectContextLabel(pyblish.api.ContextPlugin):
# Set label
label = "{host} - {scene}".format(host=host.title(), scene=base)
if host == "standalonepublisher":
label = host.title()
context.data["label"] = label

View file

@ -5,7 +5,7 @@ from pype.vendor import clique
import pype.api
class ExtractReviewSaP(pyblish.api.InstancePlugin):
class ExtractReviewSP(pyblish.api.InstancePlugin):
"""Extracting Review mov file for Ftrack
Compulsory attribute of representation is tags list with "review",
@ -16,7 +16,7 @@ class ExtractReviewSaP(pyblish.api.InstancePlugin):
filter values use preset's attributes `ext_filter`
"""
label = "Extract Review SaP"
label = "Extract Review SP"
order = pyblish.api.ExtractorOrder + 0.02
families = ["review"]
hosts = ["standalonepublisher"]
@ -24,8 +24,8 @@ class ExtractReviewSaP(pyblish.api.InstancePlugin):
def process(self, instance):
# adding plugin attributes from presets
presets = instance.context.data["presets"]
publish_presets = presets["plugins"]["global"]["publish"]
try:
publish_presets = presets["plugins"]["standalonepublisher"]["publish"]
plugin_attrs = publish_presets[self.__class__.__name__]
except KeyError:
raise KeyError("Preset for plugin \"{}\" are not set".format(

View file

@ -5,7 +5,7 @@ import pyblish.api
import pype.api
class ExtractThumbnail(pyblish.api.InstancePlugin):
class ExtractThumbnailSP(pyblish.api.InstancePlugin):
"""Extract jpeg thumbnail from component input from standalone publisher
Uses jpeg file from component if possible (when single or multiple jpegs
@ -13,7 +13,7 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
input file/s single jpeg to temp.
"""
label = "Extract Thumbnail"
label = "Extract Thumbnail SP"
hosts = ["standalonepublisher"]
order = pyblish.api.ExtractorOrder

View file

@ -15,21 +15,6 @@ from pypeapp import execute
import pyblish.api
# Registers Global pyblish plugins
pype.install()
# Registers Standalone pyblish plugins
# PUBLISH_PATH = os.path.sep.join(
# [pype.PLUGINS_DIR, 'standalonepublish', 'publish']
# )
# pyblish.api.register_plugin_path(PUBLISH_PATH)
# Registers Standalone pyblish plugins
PUBLISH_PATH = os.path.sep.join(
[pype.PLUGINS_DIR, 'ftrack', 'publish']
)
pyblish.api.register_plugin_path(PUBLISH_PATH)
def set_context(project, asset, task, app):
''' Sets context for pyblish (must be done before pyblish is launched)
:param project: Name of `Project` where instance should be published
@ -103,15 +88,16 @@ def avalon_api_publish(data, gui=True):
"-pp", os.pathsep.join(pyblish.api.registered_paths())
]
os.environ["PYBLISH_HOSTS"] = "standalonepublisher"
os.environ["SAPUBLISH_INPATH"] = json_data_path
envcopy = os.environ.copy()
envcopy["PYBLISH_HOSTS"] = "standalonepublisher"
envcopy["SAPUBLISH_INPATH"] = json_data_path
if gui:
av_publish.show()
else:
returncode = execute([
sys.executable, "-u", "-m", "pyblish"
] + args, env=os.environ)
] + args, env=envcopy)
io.uninstall()
@ -139,13 +125,15 @@ def cli_publish(data, gui=True):
if gui:
args += ["gui"]
os.environ["PYBLISH_HOSTS"] = "standalonepublisher"
os.environ["SAPUBLISH_INPATH"] = json_data_path
os.environ["SAPUBLISH_OUTPATH"] = return_data_path
envcopy = os.environ.copy()
envcopy["PYBLISH_HOSTS"] = "standalonepublisher"
envcopy["SAPUBLISH_INPATH"] = json_data_path
envcopy["SAPUBLISH_OUTPATH"] = return_data_path
envcopy["PYBLISH_GUI"] = "pyblish_lite"
returncode = execute([
sys.executable, "-u", "-m", "pyblish"
] + args, env=os.environ)
] + args, env=envcopy)
result = {}
if os.path.exists(json_data_path):

View file

@ -1,11 +1,19 @@
import os
from .app import show
from .widgets import QtWidgets
import pype
import pyblish.api
class StandAlonePublishModule:
PUBLISH_PATHS = []
def __init__(self, main_parent=None, parent=None):
self.main_parent = main_parent
self.parent_widget = parent
self.PUBLISH_PATHS.append(os.path.sep.join(
[pype.PLUGINS_DIR, "standalonepublisher", "publish"]
))
def tray_menu(self, parent_menu):
self.run_action = QtWidgets.QAction(
@ -14,5 +22,18 @@ class StandAlonePublishModule:
self.run_action.triggered.connect(self.show)
parent_menu.addAction(self.run_action)
def process_modules(self, modules):
if "FtrackModule" in modules:
self.PUBLISH_PATHS.append(os.path.sep.join(
[pype.PLUGINS_DIR, "ftrack", "publish"]
))
def tray_start(self):
# Registers Global pyblish plugins
pype.install()
# Registers Standalone pyblish plugins
for path in self.PUBLISH_PATHS:
pyblish.api.register_plugin_path(path)
def show(self):
show(self.main_parent, False)