Skip to content

validate_create_folder_checked

ValidateCreateFolderChecked

Bases: InstancePlugin

Valid if all savers have the input attribute CreateDir checked on

This attribute ensures that the folders to which the saver will write will be created.

Source code in client/ayon_fusion/plugins/publish/validate_create_folder_checked.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
class ValidateCreateFolderChecked(pyblish.api.InstancePlugin):
    """Valid if all savers have the input attribute CreateDir checked on

    This attribute ensures that the folders to which the saver will write
    will be created.
    """

    order = pyblish.api.ValidatorOrder
    label = "Validate Create Folder Checked"
    families = ["render", "image"]
    hosts = ["fusion"]
    actions = [RepairAction, SelectInvalidAction]

    @classmethod
    def get_invalid(cls, instance):
        tool = instance.data["tool"]
        create_dir = tool.GetInput("CreateDir")
        if create_dir == 0.0:
            cls.log.error(
                "%s has Create Folder turned off" % instance[0].Name
            )
            return [tool]

    def process(self, instance):
        invalid = self.get_invalid(instance)
        if invalid:
            raise PublishValidationError(
                "Found Saver with Create Folder During Render checked off",
                title=self.label,
            )

    @classmethod
    def repair(cls, instance):
        invalid = cls.get_invalid(instance)
        for tool in invalid:
            tool.SetInput("CreateDir", 1.0)