From c0a9536f52307cddad2338c438fdce4a1e77538d Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 6 Jul 2023 13:58:19 +0200 Subject: [PATCH] Ensure fullpath (=bugfix) + query relatives once + avoid duplicates --- openpype/hosts/maya/plugins/load/load_look.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_look.py b/openpype/hosts/maya/plugins/load/load_look.py index 8f3e017658..7cd430ef45 100644 --- a/openpype/hosts/maya/plugins/load/load_look.py +++ b/openpype/hosts/maya/plugins/load/load_look.py @@ -127,12 +127,14 @@ class LookLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): """ import maya.cmds as cmds - nodes_list = [] for shader in shader_nodes: - connections = cmds.listConnections(cmds.listHistory(shader, f=1), + future = cmds.listHistory(shader, future=True) + connections = cmds.listConnections(future, type='mesh') if connections: - for connection in connections: - nodes_list.extend(cmds.listRelatives(connection, - shapes=True)) - return nodes_list + # Ensure unique entries only to optimize query and results + connections = list(set(connections)) + return cmds.listRelatives(connections, + shapes=True, + fullPath=True) or [] + return []