mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into enhancement/OP-2858_move-AvalonMongoDB-logic
This commit is contained in:
commit
a579cd31c8
116 changed files with 3112 additions and 1204 deletions
|
|
@ -1,9 +1,19 @@
|
|||
from openpype.modules import ModulesManager
|
||||
from openpype.pipeline import load
|
||||
from openpype.lib.avalon_context import get_linked_ids_for_representations
|
||||
from openpype.modules.sync_server.utils import SiteAlreadyPresentError
|
||||
|
||||
|
||||
class AddSyncSite(load.LoaderPlugin):
|
||||
"""Add sync site to representation"""
|
||||
"""Add sync site to representation
|
||||
|
||||
If family of synced representation is 'workfile', it looks for all
|
||||
representations which are referenced (loaded) in workfile with content of
|
||||
'inputLinks'.
|
||||
It doesn't do any checks for site, most common use case is when artist is
|
||||
downloading workfile to his local site, but it might be helpful when
|
||||
artist is re-uploading broken representation on remote site also.
|
||||
"""
|
||||
representations = ["*"]
|
||||
families = ["*"]
|
||||
|
||||
|
|
@ -12,21 +22,42 @@ class AddSyncSite(load.LoaderPlugin):
|
|||
icon = "download"
|
||||
color = "#999999"
|
||||
|
||||
_sync_server = None
|
||||
is_add_site_loader = True
|
||||
|
||||
@property
|
||||
def sync_server(self):
|
||||
if not self._sync_server:
|
||||
manager = ModulesManager()
|
||||
self._sync_server = manager.modules_by_name["sync_server"]
|
||||
|
||||
return self._sync_server
|
||||
|
||||
def load(self, context, name=None, namespace=None, data=None):
|
||||
self.log.info("Adding {} to representation: {}".format(
|
||||
data["site_name"], data["_id"]))
|
||||
self.add_site_to_representation(data["project_name"],
|
||||
data["_id"],
|
||||
data["site_name"])
|
||||
self.log.debug("Site added.")
|
||||
family = context["representation"]["context"]["family"]
|
||||
project_name = data["project_name"]
|
||||
repre_id = data["_id"]
|
||||
site_name = data["site_name"]
|
||||
|
||||
@staticmethod
|
||||
def add_site_to_representation(project_name, representation_id, site_name):
|
||||
"""Adds new site to representation_id, resets if exists"""
|
||||
manager = ModulesManager()
|
||||
sync_server = manager.modules_by_name["sync_server"]
|
||||
sync_server.add_site(project_name, representation_id, site_name,
|
||||
force=True)
|
||||
self.sync_server.add_site(project_name, repre_id, site_name,
|
||||
force=True)
|
||||
|
||||
if family == "workfile":
|
||||
links = get_linked_ids_for_representations(project_name,
|
||||
[repre_id],
|
||||
link_type="reference")
|
||||
for link_repre_id in links:
|
||||
try:
|
||||
self.sync_server.add_site(project_name, link_repre_id,
|
||||
site_name,
|
||||
force=False)
|
||||
except SiteAlreadyPresentError:
|
||||
# do not add/reset working site for references
|
||||
self.log.debug("Site present", exc_info=True)
|
||||
|
||||
self.log.debug("Site added.")
|
||||
|
||||
def filepath_from_context(self, context):
|
||||
"""No real file loading"""
|
||||
|
|
|
|||
|
|
@ -12,22 +12,26 @@ class RemoveSyncSite(load.LoaderPlugin):
|
|||
icon = "download"
|
||||
color = "#999999"
|
||||
|
||||
_sync_server = None
|
||||
is_remove_site_loader = True
|
||||
|
||||
@property
|
||||
def sync_server(self):
|
||||
if not self._sync_server:
|
||||
manager = ModulesManager()
|
||||
self._sync_server = manager.modules_by_name["sync_server"]
|
||||
|
||||
return self._sync_server
|
||||
|
||||
def load(self, context, name=None, namespace=None, data=None):
|
||||
self.log.info("Removing {} on representation: {}".format(
|
||||
data["site_name"], data["_id"]))
|
||||
self.remove_site_on_representation(data["project_name"],
|
||||
data["_id"],
|
||||
data["site_name"])
|
||||
self.sync_server.remove_site(data["project_name"],
|
||||
data["_id"],
|
||||
data["site_name"],
|
||||
True)
|
||||
self.log.debug("Site added.")
|
||||
|
||||
@staticmethod
|
||||
def remove_site_on_representation(project_name, representation_id,
|
||||
site_name):
|
||||
manager = ModulesManager()
|
||||
sync_server = manager.modules_by_name["sync_server"]
|
||||
sync_server.remove_site(project_name, representation_id,
|
||||
site_name, True)
|
||||
|
||||
def filepath_from_context(self, context):
|
||||
"""No real file loading"""
|
||||
return ""
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin):
|
|||
|
||||
# Update global data to context
|
||||
context.data.update(create_context.context_data_to_store())
|
||||
|
||||
context.data["newPublishing"] = True
|
||||
# Update context data
|
||||
for key in ("AVALON_PROJECT", "AVALON_ASSET", "AVALON_TASK"):
|
||||
value = create_context.dbcon.Session.get(key)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from openpype.lib import (
|
|||
run_openpype_process,
|
||||
|
||||
get_transcode_temp_directory,
|
||||
convert_for_ffmpeg,
|
||||
convert_input_paths_for_ffmpeg,
|
||||
should_convert_for_ffmpeg,
|
||||
|
||||
CREATE_NO_WINDOW
|
||||
|
|
@ -187,8 +187,13 @@ class ExtractBurnin(openpype.api.Extractor):
|
|||
repre_files = repre["files"]
|
||||
if isinstance(repre_files, (tuple, list)):
|
||||
filename = repre_files[0]
|
||||
src_filepaths = [
|
||||
os.path.join(src_repre_staging_dir, filename)
|
||||
for filename in repre_files
|
||||
]
|
||||
else:
|
||||
filename = repre_files
|
||||
src_filepaths = [os.path.join(src_repre_staging_dir, filename)]
|
||||
|
||||
first_input_path = os.path.join(src_repre_staging_dir, filename)
|
||||
# Determine if representation requires pre conversion for ffmpeg
|
||||
|
|
@ -209,11 +214,9 @@ class ExtractBurnin(openpype.api.Extractor):
|
|||
new_staging_dir = get_transcode_temp_directory()
|
||||
repre["stagingDir"] = new_staging_dir
|
||||
|
||||
convert_for_ffmpeg(
|
||||
first_input_path,
|
||||
convert_input_paths_for_ffmpeg(
|
||||
src_filepaths,
|
||||
new_staging_dir,
|
||||
_temp_data["frameStart"],
|
||||
_temp_data["frameEnd"],
|
||||
self.log
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from openpype.lib import (
|
|||
path_to_subprocess_arg,
|
||||
|
||||
get_transcode_temp_directory,
|
||||
convert_for_ffmpeg,
|
||||
convert_input_paths_for_ffmpeg,
|
||||
should_convert_for_ffmpeg
|
||||
)
|
||||
|
||||
|
|
@ -79,11 +79,9 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
|
|||
if do_convert:
|
||||
convert_dir = get_transcode_temp_directory()
|
||||
filename = os.path.basename(full_input_path)
|
||||
convert_for_ffmpeg(
|
||||
full_input_path,
|
||||
convert_input_paths_for_ffmpeg(
|
||||
[full_input_path],
|
||||
convert_dir,
|
||||
None,
|
||||
None,
|
||||
self.log
|
||||
)
|
||||
full_input_path = os.path.join(convert_dir, filename)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ from openpype.lib import (
|
|||
path_to_subprocess_arg,
|
||||
|
||||
should_convert_for_ffmpeg,
|
||||
convert_for_ffmpeg,
|
||||
convert_input_paths_for_ffmpeg,
|
||||
get_transcode_temp_directory
|
||||
)
|
||||
import speedcopy
|
||||
|
|
@ -194,16 +194,20 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
src_repre_staging_dir = repre["stagingDir"]
|
||||
# Receive filepath to first file in representation
|
||||
first_input_path = None
|
||||
input_filepaths = []
|
||||
if not self.input_is_sequence(repre):
|
||||
first_input_path = os.path.join(
|
||||
src_repre_staging_dir, repre["files"]
|
||||
)
|
||||
input_filepaths.append(first_input_path)
|
||||
else:
|
||||
for filename in repre["files"]:
|
||||
first_input_path = os.path.join(
|
||||
filepath = os.path.join(
|
||||
src_repre_staging_dir, filename
|
||||
)
|
||||
break
|
||||
input_filepaths.append(filepath)
|
||||
if first_input_path is None:
|
||||
first_input_path = filepath
|
||||
|
||||
# Skip if file is not set
|
||||
if first_input_path is None:
|
||||
|
|
@ -230,13 +234,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
|
|||
new_staging_dir = get_transcode_temp_directory()
|
||||
repre["stagingDir"] = new_staging_dir
|
||||
|
||||
frame_start = instance.data["frameStart"]
|
||||
frame_end = instance.data["frameEnd"]
|
||||
convert_for_ffmpeg(
|
||||
first_input_path,
|
||||
convert_input_paths_for_ffmpeg(
|
||||
input_filepaths,
|
||||
new_staging_dir,
|
||||
frame_start,
|
||||
frame_end,
|
||||
self.log
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
"usdOverride",
|
||||
"simpleUnrealTexture"
|
||||
]
|
||||
exclude_families = ["clip"]
|
||||
exclude_families = ["clip", "render.farm"]
|
||||
db_representation_context_keys = [
|
||||
"project", "asset", "task", "subset", "version", "representation",
|
||||
"family", "hierarchy", "task", "username"
|
||||
|
|
@ -131,11 +131,15 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
subset_grouping_profiles = None
|
||||
|
||||
def process(self, instance):
|
||||
self.integrated_file_sizes = {}
|
||||
if [ef for ef in self.exclude_families
|
||||
if instance.data["family"] in ef]:
|
||||
return
|
||||
for ef in self.exclude_families:
|
||||
if (
|
||||
instance.data["family"] == ef or
|
||||
ef in instance.data["families"]):
|
||||
self.log.debug("Excluded family '{}' in '{}' or {}".format(
|
||||
ef, instance.data["family"], instance.data["families"]))
|
||||
return
|
||||
|
||||
self.integrated_file_sizes = {}
|
||||
try:
|
||||
self.register(instance)
|
||||
self.log.info("Integrated Asset in to the database ...")
|
||||
|
|
@ -228,7 +232,10 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
|
|||
|
||||
# Ensure at least one file is set up for transfer in staging dir.
|
||||
repres = instance.data.get("representations")
|
||||
assert repres, "Instance has no files to transfer"
|
||||
repres = instance.data.get("representations")
|
||||
msg = "Instance {} has no files to transfer".format(
|
||||
instance.data["family"])
|
||||
assert repres, msg
|
||||
assert isinstance(repres, (list, tuple)), (
|
||||
"Instance 'files' must be a list, got: {0} {1}".format(
|
||||
str(type(repres)), str(repres)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue