Closed gucheng599 closed 3 weeks ago
I think I know how to judge now
active_document = self.app.activeDocument
layer_group_id_list = []
layer_group_list = active_document.layerSets
for layer_group in layer_group_list:
layer_group_id_list.append(layer_group.id)
layer_list = active_document.layers
for layer in layer_list:
if layer.app.id in layer_group_id_list:
print("this is layer group")
else:
print("this is layer")
But I still have one questions
# photoshop\api\_layers.py L41
def __iter__(self):
for layer in self._layers:
yield ArtLayer(layer)
# photoshop\api\_layerSets.py L24
def __iter__(self):
for layer_set in self.app:
yield layer_set
Why isn't the COM object instantiated in layerset
Describe the bug We know that
app.activeDocument.layers
usually represent a collection of layers and layerSets How do I know if the current layer is alayerSet
when I traverseapp.activeDocument.layers
To Reproduce Steps to reproduce the behavior: In fact, using JavaScript directly can easily achieve this, but how can I use the Photoshop Python API to do it JavaScript example:
but, in photoshop-python-api, Typename is not a meta attribute of layer, but a fixed class name
I tried to use layer.app.typename to get the typename in the metadata of the layer, but got nothing. How can I determine if the layer is actually a layer group
this is bad example
Expected behavior As stated in the title
Screenshots my screenshots:
Desktop (please complete the following information):