🔧 wip use FileLocation for transfers

This commit is contained in:
Ondřej Samohel 2024-11-07 17:05:24 +01:00
parent 5b2d8590e6
commit 39a9239743
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
2 changed files with 16 additions and 1 deletions

View file

@ -20,6 +20,7 @@ from ayon_core.pipeline.publish import (
get_publish_template_name,
)
from ayon_core.pipeline.traits import Persistent, Representation
from pipeline.traits import FileLocation
if TYPE_CHECKING:
import logging
@ -146,6 +147,12 @@ class IntegrateTraits(pyblish.api.InstancePlugin):
instance.data["versionEntity"] = version_entity
# 7) Get transfers from representations
for representation in representations:
# this should test version-less FileLocation probably
if representation.contains_trait(FileLocation):
self.log.debug(
"Representation: %s", representation)
# 8) Transfer files
# 9) Commit the session to AYON
# 10) Finalize represetations - add integrated path Trait etc.
@ -306,7 +313,7 @@ class IntegrateTraits(pyblish.api.InstancePlugin):
all_version_data = self.get_version_data_from_instance(instance)
version_data = {}
version_attributes = {}
attr_defs = self._get_attributes_for_type(instance.context, "version")
attr_defs = self.get_attributes_for_type(instance.context, "version")
for key, value in all_version_data.items():
if key in attr_defs:
version_attributes[key] = value
@ -435,6 +442,11 @@ class IntegrateTraits(pyblish.api.InstancePlugin):
),path)
return path
def get_attributes_for_type(
self, context: pyblish.api.Context, entity_type: str) -> dict:
"""Get AYON attributes for the given entity type."""
return self.get_attributes_by_type(context)[entity_type]
def get_attributes_by_type(
self, context: pyblish.api.Context) -> dict:
"""Gets AYON attributes from the given context."""

View file

@ -108,6 +108,9 @@ def mock_context(
frame_end=SEQUENCE_LENGTH,
frame_padding=4,
frame_regex=r"^img\.(\d{4})\.png$",
frame_in=0,
frame_out=SEQUENCE_LENGTH - 1,
frames_per_second=25
),
FileLocation(
file_path=sequence_files[0],