Skip to content

integrate_batch_iteration

Offer to iterate after a successful batch publish.

IntegrateBatchIteration

Bases: InstancePlugin, OptionalPyblishPluginMixin

Offer to save batch as new iteration after publishing is done.

Source code in client/ayon_flame/plugins/publish/integrate_batch_iteration.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
class IntegrateBatchIteration(
    pyblish.api.InstancePlugin,
    OptionalPyblishPluginMixin,
):
    """Offer to save batch as new iteration after publishing is done.
    """

    label = "Iterate Batch After Publish"
    order = pyblish.api.IntegratorOrder + 0.5
    families = ["workfile"]
    hosts = ["flame"]
    optional = True
    active = True

    def process(self, instance):
        if not self.is_active(instance.data):
            return

        if instance.data.get("batch_name") is None:
            self.log.info(
                "Instance is not a batch workfile, skipping."
            )
            return

        batch_name = instance.data.get("batch_name")
        batch = flapi.get_batch_from_workspace(batch_name)
        if not batch:
            raise ValueError(f"Batch group not found: {batch_name}")

        batch.iterate()
        self.log.info(
            f"Created new batch iteration after publish "
            f"(total: {len(batch.batch_iterations)})."
        )