Skip to main content
Inspiring
February 21, 2018
Question

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

  • February 21, 2018
  • 1 reply
  • 1983 views

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?

This topic has been closed for replies.

1 reply

Tom Ruark
Inspiring
February 26, 2018

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

i73Author
Inspiring
March 6, 2018

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.

Tom Ruark
Inspiring
March 6, 2018

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...