hiero load plugins are expecting representation context

This commit is contained in:
Jakub Trllo 2024-02-26 17:57:18 +01:00
parent 8bdf0552be
commit bd58e9fa67
3 changed files with 15 additions and 17 deletions

View file

@ -363,7 +363,7 @@ class SequenceLoader(LoaderPlugin):
):
pass
def update(self, container, representation):
def update(self, container, context):
"""Update an existing `container`
"""
pass

View file

@ -146,27 +146,25 @@ class LoadClip(phiero.SequenceLoader):
self.__class__.__name__,
data_imprint)
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)
def update(self, container, representation):
def update(self, container, context):
""" Updating previously loaded clips
"""
version_doc = context["version"]
repre_doc = context["representation"]
# load clip to timeline and get main variables
name = container['name']
namespace = container['namespace']
track_item = phiero.get_track_items(
track_item_name=namespace).pop()
project_name = get_current_project_name()
version_doc = get_version_by_id(project_name, representation["parent"])
version_data = version_doc.get("data", {})
version_name = version_doc.get("name", None)
colorspace = version_data.get("colorspace", None)
object_name = "{}_{}".format(name, namespace)
file = get_representation_path(representation).replace("\\", "/")
file = get_representation_path(repre_doc).replace("\\", "/")
clip = track_item.source()
# reconnect media to new path
@ -191,7 +189,7 @@ class LoadClip(phiero.SequenceLoader):
# add variables related to version context
data_imprint.update({
"representation": str(representation["_id"]),
"representation": str(repre_doc["_id"]),
"version": version_name,
"colorspace": colorspace,
"objectName": object_name

View file

@ -157,19 +157,19 @@ class LoadEffects(load.LoaderPlugin):
return loaded
def update(self, container, representation):
def update(self, container, context):
""" Updating previously loaded effects
"""
version_doc = context["version"]
repre_doc = context["representation"]
active_track = container["_item"]
file = get_representation_path(representation).replace("\\", "/")
file = get_representation_path(repre_doc).replace("\\", "/")
# get main variables
name = container['name']
namespace = container['namespace']
# get timeline in out data
project_name = get_current_project_name()
version_doc = get_version_by_id(project_name, representation["parent"])
version_data = version_doc["data"]
clip_in = version_data["clipIn"]
clip_out = version_data["clipOut"]
@ -197,7 +197,7 @@ class LoadEffects(load.LoaderPlugin):
data_imprint = {
"objectName": object_name,
"name": name,
"representation": str(representation["_id"]),
"representation": str(repre_doc["_id"]),
"children_names": []
}
@ -256,8 +256,8 @@ class LoadEffects(load.LoaderPlugin):
else:
return input
def switch(self, container, representation):
self.update(container, representation)
def switch(self, container, context):
self.update(container, context)
def remove(self, container):
pass