Skip to content

create_backdrop

CreateBackdrop

Bases: NukeCreator

Add Publishable Backdrop

Source code in client/ayon_nuke/plugins/create/create_backdrop.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class CreateBackdrop(NukeCreator):
    """Add Publishable Backdrop"""

    settings_category = "nuke"

    identifier = "create_backdrop"
    label = "Nukenodes (backdrop)"
    product_type = "nukenodes"
    icon = "file-archive-o"
    maintain_selection = True

    # plugin attributes
    node_color = "0xdfea5dff"

    def create_instance_node(
        self,
        node_name,
        knobs=None,
        parent=None,
        node_type=None,
        node_selection=None,
    ):
        """Create node representing instance.

        Arguments:
            node_name (str): Name of the new node.
            knobs (OrderedDict): node knobs name and values
            parent (str): Name of the parent node.
            node_type (str, optional): Nuke node Class.
            node_selection (Optional[list[nuke.Node]]): The node selection.

        Returns:
            nuke.Node: Newly created instance node.

        Raises:
            NukeCreatorError. When multiple Camera nodes are part of the selection.

        """
        with maintained_selection():
            if len(node_selection) >= 1:
                select_nodes(node_selection)

            created_node = autoBackdrop()
            created_node["name"].setValue(node_name)
            created_node["tile_color"].setValue(int(self.node_color, 16))
            created_node["note_font_size"].setValue(24)
            created_node["label"].setValue("[{}]".format(node_name))

            return created_node

create_instance_node(node_name, knobs=None, parent=None, node_type=None, node_selection=None)

Create node representing instance.

Parameters:

Name Type Description Default
node_name str

Name of the new node.

required
knobs OrderedDict

node knobs name and values

None
parent str

Name of the parent node.

None
node_type str

Nuke node Class.

None
node_selection Optional[list[Node]]

The node selection.

None

Returns:

Type Description

nuke.Node: Newly created instance node.

Source code in client/ayon_nuke/plugins/create/create_backdrop.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def create_instance_node(
    self,
    node_name,
    knobs=None,
    parent=None,
    node_type=None,
    node_selection=None,
):
    """Create node representing instance.

    Arguments:
        node_name (str): Name of the new node.
        knobs (OrderedDict): node knobs name and values
        parent (str): Name of the parent node.
        node_type (str, optional): Nuke node Class.
        node_selection (Optional[list[nuke.Node]]): The node selection.

    Returns:
        nuke.Node: Newly created instance node.

    Raises:
        NukeCreatorError. When multiple Camera nodes are part of the selection.

    """
    with maintained_selection():
        if len(node_selection) >= 1:
            select_nodes(node_selection)

        created_node = autoBackdrop()
        created_node["name"].setValue(node_name)
        created_node["tile_color"].setValue(int(self.node_color, 16))
        created_node["note_font_size"].setValue(24)
        created_node["label"].setValue("[{}]".format(node_name))

        return created_node