nuke: adding supporting functions to plugin.py

This commit is contained in:
Jakub Jezek 2022-10-08 21:54:14 +02:00
parent ef27fc4cf2
commit ce0d2b8fe1
No known key found for this signature in database
GPG key ID: 730D7C02726179A7
2 changed files with 41 additions and 2 deletions

View file

@ -14,7 +14,9 @@ from .plugin import (
NukeWriteCreator,
NukeCreatorError,
OpenPypeCreator,
get_instance_node
get_instance_node,
get_instance_group_node_childs,
get_colorspace_from_node
)
from .pipeline import (
NukeHost,
@ -66,6 +68,8 @@ __all__ = (
"OpenPypeCreator",
"NukeHost",
"get_instance_node",
"get_instance_group_node_childs",
"get_colorspace_from_node",
"ls",

View file

@ -1,5 +1,5 @@
import nuke
import re
import os
import sys
import six
@ -415,6 +415,41 @@ def get_instance_node(instance):
return instance[0]
def get_instance_group_node_childs(instance):
"""Return list of instance group node children
Args:
instance (pyblish.Instance): pyblish instance
Returns:
list: [nuke.Node]
"""
node = get_instance_node(instance)
if node.Class() != "Group":
return
# collect child nodes
child_nodes = []
# iterate all nodes
for node in nuke.allNodes(group=node):
# add contained nodes to instance's node list
child_nodes.append(node)
return child_nodes
def get_colorspace_from_node(node):
# Add version data to instance
colorspace = node["colorspace"].value()
# remove default part of the string
if "default (" in colorspace:
colorspace = re.sub(r"default.\(|\)", "", colorspace)
return colorspace
def get_review_presets_config():
settings = get_current_project_settings()
review_profiles = (