mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
feat(nuke): adding label to collect backdrop
This commit is contained in:
parent
2e82c80e8a
commit
a2f81fbdb0
1 changed files with 16 additions and 5 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import pyblish.api
|
||||
import nuke
|
||||
|
||||
|
||||
@pyblish.api.log
|
||||
class CollectBackdrops(pyblish.api.InstancePlugin):
|
||||
"""Collect Backdrop instance from rendered frames
|
||||
"""Collect Backdrop node instance and its content
|
||||
"""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.3
|
||||
order = pyblish.api.CollectorOrder + 0.22
|
||||
label = "Collect Backdrop"
|
||||
hosts = ["nuke"]
|
||||
families = ["nukenodes"]
|
||||
|
|
@ -14,21 +16,30 @@ class CollectBackdrops(pyblish.api.InstancePlugin):
|
|||
|
||||
bckn = instance[0]
|
||||
|
||||
# define size of the backdrop
|
||||
left = bckn.xpos()
|
||||
top = bckn.ypos()
|
||||
right = left + bckn['bdwidth'].value()
|
||||
bottom = top + bckn['bdheight'].value()
|
||||
|
||||
inNodes = []
|
||||
# iterate all nodes
|
||||
for node in nuke.allNodes():
|
||||
|
||||
# exclude viewer
|
||||
if node.Class() == "Viewer":
|
||||
continue
|
||||
|
||||
# find all related nodes
|
||||
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))
|
||||
# add contained nodes to instance's node list
|
||||
instance.append(node)
|
||||
|
||||
instance.data["label"] = "{0} ({1} nodes)".format(
|
||||
bckn.name(), len(instance)-1)
|
||||
|
||||
self.log.info("Backdrop content collected: `{}`".format(instance[:]))
|
||||
self.log.info("Backdrop instance collected: `{}`".format(instance))
|
||||
Loading…
Add table
Add a link
Reference in a new issue