From 66832f3c323fb7ab7e24e9a669ef5719286ffea6 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Wed, 5 Jul 2023 18:21:40 +0300 Subject: [PATCH 01/15] add better selection --- .../plugins/create/create_pointcache.py | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index df74070fee..00ff22bdda 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- """Creator plugin for creating pointcache alembics.""" from openpype.hosts.houdini.api import plugin -from openpype.pipeline import CreatedInstance import hou @@ -14,15 +13,13 @@ class CreatePointCache(plugin.HoudiniCreator): icon = "gears" def create(self, subset_name, instance_data, pre_create_data): - import hou - instance_data.pop("active", None) instance_data.update({"node_type": "alembic"}) instance = super(CreatePointCache, self).create( subset_name, instance_data, - pre_create_data) # type: CreatedInstance + pre_create_data) instance_node = hou.node(instance.get("instance_node")) parms = { @@ -37,13 +34,50 @@ class CreatePointCache(plugin.HoudiniCreator): } if self.selected_nodes: - parms["sop_path"] = self.selected_nodes[0].path() + selected_node = self.selected_nodes[0] - # try to find output node - for child in self.selected_nodes[0].children(): - if child.type().name() == "output": - parms["sop_path"] = child.path() - break + # Although Houdini allows ObjNode path on `sop_path`rop node + # However, it's preferred to set SopNode path explicitly + # These checks prevent using user selecting + + # Allow sop level paths (e.g. /obj/geo1/box1) + # but do not allow other sop level paths when + # the parent type is not 'geo' like + # Cameras, Dopnet nodes(sop solver) + if isinstance(selected_node, hou.SopNode) and \ + selected_node.parent().type().name() == 'geo': + parms["sop_path"] = selected_node.path() + self.log.debug( + "Valid SopNode selection, 'SOP Path' in ROP will be set to '%s'." + % selected_node.path() + ) + + # Allow object level paths to Geometry nodes (e.g. /obj/geo1) + # but do not allow other object level nodes types like cameras, etc. + elif isinstance(selected_node, hou.ObjNode) and \ + selected_node.type().name() == 'geo': + + # get the output node with the minimum + # 'outputidx' or the node with display flag + sop_path = self.get_obj_output(selected_node) or \ + selected_node.displayNode() + + if sop_path: + parms["sop_path"] = sop_path.path() + self.log.debug( + "Valid ObjNode selection, 'SOP Path' in ROP will be set to " + "the child path '%s'." + % sop_path.path() + ) + + if not parms.get("sop_path", None): + self.log.debug( + "Selection isn't valid.'SOP Path' in ROP will be empty." + ) + else: + self.log.debug( + "No Selection.'SOP Path' in ROP will be empty." + ) instance_node.setParms(parms) instance_node.parm("trange").set(1) @@ -57,3 +91,17 @@ class CreatePointCache(plugin.HoudiniCreator): hou.ropNodeTypeCategory(), hou.sopNodeTypeCategory() ] + + def get_obj_output(self, obj_node): + """Find output node with the smallest 'outputidx'.""" + + outputs = dict() + + for sop_node in obj_node.children(): + if sop_node.type().name() == 'output' : + outputs.update({sop_node : sop_node.parm('outputidx').eval()}) + + if outputs: + return min(outputs, key = outputs.get) + else: + return From e710f5f70e491a1c744e21ac5e6693f772c56b43 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Wed, 5 Jul 2023 18:48:12 +0300 Subject: [PATCH 02/15] add subnet to allowed --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 00ff22bdda..931b8561a8 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -45,7 +45,7 @@ class CreatePointCache(plugin.HoudiniCreator): # the parent type is not 'geo' like # Cameras, Dopnet nodes(sop solver) if isinstance(selected_node, hou.SopNode) and \ - selected_node.parent().type().name() == 'geo': + selected_node.parent().type().name() in ['geo', 'subnet']: parms["sop_path"] = selected_node.path() self.log.debug( "Valid SopNode selection, 'SOP Path' in ROP will be set to '%s'." @@ -55,7 +55,7 @@ class CreatePointCache(plugin.HoudiniCreator): # Allow object level paths to Geometry nodes (e.g. /obj/geo1) # but do not allow other object level nodes types like cameras, etc. elif isinstance(selected_node, hou.ObjNode) and \ - selected_node.type().name() == 'geo': + selected_node.type().name() in ['geo']: # get the output node with the minimum # 'outputidx' or the node with display flag From 5009df0f2893827b739032094ab7af2dad8e7b22 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Wed, 5 Jul 2023 20:02:33 +0300 Subject: [PATCH 03/15] up date get_obj_output --- .../plugins/create/create_pointcache.py | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 931b8561a8..d36c6dfb3f 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -36,9 +36,8 @@ class CreatePointCache(plugin.HoudiniCreator): if self.selected_nodes: selected_node = self.selected_nodes[0] - # Although Houdini allows ObjNode path on `sop_path`rop node - # However, it's preferred to set SopNode path explicitly - # These checks prevent using user selecting + # Although Houdini allows ObjNode path on `sop_path` for the + # the ROP node we prefer it set to the SopNode path explicitly # Allow sop level paths (e.g. /obj/geo1/box1) # but do not allow other sop level paths when @@ -72,11 +71,11 @@ class CreatePointCache(plugin.HoudiniCreator): if not parms.get("sop_path", None): self.log.debug( - "Selection isn't valid.'SOP Path' in ROP will be empty." + "Selection isn't valid. 'SOP Path' in ROP will be empty." ) else: self.log.debug( - "No Selection.'SOP Path' in ROP will be empty." + "No Selection. 'SOP Path' in ROP will be empty." ) instance_node.setParms(parms) @@ -95,13 +94,18 @@ class CreatePointCache(plugin.HoudiniCreator): def get_obj_output(self, obj_node): """Find output node with the smallest 'outputidx'.""" - outputs = dict() + outputs = obj_node.subnetOutputs() - for sop_node in obj_node.children(): - if sop_node.type().name() == 'output' : - outputs.update({sop_node : sop_node.parm('outputidx').eval()}) - - if outputs: - return min(outputs, key = outputs.get) - else: + # if obj_node is empty + if not outputs: return + + # if obj_node has one output child whether its + # sop output node or a node with the render flag + elif len(outputs)==1: + return outputs[0] + + # if there are more than one, then it have multiple ouput nodes + # return the one with the minimum 'outputidx' + else: + return (min(outputs, key=lambda node : node.parm('outputidx').eval())) From 10dcc4440cd0218c899c54e70581a4814ce54e6e Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 11:24:39 +0300 Subject: [PATCH 04/15] fix lint problems --- .../houdini/plugins/create/create_pointcache.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index d36c6dfb3f..b06fb64603 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -44,7 +44,7 @@ class CreatePointCache(plugin.HoudiniCreator): # the parent type is not 'geo' like # Cameras, Dopnet nodes(sop solver) if isinstance(selected_node, hou.SopNode) and \ - selected_node.parent().type().name() in ['geo', 'subnet']: + selected_node.parent().type().name() in ["geo", "subnet"]: parms["sop_path"] = selected_node.path() self.log.debug( "Valid SopNode selection, 'SOP Path' in ROP will be set to '%s'." @@ -54,7 +54,7 @@ class CreatePointCache(plugin.HoudiniCreator): # Allow object level paths to Geometry nodes (e.g. /obj/geo1) # but do not allow other object level nodes types like cameras, etc. elif isinstance(selected_node, hou.ObjNode) and \ - selected_node.type().name() in ['geo']: + selected_node.type().name() in ["geo"]: # get the output node with the minimum # 'outputidx' or the node with display flag @@ -71,7 +71,7 @@ class CreatePointCache(plugin.HoudiniCreator): if not parms.get("sop_path", None): self.log.debug( - "Selection isn't valid. 'SOP Path' in ROP will be empty." + "Selection isn't valid. 'SOP Path' in ROP will be empty." ) else: self.log.debug( @@ -102,10 +102,11 @@ class CreatePointCache(plugin.HoudiniCreator): # if obj_node has one output child whether its # sop output node or a node with the render flag - elif len(outputs)==1: + elif len(outputs) == 1: return outputs[0] # if there are more than one, then it have multiple ouput nodes # return the one with the minimum 'outputidx' - else: - return (min(outputs, key=lambda node : node.parm('outputidx').eval())) + else : + return min(outputs, + key=lambda node : node.parm('outputidx').eval()) From fa57cc4bdc14f6b01306a940b20b1e3907fa29df Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 11:27:29 +0300 Subject: [PATCH 05/15] fix lint problems --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index b06fb64603..98d46d0eef 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -107,6 +107,6 @@ class CreatePointCache(plugin.HoudiniCreator): # if there are more than one, then it have multiple ouput nodes # return the one with the minimum 'outputidx' - else : + else: return min(outputs, - key=lambda node : node.parm('outputidx').eval()) + key=lambda node : node.parm('outputidx').eval()) From fdf35e115b1373a9c49be9e62ae506445894f902 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 12:39:13 +0300 Subject: [PATCH 06/15] fix lint problems --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 98d46d0eef..18ca5240ad 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -109,4 +109,4 @@ class CreatePointCache(plugin.HoudiniCreator): # return the one with the minimum 'outputidx' else: return min(outputs, - key=lambda node : node.parm('outputidx').eval()) + key=lambda node : node.parm('outputidx').eval()) From ac517edf5545b0ffbdd7e47f22ee8a8aea84ec80 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 13:35:13 +0300 Subject: [PATCH 07/15] resolve conversation --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 18ca5240ad..cf5f9b2edb 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -109,4 +109,4 @@ class CreatePointCache(plugin.HoudiniCreator): # return the one with the minimum 'outputidx' else: return min(outputs, - key=lambda node : node.parm('outputidx').eval()) + key=lambda node : node.evalParm('outputidx')) From 44571c1f062ee2ed607378f560332bae824b2225 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 13:42:50 +0300 Subject: [PATCH 08/15] delete unnecessary function call --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index cf5f9b2edb..8914269f45 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -58,8 +58,7 @@ class CreatePointCache(plugin.HoudiniCreator): # get the output node with the minimum # 'outputidx' or the node with display flag - sop_path = self.get_obj_output(selected_node) or \ - selected_node.displayNode() + sop_path = self.get_obj_output(selected_node) if sop_path: parms["sop_path"] = sop_path.path() From d58ef791f81130a9552811ff4e95da5abe9be87a Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 13:47:52 +0300 Subject: [PATCH 09/15] make hound happy --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 8914269f45..4eadef86f7 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -108,4 +108,4 @@ class CreatePointCache(plugin.HoudiniCreator): # return the one with the minimum 'outputidx' else: return min(outputs, - key=lambda node : node.evalParm('outputidx')) + key=lambda node: node.evalParm('outputidx')) From c0a9536f52307cddad2338c438fdce4a1e77538d Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 6 Jul 2023 13:58:19 +0200 Subject: [PATCH 10/15] 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 [] From 01c8b6b46924cd2b6e0e1332b3e2ecf4fce98df1 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 6 Jul 2023 13:58:38 +0200 Subject: [PATCH 11/15] Improve readability --- openpype/hosts/maya/plugins/load/load_look.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_look.py b/openpype/hosts/maya/plugins/load/load_look.py index 7cd430ef45..7c6e4954af 100644 --- a/openpype/hosts/maya/plugins/load/load_look.py +++ b/openpype/hosts/maya/plugins/load/load_look.py @@ -113,8 +113,8 @@ class LookLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): # region compute lookup nodes_by_id = defaultdict(list) - for n in nodes: - nodes_by_id[lib.get_id(n)].append(n) + for node in nodes: + nodes_by_id[lib.get_id(node)].append(node) lib.apply_attributes(attributes, nodes_by_id) def _get_nodes_with_shader(self, shader_nodes): From a2b1de806a3cce0af2d1ba3ac4a26c633424505b Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 6 Jul 2023 13:58:51 +0200 Subject: [PATCH 12/15] Align import style --- openpype/hosts/maya/plugins/load/load_look.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/maya/plugins/load/load_look.py b/openpype/hosts/maya/plugins/load/load_look.py index 7c6e4954af..b060ae2b05 100644 --- a/openpype/hosts/maya/plugins/load/load_look.py +++ b/openpype/hosts/maya/plugins/load/load_look.py @@ -29,7 +29,7 @@ class LookLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): color = "orange" def process_reference(self, context, name, namespace, options): - import maya.cmds as cmds + from maya import cmds with lib.maintained_selection(): file_url = self.prepare_root_value(self.fname, @@ -125,7 +125,7 @@ class LookLoader(openpype.hosts.maya.api.plugin.ReferenceLoader): Returns node names """ - import maya.cmds as cmds + from maya import cmds for shader in shader_nodes: future = cmds.listHistory(shader, future=True) From 6b1707d51fc633db190300f46f5c72a3c1395590 Mon Sep 17 00:00:00 2001 From: Mustafa-Zarkash Date: Thu, 6 Jul 2023 17:37:21 +0300 Subject: [PATCH 13/15] make it less restrictive --- openpype/hosts/houdini/plugins/create/create_pointcache.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/openpype/hosts/houdini/plugins/create/create_pointcache.py b/openpype/hosts/houdini/plugins/create/create_pointcache.py index 4eadef86f7..554d5f2016 100644 --- a/openpype/hosts/houdini/plugins/create/create_pointcache.py +++ b/openpype/hosts/houdini/plugins/create/create_pointcache.py @@ -40,11 +40,7 @@ class CreatePointCache(plugin.HoudiniCreator): # the ROP node we prefer it set to the SopNode path explicitly # Allow sop level paths (e.g. /obj/geo1/box1) - # but do not allow other sop level paths when - # the parent type is not 'geo' like - # Cameras, Dopnet nodes(sop solver) - if isinstance(selected_node, hou.SopNode) and \ - selected_node.parent().type().name() in ["geo", "subnet"]: + if isinstance(selected_node, hou.SopNode): parms["sop_path"] = selected_node.path() self.log.debug( "Valid SopNode selection, 'SOP Path' in ROP will be set to '%s'." From 680ea6d0d71bbee13d3ff85bc0ff6c444501d60d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 8 Jul 2023 03:32:33 +0000 Subject: [PATCH 14/15] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9fcb69e2e9..1280e6a6e5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to OpenPype Tray options: + - 3.15.12-nightly.4 - 3.15.12-nightly.3 - 3.15.12-nightly.2 - 3.15.12-nightly.1 @@ -134,7 +135,6 @@ body: - 3.14.5-nightly.1 - 3.14.4 - 3.14.4-nightly.4 - - 3.14.4-nightly.3 validations: required: true - type: dropdown From 252e1f03076860778e8b4a5c8a3049f17e2efa0b Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Mon, 10 Jul 2023 10:01:38 +0100 Subject: [PATCH 15/15] Move Qt imports away from module init --- openpype/hosts/unreal/addon.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/unreal/addon.py b/openpype/hosts/unreal/addon.py index ed23950b35..b5c978d98f 100644 --- a/openpype/hosts/unreal/addon.py +++ b/openpype/hosts/unreal/addon.py @@ -1,7 +1,6 @@ import os import re from openpype.modules import IHostAddon, OpenPypeModule -from openpype.widgets.message_window import Window UNREAL_ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,6 +20,8 @@ class UnrealAddon(OpenPypeModule, IHostAddon): from .lib import get_compatible_integration + from openpype.widgets.message_window import Window + pattern = re.compile(r'^\d+-\d+$') if not pattern.match(app.name):