本文整理汇总了Python中nuke.createNode方法的典型用法代码示例。如果您正苦于以下问题:Python nuke.createNode方法的具体用法?Python nuke.createNode怎么用?Python nuke.createNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuke
的用法示例。
在下文中一共展示了nuke.createNode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_tools
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def create_tools(self, menu, type, name, command, shortcut, icon_name):
"""
create menu tools
:param type:
:param menu:
:param name:
:param command:
:param shortcut:
:param icon:
:return:
"""
if type == "python":
menu.addCommand(name, command, shortcut, icon=icon_name)
elif type == "gizmo":
menu.addCommand(name, "nuke.createNode(\"%s\")" % command, icon=icon_name)
elif type == "toolbar":
menu.addCommand(name, icon=icon_name)
示例2: add_write_node
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def add_write_node(name, **kwarg):
"""Adding nuke write node
Arguments:
name (str): nuke node name
kwarg (attrs): data for nuke knobs
Returns:
node (obj): nuke write node
"""
frame_range = kwarg.get("frame_range", None)
w = nuke.createNode(
"Write",
"name {}".format(name))
w["file"].setValue(kwarg["file"])
for k, v in kwarg.items():
if "frame_range" in k:
continue
log.info([k, v])
try:
w[k].setValue(v)
except KeyError as e:
log.debug(e)
continue
if frame_range:
w["use_limit"].setValue(True)
w["first"].setValue(frame_range[0])
w["last"].setValue(frame_range[1])
return w
示例3: create_write_product_node
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def create_write_product_node():
node = nuke.createNode('Write', inpanel=True)
node_name = 'WriteProduct'
node_inst = 1
while nuke.exists(node_name + str(node_inst)):
node_inst += 1
node_name += str(node_inst)
node.knob('name').setValue(node_name)
node.knob('beforeRender').setValue(
'dpa.nuke.utils.create_product_before_render()')
node.knob('afterFrameRender').setValue(
'dpa.nuke.utils.set_permissions_after_frame()')
products_tab = nuke.Tab_Knob("Product")
node.addKnob(products_tab)
node.addKnob(nuke.EvalString_Knob('product_desc', 'description', ""))
node.addKnob(nuke.EvalString_Knob('product_name', 'name',
get_default_product_name()))
node.addKnob(nuke.EvalString_Knob('product_ver_note', 'description', ""))
# hide the file knob
node.knob('file_type').setValue('exr')
node.knob('product_ver_note').setVisible(False)
# -----------------------------------------------------------------------------
示例4: cryptomatte_create_gizmo
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def cryptomatte_create_gizmo():
return nuke.createNode("Cryptomatte")
示例5: encryptomatte_create_gizmo
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def encryptomatte_create_gizmo():
return nuke.createNode("Encryptomatte")
#############################################
# Public - cryptomatte Events
#############################################
示例6: create_node
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def create_node(node_name, read_data):
label = "%s points" % (read_data["verts_count"])
node = nuke.createNode("BakedPointCloud")
node.knob("serializePoints").setValue("%s %s" % (read_data["total"], read_data["points"]))
node.knob("serializeNormals").setValue("%s %s" % (read_data["total"], read_data["normals"]))
node.knob("serializeColors").setValue("%s %s" % (read_data["total"], read_data["colors"]))
node.knob("name").setValue(node_name)
node.knob("label").setValue(label)
示例7: shuffle
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def shuffle():
for selected_node in nuke.selectedNodes():
if selected_node.Class() == 'Read':
all_channels = selected_node.channels()
all_channels = list(set([i.split('.')[0] for i in all_channels]))
for channel in all_channels:
shuffle_node = nuke.createNode('Shuffle', inpanel=False)
shuffle_node['name'].setValue(channel+'_'+selected_node['name'].getValue())
shuffle_node['in'].setValue(channel)
shuffle_node.setInput(0, selected_node)
shuffle_node['postage_stamp'].setValue(1)
示例8: populate_menu_recursive
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def populate_menu_recursive(tool_path, menu):
if not tool_path.endswith(os.sep):
tool_path += os.sep
for root, dirs, files in os.walk(tool_path):
category = root.replace(tool_path, '')
# build the dynamic menus, ignoring empty dirs:
for dir_name in natural_sort(dirs):
if os.listdir(os.path.join(root, dir_name)) and dir_name != DEPRECATED:
img = find_icon(root, dir_name)
menu.addMenu(category + '/' + dir_name, icon=img)
# stop here if we're in a deprecated menu
if category == DEPRECATED:
continue
# if we have both dirs and files, add a separator
if files and dirs:
submenu = menu.addMenu(category) # menu() and findItem() do not return a menu object.
submenu.addSeparator()
# Populate the menus
for nuke_file in natural_sort(files):
file_name, extension = os.path.splitext(nuke_file)
if extension.lower() in ['.gizmo', '.so', '.nk']:
img = find_icon(root, file_name)
# Adding the menu command
if extension.lower() in ['.nk']:
menu.addCommand(category + '/' + file_name,
'nuke.nodePaste( "{}" )'.format(os.path.join(root, nuke_file)),
icon=img)
if extension.lower() in ['.gizmo', '.so']:
menu.addCommand(category + '/' + file_name,
'nuke.createNode( "{}" )'.format(file_name),
icon=img)
return menu
示例9: create_auto_crop_writer
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def create_auto_crop_writer():
"""creates a write node for every selected node, and sets the autocrop flag
to auto crop the output for fast reading
"""
# get selected nodes and deselect them
nodes = nuke.selectedNodes()
[node.setSelected(False) for node in nodes]
write_nodes = []
for node in nodes:
write_node = nuke.createNode('Write')
file_path = node['file'].value()
filename_with_number_seq, ext = os.path.splitext(file_path)
filename, number_seq = os.path.splitext(filename_with_number_seq)
write_node['file'].setValue(
filename + '_auto_cropped' + number_seq + ext
)
write_node['channels'].setValue('all')
write_node['autocrop'].setValue(True)
write_node.setXpos(node.xpos() + 100)
write_node.setYpos(node.ypos())
# connect it to the original node
write_node.setInput(0, node)
write_node.setSelected(False)
# store the write node
write_nodes.append(write_node)
# connect the write nodes to afanasy if afanasy exists
try:
afanasy = nuke.createNode('afanasy')
for i, node in enumerate(write_nodes):
afanasy.setInput(i, node)
except RuntimeError:
pass
示例10: imprint
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def imprint(node, data, tab=None):
"""Store attributes with value on node
Parse user data into Node knobs.
Use `collections.OrderedDict` to ensure knob order.
Args:
node(nuke.Node): node object from Nuke
data(dict): collection of attributes and their value
Returns:
None
Examples:
```
import nuke
from avalon.nuke import lib
node = nuke.createNode("NoOp")
data = {
# Regular type of attributes
"myList": ["x", "y", "z"],
"myBool": True,
"myFloat": 0.1,
"myInt": 5,
# Creating non-default imprint type of knob
"MyFilePath": lib.Knobby("File_Knob", "/file/path"),
"divider": lib.Knobby("Text_Knob", ""),
# Manual nice knob naming
("my_knob", "Nice Knob Name"): "some text",
# dict type will be created as knob group
"KnobGroup": {
"knob1": 5,
"knob2": "hello",
"knob3": ["a", "b"],
},
# Nested dict will be created as tab group
"TabGroup": {
"tab1": {"count": 5},
"tab2": {"isGood": True},
"tab3": {"direction": ["Left", "Right"]},
},
}
lib.imprint(node, data, tab="Demo")
```
"""
for knob in create_knobs(data, tab):
node.addKnob(knob)
示例11: create_read_sub_node
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import createNode [as 别名]
def create_read_sub_node():
node = nuke.createNode('Read', inpanel=True)
node_name = 'ReadSub'
node_inst = 1
while nuke.exists(node_name + str(node_inst)):
node_inst += 1
node_name += str(node_inst)
node.knob('name').setValue(node_name)
sub_tab = nuke.Tab_Knob("Sub")
# make sure the product reprs are cached
populate_sub_cache(refresh=False)
repr_str_list = [DEFAULT_REPR_STR]
repr_str_list.extend(sorted(PRODUCT_REPR_STR_TO_PATH.keys()))
product_repr_select = nuke.Enumeration_Knob(
'product_repr_select',
'subscription',
repr_str_list,
)
product_seq_select = nuke.Enumeration_Knob(
'product_seq_select',
'files',
[],
)
nuke.callbacks.addKnobChanged(read_sub_knob_changed,
nodeClass='Read', node=node)
node.addKnob(sub_tab)
node.addKnob(product_repr_select)
node.addKnob(product_seq_select)
# make the tab pop to front
node['Sub'].setFlag(0)
read_sub_knob_changed(node=node, knob=node.knob('product_repr_select'))
# -----------------------------------------------------------------------------