本文整理汇总了Python中nuke.allNodes方法的典型用法代码示例。如果您正苦于以下问题:Python nuke.allNodes方法的具体用法?Python nuke.allNodes怎么用?Python nuke.allNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuke
的用法示例。
在下文中一共展示了nuke.allNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ls
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def ls():
"""List available containers.
This function is used by the Container Manager in Nuke. You'll
need to implement a for-loop that then *yields* one Container at
a time.
See the `container.json` schema for details on how it should look,
and the Maya equivalent, which is in `avalon.maya.pipeline`
"""
all_nodes = nuke.allNodes(recurseGroups=False)
# TODO: add readgeo, readcamera, readimage
nodes = [n for n in all_nodes]
for n in nodes:
log.debug("name: `{}`".format(n.name()))
container = parse_container(n)
if container:
yield container
示例2: _force_update_all
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def _force_update_all():
with nuke.root():
node_count = 0
for node in nuke.allNodes():
if node.Class() == "Cryptomatte":
node_count = node_count + 1
cinfo = CryptomatteInfo(node)
_update_cryptomatte_gizmo(node, cinfo, force=True)
nuke.message("Updated %s cryptomatte gizmos." % node_count)
#############################################
# Utils - Update Gizmi
#############################################
示例3: main
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def main():
for read_node in nuke.allNodes('Read'):
file_name = read_node['file'].getValue().replace('\\', '/')
folder = os.path.dirname(file_name)
all_frames = get_frames(folder)
if all_frames:
replaced_frame = re.sub(r'\.\d{4}', '.%04d', all_frames[0])
frame_ext = os.path.join(folder, replaced_frame)
frame_ext = frame_ext.replace('\\', '/')
if file_name == frame_ext:
continue
read_node['file'].setValue(frame_ext)
frames = get_frame_range(all_frames)
if frames:
start_frame, end_frame = frames
rebuild_read_node(read_node, start_frame, end_frame)
示例4: replace_shot
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def replace_shot(self, current_shot, new_shot, sep):
all_read_node = nuke.allNodes('Read')
if all_read_node:
replace_task = nuke.ProgressTask("AAS | Replacing Files")
value = 1
for read_node in nuke.allNodes('Read'):
replace_task.setProgress(100/len(all_read_node)*value)
file_name = read_node['file'].getValue()
new_file_name = re.sub(current_shot, new_shot, file_name)
new_file_dir = os.path.dirname(new_file_name)
if os.path.isdir(new_file_dir):
read_node['file'].setValue(self.get_frame_profile(new_file_dir, sep))
read_node['disable'].setValue(0)
start_frame, end_frame = self.get_frame_range(new_file_dir, sep)
self.fix_read_node(read_node, start_frame, end_frame)
else:
read_node['disable'].setValue(1)
value += 1
replace_task.setProgress(100)
示例5: toggleStamp
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def toggleStamp():
sel = nuke.selectedNodes()
if len(sel):
toggleVal = True
for n in sel:
if n.knob('postage_stamp') != None:
toggleVal = not bool(n.knob('postage_stamp').getValue())
break
for node in sel:
if node.knob('postage_stamp') != None:
node.knob('postage_stamp').setValue(toggleVal)
else:
nodes = nuke.allNodes()
toggleVal = True
for n in nodes:
if n.knob('postage_stamp') != None:
toggleVal = not bool(n.knob('postage_stamp').getValue())
break
for node in nodes:
if node.knob('postage_stamp') != None:
node.knob('postage_stamp').setValue(toggleVal)
示例6: update_all_read_sub_nodes
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def update_all_read_sub_nodes():
read_sub_nodes = [node for node in nuke.allNodes(
filter='Read') if node.knob('product_repr_select')]
repr_str_list = [DEFAULT_REPR_STR]
repr_str_list.extend(sorted(PRODUCT_REPR_STR_TO_PATH.keys()))
print "UPDATING: " + str([n.name() for n in read_sub_nodes])
for node in read_sub_nodes:
product_repr_select = node.knob('product_repr_select')
product_seq_select = node.knob('product_seq_select')
cur_repr_value = product_repr_select.value()
cur_seq_value = product_seq_select.value()
product_repr_select.setValues(repr_str_list)
if cur_repr_value in repr_str_list:
product_repr_select.setValue(cur_repr_value)
read_sub_knob_changed(node=node, knob=product_repr_select)
seq_values = product_seq_select.value()
if cur_seq_value in seq_values:
product_seq_select.setValue(cur_seq_value)
else:
product_repr_select.setValue(DEFAULT_REPR_STR)
nuke.callbacks.addKnobChanged(read_sub_knob_changed,
nodeClass='Read', node=node)
# -----------------------------------------------------------------------------
示例7: process
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def process(self, instance):
import os
import nuke
current = instance[0]["file"].getValue()
expected = self.get_expected_value(instance)
msg = "Output path for \"{0}\"."
msg += " Current: \"{1}\". Expected: \"{2}\""
assert current == expected, msg.format(
instance[0].name(), current, expected
)
# Validate metadata knob
if "metadata" in instance[0].knobs().keys():
msg = "Metadata needs to be set to \"all metadata\"."
assert instance[0]["metadata"].value() == "all metadata", msg
# Validate file type
msg = "Wrong file type \"{0}\" selected for extension \"{1}\""
ext = os.path.splitext(current)[1][1:]
file_type = instance[0]["file_type"].enumName(
int(instance[0]["file_type"].getValue())
)
assert file_type == ext, msg.format(file_type, ext)
# Validate no other node is called ""{instance name}_review"
node_name = "{0}_review".format(instance.data["name"])
for node in nuke.allNodes():
assert node.name() != node_name
示例8: decryptomatte_all
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def decryptomatte_all(ask=True):
decryptomatte_nodes(nuke.allNodes(), ask)
示例9: toggleInput
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def toggleInput():
sel = nuke.selectedNodes()
if len(sel):
toggleVal = not bool(sel[0].knob('hide_input').getValue())
for node in sel:
if node.knob('hide_input') != None:
node.knob('hide_input').setValue(toggleVal)
else:
nodes = nuke.allNodes()
toggleVal = not bool(nodes[0].knob('hide_input').getValue())
for node in nodes:
if node.knob('hide_input') != None:
node.knob('hide_input').setValue(toggleVal)
示例10: import_pictures
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def import_pictures(self, sequence_dir, sep):
all_read_file = [read_node['file'].getValue()
for read_node in nuke.allNodes('Read')]
all_read_file = list(set(all_read_file))
start_frame, end_frame = self.get_frame_range(sequence_dir, sep)
read_file_name = self.get_frame_profile(sequence_dir, sep)
if read_file_name:
read_file_name = read_file_name.replace('\\', '/')
if all((start_frame, end_frame)) and read_file_name not in all_read_file:
read_node = nuke.nodes.Read(file=read_file_name)
self.fix_read_node(read_node, start_frame, end_frame)
nuke.zoom(1, [read_node.xpos(), read_node.ypos()])
示例11: get_current_project_dir
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def get_current_project_dir(self):
all_dirs = list()
if not nuke.allNodes('Read'):
return
for read_node in nuke.allNodes('Read'):
file_name = read_node['file'].getValue()
file_dir_name = os.path.dirname(os.path.dirname(file_name))
all_dirs.append(file_dir_name)
all_dirs = list(set(all_dirs))
return all_dirs
示例12: do_replace
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def do_replace(self):
source_path = str(self.source_le.text())
target_path = str(self.target_le.text())
for node in nuke.allNodes('Read'):
node_file_path = node['file'].getValue()
if source_path in node_file_path:
new_path = node_file_path.replace(source_path, target_path)
node['file'].setValue(new_path)
示例13: doIt
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def doIt(self):
nodesToProcess = nuke.selectedNodes() if self.nodeSelectionChoice.currentIndex() == 1 else nuke.allNodes()
processFunction = makeNodesAbsolute if self.commandTypeChoice.currentIndex() == 1 else makeNodesRelative
filteredNodes = self.filterByNodeType(nodesToProcess)
choosenKnobTypes = self.collectChoosenTypes(self.supportedKnobTypes)
result = processFunction(filteredNodes,choosenKnobTypes)
self.warningsText.setText("\n\n".join(result['warnings']))
self.resultsText.setText("\n".join(result['replacements']))
示例14: get_main_write_nodes
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def get_main_write_nodes(self):
"""Returns the main write node in the scene or None.
"""
# list all the write nodes in the current file
all_main_write_nodes = []
for write_node in nuke.allNodes("Write"):
if write_node.name().startswith(self._main_output_node_name):
all_main_write_nodes.append(write_node)
return all_main_write_nodes
示例15: _force_update_all
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import allNodes [as 别名]
def _force_update_all():
with nuke.root():
node_count = 0
for node in nuke.allNodes():
if node.Class() == "Cryptomatte":
node_count = node_count + 1
cinfo = CryptomatteInfo(node, reload_metadata=True)
_update_cryptomatte_gizmo(node, cinfo, force=True)
nuke.message("Updated %s cryptomatte gizmos." % node_count)