Skip to content

action

SelectInvalidAction

Bases: Action

Select invalid nodes in Maya when plug-in failed.

To retrieve the invalid nodes this assumes a static get_invalid() method is available on the plugin.

Source code in client/ayon_houdini/api/action.py
 7
 8
 9
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
class SelectInvalidAction(pyblish.api.Action):
    """Select invalid nodes in Maya when plug-in failed.

    To retrieve the invalid nodes this assumes a static `get_invalid()`
    method is available on the plugin.

    """
    label = "Select invalid"
    on = "failed"  # This action is only available on a failed plug-in
    icon = "search"  # Icon from Awesome Icon

    def process(self, context, plugin):

        # Get the invalid nodes for the plug-ins
        self.log.info("Finding invalid nodes..")
        invalid = list()
        if issubclass(plugin, pyblish.api.ContextPlugin):
            invalid = plugin.get_invalid(context)
        else:
            errored_instances = get_errored_instances_from_context(
                context, plugin=plugin
            )
            for instance in errored_instances:
                invalid_nodes = plugin.get_invalid(instance)
                if invalid_nodes:
                    if isinstance(invalid_nodes, (list, tuple)):
                        invalid.extend(invalid_nodes)
                    else:
                        self.log.warning("Plug-in returned to be invalid, "
                                         "but has no selectable nodes.")

        hou.clearAllSelected()
        if invalid:
            self.log.info("Selecting invalid nodes: {}".format(
                ", ".join(node.path() for node in invalid)
            ))
            for node in invalid:
                node.setSelected(True)
                node.setCurrent(True)
        else:
            self.log.info("No invalid nodes found.")

SelectROPAction

Bases: Action

Select ROP.

It's used to select the associated ROPs with the errored instances.

Source code in client/ayon_houdini/api/action.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class SelectROPAction(pyblish.api.Action):
    """Select ROP.

    It's used to select the associated ROPs with the errored instances.
    """

    label = "Select ROP"
    on = "failed"  # This action is only available on a failed plug-in
    icon = "mdi.cursor-default-click"

    def process(self, context, plugin):
        errored_instances = get_errored_instances_from_context(context, plugin)

        # Get the invalid nodes for the plug-ins
        self.log.info("Finding ROP nodes..")
        rop_nodes = list()
        for instance in errored_instances:
            node_path = instance.data.get("instance_node")
            if not node_path:
                continue

            node = hou.node(node_path)
            if not node:
                continue

            rop_nodes.append(node)

        hou.clearAllSelected()
        if rop_nodes:
            self.log.info("Selecting ROP nodes: {}".format(
                ", ".join(node.path() for node in rop_nodes)
            ))
            for node in rop_nodes:
                node.setSelected(True)
                node.setCurrent(True)
        else:
            self.log.info("No ROP nodes found.")