Skip to content

layerSet

LayerSet

Bases: Photoshop

A group of layer objects, which can include art layer objects and other (nested) layer set objects.

A single command or set of commands manipulates all layers in a layer set object.

Source code in photoshop/api/_layerSet.py
 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
 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
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
class LayerSet(Photoshop):
    """A group of layer objects, which can include art layer objects and other (nested) layer set objects.

    A single command or set of commands manipulates all layers in a layer set object.

    """

    def __init__(self, parent):
        super().__init__(parent=parent)
        self._flag_as_method(
            "merge",
            "duplicate",
            "add",
            "delete",
            "link",
            "move",
            "resize",
            "rotate",
            "translate",
            "unlink",
        )

    @property
    def allLocked(self):
        return self.app.allLocked

    @allLocked.setter
    def allLocked(self, value):
        self.app.allLocked = value

    @property
    def artLayers(self):
        return ArtLayers(self.app.artLayers)

    @property
    def blendMode(self):
        return BlendMode(self.app.blendMode)

    @property
    def bounds(self):
        """The bounding rectangle of the layer set."""
        return self.app.bounds

    @property
    def enabledChannels(self):
        return self.app.enabledChannels

    @enabledChannels.setter
    def enabledChannels(self, value):
        self.app.enabledChannels = value

    @property
    def layers(self):
        return Layers(self.app.layers)

    @property
    def layerSets(self):
        # pylint: disable=import-outside-toplevel
        from ._layerSets import LayerSets

        return LayerSets(self.app.layerSets)

    @property
    def linkedLayers(self):
        """The layers linked to this layerSet object."""
        return self.app.linkedLayers or []

    @property
    def name(self) -> str:
        return self.app.name

    @name.setter
    def name(self, value):
        """The name of this layer set."""
        self.app.name = value

    @property
    def opacity(self):
        """The master opacity of the set."""
        return round(self.app.opacity)

    @opacity.setter
    def opacity(self, value):
        self.app.opacity = value

    @property
    def parent(self):
        return self.app.parent

    @property
    def visible(self):
        return self.app.visible

    @visible.setter
    def visible(self, value):
        self.app.visible = value

    def duplicate(self, relativeObject=None, insertionLocation=None):
        return LayerSet(self.app.duplicate(relativeObject, insertionLocation))

    def link(self, with_layer):
        self.app.link(with_layer)

    def add(self):
        """Adds an element."""
        self.app.add()

    def merge(self) -> ArtLayer:
        """Merges the layer set."""
        return ArtLayer(self.app.merge())

    def move(self, relativeObject, insertionLocation):
        self.app.move(relativeObject, insertionLocation)

    def remove(self):
        """Remove this layer set from the document."""
        self.app.delete()

    def resize(self, horizontal=None, vertical=None, anchor: AnchorPosition = None):
        self.app.resize(horizontal, vertical, anchor)

    def rotate(self, angle, anchor=None):
        self.app.rotate(angle, anchor)

    def translate(self, delta_x, delta_y):
        """Moves the position relative to its current position."""
        self.app.translate(delta_x, delta_y)

    def unlink(self):
        """Unlinks the layer set."""
        self.app.unlink()

    def __iter__(self):
        for layer in self.app:
            yield layer

bounds property

The bounding rectangle of the layer set.

linkedLayers property

The layers linked to this layerSet object.

opacity property writable

The master opacity of the set.

add()

Adds an element.

Source code in photoshop/api/_layerSet.py
113
114
115
def add(self):
    """Adds an element."""
    self.app.add()

merge()

Merges the layer set.

Source code in photoshop/api/_layerSet.py
117
118
119
def merge(self) -> ArtLayer:
    """Merges the layer set."""
    return ArtLayer(self.app.merge())

remove()

Remove this layer set from the document.

Source code in photoshop/api/_layerSet.py
124
125
126
def remove(self):
    """Remove this layer set from the document."""
    self.app.delete()

translate(delta_x, delta_y)

Moves the position relative to its current position.

Source code in photoshop/api/_layerSet.py
134
135
136
def translate(self, delta_x, delta_y):
    """Moves the position relative to its current position."""
    self.app.translate(delta_x, delta_y)

Unlinks the layer set.

Source code in photoshop/api/_layerSet.py
138
139
140
def unlink(self):
    """Unlinks the layer set."""
    self.app.unlink()

Last update: 2024-11-17
Created: 2024-11-17