mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
updating version should be updated as expected
This commit is contained in:
parent
5a00cab24c
commit
f4e42e27ac
9 changed files with 75 additions and 60 deletions
|
|
@ -54,7 +54,10 @@ class FbxLoader(load.LoaderPlugin):
|
|||
path = get_representation_path(representation)
|
||||
node_name = container["instance_node"]
|
||||
node = rt.getNodeByName(node_name)
|
||||
inst_name, _ = node_name.split("_")
|
||||
container_name = node_name.split(":")[-1]
|
||||
param_container, _ = container_name.split("_")
|
||||
|
||||
inst_container = rt.getNodeByName(param_container)
|
||||
rt.Select(node.Children)
|
||||
|
||||
rt.FBXImporterSetParam("Animation", True)
|
||||
|
|
@ -65,12 +68,16 @@ class FbxLoader(load.LoaderPlugin):
|
|||
rt.ImportFile(
|
||||
path, rt.name("noPrompt"), using=rt.FBXIMP)
|
||||
current_fbx_objects = rt.GetCurrentSelection()
|
||||
inst_container = rt.getNodeByName(inst_name)
|
||||
for fbx_object in current_fbx_objects:
|
||||
if fbx_object.Parent != inst_container:
|
||||
fbx_object.Parent = inst_container
|
||||
update_custom_attribute_data(
|
||||
inst_container, rt.GetCurrentSelection())
|
||||
|
||||
for children in node.Children:
|
||||
if rt.classOf(children) == rt.Container:
|
||||
if children.name == param_container:
|
||||
update_custom_attribute_data(
|
||||
children, current_fbx_objects)
|
||||
|
||||
with maintained_selection():
|
||||
rt.Select(node)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class MaxSceneLoader(load.LoaderPlugin):
|
|||
name + "_",
|
||||
suffix="_",
|
||||
)
|
||||
|
||||
return containerise(
|
||||
name, max_container, context,
|
||||
namespace, loader=self.__class__.__name__)
|
||||
|
|
@ -50,9 +49,11 @@ class MaxSceneLoader(load.LoaderPlugin):
|
|||
|
||||
path = get_representation_path(representation)
|
||||
node_name = container["instance_node"]
|
||||
|
||||
node = rt.getNodeByName(node_name)
|
||||
inst_name, _ = node_name.split("_")
|
||||
inst_container = rt.getNodeByName(inst_name)
|
||||
container_name = node_name.split(":")[-1]
|
||||
param_container, _ = container_name.split("_")
|
||||
|
||||
# delete the old container with attribute
|
||||
# delete old duplicate
|
||||
prev_max_object_names = [obj.name for obj
|
||||
|
|
@ -71,10 +72,14 @@ class MaxSceneLoader(load.LoaderPlugin):
|
|||
prev_max_object = rt.getNodeByName(object_name)
|
||||
rt.Delete(prev_max_object)
|
||||
|
||||
update_custom_attribute_data(inst_container, current_max_objects)
|
||||
|
||||
for max_object in current_max_objects:
|
||||
max_object.Parent = node
|
||||
for children in node.Children:
|
||||
if rt.classOf(children) == rt.Container:
|
||||
if children.name == param_container:
|
||||
update_custom_attribute_data(
|
||||
children, current_max_objects)
|
||||
|
||||
lib.imprint(container["instance_node"], {
|
||||
"representation": str(representation["_id"])
|
||||
})
|
||||
|
|
|
|||
|
|
@ -69,23 +69,19 @@ class ModelAbcLoader(load.LoaderPlugin):
|
|||
|
||||
path = get_representation_path(representation)
|
||||
node = rt.GetNodeByName(container["instance_node"])
|
||||
rt.Select(node.Children)
|
||||
|
||||
nodes_list = []
|
||||
with maintained_selection():
|
||||
rt.Select(node)
|
||||
for alembic in rt.Selection:
|
||||
abc = rt.GetNodeByName(alembic.name)
|
||||
update_custom_attribute_data(abc, abc.Children)
|
||||
rt.Select(abc.Children)
|
||||
for abc_con in rt.Selection:
|
||||
abc_container = rt.GetNodeByName(abc_con.name)
|
||||
abc_container.source = path
|
||||
rt.Select(abc_container.Children)
|
||||
for abc_obj in rt.Selection:
|
||||
alembic_obj = rt.GetNodeByName(abc_obj.name)
|
||||
alembic_obj.source = path
|
||||
nodes_list.append(alembic_obj)
|
||||
rt.Select(node.Children)
|
||||
|
||||
for alembic in rt.Selection:
|
||||
abc = rt.GetNodeByName(alembic.name)
|
||||
update_custom_attribute_data(abc, abc.Children)
|
||||
rt.Select(abc.Children)
|
||||
for abc_con in abc.Children:
|
||||
abc_con.source = path
|
||||
rt.Select(abc_con.Children)
|
||||
for abc_obj in abc_con.Children:
|
||||
abc_obj.source = path
|
||||
|
||||
lib.imprint(
|
||||
container["instance_node"],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import os
|
||||
from openpype.pipeline import load, get_representation_path
|
||||
from openpype.hosts.max.api.pipeline import (
|
||||
containerise, import_custom_attribute_data, update_custom_attribute_data
|
||||
containerise, import_custom_attribute_data,
|
||||
update_custom_attribute_data
|
||||
)
|
||||
from openpype.hosts.max.api import lib
|
||||
from openpype.hosts.max.api.lib import unique_namespace
|
||||
|
|
@ -51,9 +52,8 @@ class FbxModelLoader(load.LoaderPlugin):
|
|||
path = get_representation_path(representation)
|
||||
node_name = container["instance_node"]
|
||||
node = rt.getNodeByName(node_name)
|
||||
inst_name, _ = node_name.split("_")
|
||||
inst_container = rt.getNodeByName(inst_name)
|
||||
|
||||
container_name = node_name.split(":")[-1]
|
||||
param_container, _ = container_name.split("_")
|
||||
rt.FBXImporterSetParam("Animation", False)
|
||||
rt.FBXImporterSetParam("Cameras", False)
|
||||
rt.FBXImporterSetParam("Mode", rt.Name("merge"))
|
||||
|
|
@ -61,11 +61,16 @@ class FbxModelLoader(load.LoaderPlugin):
|
|||
rt.FBXImporterSetParam("Preserveinstances", True)
|
||||
rt.importFile(path, rt.name("noPrompt"), using=rt.FBXIMP)
|
||||
current_fbx_objects = rt.GetCurrentSelection()
|
||||
|
||||
inst_container = rt.getNodeByName(param_container)
|
||||
for children in node.Children:
|
||||
if rt.classOf(children) == rt.Container:
|
||||
if children.name == param_container:
|
||||
update_custom_attribute_data(
|
||||
children, current_fbx_objects)
|
||||
for fbx_object in current_fbx_objects:
|
||||
if fbx_object.Parent != inst_container:
|
||||
fbx_object.Parent = inst_container
|
||||
update_custom_attribute_data(
|
||||
inst_container, current_fbx_objects)
|
||||
with maintained_selection():
|
||||
rt.Select(node)
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,11 @@ class ObjLoader(load.LoaderPlugin):
|
|||
node_name = container["instance_node"]
|
||||
node = rt.GetNodeByName(node_name)
|
||||
|
||||
instance_name, _ = node_name.split("_")
|
||||
inst_container = rt.GetNodeByName(instance_name)
|
||||
for child in container.Children:
|
||||
container_name = node_name.split(":")[-1]
|
||||
param_container, _ = container_name.split("_")
|
||||
|
||||
inst_container = rt.getNodeByName(param_container)
|
||||
for child in inst_container.Children:
|
||||
rt.Delete(child)
|
||||
|
||||
rt.Execute(f'importFile @"{path}" #noPrompt using:ObjImp')
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ class ModelUSDLoader(load.LoaderPlugin):
|
|||
for r in n.Children:
|
||||
rt.Delete(r)
|
||||
rt.Delete(n)
|
||||
instance_name, _ = node_name.split("_")
|
||||
container_name = node_name.split(":")[-1]
|
||||
param_container, _ = container_name.split("_")
|
||||
|
||||
import_options = rt.USDImporter.CreateOptions()
|
||||
base_filename = os.path.basename(path)
|
||||
|
|
@ -70,9 +71,13 @@ class ModelUSDLoader(load.LoaderPlugin):
|
|||
rt.USDImporter.importFile(
|
||||
path, importOptions=import_options)
|
||||
|
||||
asset = rt.GetNodeByName(instance_name)
|
||||
asset = rt.GetNodeByName(param_container)
|
||||
asset.Parent = node
|
||||
update_custom_attribute_data(asset, asset.Children)
|
||||
for children in node.Children:
|
||||
if rt.classOf(children) == rt.Container:
|
||||
if children.name == param_container:
|
||||
update_custom_attribute_data(
|
||||
asset, asset.Children)
|
||||
|
||||
with maintained_selection():
|
||||
rt.Select(node)
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ class AbcLoader(load.LoaderPlugin):
|
|||
path = get_representation_path(representation)
|
||||
node = rt.GetNodeByName(container["instance_node"])
|
||||
|
||||
nodes_list = []
|
||||
with maintained_selection():
|
||||
rt.Select(node.Children)
|
||||
|
||||
|
|
@ -84,14 +83,11 @@ class AbcLoader(load.LoaderPlugin):
|
|||
abc = rt.GetNodeByName(alembic.name)
|
||||
update_custom_attribute_data(abc, abc.Children)
|
||||
rt.Select(abc.Children)
|
||||
for abc_con in rt.Selection:
|
||||
abc_container = rt.GetNodeByName(abc_con.name)
|
||||
abc_container.source = path
|
||||
rt.Select(abc_container.Children)
|
||||
for abc_obj in rt.Selection:
|
||||
alembic_obj = rt.GetNodeByName(abc_obj.name)
|
||||
alembic_obj.source = path
|
||||
nodes_list.append(alembic_obj)
|
||||
for abc_con in abc.Children:
|
||||
abc_con.source = path
|
||||
rt.Select(abc_con.Children)
|
||||
for abc_obj in abc_con.Children:
|
||||
abc_obj.source = path
|
||||
|
||||
lib.imprint(
|
||||
container["instance_node"],
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ class PointCloudLoader(load.LoaderPlugin):
|
|||
filepath = os.path.normpath(self.filepath_from_context(context))
|
||||
obj = rt.tyCache()
|
||||
obj.filename = filepath
|
||||
prt_container = rt.GetNodeByName(obj.name)
|
||||
prt_container = rt.container()
|
||||
prt_container.name = name
|
||||
prt_container = rt.Container(name=name)
|
||||
obj.Parent = prt_container
|
||||
import_custom_attribute_data(prt_container, [obj])
|
||||
|
||||
|
|
@ -49,10 +47,12 @@ class PointCloudLoader(load.LoaderPlugin):
|
|||
node = rt.GetNodeByName(container["instance_node"])
|
||||
with maintained_selection():
|
||||
rt.Select(node.Children)
|
||||
for prt in rt.Selection:
|
||||
prt_object = rt.GetNodeByName(prt.name)
|
||||
prt_object.filename = path
|
||||
update_custom_attribute_data(node, node.Children)
|
||||
for sub_node in rt.Selection:
|
||||
children_node = sub_node.Children
|
||||
update_custom_attribute_data(
|
||||
sub_node, sub_node.Children)
|
||||
for prt in children_node:
|
||||
prt.filename = path
|
||||
lib.imprint(container["instance_node"], {
|
||||
"representation": str(representation["_id"])
|
||||
})
|
||||
|
|
|
|||
|
|
@ -35,11 +35,9 @@ class RedshiftProxyLoader(load.LoaderPlugin):
|
|||
if collections:
|
||||
rs_proxy.is_sequence = True
|
||||
|
||||
container = rt.container()
|
||||
container.name = name
|
||||
container = rt.Container(name=name)
|
||||
rs_proxy.Parent = container
|
||||
import_custom_attribute_data(container, [rs_proxy])
|
||||
asset = rt.getNodeByName(name)
|
||||
|
||||
namespace = unique_namespace(
|
||||
name + "_",
|
||||
|
|
@ -47,7 +45,7 @@ class RedshiftProxyLoader(load.LoaderPlugin):
|
|||
)
|
||||
|
||||
return containerise(
|
||||
name, [asset], context,
|
||||
name, [container], context,
|
||||
namespace, loader=self.__class__.__name__)
|
||||
|
||||
def update(self, container, representation):
|
||||
|
|
@ -55,12 +53,13 @@ class RedshiftProxyLoader(load.LoaderPlugin):
|
|||
|
||||
path = get_representation_path(representation)
|
||||
node = rt.getNodeByName(container["instance_node"])
|
||||
for children in node.Children:
|
||||
children_node = rt.getNodeByName(children.name)
|
||||
for proxy in children_node.Children:
|
||||
for sub_node in node.Children:
|
||||
children_node = sub_node.Children
|
||||
update_custom_attribute_data(
|
||||
sub_node, children_node)
|
||||
for proxy in children_node:
|
||||
proxy.file = path
|
||||
|
||||
update_custom_attribute_data(node, node.Children)
|
||||
lib.imprint(container["instance_node"], {
|
||||
"representation": str(representation["_id"])
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue