Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Move subset name functionality #3723

Merged
merged 9 commits into from
Aug 26, 2022
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

import pyblish.api
from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline import legacy_io
from openpype.pipeline.create import get_subset_name


class CollectWorkfile(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -71,13 +71,14 @@ def _get_new_instance(self, context, scene_file):

# workfile instance
family = "workfile"
subset = get_subset_name_with_asset_doc(
subset = get_subset_name(
family,
self.default_variant,
context.data["anatomyData"]["task"]["name"],
context.data["assetEntity"],
context.data["anatomyData"]["project"]["name"],
host_name=context.data["hostName"]
host_name=context.data["hostName"],
project_settings=context.data["project_settings"]
)
# Create instance
instance = context.create_instance(subset)
Expand Down
9 changes: 6 additions & 3 deletions openpype/hosts/flame/plugins/publish/collect_timeline_otio.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pyblish.api

import openpype.lib as oplib
from openpype.pipeline import legacy_io
import openpype.hosts.flame.api as opfapi
from openpype.hosts.flame.otio import flame_export
from openpype.pipeline import legacy_io
from openpype.pipeline.create import get_subset_name


class CollecTimelineOTIO(pyblish.api.ContextPlugin):
Expand All @@ -24,11 +24,14 @@ def process(self, context):
sequence = opfapi.get_current_sequence(opfapi.CTX.selection)

# create subset name
subset_name = oplib.get_subset_name_with_asset_doc(
subset_name = get_subset_name(
family,
variant,
task_name,
asset_doc,
context.data["projectName"],
context.data["hostName"],
project_settings=context.data["project_settings"]
)

# adding otio timeline to context
Expand Down
9 changes: 5 additions & 4 deletions openpype/hosts/harmony/plugins/publish/collect_workfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""Collect current workfile from Harmony."""
import pyblish.api
import os
import pyblish.api

from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name


class CollectWorkfile(pyblish.api.ContextPlugin):
Expand All @@ -17,13 +17,14 @@ def process(self, context):
"""Plugin entry point."""
family = "workfile"
basename = os.path.basename(context.data["currentFile"])
subset = get_subset_name_with_asset_doc(
subset = get_subset_name(
family,
"",
context.data["anatomyData"]["task"]["name"],
context.data["assetEntity"],
context.data["anatomyData"]["project"]["name"],
host_name=context.data["hostName"]
host_name=context.data["hostName"],
project_settings=context.data["project_settings"]
)

# Create instance
Expand Down
7 changes: 4 additions & 3 deletions openpype/hosts/photoshop/plugins/publish/collect_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import pyblish.api

from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name


class CollectReview(pyblish.api.ContextPlugin):
Expand All @@ -27,13 +27,14 @@ class CollectReview(pyblish.api.ContextPlugin):

def process(self, context):
family = "review"
subset = get_subset_name_with_asset_doc(
subset = get_subset_name(
family,
context.data.get("variant", ''),
context.data["anatomyData"]["task"]["name"],
context.data["assetEntity"],
context.data["anatomyData"]["project"]["name"],
host_name=context.data["hostName"]
host_name=context.data["hostName"],
project_settings=context.data["project_settings"]
)

instance = context.create_instance(subset)
Expand Down
7 changes: 4 additions & 3 deletions openpype/hosts/photoshop/plugins/publish/collect_workfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import pyblish.api

from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name


class CollectWorkfile(pyblish.api.ContextPlugin):
Expand All @@ -24,13 +24,14 @@ def process(self, context):
family = "workfile"
# context.data["variant"] might come only from collect_batch_data
variant = context.data.get("variant") or self.default_variant
subset = get_subset_name_with_asset_doc(
subset = get_subset_name(
family,
variant,
context.data["anatomyData"]["task"]["name"],
context.data["assetEntity"],
context.data["anatomyData"]["project"]["name"],
host_name=context.data["hostName"]
host_name=context.data["hostName"],
project_settings=context.data["project_settings"]
)

file_path = context.data["currentFile"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import json
import pyblish.api

from openpype.lib import get_subset_name_with_asset_doc
from openpype.client import get_asset_by_name
from openpype.pipeline.create import get_subset_name


class CollectBulkMovInstances(pyblish.api.InstancePlugin):
Expand Down Expand Up @@ -44,12 +44,14 @@ def process(self, instance):
task_name = available_task_names[_task_name_low]
break

subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
self.new_instance_family,
self.subset_name_variant,
task_name,
asset_doc,
project_name
project_name,
host_name=context.data["hostName"],
project_settings=context.data["project_settings"]
)
instance_name = f"{asset_name}_{subset_name}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
from openpype.lib import (
FileDef,
BoolDef,
get_subset_name_with_asset_doc,
TaskNotSetError,
)
from openpype.pipeline import (
CreatedInstance,
CreatorError
)
from openpype.pipeline.create import (
get_subset_name,
TaskNotSetError,
)

from openpype.hosts.traypublisher.api.plugin import TrayPublishCreator

Expand Down Expand Up @@ -130,7 +132,7 @@ def _get_subset_and_task(self, asset_doc, variant, project_name):
task_name = self._get_task_name(asset_doc)

try:
subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
self.family,
variant,
task_name,
Expand All @@ -143,7 +145,7 @@ def _get_subset_and_task(self, asset_doc, variant, project_name):
# but user have ability to change it
# NOTE: This expect that there is not task 'Undefined' on asset
task_name = "Undefined"
subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
self.family,
variant,
task_name,
Expand Down
7 changes: 4 additions & 3 deletions openpype/hosts/tvpaint/plugins/publish/collect_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pyblish.api

from openpype.client import get_asset_by_name
from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline import legacy_io
from openpype.pipeline.create import get_subset_name


class CollectInstances(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -107,13 +107,14 @@ def process(self, context):
# Use empty variant value
variant = ""
task_name = legacy_io.Session["AVALON_TASK"]
new_subset_name = get_subset_name_with_asset_doc(
new_subset_name = get_subset_name(
family,
variant,
task_name,
asset_doc,
project_name,
host_name
host_name,
project_settings=context.data["project_settings"]
)
instance_data["subset"] = new_subset_name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pyblish.api

from openpype.client import get_asset_by_name
from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name


class CollectRenderScene(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -75,14 +75,15 @@ def process(self, context):
dynamic_data["render_pass"] = dynamic_data["renderpass"]

task_name = workfile_context["task"]
subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
"render",
variant,
task_name,
asset_doc,
project_name,
host_name,
dynamic_data=dynamic_data
dynamic_data=dynamic_data,
project_settings=context.data["project_settings"]
)

instance_data = {
Expand Down
7 changes: 4 additions & 3 deletions openpype/hosts/tvpaint/plugins/publish/collect_workfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pyblish.api

from openpype.client import get_asset_by_name
from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline import legacy_io
from openpype.pipeline.create import get_subset_name


class CollectWorkfile(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -39,13 +39,14 @@ def process(self, context):
# Use empty variant value
variant = ""
task_name = legacy_io.Session["AVALON_TASK"]
subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
family,
variant,
task_name,
asset_doc,
project_name,
host_name
host_name,
project_settings=context.data["project_settings"]
)

# Create Workfile instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
get_ffprobe_streams,
convert_ffprobe_fps_value,
)
from openpype.lib.plugin_tools import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name
from openpype_modules.webpublisher.lib import parse_json


Expand Down Expand Up @@ -78,9 +78,14 @@ def process(self, context):
is_sequence,
extension.replace(".", ''))

subset_name = get_subset_name_with_asset_doc(
family, variant, task_name, asset_doc,
project_name=project_name, host_name="webpublisher"
subset_name = get_subset_name(
family,
variant,
task_name,
asset_doc,
project_name=project_name,
host_name="webpublisher",
project_settings=context.data["project_settings"]
)
version = self._get_next_version(
project_name, asset_doc, subset_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import copy
import pyblish.api

from openpype.lib import get_subset_name_with_asset_doc
from openpype.pipeline.create import get_subset_name


class CollectTVPaintInstances(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -47,27 +47,29 @@ def process(self, context):
new_instances = []

# Workfile instance
workfile_subset_name = get_subset_name_with_asset_doc(
workfile_subset_name = get_subset_name(
self.workfile_family,
self.workfile_variant,
task_name,
asset_doc,
project_name,
host_name
host_name,
project_settings=context.data["project_settings"]
)
workfile_instance = self._create_workfile_instance(
context, workfile_subset_name
)
new_instances.append(workfile_instance)

# Review instance
review_subset_name = get_subset_name_with_asset_doc(
review_subset_name = get_subset_name(
self.review_family,
self.review_variant,
task_name,
asset_doc,
project_name,
host_name
host_name,
project_settings=context.data["project_settings"]
)
review_instance = self._create_review_instance(
context, review_subset_name
Expand Down Expand Up @@ -114,14 +116,15 @@ def process(self, context):
"family": "render"
}

subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
self.render_pass_family,
render_pass,
task_name,
asset_doc,
project_name,
host_name,
dynamic_data=dynamic_data
dynamic_data=dynamic_data,
project_settings=context.data["project_settings"]
)

instance = self._create_render_pass_instance(
Expand All @@ -137,14 +140,15 @@ def process(self, context):
# Override family for subset name
"family": "render"
}
subset_name = get_subset_name_with_asset_doc(
subset_name = get_subset_name(
self.render_layer_family,
variant,
task_name,
asset_doc,
project_name,
host_name,
dynamic_data=dynamic_data
dynamic_data=dynamic_data,
project_settings=context.data["project_settings"]
)
instance = self._create_render_layer_instance(
context, layers, subset_name
Expand Down
Loading