當前位置: 首頁>>代碼示例>>Python>>正文


Python nuke.allNodes方法代碼示例

本文整理匯總了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 
開發者ID:getavalon,項目名稱:core,代碼行數:22,代碼來源:pipeline.py

示例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
############################################# 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:18,代碼來源:cryptomatte_utilities.py

示例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) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:18,代碼來源:single_to_sequence.py

示例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) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:21,代碼來源:switch_shot.py

示例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) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:23,代碼來源:toggle_stamp.py

示例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)

# ----------------------------------------------------------------------------- 
開發者ID:Clemson-DPA,項目名稱:dpa-pipe,代碼行數:38,代碼來源:nodes.py

示例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 
開發者ID:bumpybox,項目名稱:pyblish-bumpybox,代碼行數:33,代碼來源:validate_write_node.py

示例8: decryptomatte_all

# 需要導入模塊: import nuke [as 別名]
# 或者: from nuke import allNodes [as 別名]
def decryptomatte_all(ask=True):
    decryptomatte_nodes(nuke.allNodes(), ask) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:4,代碼來源:cryptomatte_utilities.py

示例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) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:15,代碼來源:toggle_input.py

示例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()]) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:14,代碼來源:switch_shot.py

示例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 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:12,代碼來源:switch_shot.py

示例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) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:10,代碼來源:replace_read_node_path.py

示例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'])) 
開發者ID:weijer,項目名稱:NukeToolSet,代碼行數:14,代碼來源:relativeFilePath.py

示例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 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:12,代碼來源:nukeEnv.py

示例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) 
開發者ID:Psyop,項目名稱:Cryptomatte,代碼行數:12,代碼來源:cryptomatte_utilities.py


注:本文中的nuke.allNodes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。