Skip to content

determine_future_version

DetermineFutureVersion

Bases: MayaInstancePlugin

This will determine version of product if we want render to be attached to.

Source code in client/ayon_maya/plugins/publish/determine_future_version.py
 5
 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 DetermineFutureVersion(plugin.MayaInstancePlugin):
    """
    This will determine version of product if we want render to be attached to.
    """
    label = "Determine Product Version"
    order = pyblish.api.IntegratorOrder
    families = ["renderlayer"]

    def process(self, instance):
        context = instance.context
        attatch_to_products = [
            i["productName"]
            for i in instance.data["attachTo"]
        ]
        if not attatch_to_products:
            return

        for i in context:
            if i.data["productName"] not in attatch_to_products:
                continue
            # # this will get corresponding product in attachTo list
            # # so we can set version there
            sub = next(
                item
                for item in instance.data["attachTo"]
                if item["productName"] == i.data["productName"]
            )

            sub["version"] = i.data.get("version", 1)
            self.log.info("render will be attached to {} v{}".format(
                    sub["productName"], sub["version"]
            ))