harmony is using product name and type

This commit is contained in:
Jakub Trllo 2024-02-22 17:06:48 +01:00
parent 9d72a7bff2
commit cf0ac31aa6
17 changed files with 75 additions and 62 deletions

View file

@ -204,7 +204,7 @@ class CreateComposite(harmony.Creator):
name = "compositeDefault"
label = "Composite"
family = "mindbender.template"
product_type = "mindbender.template"
def __init__(self, *args, **kwargs):
super(CreateComposite, self).__init__(*args, **kwargs)
@ -221,7 +221,7 @@ class CreateRender(harmony.Creator):
name = "writeDefault"
label = "Write"
family = "mindbender.imagesequence"
product_type = "mindbender.imagesequence"
node_type = "WRITE"
def __init__(self, *args, **kwargs):

View file

@ -88,7 +88,7 @@ ImageSequenceLoader.getUniqueColumnName = function(columnPrefix) {
* var args = [
* files, // Files in file sequences.
* asset, // Asset name.
* subset, // Subset name.
* productName, // Product name.
* startFrame, // Sequence starting frame.
* groupId // Unique group ID (uuid4).
* ];
@ -106,7 +106,7 @@ ImageSequenceLoader.prototype.importFiles = function(args) {
var doc = $.scn;
var files = args[0];
var asset = args[1];
var subset = args[2];
var productName = args[2];
var startFrame = args[3];
var groupId = args[4];
var vectorFormat = null;
@ -124,7 +124,7 @@ ImageSequenceLoader.prototype.importFiles = function(args) {
var num = 0;
var name = '';
do {
name = asset + '_' + (num++) + '_' + subset;
name = asset + '_' + (num++) + '_' + productName;
} while (currentGroup.getNodeByName(name) != null);
extension = filename.substr(pos+1).toLowerCase();

View file

@ -31,7 +31,7 @@ var TemplateLoader = function() {};
* var args = [
* templatePath, // Path to tpl file.
* assetName, // Asset name.
* subsetName, // Subset name.
* productName, // Product name.
* groupId // unique ID (uuid4)
* ];
*/
@ -39,7 +39,7 @@ TemplateLoader.prototype.loadContainer = function(args) {
var doc = $.scn;
var templatePath = args[0];
var assetName = args[1];
var subset = args[2];
var productName = args[2];
var groupId = args[3];
// Get the current group
@ -62,7 +62,7 @@ TemplateLoader.prototype.loadContainer = function(args) {
var num = 0;
var containerGroupName = '';
do {
containerGroupName = assetName + '_' + (num++) + '_' + subset;
containerGroupName = assetName + '_' + (num++) + '_' + productName;
} while (currentGroup.getNodeByName(containerGroupName) != null);
// import the template

View file

@ -9,7 +9,7 @@ class CreateFarmRender(plugin.Creator):
name = "renderDefault"
label = "Render on Farm"
family = "renderFarm"
product_type = "renderFarm"
node_type = "WRITE"
def __init__(self, *args, **kwargs):

View file

@ -9,7 +9,7 @@ class CreateRender(plugin.Creator):
name = "renderDefault"
label = "Render"
family = "render"
product_type = "render"
node_type = "WRITE"
def __init__(self, *args, **kwargs):

View file

@ -6,7 +6,7 @@ class CreateTemplate(plugin.Creator):
name = "templateDefault"
label = "Template"
family = "harmony.template"
product_type = "harmony.template"
def __init__(self, *args, **kwargs):
super(CreateTemplate, self).__init__(*args, **kwargs)

View file

@ -45,12 +45,12 @@ class ImportAudioLoader(load.LoaderPlugin):
{"function": func, "args": [context["subset"]["name"], wav_file]}
)
subset_name = context["subset"]["name"]
product_name = context["subset"]["name"]
return harmony.containerise(
subset_name,
product_name,
namespace,
subset_name,
product_name,
context,
self.__class__.__name__
)

View file

@ -254,7 +254,7 @@ class BackgroundLoader(load.LoaderPlugin):
bg_folder = os.path.dirname(path)
subset_name = context["subset"]["name"]
product_name = context["subset"]["name"]
# read_node_name += "_{}".format(uuid.uuid4())
container_nodes = []
@ -272,9 +272,9 @@ class BackgroundLoader(load.LoaderPlugin):
container_nodes.append(read_node)
return harmony.containerise(
subset_name,
product_name,
namespace,
subset_name,
product_name,
context,
self.__class__.__name__,
nodes=container_nodes

View file

@ -47,7 +47,7 @@ class ImageSequenceLoader(load.LoaderPlugin):
files.append(fname.parent.joinpath(remainder[0]).as_posix())
asset = context["asset"]["name"]
subset = context["subset"]["name"]
product_name = context["subset"]["name"]
group_id = str(uuid.uuid4())
read_node = harmony.send(
@ -56,7 +56,7 @@ class ImageSequenceLoader(load.LoaderPlugin):
"args": [
files,
asset,
subset,
product_name,
1,
group_id
]
@ -64,7 +64,7 @@ class ImageSequenceLoader(load.LoaderPlugin):
)["result"]
return harmony.containerise(
f"{asset}_{subset}",
f"{asset}_{product_name}",
namespace,
read_node,
context,

View file

@ -27,8 +27,8 @@ class ImportPaletteLoader(load.LoaderPlugin):
)
def load_palette(self, representation):
subset_name = representation["context"]["subset"]
name = subset_name.replace("palette", "")
product_name = representation["context"]["subset"]
name = product_name.replace("palette", "")
# Overwrite palette on disk.
scene_path = harmony.send(
@ -44,7 +44,7 @@ class ImportPaletteLoader(load.LoaderPlugin):
harmony.save_scene()
msg = "Updated {}.".format(subset_name)
msg = "Updated {}.".format(product_name)
msg += " You need to reload the scene to see the changes.\n"
msg += "Please save workfile when ready and use Workfiles "
msg += "to reopen it."

View file

@ -40,12 +40,12 @@ class ImportTemplateLoader(load.LoaderPlugin):
shutil.rmtree(temp_dir)
subset_name = context["subset"]["name"]
product_name = context["subset"]["name"]
return harmony.containerise(
subset_name,
product_name,
namespace,
subset_name,
product_name,
context,
self.__class__.__name__
)

View file

@ -80,7 +80,7 @@ class CollectFarmRender(publish.AbstractCollectRender):
for frame in range(start, end + 1):
expected_files.append(
path / "{}-{}.{}".format(
render_instance.subset,
render_instance.productName,
str(frame).rjust(int(info[2]) + 1, "0"),
ext
)
@ -89,7 +89,7 @@ class CollectFarmRender(publish.AbstractCollectRender):
return expected_files
def get_instances(self, context):
"""Get instances per Write node in `renderFarm` family."""
"""Get instances per Write node in `renderFarm` product type."""
version = None
if self.sync_workfile_version:
version = context.data["version"]
@ -111,7 +111,10 @@ class CollectFarmRender(publish.AbstractCollectRender):
if "container" in data["id"]:
continue
if data["family"] != "renderFarm":
product_type = data.get("productType")
if product_type is None:
product_type = data.get("family")
if product_type != "renderFarm":
continue
# 0 - filename / 1 - type / 2 - zeros / 3 - start / 4 - enabled
@ -124,15 +127,14 @@ class CollectFarmRender(publish.AbstractCollectRender):
# TODO: handle pixel aspect and frame step
# TODO: set Deadline stuff (pools, priority, etc. by presets)
# because of using 'renderFarm' as a family, replace 'Farm' with
# capitalized task name - issue of avalon-core Creator app
subset_name = node.split("/")[1]
task_name = context.data["anatomyData"]["task"][
"name"].capitalize()
# because of using 'renderFarm' as a product type, replace 'Farm'
# with capitalized task name - issue of Creator tool
product_name = node.split("/")[1]
task_name = context.data["task"].capitalize()
replace_str = ""
if task_name.lower() not in subset_name.lower():
if task_name.lower() not in product_name.lower():
replace_str = task_name
subset_name = subset_name.replace(
product_name = product_name.replace(
'Farm',
replace_str)
@ -141,7 +143,7 @@ class CollectFarmRender(publish.AbstractCollectRender):
time=get_formatted_current_time(),
source=context.data["currentFile"],
label=node.split("/")[1],
subset=subset_name,
productName=product_name,
folderPath=folder_path,
task=task_name,
attachTo=False,
@ -151,7 +153,7 @@ class CollectFarmRender(publish.AbstractCollectRender):
priority=50,
name=node.split("/")[1],
family="render.farm",
productType="render.farm",
families=["render.farm"],
farm=True,

View file

@ -19,7 +19,7 @@ class CollectInstances(pyblish.api.ContextPlugin):
label = "Instances"
order = pyblish.api.CollectorOrder
hosts = ["harmony"]
families_mapping = {
product_type_mapping = {
"render": ["review", "ftrack"],
"harmony.template": [],
"palette": ["palette", "ftrack"]
@ -49,8 +49,13 @@ class CollectInstances(pyblish.api.ContextPlugin):
if "container" in data["id"]:
continue
# skip render farm family as it is collected separately
if data["family"] == "renderFarm":
product_type = data.get("productType")
if product_type is None:
product_type = data["family"]
data["productType"] = product_type
# skip render farm product type as it is collected separately
if product_type == "renderFarm":
continue
instance = context.create_instance(node.split("/")[-1])
@ -59,11 +64,14 @@ class CollectInstances(pyblish.api.ContextPlugin):
instance.data["publish"] = harmony.send(
{"function": "node.getEnable", "args": [node]}
)["result"]
instance.data["families"] = self.families_mapping[data["family"]]
families = [product_type]
families.extend(self.product_type_mapping[product_type])
instance.data["families"] = families
# If set in plugin, pair the scene Version in ftrack with
# thumbnails and review media.
if (self.pair_media and instance.data["family"] == "scene"):
if (self.pair_media and product_type == "scene"):
context.data["scene_instance"] = instance
# Produce diagnostic message for any graphical

View file

@ -33,14 +33,15 @@ class CollectPalettes(pyblish.api.ContextPlugin):
return
folder_path = context.data["folderPath"]
product_type = "harmony.palette"
for name, id in palettes.items():
instance = context.create_instance(name)
instance.data.update({
"id": id,
"family": "harmony.palette",
'families': [],
"productType": product_type,
"families": [product_type],
"folderPath": folder_path,
"subset": "{}{}".format("palette", name)
"productName": "{}{}".format("palette", name)
})
self.log.info(
"Created instance:\n" + json.dumps(

View file

@ -3,7 +3,7 @@
import os
import pyblish.api
from ayon_core.pipeline.create import get_subset_name
from ayon_core.pipeline.create import get_product_name
class CollectWorkfile(pyblish.api.ContextPlugin):
@ -15,26 +15,26 @@ class CollectWorkfile(pyblish.api.ContextPlugin):
def process(self, context):
"""Plugin entry point."""
family = "workfile"
product_type = "workfile"
basename = os.path.basename(context.data["currentFile"])
subset = get_subset_name(
family,
"",
context.data["anatomyData"]["task"]["name"],
product_name = get_product_name(
context.data["projectName"],
context.data["assetEntity"],
context.data["anatomyData"]["project"]["name"],
host_name=context.data["hostName"],
context.data["task"],
context.data["hostName"],
product_type,
"",
project_settings=context.data["project_settings"]
)
# Create instance
instance = context.create_instance(subset)
instance = context.create_instance(product_name)
instance.data.update({
"subset": subset,
"productName": product_name,
"label": basename,
"name": basename,
"family": family,
"families": [family],
"productType": product_type,
"families": [product_type],
"representations": [],
"folderPath": context.data["folderPath"]
})

View file

@ -75,7 +75,9 @@ class ExtractTemplate(publish.Extractor):
instance.data["representations"] = [representation]
instance.data["version_name"] = "{}_{}".format(
instance.data["subset"], instance.context.data["task"])
instance.data["productName"],
instance.context.data["task"]
)
def get_backdrops(self, node: str) -> list:
"""Get backdrops for the node.

View file

@ -3,9 +3,9 @@
<error id="main">
<title>Subset context</title>
<description>
## Invalid subset context
## Invalid product context
Asset name found '{found}' in subsets, expected '{expected}'.
Asset name found '{found}' in products, expected '{expected}'.
### How to repair?
@ -19,7 +19,7 @@ If this is unwanted, close workfile and open again, that way different asset val
### __Detailed Info__ (optional)
This might happen if you are reuse old workfile and open it in different context.
(Eg. you created subset "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing subset for "Robot" asset stayed in the workfile.)
(Eg. you created product "renderCompositingDefault" from asset "Robot' in "your_project_Robot_compositing.aep", now you opened this workfile in a context "Sloth" but existing product for "Robot" asset stayed in the workfile.)
</detail>
</error>
</root>