Skip to content

select_containers

SelectInScene

Bases: InventoryAction

Select nodes in the scene from selected containers in scene inventory

Source code in client/ayon_houdini/plugins/inventory/select_containers.py
 6
 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
class SelectInScene(InventoryAction):
    """Select nodes in the scene from selected containers in scene inventory"""

    label = "Select in scene"
    icon = "search"
    color = "#888888"
    order = 99

    @staticmethod
    def is_compatible(container) -> bool:
        object_name: str = container.get("objectName")
        if not object_name:
            return False

        node = hou.node(object_name)
        if not node:
            return False

        return True

    def process(self, containers):
        nodes = [hou.node(container["objectName"]) for container in containers]
        if not nodes:
            return

        hou.clearAllSelected()
        for node in nodes:
            node.setSelected(True)

        # Set last as current
        nodes[-1].setCurrent(True)