Skip to content

select_containers

HighlightBySceneSelection

Bases: InventoryAction

Select containers in scene inventory from the current scene selection

Source code in client/ayon_maya/plugins/inventory/select_containers.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
class HighlightBySceneSelection(InventoryAction):
    """Select containers in scene inventory from the current scene selection"""

    label = "Highlight by scene selection"
    icon = "search"
    color = "#888888"
    order = 100

    def process(self, containers):

        selection = set(cmds.ls(selection=True, long=True, objectsOnly=True))
        host = registered_host()

        to_select = []
        for container in host.get_containers():
            members = get_container_members(container)
            if any(member in selection for member in members):
                to_select.append(container["objectName"])

        return {
            "objectNames": to_select,
            "options": {"clear": True}
        }

SelectInScene

Bases: InventoryAction

Select nodes in the scene from selected containers in scene inventory

Source code in client/ayon_maya/plugins/inventory/select_containers.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class SelectInScene(InventoryAction):
    """Select nodes in the scene from selected containers in scene inventory"""

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

    def process(self, containers):

        all_members = []
        for container in containers:
            members = get_container_members(container)
            all_members.extend(members)
        cmds.select(all_members, replace=True, noExpand=True)