• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Document `layersDescriptor` is null if only one layer exists

Engaged ,
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

I'm having long term bugs with having one layer in the Document:

ReadLayerDesc *readLayerDesc = gFilterRecord->documentInfo->layersDescriptor;

Screenshot_189.png

But this only happens when there's one image (Assuming the layer array is not initialized when there's only one layer present), even looking through the (FilterRecordPtr)`filterRecord` the only accessable data is the `documentInfo` property...

What's the solution to this to acquire a single layer from the descriptor with the filterRecord?

TOPICS
SDK

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Engaged ,
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

Currently the only work around to this is for me to create a layer and just break out of my iteration of the `layersDescriptor` when it hit's the created layer.

I'm not a fan of hacks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Aug 13, 2018 Aug 13, 2018

Copy link to clipboard

Copied

You probably have a background only document. Photoshop treats this kind of document special. In this case look at the targetCompositeChannels. We call it a simple document internally and as you have seen it reports NO layers. If you double click the "Background" text in the layers panel and give the layer a name you have now created a document with one layer. But that means no layers as you have one layer. So you need a document with more than one to get "layers" to have something besides NULL. Check out the PoorMans example and how it deals with this situation.

Recap:

Test with a "Background" only.

Test with a layer.

Test with a "Background and a layer.

Test with multiple layers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2018 Aug 16, 2018

Copy link to clipboard

Copied

Thanks for the reply Tom, just to confirm.

The PS document changes when there's only one layer in the scene? (I understand there's not a list / "Layers" of them, it's just a little bit backwards from a technical OOP standpoint to switch a vector / list out for a object when they both contain the same properties in the end)

None of the artists use background layers, and if one is found I remove it in the automation process, since the background layer contain different properties than a layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2018 Aug 16, 2018

Copy link to clipboard

Copied

Background layers are a terrible problem in using Actions to Scripts development.  Often the ExtendScript coder has no idea what kind of file the Action used to build it.  But Actions seem to work with or without the BGlayer.  We now know how to build the Actions without using the Layers panel but old ones are hit and miss.

For Plugins, we flatten then un-flatten the input before continuing.

RONC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2018 Aug 16, 2018

Copy link to clipboard

Copied

LATEST

Yeah I've learned how background layers contain completely different properties than a document layer, so we don't ever use them.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines