mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merged in feature/PYPE-551_standalone_publish_lite (pull request #332)
Feature/PYPE-551 standalone publish lite
This commit is contained in:
commit
a2bab256a5
6 changed files with 38 additions and 27 deletions
|
|
@ -26,4 +26,6 @@ class CollectContextLabel(pyblish.api.ContextPlugin):
|
||||||
|
|
||||||
# Set label
|
# Set label
|
||||||
label = "{host} - {scene}".format(host=host.title(), scene=base)
|
label = "{host} - {scene}".format(host=host.title(), scene=base)
|
||||||
|
if host == "standalonepublisher":
|
||||||
|
label = host.title()
|
||||||
context.data["label"] = label
|
context.data["label"] = label
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ from pype.vendor import clique
|
||||||
import pype.api
|
import pype.api
|
||||||
|
|
||||||
|
|
||||||
class ExtractReviewSaP(pyblish.api.InstancePlugin):
|
class ExtractReviewSP(pyblish.api.InstancePlugin):
|
||||||
"""Extracting Review mov file for Ftrack
|
"""Extracting Review mov file for Ftrack
|
||||||
|
|
||||||
Compulsory attribute of representation is tags list with "review",
|
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`
|
filter values use preset's attributes `ext_filter`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
label = "Extract Review SaP"
|
label = "Extract Review SP"
|
||||||
order = pyblish.api.ExtractorOrder + 0.02
|
order = pyblish.api.ExtractorOrder + 0.02
|
||||||
families = ["review"]
|
families = ["review"]
|
||||||
hosts = ["standalonepublisher"]
|
hosts = ["standalonepublisher"]
|
||||||
|
|
@ -24,8 +24,8 @@ class ExtractReviewSaP(pyblish.api.InstancePlugin):
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
# adding plugin attributes from presets
|
# adding plugin attributes from presets
|
||||||
presets = instance.context.data["presets"]
|
presets = instance.context.data["presets"]
|
||||||
publish_presets = presets["plugins"]["global"]["publish"]
|
|
||||||
try:
|
try:
|
||||||
|
publish_presets = presets["plugins"]["standalonepublisher"]["publish"]
|
||||||
plugin_attrs = publish_presets[self.__class__.__name__]
|
plugin_attrs = publish_presets[self.__class__.__name__]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise KeyError("Preset for plugin \"{}\" are not set".format(
|
raise KeyError("Preset for plugin \"{}\" are not set".format(
|
||||||
|
|
@ -5,7 +5,7 @@ import pyblish.api
|
||||||
import pype.api
|
import pype.api
|
||||||
|
|
||||||
|
|
||||||
class ExtractThumbnail(pyblish.api.InstancePlugin):
|
class ExtractThumbnailSP(pyblish.api.InstancePlugin):
|
||||||
"""Extract jpeg thumbnail from component input from standalone publisher
|
"""Extract jpeg thumbnail from component input from standalone publisher
|
||||||
|
|
||||||
Uses jpeg file from component if possible (when single or multiple jpegs
|
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.
|
input file/s single jpeg to temp.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
label = "Extract Thumbnail"
|
label = "Extract Thumbnail SP"
|
||||||
hosts = ["standalonepublisher"]
|
hosts = ["standalonepublisher"]
|
||||||
order = pyblish.api.ExtractorOrder
|
order = pyblish.api.ExtractorOrder
|
||||||
|
|
||||||
|
|
@ -15,21 +15,6 @@ from pypeapp import execute
|
||||||
import pyblish.api
|
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):
|
def set_context(project, asset, task, app):
|
||||||
''' Sets context for pyblish (must be done before pyblish is launched)
|
''' Sets context for pyblish (must be done before pyblish is launched)
|
||||||
:param project: Name of `Project` where instance should be published
|
: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())
|
"-pp", os.pathsep.join(pyblish.api.registered_paths())
|
||||||
]
|
]
|
||||||
|
|
||||||
os.environ["PYBLISH_HOSTS"] = "standalonepublisher"
|
envcopy = os.environ.copy()
|
||||||
os.environ["SAPUBLISH_INPATH"] = json_data_path
|
envcopy["PYBLISH_HOSTS"] = "standalonepublisher"
|
||||||
|
envcopy["SAPUBLISH_INPATH"] = json_data_path
|
||||||
|
|
||||||
if gui:
|
if gui:
|
||||||
av_publish.show()
|
av_publish.show()
|
||||||
else:
|
else:
|
||||||
returncode = execute([
|
returncode = execute([
|
||||||
sys.executable, "-u", "-m", "pyblish"
|
sys.executable, "-u", "-m", "pyblish"
|
||||||
] + args, env=os.environ)
|
] + args, env=envcopy)
|
||||||
|
|
||||||
io.uninstall()
|
io.uninstall()
|
||||||
|
|
||||||
|
|
@ -139,13 +125,15 @@ def cli_publish(data, gui=True):
|
||||||
if gui:
|
if gui:
|
||||||
args += ["gui"]
|
args += ["gui"]
|
||||||
|
|
||||||
os.environ["PYBLISH_HOSTS"] = "standalonepublisher"
|
envcopy = os.environ.copy()
|
||||||
os.environ["SAPUBLISH_INPATH"] = json_data_path
|
envcopy["PYBLISH_HOSTS"] = "standalonepublisher"
|
||||||
os.environ["SAPUBLISH_OUTPATH"] = return_data_path
|
envcopy["SAPUBLISH_INPATH"] = json_data_path
|
||||||
|
envcopy["SAPUBLISH_OUTPATH"] = return_data_path
|
||||||
|
envcopy["PYBLISH_GUI"] = "pyblish_lite"
|
||||||
|
|
||||||
returncode = execute([
|
returncode = execute([
|
||||||
sys.executable, "-u", "-m", "pyblish"
|
sys.executable, "-u", "-m", "pyblish"
|
||||||
] + args, env=os.environ)
|
] + args, env=envcopy)
|
||||||
|
|
||||||
result = {}
|
result = {}
|
||||||
if os.path.exists(json_data_path):
|
if os.path.exists(json_data_path):
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
|
import os
|
||||||
from .app import show
|
from .app import show
|
||||||
from .widgets import QtWidgets
|
from .widgets import QtWidgets
|
||||||
|
import pype
|
||||||
|
import pyblish.api
|
||||||
|
|
||||||
|
|
||||||
class StandAlonePublishModule:
|
class StandAlonePublishModule:
|
||||||
|
PUBLISH_PATHS = []
|
||||||
|
|
||||||
def __init__(self, main_parent=None, parent=None):
|
def __init__(self, main_parent=None, parent=None):
|
||||||
self.main_parent = main_parent
|
self.main_parent = main_parent
|
||||||
self.parent_widget = parent
|
self.parent_widget = parent
|
||||||
|
self.PUBLISH_PATHS.append(os.path.sep.join(
|
||||||
|
[pype.PLUGINS_DIR, "standalonepublisher", "publish"]
|
||||||
|
))
|
||||||
|
|
||||||
def tray_menu(self, parent_menu):
|
def tray_menu(self, parent_menu):
|
||||||
self.run_action = QtWidgets.QAction(
|
self.run_action = QtWidgets.QAction(
|
||||||
|
|
@ -14,5 +22,18 @@ class StandAlonePublishModule:
|
||||||
self.run_action.triggered.connect(self.show)
|
self.run_action.triggered.connect(self.show)
|
||||||
parent_menu.addAction(self.run_action)
|
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):
|
def show(self):
|
||||||
show(self.main_parent, False)
|
show(self.main_parent, False)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue