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

Is there a way to check if a layer (ReadLayerDesc) is selected or not?

Engaged ,
Feb 21, 2018 Feb 21, 2018

Copy link to clipboard

Copied

I'm writing a filter plugin and I need a to return all the layers that are selected in a document. I am creating a pointer to a list of layers with 'gFilterRecord->documentInfo->layersDescriptor'  I was hoping there would be a descriptor to check if it's selected similar to: 'layersDescriptor->isVisible'

I can't seem to find anywhere other than a 'ReadChannelDesc' that contains a 'Selection' property. Can I add this or in some way return if it's selected in the layers tab?

TOPICS
SDK

Views

1.7K

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
Adobe Employee ,
Feb 26, 2018 Feb 26, 2018

Copy link to clipboard

Copied

I would look at the UI code for AutomationFilter on windows. It selects the active layer I believe.

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 ,
Mar 05, 2018 Mar 05, 2018

Copy link to clipboard

Copied

Thanks Tom, I'm wondering if there is a property I can check (iterate through each layer and check to see if it has a selection key) , you are correct that I can return the `Selected layer` and I do it like: `error = sPSActionDescriptor->GetInteger(result, keyItemIndex, &layerIndex);`

But I need to check to see if more than one layer is Selected.

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
Adobe Employee ,
Mar 06, 2018 Mar 06, 2018

Copy link to clipboard

Copied

Is this what you are looking for? Getting selected layers by script (object refs, not indices!)

Your filter will not run if multiple layers are selected...

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 ,
Mar 06, 2018 Mar 06, 2018

Copy link to clipboard

Copied

I still can't seem to get this to work:

Auto_Desc result(false);

Auto_Ref reference;

DescriptorTypeID typeID;

AFERROR(sPSActionReference->PutEnumerated(reference.get(), classDocument, typeOrdinal, enumTarget));

AFERROR(sPSActionControl->Get(&result, reference.get()));

sPSActionControl->StringIDToTypeID(ktargetLayers, &typeID);

PIActionList PIList;

sPSActionDescriptor->GetList(result.get(), typeID, &PIList);

uint32 listSize = 0;

sPSActionList->GetCount(PIList, &listSize);

When you say I can't get my Filter plugin to run do you mean I can't run it directly?

Because I am currently running a filter that will return the data I need though I was planning on passing a list of selected layers from the Hidden plugin to the filter and preform what I need to on the layers specified in the filter plugin.

Thanks for your reply.

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 ,
Mar 13, 2018 Mar 13, 2018

Copy link to clipboard

Copied

I've still been unable to get the selected layers, do you know if I am doing it wrong Tom?

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
Adobe Employee ,
Mar 14, 2018 Mar 14, 2018

Copy link to clipboard

Copied

All that looks correct. You are getting an error or listSize is remaining a 0?

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

Yes It's remaining at 0; It seems that the GetList() is tossing an error:

XoOUZTh.png

`errMissingParameter` But I have no idea what param it could be missing...

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

sPSActionReference->PutProperty(reference.get(), classProperty, keyLayerID);

sPSActionReference->PutEnumerated(reference.get(), classLayer, typeOrdinal, enumTarget);

sPSActionControl->Get(&result, reference.get());

I spent some time on it, I still can't access a list, the only thing I've accomplished is returning one selected layer with the above code, I'm not able to return a list...

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 ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

LATEST

Even getting this error with "targetLayers" and all the docs say that's when I have to use...

DescriptorTypeID typeID;

error = sPSActionControl->StringIDToTypeID("targetLayers", &typeID);

error = sPSActionDescriptor->GetList(result.get(), typeID, &PIList);

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