Merge branch 'develop' into bugfix/OP-4914_Anchored-publishing-issues

This commit is contained in:
Jakub Jezek 2023-02-14 14:27:24 +01:00
commit 6027b1e080
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
7 changed files with 67 additions and 26 deletions

View file

@ -164,7 +164,6 @@ def get_linked_representation_id(
# Recursive graph lookup for inputs
{"$graphLookup": graph_lookup}
]
conn = get_project_connection(project_name)
result = conn.aggregate(query_pipeline)
referenced_version_ids = _process_referenced_pipeline_result(
@ -213,7 +212,7 @@ def _process_referenced_pipeline_result(result, link_type):
for output in sorted(outputs_recursive, key=lambda o: o["depth"]):
output_links = output.get("data", {}).get("inputLinks")
if not output_links:
if not output_links and output["type"] != "hero_version":
continue
# Leaf
@ -232,6 +231,9 @@ def _process_referenced_pipeline_result(result, link_type):
def _filter_input_links(input_links, link_type, correctly_linked_ids):
if not input_links: # to handle hero versions
return
for input_link in input_links:
if link_type and input_link["type"] != link_type:
continue

View file

@ -44,7 +44,7 @@ class AppendBlendLoader(plugin.AssetLoader):
"""
representations = ["blend"]
families = ["*"]
families = ["workfile"]
label = "Append Workfile"
order = 9
@ -68,7 +68,7 @@ class ImportBlendLoader(plugin.AssetLoader):
"""
representations = ["blend"]
families = ["*"]
families = ["workfile"]
label = "Import Workfile"
order = 9

View file

@ -34,12 +34,24 @@ class AddSyncSite(load.LoaderPlugin):
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"]))
family = context["representation"]["context"]["family"]
project_name = data["project_name"]
repre_id = data["_id"]
""""Adds site skeleton information on representation_id
Looks for loaded containers for workfile, adds them site skeleton too
(eg. they should be downloaded too).
Args:
context (dict):
name (str):
namespace (str):
data (dict): expects {"site_name": SITE_NAME_TO_ADD}
"""
# self.log wont propagate
project_name = context["project"]["name"]
repre_doc = context["representation"]
family = repre_doc["context"]["family"]
repre_id = repre_doc["_id"]
site_name = data["site_name"]
print("Adding {} to representation: {}".format(
data["site_name"], repre_id))
self.sync_server.add_site(project_name, repre_id, site_name,
force=True)
@ -52,6 +64,8 @@ class AddSyncSite(load.LoaderPlugin):
)
for link_repre_id in links:
try:
print("Adding {} to linked representation: {}".format(
data["site_name"], link_repre_id))
self.sync_server.add_site(project_name, link_repre_id,
site_name,
force=False)

View file

@ -3,7 +3,10 @@ from openpype.pipeline import load
class RemoveSyncSite(load.LoaderPlugin):
"""Remove sync site and its files on representation"""
"""Remove sync site and its files on representation.
Removes files only on local site!
"""
representations = ["*"]
families = ["*"]
@ -24,13 +27,18 @@ class RemoveSyncSite(load.LoaderPlugin):
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.sync_server.remove_site(data["project_name"],
data["_id"],
data["site_name"],
project_name = context["project"]["name"]
repre_doc = context["representation"]
repre_id = repre_doc["_id"]
site_name = data["site_name"]
print("Removing {} on representation: {}".format(site_name, repre_id))
self.sync_server.remove_site(project_name,
repre_id,
site_name,
True)
self.log.debug("Site added.")
self.log.debug("Site removed.")
def filepath_from_context(self, context):
"""No real file loading"""

View file

@ -386,6 +386,25 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
repre["_id"] = old_repre["_id"]
update_data = prepare_representation_update_data(
old_repre, repre)
# Keep previously synchronized sites up-to-date
# by comparing old and new sites and adding old sites
# if missing in new ones
old_repre_files_sites = [
f.get("sites", []) for f in old_repre.get("files", [])
]
for i, file in enumerate(repre.get("files", [])):
repre_sites_names = {
s["name"] for s in file.get("sites", [])
}
for site in old_repre_files_sites[i]:
if site["name"] not in repre_sites_names:
# Pop the date to tag for sync
site.pop("created_dt", None)
file["sites"].append(site)
update_data["files"][i] = file
op_session.update_entity(
project_name,
old_repre["type"],

View file

@ -1480,23 +1480,21 @@ class RepresentationWidget(QtWidgets.QWidget):
repre_ids = []
data_by_repre_id = {}
selected_side = action_representation.get("selected_side")
site_name = "{}_site_name".format(selected_side)
is_sync_loader = tools_lib.is_sync_loader(loader)
for item in items:
item_id = item.get("_id")
repre_ids.append(item_id)
repre_id = item["_id"]
repre_ids.append(repre_id)
if not is_sync_loader:
continue
site_name = "{}_site_name".format(selected_side)
data_site_name = item.get(site_name)
if not data_site_name:
continue
data_by_repre_id[item_id] = {
"_id": item_id,
"site_name": data_site_name,
"project_name": self.dbcon.active_project()
data_by_repre_id[repre_id] = {
"site_name": data_site_name
}
repre_contexts = get_repres_contexts(repre_ids, self.dbcon)
@ -1586,8 +1584,8 @@ def _load_representations_by_loader(loader, repre_contexts,
version_name = version_doc.get("name")
try:
if data_by_repre_id:
_id = repre_context["representation"]["_id"]
data = data_by_repre_id.get(_id)
repre_id = repre_context["representation"]["_id"]
data = data_by_repre_id.get(repre_id)
options.update(data)
load_with_repre_context(
loader,

View file

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring Pype version."""
__version__ = "3.15.1-nightly.4"
__version__ = "3.15.1-nightly.5"