From c4292d3add70c3ea1353a78afea4ca82b6e4e925 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Thu, 21 Nov 2019 19:56:12 +0100 Subject: [PATCH] feat(nuke): adding collect backdrop plugin --- .../plugins/nuke/publish/collect_nukenodes.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pype/plugins/nuke/publish/collect_nukenodes.py diff --git a/pype/plugins/nuke/publish/collect_nukenodes.py b/pype/plugins/nuke/publish/collect_nukenodes.py new file mode 100644 index 0000000000..ba5a28c44a --- /dev/null +++ b/pype/plugins/nuke/publish/collect_nukenodes.py @@ -0,0 +1,34 @@ +import pyblish.api +import nuke + +class CollectBackdrops(pyblish.api.InstancePlugin): + """Collect Backdrop instance from rendered frames + """ + + order = pyblish.api.CollectorOrder + 0.3 + label = "Collect Backdrop" + hosts = ["nuke"] + families = ["nukenodes"] + + def process(self, instance): + + bckn = instance[0] + + left = bckn.xpos() + top = bckn.ypos() + right = left + bckn['bdwidth'].value() + bottom = top + bckn['bdheight'].value() + + inNodes = [] + for node in nuke.allNodes(): + if node.Class() == "Viewer": + continue + + if (node.xpos() > left) \ + and (node.xpos() + node.screenWidth() < right) \ + and (node.ypos() > top) \ + and (node.ypos() + node.screenHeight() < bottom): + inNodes.append(node) + + self.log.info("Backdrop content collected: `{}`".format(inNodes)) + self.log.info("Backdrop instance collected: `{}`".format(instance))