예제 #1
0
    def __init__(self, *args, **kwargs):
        super(CrateRead, self).__init__(*args, **kwargs)
        self.nodes = nuke.selectedNodes()
        data = OrderedDict()
        data['family'] = self.family
        data['families'] = self.families

        for k, v in self.data.items():
            if k not in data.keys():
                data.update({k: v})

        self.data = data
예제 #2
0
    def process(self):
        self.name = self.data["subset"]

        nodes = nuke.selectedNodes()

        if not nodes or len(nodes) == 0:
            nuke.message('Please select Read node')
        else:
            count_reads = 0
            for node in nodes:
                if node.Class() != 'Read':
                    continue
                name = node["name"].value()
                avalon_data = self.data
                avalon_data['subset'] = "{}_{}".format(self.family, name)
                self.change_read_node(self.data["subset"], node, avalon_data)
                count_reads += 1

            if count_reads < 1:
                nuke.message('Please select Read node')
        return
예제 #3
0
    def process(self):
        from pype.nuke import lib as pnlib
        reload(pnlib)

        inputs = []
        outputs = []
        instance = nuke.toNode(self.data["subset"])
        selected_node = None

        # use selection
        if (self.options or {}).get("useSelection"):
            nodes = nuke.selectedNodes()

            assert len(nodes) == 1, self.log.error(
                "Select only one node. The node you want to connect to, or tick off `Use selection`"
            )

            selected_node = nodes[0]
            inputs = [selected_node]
            outputs = selected_node.dependent()

            if instance:
                if (instance.name() in selected_node.name()):
                    selected_node = instance.dependencies()[0]

        # if node already exist
        if instance:
            # collect input / outputs
            inputs = instance.dependencies()
            outputs = instance.dependent()
            selected_node = inputs[0]
            # remove old one
            nuke.delete(instance)

        # recreate new
        write_data = {
            "class": self.nClass,
            "families": [self.family],
            "avalon": self.data
        }

        if self.presets.get('fpath_template'):
            self.log.info("Adding template path from preset")
            write_data.update(
                {"fpath_template": self.presets["fpath_template"]})
        else:
            self.log.info("Adding template path from plugin")
            write_data.update({
                "fpath_template":
                "{work}/renders/nuke/{subset}/{subset}.{frame}.{ext}"
            })

        write_node = pnlib.create_write_node(self.data["subset"],
                                             write_data,
                                             input=selected_node)

        # relinking to collected connections
        for i, input in enumerate(inputs):
            write_node.setInput(i, input)

        write_node.autoplace()

        for output in outputs:
            output.setInput(0, write_node)

        return True
예제 #4
0
 def __init__(self, *args, **kwargs):
     super(CreateBackdrop, self).__init__(*args, **kwargs)
     self.nodes = nuke.selectedNodes()
     self.node_color = "0xdfea5dff"
     return
예제 #5
0
 def __init__(self, *args, **kwargs):
     super(CreateGizmo, self).__init__(*args, **kwargs)
     self.nodes = nuke.selectedNodes()
     self.node_color = "0x7533c1ff"
     return