Skip to content

collect_scene

Collect scene data.

CollectScene

Bases: ContextPlugin

Collect basic scene information.

Source code in client/ayon_harmony/plugins/publish/collect_scene.py
 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class CollectScene(pyblish.api.ContextPlugin):
    """Collect basic scene information."""

    label = "Scene Data"
    order = pyblish.api.CollectorOrder
    hosts = ["harmony"]

    def process(self, context):
        """Plugin entry point."""
        result = harmony.send(
            {
                "function": "AyonHarmony.getSceneSettings",
                "args": []}
        )["result"]

        context.data["applicationPath"] = result[0]
        context.data["scenePath"] = os.path.join(
            result[1], result[2] + ".xstage")
        context.data["frameRate"] = result[3]
        context.data["frameStartHandle"] = result[4]
        context.data["frameEndHandle"] = result[5]
        context.data["audioPath"] = result[6]
        context.data["resolutionWidth"] = result[7]
        context.data["resolutionHeight"] = result[8]
        context.data["FOV"] = result[9]

        # harmony always starts from 1. frame
        # 1001 - 10010 >> 1 - 10
        # frameStart, frameEnd already collected by global plugin
        offset = context.data["frameStart"] - 1
        frame_start = context.data["frameStart"] - offset
        frames_count = context.data["frameEnd"] - \
            context.data["frameStart"] + 1

        # increase by handleStart - real frame range
        # frameStart != frameStartHandle with handle presence
        context.data["frameStart"] = int(frame_start) + \
            context.data["handleStart"]
        context.data["frameEnd"] = int(frames_count) + \
            context.data["frameStart"] - 1

        all_nodes = harmony.send(
            {"function": "node.subNodes", "args": ["Top"]}
        )["result"]

        context.data["allNodes"] = all_nodes

        # collect all write nodes to be able disable them in Deadline
        all_write_nodes = harmony.send(
            {"function": "node.getNodes", "args": ["WRITE"]}
        )["result"]

        context.data["all_write_nodes"] = all_write_nodes

        result = harmony.send(
            {
                "function": "AyonHarmony.getVersion",
                "args": []}
        )["result"]
        context.data["harmonyVersion"] = "{}.{}".format(result[0], result[1])

process(context)

Plugin entry point.

Source code in client/ayon_harmony/plugins/publish/collect_scene.py
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
59
60
61
62
63
64
65
66
67
68
def process(self, context):
    """Plugin entry point."""
    result = harmony.send(
        {
            "function": "AyonHarmony.getSceneSettings",
            "args": []}
    )["result"]

    context.data["applicationPath"] = result[0]
    context.data["scenePath"] = os.path.join(
        result[1], result[2] + ".xstage")
    context.data["frameRate"] = result[3]
    context.data["frameStartHandle"] = result[4]
    context.data["frameEndHandle"] = result[5]
    context.data["audioPath"] = result[6]
    context.data["resolutionWidth"] = result[7]
    context.data["resolutionHeight"] = result[8]
    context.data["FOV"] = result[9]

    # harmony always starts from 1. frame
    # 1001 - 10010 >> 1 - 10
    # frameStart, frameEnd already collected by global plugin
    offset = context.data["frameStart"] - 1
    frame_start = context.data["frameStart"] - offset
    frames_count = context.data["frameEnd"] - \
        context.data["frameStart"] + 1

    # increase by handleStart - real frame range
    # frameStart != frameStartHandle with handle presence
    context.data["frameStart"] = int(frame_start) + \
        context.data["handleStart"]
    context.data["frameEnd"] = int(frames_count) + \
        context.data["frameStart"] - 1

    all_nodes = harmony.send(
        {"function": "node.subNodes", "args": ["Top"]}
    )["result"]

    context.data["allNodes"] = all_nodes

    # collect all write nodes to be able disable them in Deadline
    all_write_nodes = harmony.send(
        {"function": "node.getNodes", "args": ["WRITE"]}
    )["result"]

    context.data["all_write_nodes"] = all_write_nodes

    result = harmony.send(
        {
            "function": "AyonHarmony.getVersion",
            "args": []}
    )["result"]
    context.data["harmonyVersion"] = "{}.{}".format(result[0], result[1])