mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
🐛 fix how folder name is used
This commit is contained in:
parent
d0bf97d117
commit
5649093230
4 changed files with 40 additions and 22 deletions
|
|
@ -5,6 +5,7 @@ import logging
|
|||
from typing import List
|
||||
from contextlib import contextmanager
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import semver
|
||||
import pyblish.api
|
||||
|
|
@ -47,7 +48,7 @@ INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
|
|||
class UnrealHost(HostBase, ILoadHost, IPublishHost):
|
||||
"""Unreal host implementation.
|
||||
|
||||
For some time this class will re-use functions from module based
|
||||
For some time this class will reuse functions from module based
|
||||
implementation for backwards compatibility of older unreal projects.
|
||||
"""
|
||||
|
||||
|
|
@ -590,22 +591,27 @@ def set_sequence_hierarchy(
|
|||
hid_section.set_level_names(maps)
|
||||
|
||||
|
||||
def generate_sequence(h, h_dir):
|
||||
def generate_sequence(folder_path: Path, unreal_directory: str):
|
||||
"""Generate Level Sequence from AYON folder.
|
||||
|
||||
Args:
|
||||
folder_path (Path): Path to AYON folder
|
||||
unreal_directory (str): Unreal directory path
|
||||
|
||||
"""
|
||||
tools = unreal.AssetToolsHelpers().get_asset_tools()
|
||||
|
||||
sequence = tools.create_asset(
|
||||
asset_name=h,
|
||||
package_path=h_dir,
|
||||
asset_name=folder_path.name,
|
||||
package_path=unreal_directory,
|
||||
asset_class=unreal.LevelSequence,
|
||||
factory=unreal.LevelSequenceFactoryNew()
|
||||
)
|
||||
|
||||
project_name = get_current_project_name()
|
||||
# TODO Fix this does not return folder path
|
||||
folder_path = h_dir.split('/')[-1],
|
||||
folder_entity = ayon_api.get_folder_by_path(
|
||||
project_name,
|
||||
folder_path,
|
||||
folder_path.as_posix(),
|
||||
fields={"id", "attrib.fps"}
|
||||
)
|
||||
|
||||
|
|
@ -627,6 +633,10 @@ def generate_sequence(h, h_dir):
|
|||
fields={"id", "attrib.clipIn", "attrib.clipOut"}
|
||||
))
|
||||
|
||||
# folder doesn't have time data
|
||||
if not start_frames or end_frames:
|
||||
return
|
||||
|
||||
min_frame = min(start_frames)
|
||||
max_frame = max(end_frames)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,25 +3,24 @@
|
|||
from pathlib import Path
|
||||
|
||||
import ayon_api
|
||||
|
||||
import unreal
|
||||
from unreal import (
|
||||
EditorAssetLibrary,
|
||||
EditorLevelLibrary,
|
||||
EditorLevelUtils,
|
||||
LevelSequenceEditorBlueprintLibrary as LevelSequenceLib,
|
||||
from ayon_core.hosts.unreal.api import plugin
|
||||
from ayon_core.hosts.unreal.api.pipeline import (
|
||||
create_container,
|
||||
generate_sequence,
|
||||
imprint,
|
||||
set_sequence_hierarchy,
|
||||
)
|
||||
from ayon_core.pipeline import (
|
||||
AYON_CONTAINER_ID,
|
||||
get_current_project_name,
|
||||
get_representation_path,
|
||||
)
|
||||
from ayon_core.hosts.unreal.api import plugin
|
||||
from ayon_core.hosts.unreal.api.pipeline import (
|
||||
generate_sequence,
|
||||
set_sequence_hierarchy,
|
||||
create_container,
|
||||
imprint,
|
||||
from unreal import (
|
||||
EditorAssetLibrary,
|
||||
EditorLevelLibrary,
|
||||
EditorLevelUtils,
|
||||
LevelSequenceEditorBlueprintLibrary as LevelSequenceLib,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -177,7 +176,11 @@ class CameraLoader(plugin.Loader):
|
|||
seq.get_asset().get_playback_start(),
|
||||
seq.get_asset().get_playback_end()))
|
||||
else:
|
||||
sequence, frame_range = generate_sequence(h, h_dir)
|
||||
sequence_data = generate_sequence(
|
||||
Path(folder_path), h_dir)
|
||||
if not sequence_data:
|
||||
continue
|
||||
sequence, frame_range = sequence_data[0], sequence_data[1]
|
||||
|
||||
sequences.append(sequence)
|
||||
frame_ranges.append(frame_range)
|
||||
|
|
|
|||
|
|
@ -587,7 +587,12 @@ class LayoutLoader(plugin.Loader):
|
|||
]
|
||||
|
||||
if not existing_sequences:
|
||||
sequence, frame_range = generate_sequence(h, h_dir)
|
||||
sequence_data = generate_sequence(
|
||||
Path(folder_path), h_dir
|
||||
)
|
||||
if not sequence_data:
|
||||
continue
|
||||
sequence, frame_range = sequence_data[0], sequence_data[1]
|
||||
|
||||
sequences.append(sequence)
|
||||
frame_ranges.append(frame_range)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ line-ending = "auto"
|
|||
|
||||
[tool.codespell]
|
||||
# Ignore words that are not in the dictionary.
|
||||
ignore-words-list = "ayon,ynput,parms,parm,hda"
|
||||
ignore-words-list = "ayon,ynput,parms,parm,hda,ue"
|
||||
skip = "./.*,./package/*,*/vendor/*,*/unreal/integration/*,*/aftereffects/api/extension/js/libs/*"
|
||||
count = true
|
||||
quiet-level = 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue