Skip to content

play_in_existing_rv

PlayInExistingRV

Bases: LoaderPlugin

Opens representation with network connected OpenRV

Could be run from Loader in DCC or outside. It expects to be run only on representations published to any task!

Source code in client/ayon_openrv/plugins/load/global/play_in_existing_rv.py
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
class PlayInExistingRV(load.LoaderPlugin):
    """Opens representation with network connected OpenRV

    Could be run from Loader in DCC or outside.
    It expects to be run only on representations published to any task!
    """

    product_base_types = {"*"}
    product_types = product_base_types
    representations = {"*"}
    extensions = {
        ext.lstrip(".")
        for ext in IMAGE_EXTENSIONS | VIDEO_EXTENSIONS
    }

    label = "Open in Existing RV"
    order = -10
    icon = "play-circle"
    color = "orange"

    def load(self, context, name, namespace, data):
        rv_connector = RVConnector()
        if not rv_connector.is_connected:
            raise LoadError(
                "No existing OpenRV connection found."
                " Make sure OpenRV is running and network connected."
            )

        payload = json.dumps([{
            "objectName": context["representation"]["name"],
            "representation": context["representation"]["id"],
        }])
        # This also retries the connection
        with rv_connector:
            rv_connector.send_event(
                "ayon_load_container",
                payload,
                shall_return=False
            )