Skip to content

validate_smart_object_links

Bases: ContextPlugin, OptionalPyblishPluginMixin

Validate that no Smart Object layers have broken or missing links.

Checks both locally linked files (link.status == missing / unresolved) and CC Libraries assets (linkMissing flag). Broken links prevent correct rendering and must be resolved before publishing.

Source code in client/ayon_photoshop/plugins/publish/validate_smart_object_links.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class ValidateSmartObjectLinks(
    pyblish.api.ContextPlugin, OptionalPyblishPluginMixin
):
    """Validate that no Smart Object layers have broken or missing links.

    Checks both locally linked files (link.status == missing / unresolved)
    and CC Libraries assets (linkMissing flag).  Broken links prevent correct
    rendering and must be resolved before publishing.
    """

    label = "Validate Smart Object Links"
    hosts = ["photoshop"]
    order = ValidateContentsOrder
    settings_category = "photoshop"
    actions = [ValidateSmartObjectLinksRepair]

    optional = True
    active = True

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

        stub = photoshop.stub()
        broken = stub.get_broken_smart_object_links()

        if broken:
            names = ", ".join(broken)
            raise PublishXmlValidationError(
                self,
                "Broken Smart Object links detected.",
                formatting_data={"broken_layers": names},
            )

ValidateSmartObjectLinksRepair

Bases: Action

Rasterise broken Smart Object layers and re-embed them as local objects.

Warning: This repair is destructive — the original linked content is replaced by a rasterised snapshot that is re-wrapped as an embedded Smart Object. Consider relinking the original sources manually if you want to preserve editability.

Source code in client/ayon_photoshop/plugins/publish/validate_smart_object_links.py
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
class ValidateSmartObjectLinksRepair(pyblish.api.Action):
    """Rasterise broken Smart Object layers and re-embed them as local objects.

    Warning: This repair is destructive — the original linked content is
    replaced by a rasterised snapshot that is re-wrapped as an embedded Smart
    Object.  Consider relinking the original sources manually if you want to
    preserve editability.
    """

    label = "Repair"
    icon = "wrench"
    on = "failed"

    def process(self, context, plugin):
        stub = photoshop.stub()
        fixed = stub.fix_broken_smart_object_links()
        if fixed:
            self.log.info(
                "Repaired {} layer(s): {}".format(len(fixed), ", ".join(fixed))
            )
        else:
            self.log.warning(
                "Repair ran but no layers were modified. "
                "Please check the document manually."
            )