Skip to content

collect_source

CollectSource

Bases: ContextPlugin

Collecting instances from traypublisher host.

Source code in client/ayon_traypublisher/plugins/publish/collect_source.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class CollectSource(pyblish.api.ContextPlugin):
    """Collecting instances from traypublisher host."""

    label = "Collect source"
    order = pyblish.api.CollectorOrder - 0.49
    hosts = ["traypublisher"]

    def process(self, context):
        # get json paths from os and load them
        source_name = "traypublisher"
        for instance in context:
            source = instance.data.get("source")
            if not source:
                instance.data["source"] = source_name
                self.log.info((
                    "Source of instance \"{}\" is changed to \"{}\""
                ).format(instance.data["name"], source_name))
            else:
                self.log.info((
                    "Source of instance \"{}\" was already set to \"{}\""
                ).format(instance.data["name"], source))