本文整理汇总了Python中nuke.thisNode方法的典型用法代码示例。如果您正苦于以下问题:Python nuke.thisNode方法的具体用法?Python nuke.thisNode怎么用?Python nuke.thisNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuke
的用法示例。
在下文中一共展示了nuke.thisNode方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_expected_value
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def get_expected_value(self, instance):
import os
expected = (
"[python {nuke.script_directory()}]/workspace/[python "
"{os.path.splitext(os.path.basename(nuke.scriptName()))[0]}]_"
"[python {nuke.thisNode().name()}]"
)
# Extension, defaulting to exr files.
current = self.get_current_value(instance)
ext = os.path.splitext(os.path.basename(current))[1]
if not ext:
ext = ".abc"
expected += ext
return expected
示例2: test_bug_still_exists
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def test_bug_still_exists(self):
"""Tests this bug still exists. We don't want to be running the fix if we don't have to. """
import nuke
if nuke.NUKE_VERSION_MAJOR == 7: # but is known not to exist in version 7.
return
def test_callback(node=None, knob=None):
node.metadata()
callback = lambda: test_callback(nuke.thisNode())
nuke.addKnobChanged(callback, nodeClass='Cryptomatte')
try:
self.test_paste_with_channelmerge()
exception = None
except Exception, e:
exception = e
示例3: encryptomatte_add_manifest_id
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def encryptomatte_add_manifest_id():
node = nuke.thisNode()
parent = nuke.thisParent()
name = parent.knob('matteName').value()
id_hex = parent.knob('idHex').value()
manifest_key = parent.knob('manifestKey').value()
metadata = node.metadata()
manifest = metadata.get(manifest_key + 'manifest', "{}")
# Add another item, with closing bracket
last_item = '"%s":"%s"}' % (name, id_hex)
last_bracket_pos = manifest.rfind('}')
existing_items = manifest[:last_bracket_pos].rstrip()
if not existing_items.endswith(',') and not existing_items.endswith('{'):
existing_items += ','
existing_items += last_item
return existing_items
#############################################
# Utils - Troubleshooting
#############################################
示例4: set_permissions_after_frame
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def set_permissions_after_frame():
node = nuke.thisNode()
frame_path = nuke.filename(node, nuke.REPLACE)
os.chmod(frame_path, 0660)
示例5: get_expected_value
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def get_expected_value(self, instance):
import os
expected = (
"[python {nuke.script_directory()}]/workspace/[python "
"{nuke.thisNode().name()}]/[python {os.path.splitext("
"os.path.basename(nuke.scriptName()))[0]}]/[python {"
"os.path.splitext(os.path.basename(nuke.scriptName()))[0]}]_"
"[python {nuke.thisNode().name()}]"
)
# Default padding starting at 4 digits.
padding = 4
if instance.data["collection"]:
padding = instance.data["collection"].padding
# Can't have less than 4 digits.
if padding < 4:
padding = 4
# Extension, defaulting to exr files.
current = self.get_current_value(instance)
ext = os.path.splitext(os.path.basename(current))[1]
if not ext:
ext = ".exr"
expected += ".%{1}d{2}".format(
instance[0].name(),
str(padding).zfill(2),
ext
)
return expected
示例6: setup_cryptomatte
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def setup_cryptomatte():
nuke.addKnobChanged(lambda: cryptomatte_knob_changed_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')
nuke.addKnobChanged(lambda: encryptomatte_knob_changed_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
nuke.addOnCreate(lambda: encryptomatte_on_create_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
#############################################
# Hash to float
#############################################
示例7: encryptomatte_add_manifest_id
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def encryptomatte_add_manifest_id(deserialize = False):
node = nuke.thisNode()
parent = nuke.thisParent()
name = parent.knob('matteName').value()
id_hex = parent.knob('idHex').value()
manifest_key = parent.knob('manifestKey').value()
metadata = node.metadata()
manifest = metadata.get(manifest_key + 'manifest', "{}")
if deserialize:
import json
d = json.loads(manifest)
d[name] = hex_id
new_manifest = json.dumps(d)
return new_manifest
else:
last_item = '"{name}":"{id_hex}"'.format(name=name, id_hex=id_hex)
last_item += '}'
last_bracket_pos = manifest.rfind('}')
existing_items = manifest[:last_bracket_pos].rstrip()
if not existing_items.endswith(',') and not existing_items.endswith('{'):
return existing_items + ',' + last_item
else:
return existing_items + last_item
#############################################
# Utils - Unload Manifest
#############################################
示例8: center_chromatik
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def center_chromatik():
try:
node_format = nuke.selectedNode()
except ValueError:
node_format = nuke.root()['format'].value()
nuke.thisNode()['center'].setValue((node_format.width() / 2, node_format.height() / 2))
示例9: output_to_h264
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def output_to_h264(write_node=None):
"""an after render function which converts the input to h264
"""
# get the file name
if not write_node:
write_node = nuke.thisNode()
file_full_path = nuke.filename(write_node)
# add the _h264 extension to the filename
file_name = os.path.basename(file_full_path)
path = file_full_path[:-len(file_name)]
file_name_wo_ext, ext = os.path.splitext(file_name)
# split any '.' (ex: a.%04d -> [a, %04d])
file_name_wo_ext = file_name_wo_ext.split('.')[0]
# add _h264
output_file_name = file_name_wo_ext + '_h264.mov'
output_full_path = os.path.join(path, output_file_name)
# TODO: if it is a sequence of images rename them by creating temp soft
# links to each frame and then use the sequence format in ffmpeg
# run ffmpeg in a separate thread
t = threading.Timer(
1.0,
convert_to_h264,
args=[file_full_path, output_full_path]
)
t.start()
示例10: setup_cryptomatte
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def setup_cryptomatte():
nuke.addOnCreate(lambda: cryptomatte_on_create_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')
nuke.addKnobChanged(lambda: cryptomatte_knob_changed_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')
nuke.addKnobChanged(lambda: encryptomatte_knob_changed_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
nuke.addOnCreate(lambda: encryptomatte_on_create_event(
nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
#############################################
# Testing
#############################################
示例11: read_sub_knob_changed
# 需要导入模块: import nuke [as 别名]
# 或者: from nuke import thisNode [as 别名]
def read_sub_knob_changed(node=None, knob=None):
if not node:
node = nuke.thisNode()
if not knob:
knob = nuke.thisKnob()
if knob.name() == 'product_repr_select':
product_repr_str = node['product_repr_select'].value()
if (product_repr_str == DEFAULT_REPR_STR or
product_repr_str not in PRODUCT_REPR_STR_TO_PATH):
node['product_seq_select'].setValues([])
node['file'].setValue('')
return
repr_dir = PRODUCT_REPR_STR_TO_PATH[product_repr_str]
# populate the possible file names
file_specs = {}
frame_regex = re.compile('([,\w]+).(\d{4})\.(\w+)')
for file_name in os.listdir(repr_dir):
matches = frame_regex.search(file_name)
if matches:
(file_base, frame_num, file_ext) = matches.groups()
spec = file_base + '.####.' + file_ext
file_specs[spec] = None
file_specs = sorted(file_specs.keys())
node['product_seq_select'].setValues(file_specs)
file_str = os.path.join(repr_dir, file_specs[0])
node['file'].setValue(file_str)
if knob.name() == 'product_seq_select':
repr_dir = os.path.dirname(node['file'].value())
file_spec = node['product_seq_select'].value()
file_str = os.path.join(repr_dir, file_spec)
node['file'].setValue(file_str)
# -----------------------------------------------------------------------------