fusion load plugins are expecting representation context

This commit is contained in:
Jakub Trllo 2024-02-26 17:56:43 +01:00
parent 00bfee8289
commit 63acc96fd0
4 changed files with 24 additions and 20 deletions

View file

@ -44,23 +44,24 @@ class FusionLoadAlembicMesh(load.LoaderPlugin):
context=context,
loader=self.__class__.__name__)
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):
"""Update Alembic path"""
tool = container["_tool"]
assert tool.ID == self.tool_type, f"Must be {self.tool_type}"
comp = tool.Comp()
path = get_representation_path(representation)
repre_doc = context["representation"]
path = get_representation_path(repre_doc)
with comp_lock_and_undo_chunk(comp, "Update tool"):
tool["Filename"] = path
# Update the imprinted representation
tool.SetData("avalon.representation", str(representation["_id"]))
tool.SetData("avalon.representation", str(repre_doc["_id"]))
def remove(self, container):
tool = container["_tool"]

View file

@ -59,23 +59,24 @@ class FusionLoadFBXMesh(load.LoaderPlugin):
loader=self.__class__.__name__,
)
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):
"""Update path"""
tool = container["_tool"]
assert tool.ID == self.tool_type, f"Must be {self.tool_type}"
comp = tool.Comp()
path = get_representation_path(representation)
repre_doc = context["representation"]
path = get_representation_path(repre_doc)
with comp_lock_and_undo_chunk(comp, "Update tool"):
tool["ImportFile"] = path
# Update the imprinted representation
tool.SetData("avalon.representation", str(representation["_id"]))
tool.SetData("avalon.representation", str(repre_doc["_id"]))
def remove(self, container):
tool = container["_tool"]

View file

@ -175,10 +175,10 @@ class FusionLoadSequence(load.LoaderPlugin):
loader=self.__class__.__name__,
)
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):
"""Update the Loader's path
Fusion automatically tries to reset some variables when changing
@ -224,7 +224,8 @@ class FusionLoadSequence(load.LoaderPlugin):
assert tool.ID == "Loader", "Must be Loader"
comp = tool.Comp()
context = get_representation_context(representation)
repre_doc = context["representation"]
context = get_representation_context(repre_doc)
path = self.filepath_from_context(context)
# Get start frame from version data
@ -255,7 +256,7 @@ class FusionLoadSequence(load.LoaderPlugin):
)
# Update the imprinted representation
tool.SetData("avalon.representation", str(representation["_id"]))
tool.SetData("avalon.representation", str(repre_doc["_id"]))
def remove(self, container):
tool = container["_tool"]

View file

@ -61,22 +61,23 @@ class FusionLoadUSD(load.LoaderPlugin):
context=context,
loader=self.__class__.__name__)
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):
tool = container["_tool"]
assert tool.ID == self.tool_type, f"Must be {self.tool_type}"
comp = tool.Comp()
path = get_representation_path(representation)
repre_doc = context["representation"]
path = get_representation_path(repre_doc)
with comp_lock_and_undo_chunk(comp, "Update tool"):
tool["Filename"] = path
# Update the imprinted representation
tool.SetData("avalon.representation", str(representation["_id"]))
tool.SetData("avalon.representation", str(repre_doc["_id"]))
def remove(self, container):
tool = container["_tool"]