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?
Copy link to clipboard
Copied
I would look at the UI code for AutomationFilter on windows. It selects the active layer I believe.
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.
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...
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.
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?
Copy link to clipboard
Copied
All that looks correct. You are getting an error or listSize is remaining a 0?
Copy link to clipboard
Copied
Yes It's remaining at 0; It seems that the GetList() is tossing an error:
`errMissingParameter` But I have no idea what param it could be missing...
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...
Copy link to clipboard
Copied
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);