mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
fix the update and load function of the max scene loader
This commit is contained in:
parent
da56583d19
commit
33335a3e89
1 changed files with 22 additions and 11 deletions
|
|
@ -26,20 +26,16 @@ class MaxSceneLoader(load.LoaderPlugin):
|
|||
|
||||
merge_before = {
|
||||
c for c in rt.rootNode.Children
|
||||
if rt.classOf(c) == rt.Container
|
||||
}
|
||||
rt.mergeMaxFile(path)
|
||||
|
||||
merge_after = {
|
||||
c for c in rt.rootNode.Children
|
||||
if rt.classOf(c) == rt.Container
|
||||
}
|
||||
max_containers = merge_after.difference(merge_before)
|
||||
|
||||
if len(max_containers) != 1:
|
||||
self.log.error("Something failed when loading.")
|
||||
|
||||
max_container = max_containers.pop()
|
||||
max_objects = merge_after.difference(merge_before)
|
||||
max_container = rt.container(name=f"{name}")
|
||||
for max_object in max_objects:
|
||||
max_object.Parent = max_container
|
||||
|
||||
return containerise(
|
||||
name, [max_container], context, loader=self.__class__.__name__)
|
||||
|
|
@ -48,15 +44,30 @@ class MaxSceneLoader(load.LoaderPlugin):
|
|||
from pymxs import runtime as rt
|
||||
|
||||
path = get_representation_path(representation)
|
||||
node = rt.getNodeByName(container["instance_node"])
|
||||
max_objects = node.Children
|
||||
node_name = container["instance_node"]
|
||||
instance_name, _ = node_name.split("_")
|
||||
merge_before = {
|
||||
c for c in rt.rootNode.Children
|
||||
}
|
||||
rt.mergeMaxFile(path,
|
||||
rt.Name("noRedraw"),
|
||||
rt.Name("deleteOldDups"),
|
||||
rt.Name("useSceneMtlDups"))
|
||||
merge_after = {
|
||||
c for c in rt.rootNode.Children
|
||||
}
|
||||
max_objects = merge_after.difference(merge_before)
|
||||
container_node = rt.getNodeByName(instance_name)
|
||||
for max_object in max_objects:
|
||||
max_object.source = path
|
||||
max_object.Parent = container_node
|
||||
|
||||
lib.imprint(container["instance_node"], {
|
||||
"representation": str(representation["_id"])
|
||||
})
|
||||
|
||||
def switch(self, container, representation):
|
||||
self.update(container, representation)
|
||||
|
||||
def remove(self, container):
|
||||
from pymxs import runtime as rt
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue