mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Fusion: get filepath from representation instead of listing files from publish folder
This commit is contained in:
parent
21090fffcc
commit
16cece3e49
1 changed files with 8 additions and 17 deletions
|
|
@ -1,11 +1,9 @@
|
||||||
import os
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
from openpype.client import get_version_by_id
|
import openpype.pipeline.load as load
|
||||||
from openpype.pipeline import (
|
from openpype.pipeline.load import (
|
||||||
load,
|
get_representation_context,
|
||||||
legacy_io,
|
get_representation_path_from_context
|
||||||
get_representation_path,
|
|
||||||
)
|
)
|
||||||
from openpype.hosts.fusion.api import (
|
from openpype.hosts.fusion.api import (
|
||||||
imprint_container,
|
imprint_container,
|
||||||
|
|
@ -141,7 +139,7 @@ class FusionLoadSequence(load.LoaderPlugin):
|
||||||
namespace = context['asset']['name']
|
namespace = context['asset']['name']
|
||||||
|
|
||||||
# Use the first file for now
|
# Use the first file for now
|
||||||
path = self._get_first_image(os.path.dirname(self.fname))
|
path = get_representation_path_from_context(context)
|
||||||
|
|
||||||
# Create the Loader with the filename path set
|
# Create the Loader with the filename path set
|
||||||
comp = get_current_comp()
|
comp = get_current_comp()
|
||||||
|
|
@ -210,13 +208,11 @@ class FusionLoadSequence(load.LoaderPlugin):
|
||||||
assert tool.ID == "Loader", "Must be Loader"
|
assert tool.ID == "Loader", "Must be Loader"
|
||||||
comp = tool.Comp()
|
comp = tool.Comp()
|
||||||
|
|
||||||
root = os.path.dirname(get_representation_path(representation))
|
context = get_representation_context(representation)
|
||||||
path = self._get_first_image(root)
|
path = get_representation_path_from_context(context)
|
||||||
|
|
||||||
# Get start frame from version data
|
# Get start frame from version data
|
||||||
project_name = legacy_io.active_project()
|
start = self._get_start(context["version"], tool)
|
||||||
version = get_version_by_id(project_name, representation["parent"])
|
|
||||||
start = self._get_start(version, tool)
|
|
||||||
|
|
||||||
with comp_lock_and_undo_chunk(comp, "Update Loader"):
|
with comp_lock_and_undo_chunk(comp, "Update Loader"):
|
||||||
|
|
||||||
|
|
@ -249,11 +245,6 @@ class FusionLoadSequence(load.LoaderPlugin):
|
||||||
with comp_lock_and_undo_chunk(comp, "Remove Loader"):
|
with comp_lock_and_undo_chunk(comp, "Remove Loader"):
|
||||||
tool.Delete()
|
tool.Delete()
|
||||||
|
|
||||||
def _get_first_image(self, root):
|
|
||||||
"""Get first file in representation root"""
|
|
||||||
files = sorted(os.listdir(root))
|
|
||||||
return os.path.join(root, files[0])
|
|
||||||
|
|
||||||
def _get_start(self, version_doc, tool):
|
def _get_start(self, version_doc, tool):
|
||||||
"""Return real start frame of published files (incl. handles)"""
|
"""Return real start frame of published files (incl. handles)"""
|
||||||
data = version_doc["data"]
|
data = version_doc["data"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue