Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Use 'folderPath' instead of 'asset' during publishing #81

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aafc647
use 'folderPath' instead of 'asset'
iLLiCiTiT Feb 16, 2024
ecba1da
changed docstrings
iLLiCiTiT Feb 16, 2024
4ab0591
fix used key in collect current context
iLLiCiTiT Feb 16, 2024
f5fb730
use 'folderPath' in hosts
iLLiCiTiT Feb 16, 2024
eaf6e0d
fix collect anatomy instance data
iLLiCiTiT Feb 16, 2024
47f51af
fix precollect workfile in hiero
iLLiCiTiT Feb 16, 2024
2cbbe4b
file maya collectors
iLLiCiTiT Feb 19, 2024
9c22294
fix another maya plugins
iLLiCiTiT Feb 19, 2024
1675fbf
Merge branch 'develop' into enhancement/OP-8208_Use-folderPath-during…
iLLiCiTiT Feb 19, 2024
14ba402
fix forgotten places
iLLiCiTiT Feb 20, 2024
43485cc
fix extract usd layered
iLLiCiTiT Feb 20, 2024
fc10b8d
Merge branch 'develop' into enhancement/OP-8208_Use-folderPath-during…
iLLiCiTiT Feb 20, 2024
74ec502
Merge branch 'develop' into enhancement/OP-8208_Use-folderPath-during…
iLLiCiTiT Feb 20, 2024
ce6fc93
fix collect usd bootstrap
iLLiCiTiT Feb 20, 2024
522e1b1
fix extract hierarchy to ayon
iLLiCiTiT Feb 20, 2024
229bd07
fix 'get_last_versions_for_instances'
iLLiCiTiT Feb 20, 2024
e145b33
Fix typo in data key and update variable name.
jakubjezek001 Feb 20, 2024
ebfa5a2
fix traypublisher editorial
iLLiCiTiT Feb 20, 2024
9677b16
Merge branch 'develop' into enhancement/OP-8208_Use-folderPath-during…
iLLiCiTiT Feb 21, 2024
7e78937
fix 'update_content_on_context_change' in maya
iLLiCiTiT Feb 21, 2024
65006af
Merge branch 'develop' into enhancement/OP-8208_Use-folderPath-during…
jakubjezek001 Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_instances(self, context):
source=current_file,
label="{} - {}".format(subset_name, family),
subset=subset_name,
asset=inst.data["asset"],
folderPath=inst.data["folderPath"],
task=task_name,
attachTo=False,
setMembers='',
Expand Down Expand Up @@ -175,7 +175,7 @@ def get_expected_files(self, render_instance):
version_str = "v{:03d}".format(render_instance.version)
if "#" not in file_name: # single frame (mov)W
path = os.path.join(base_dir, "{}_{}_{}.{}".format(
render_instance.asset,
render_instance.folderPath,
render_instance.subset,
version_str,
ext
Expand All @@ -184,7 +184,7 @@ def get_expected_files(self, render_instance):
else:
for frame in range(start, end + 1):
path = os.path.join(base_dir, "{}_{}_{}.{}.{}".format(
render_instance.asset,
render_instance.folderPath,
render_instance.subset,
version_str,
str(frame).zfill(self.padding_width),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def _get_new_instance(self, context, scene_file):
asset_entity = context.data["assetEntity"]
project_entity = context.data["projectEntity"]

asset_name = get_asset_name_identifier(asset_entity)
folder_path = get_asset_name_identifier(asset_entity)

instance_data = {
"active": True,
"asset": asset_name,
"folderPath": folder_path,
"task": task,
"frameStart": context.data['frameStart'],
"frameEnd": context.data['frameEnd'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def process(self, context, plugin):
for instance in instances:
data = stub.read(instance[0])

data["asset"] = get_current_asset_name()
data["folderPath"] = get_current_asset_name()
stub.imprint(instance[0].instance_id, data)


Expand All @@ -53,7 +53,7 @@ class ValidateInstanceAsset(pyblish.api.InstancePlugin):
order = ValidateContentsOrder

def process(self, instance):
instance_asset = instance.data["asset"]
instance_asset = instance.data["folderPath"]
current_asset = get_current_asset_name()
msg = (
f"Instance asset {instance_asset} is not the same "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def create(
)

# Get instance name
name = plugin.prepare_scene_name(instance_data["asset"], subset_name)
name = plugin.prepare_scene_name(
instance_data["folderPath"], subset_name
)

if pre_create_data.get("use_selection"):
for obj in lib.get_selection():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def process(self, context):
asset_name = get_asset_name_identifier(asset_entity)

shared_instance_data = {
"asset": asset_name,
"folderPath": asset_name,
"frameStart": asset_entity["data"]["frameStart"],
"frameEnd": asset_entity["data"]["frameEnd"],
"handleStart": asset_entity["data"]["handleStart"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def process(self, context):
project_settings=context.data["project_settings"]
)

asset_name = get_asset_name_identifier(asset_doc)
folder_path = get_asset_name_identifier(asset_doc)

# adding otio timeline to context
with opfapi.maintained_segment_selection(sequence) as selected_seg:
otio_timeline = flame_export.create_otio_timeline(sequence)

instance_data = {
"name": subset_name,
"asset": asset_name,
"folderPath": folder_path,
"subset": subset_name,
"family": "workfile",
"families": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def process(self, instance):

# flame objects
segment = instance.data["item"]
asset_name = instance.data["asset"]
folder_path = instance.data["folderPath"]
segment_name = segment.name.get_value()
clip_path = instance.data["path"]
sequence_clip = instance.context.data["flameSequence"]
Expand Down Expand Up @@ -249,7 +249,7 @@ def process(self, instance):
out_mark = in_mark + source_duration_handles
exporting_clip = self.import_clip(clip_path)
exporting_clip.name.set_value("{}_{}".format(
asset_name, segment_name))
folder_path, segment_name))

# add xml tags modifications
modify_xml_data.update({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def _get_batch_group(self, instance, task_data):
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]
frame_duration = (frame_end - frame_start) + 1
asset_name = instance.data["asset"]
folder_path = instance.data["folderPath"]

task_name = task_data["name"]
batchgroup_name = "{}_{}".format(asset_name, task_name)
batchgroup_name = "{}_{}".format(folder_path, task_name)

batch_data = {
"shematic_reels": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def get_instances(self, context):
source=current_file,
label=inst.data["label"],
subset=subset_name,
asset=inst.data["asset"],
folderPath=inst.data["folderPath"],
task=task_name,
attachTo=False,
setMembers='',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def process(self, instance):
self.log.info(
"Rendered '{nm}' for asset '{ast}' under the task '{tsk}'".format(
nm=instance.data["name"],
ast=instance.data["asset"],
ast=instance.data["folderPath"],
tsk=instance.data["task"],
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def get_invalid(cls, context):
# Collect instances per subset per asset
instances_per_subset_asset = defaultdict(lambda: defaultdict(list))
for instance in context:
asset = instance.data.get("asset", context.data.get("asset"))
asset = instance.data.get(
"folderPath", context.data.get("folderPath")
)
subset = instance.data.get("subset", context.data.get("subset"))
instances_per_subset_asset[asset][subset].append(instance)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_instances(self, context):

self_name = self.__class__.__name__

asset_name = context.data["asset"]
folder_path = context.data["folderPath"]

for node in context.data["allNodes"]:
data = harmony.read(node)
Expand Down Expand Up @@ -142,7 +142,7 @@ def get_instances(self, context):
source=context.data["currentFile"],
label=node.split("/")[1],
subset=subset_name,
asset=asset_name,
folderPath=folder_path,
task=task_name,
attachTo=False,
setMembers=[node],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ def process(self, context):
if (not any([re.search(pattern, task_name)
for pattern in self.allowed_tasks])):
return
asset_name = context.data["asset"]
folder_path = context.data["folderPath"]

for name, id in palettes.items():
instance = context.create_instance(name)
instance.data.update({
"id": id,
"family": "harmony.palette",
'families': [],
"asset": asset_name,
"folderPath": folder_path,
"subset": "{}{}".format("palette", name)
})
self.log.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ def process(self, context):
"family": family,
"families": [family],
"representations": [],
"asset": context.data["asset"]
"folderPath": context.data["folderPath"]
})
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ def process(self, context, plugin):
# Apply pyblish.logic to get the instances for the plug-in
instances = pyblish.api.instances_by_plugin(failed, plugin)

folder_path = get_current_asset_name()
for instance in instances:
data = harmony.read(instance.data["setMembers"][0])
data["asset"] = get_current_asset_name()
data["folderPath"] = folder_path
harmony.imprint(instance.data["setMembers"][0], data)


Expand All @@ -42,7 +43,7 @@ class ValidateInstance(pyblish.api.InstancePlugin):
order = ValidateContentsOrder

def process(self, instance):
instance_asset = instance.data["asset"]
instance_asset = instance.data["folderPath"]
current_asset = get_current_asset_name()
msg = (
"Instance asset is not the same as current asset:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def process(self, instance):
data["subset"] = name
data["family"] = family
data["families"] = [family]
data["name"] = data["subset"] + "_" + data["asset"]
data["name"] = data["subset"] + "_" + data["folderPath"]
data["label"] = "{} - {}".format(
data['asset'], data["subset"]
data["folderPath"], data["subset"]
)
data["effects"] = effects

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _create_frame_subset_data_sequence(self, context):
# first collect all available subset tag frames
subset_data = {}
context_asset_doc = context.data["assetEntity"]
context_asset_name = get_asset_name_identifier(context_asset_doc)
context_folder_path = get_asset_name_identifier(context_asset_doc)

for tag_data in sequence_tags:
frame = int(tag_data["start"])
Expand All @@ -120,7 +120,7 @@ def _create_frame_subset_data_sequence(self, context):
subset_data[subset] = {
"frames": [frame],
"format": tag_data["format"],
"asset": context_asset_name
"folderPath": context_folder_path
}
return subset_data

Expand All @@ -133,7 +133,7 @@ def _create_instances(self, subset_data):
"label": "{} {}".format(name, subset_data["frames"]),
"family": "image",
"families": ["frame"],
"asset": subset_data["asset"],
"folderPath": subset_data["folderPath"],
"subset": name,
"format": subset_data["format"],
"frames": subset_data["frames"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def process(self, instance):
"sourceStart", "sourceStartH", "sourceEnd", "sourceEndH",
"frameStart", "frameEnd",
"clipIn", "clipOut", "clipInH", "clipOutH",
"asset", "version"
"folderPath", "version"
]

# pass data to version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def process(self, context):
data.update({
"name": "{}_{}".format(asset, subset),
"label": label,
"asset": asset,
"folderPath": asset,
"asset_name": asset_name,
"item": track_item,
"families": families,
Expand Down Expand Up @@ -189,7 +189,7 @@ def create_shot_instance(self, context, **data):
if not hierarchy_data:
return

asset = data["asset"]
asset = data["folderPath"]
asset_name = data["asset_name"]

# insert family into families
Expand Down Expand Up @@ -241,15 +241,14 @@ def create_audio_instance(self, context, **data):
if not master_layer:
return

asset = data.get("asset")
item = data.get("item")
clip_name = item.name()

# test if any audio clips
if not self.test_any_audio(item):
return

asset = data["asset"]
asset = data["folferPath"]
asset_name = data["asset_name"]

# insert family into families
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder - 0.491

def process(self, context):
asset = context.data["asset"]
asset = context.data["folderPath"]
asset_name = asset.split("/")[-1]

active_timeline = hiero.ui.activeSequence()
Expand Down Expand Up @@ -64,7 +64,7 @@ def process(self, context):
"label": "{} - {}Main".format(
asset, family),
"name": "{}_{}".format(asset_name, family),
"asset": context.data["asset"],
"folderPath": context.data["folderPath"],
# TODO use 'get_subset_name'
"subset": "{}{}Main".format(asset_name, family.capitalize()),
"item": project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def process(self, context):

# Create nice name if the instance has a frame range.
label = data.get("name", node.name())
label += " (%s)" % data["asset"] # include asset in name
label += " (%s)" % data["folderPath"] # include folder in name

instance = context.create_instance(label)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def process(self, instance):
renderer = str(renderer_class).split(":")[0]
# also need to get the render dir for conversion
data = {
"asset": instance.data["asset"],
"folderPath": instance.data["folderPath"],
"subset": str(instance.name),
"publish": True,
"maxversion": str(get_max_version()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def process(self, context):

data.update({
"subset": subset,
"asset": context.data["asset"],
"folderPath": context.data["folderPath"],
"label": subset,
"publish": True,
"family": 'workfile',
Expand Down
4 changes: 2 additions & 2 deletions client/ayon_core/hosts/maya/api/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GenerateUUIDsOnInvalidAction(pyblish.api.Action):
receive new UUIDs are actually invalid.

Requires:
- instance.data["asset"]
- instance.data["folderPath"]

"""

Expand Down Expand Up @@ -78,7 +78,7 @@ def _update_id_attribute(self, instance, nodes):
# should be always available, but kept a way to query it by name.
asset_doc = instance.data.get("assetEntity")
if not asset_doc:
asset_name = instance.data["asset"]
asset_name = instance.data["folderPath"]
project_name = instance.context.data["projectName"]
self.log.info((
"Asset is not stored on instance."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ def is_group(group_name):
r = re.compile(regex)
m = r.match(top_group)
project_name = instance.context.data["projectName"]
current_asset_name = instance.context.data["asset"]
current_folder_path = instance.context.data["folderPath"]
if m is None:
cls.log.error("invalid name on: {}".format(top_group))
cls.log.error("name doesn't match regex {}".format(regex))
invalid.append(top_group)
else:
if "asset" in r.groupindex:
if m.group("asset") != current_asset_name:
if m.group("folderPath") != current_folder_path:
cls.log.error("Invalid asset name in top level group.")
return top_group
if "subset" in r.groupindex:
Expand Down
Loading