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

UnrealAlembicPointCacheLoader/SkeletalMeshLoader: Align the loaded frame range to db #32

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions client/ayon_unreal/plugins/load/load_alembic_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class AnimationAlembicLoader(plugin.Loader):
icon = "cube"
color = "orange"
abc_conversion_preset = "maya"
root = unreal_pipeline.AYON_ASSET_DIR

@classmethod
def apply_settings(cls, project_settings):
Expand Down Expand Up @@ -140,6 +141,7 @@ def load(self, context, name, namespace, options):
"""

# Create directory for asset and ayon container
folder_entity = context["folder"]
folder_name = context["folder"]["name"]
folder_path = context["folder"]["path"]
product_type = context["product"]["productType"]
Expand All @@ -166,9 +168,12 @@ def load(self, context, name, namespace, options):
if not unreal.EditorAssetLibrary.does_directory_exist(asset_dir):
unreal.EditorAssetLibrary.make_directory(asset_dir)
loaded_options = {
"abc_conversion_preset": options.get(
"abc_conversion_preset", self.abc_conversion_preset)
"abc_conversion_preset": options.get("abc_conversion_preset", self.abc_conversion_preset),
"frameStart": folder_entity["attrib"]["frameStart"],
"frameEnd": folder_entity["attrib"]["frameEnd"]
}

path = self.filepath_from_context(context)
task = self.get_task(path, asset_dir, asset_name, False, loaded_options)

asset_tools = unreal.AssetToolsHelpers.get_asset_tools()
Expand All @@ -189,6 +194,8 @@ def load(self, context, name, namespace, options):
"representation": context["representation"]["id"],
"parent": context["representation"]["versionId"],
"product_type": product_type,
"frameStart": folder_entity["attrib"]["frameStart"],
"frameEnd": folder_entity["attrib"]["frameEnd"],
# TODO these should be probably removed
"asset": folder_path,
"family": product_type,
Expand Down Expand Up @@ -216,9 +223,6 @@ def update(self, container, context):
# Create directory for folder and Ayon container
suffix = "_CON"
source_path = get_representation_path(repre_entity)
loaded_options = {
"abc_conversion_preset": self.abc_conversion_preset
}

ext = os.path.splitext(source_path)[-1].lstrip(".")
asset_name = product_name
Expand All @@ -238,7 +242,9 @@ def update(self, container, context):

if not unreal.EditorAssetLibrary.does_directory_exist(asset_dir):
loaded_options = {
"abc_conversion_preset": self.abc_conversion_preset
"abc_conversion_preset": self.abc_conversion_preset,
"frameStart": int(container.get("frameStart", "1")),
"frameEnd": int(container.get("frameEnd", "1"))
}
self.import_and_containerize(
source_path, asset_dir, asset_name, container_name, loaded_options
Expand Down
2 changes: 2 additions & 0 deletions client/ayon_unreal/plugins/load/load_geometrycache_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def get_task(

options.set_editor_property(
'import_type', unreal.AlembicImportType.GEOMETRY_CACHE)
options.sampling_settings.frame_start = frame_start
options.sampling_settings.frame_end = frame_end

gc_settings.set_editor_property('flatten_tracks', False)

Expand Down
28 changes: 22 additions & 6 deletions client/ayon_unreal/plugins/load/load_skeletalmesh_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def get_task(filename, asset_dir, asset_name, replace, loaded_options):

options.set_editor_property(
'import_type', unreal.AlembicImportType.SKELETAL)
options.sampling_settings.frame_start = loaded_options.get("frameStart")
options.sampling_settings.frame_end = loaded_options.get("frameEnd")

if loaded_options.get("abc_material_settings") == "create_materials":
mat_settings.set_editor_property("create_materials", True)
Expand All @@ -101,6 +103,7 @@ def get_task(filename, asset_dir, asset_name, replace, loaded_options):
flip_u=False, flip_v=False,
rotation=[0.0, 0.0, 0.0],
scale=[1.0, 1.0, 1.0])

options.conversion_settings = conversion_settings

options.material_settings = mat_settings
Expand Down Expand Up @@ -130,7 +133,9 @@ def imprint(
container_name,
asset_name,
representation,
product_type
product_type,
frameStart,
frameEnd
):
data = {
"schema": "ayon:container-2.0",
Expand All @@ -143,6 +148,8 @@ def imprint(
"representation": representation["id"],
"parent": representation["versionId"],
"product_type": product_type,
"frameStart":frameStart,
"frameEnd": frameEnd,
# TODO these should be probably removed
"asset": folder_path,
"family": product_type,
Expand All @@ -165,8 +172,9 @@ def load(self, context, name, namespace, options):
list(str): list of container content
"""
# Create directory for asset and ayon container
folder_path = context["folder"]["path"]
folder_name = context["folder"]["name"]
folder_entity = context["folder"]
folder_path = folder_entity["path"]
folder_name = folder_entity["name"]
suffix = "_CON"
path = self.filepath_from_context(context)
ext = os.path.splitext(path)[-1].lstrip(".")
Expand All @@ -182,7 +190,9 @@ def load(self, context, name, namespace, options):
"default_conversion": options.get("default_conversion", False),
"abc_conversion_preset": options.get(
"abc_conversion_preset", self.abc_conversion_preset),
"abc_material_settings": options.get("abc_material_settings", "no_material")
"abc_material_settings": options.get("abc_material_settings", "no_material"),
"frameStart": folder_entity["attrib"]["frameStart"],
"frameEnd": folder_entity["attrib"]["frameEnd"]
}

tools = unreal.AssetToolsHelpers().get_asset_tools()
Expand All @@ -202,7 +212,9 @@ def load(self, context, name, namespace, options):
container_name,
asset_name,
context["representation"],
product_type
product_type,
folder_entity["attrib"]["frameStart"],
folder_entity["attrib"]["frameEnd"]
)

asset_content = unreal.EditorAssetLibrary.list_assets(
Expand Down Expand Up @@ -244,7 +256,9 @@ def update(self, container, context):
path = get_representation_path(repre_entity)
loaded_options = {
"default_conversion": False,
"abc_conversion_preset": self.abc_conversion_preset
"abc_conversion_preset": self.abc_conversion_preset,
"frameStart": container.get("frameStart", 1),
"frameEnd": container.get("frameEnd", 1)
}
self.import_and_containerize(path, asset_dir, asset_name,
container_name, loaded_options)
Expand All @@ -256,6 +270,8 @@ def update(self, container, context):
asset_name,
repre_entity,
product_type,
container.get("frameStart", 1),
container.get("frameEnd", 1),
)

asset_content = unreal.EditorAssetLibrary.list_assets(
Expand Down