Copy link to clipboard
Copied
Hi
I am looking at retrieving all layers and groups and can see access is possible through layerSets and artLayers.
Lets say my document layers look like this:
Group
Layer
Layer
Group
Group
Layer
layerSets will give me: Group, Group, Group and artLayers give me: Layer, Layer, Layer.
This is exactly my issue, as I retrive groups and layer seperately I can keep them in order. Is it possible to some how retain the original order? Or get an object with both artLayers and layerSets in? Or are they exclusive to one another?
Copy link to clipboard
Copied
Layers sets in PS are represented as lets say dummy layers that mars set start and and set end and feal layers
for example:
layer1 (real layer)
layer2 (set start )
layer3 also real
layer4 start
layer5 real
layer6 end
layer7 end
To decide what "layer represens"t we use something like (we traverse all layers using index):
SPErr AMAutoPlugin::GetLayerSetInfo(int index, int * result)
{
SPErr error = kSPNoError;
char layertype[1024]="";
char cdata1[1024]="";
char cdata2[1024]="";
DescriptorTypeID runtimeKeyID;
uint32 data1;
uint32 data2;
error = sPSActionControl->StringIDToTypeID("layerSection", &runtimeKeyID);
if (error) goto returnError;
error = PIUGetInfoByIndex(index, classLayer,runtimeKeyID, &data1, &data2);
if (error) goto returnError;
error = sPSActionControl->TypeIDToStringID(data1,cdata1,255);
if (error) goto returnError;
error = sPSActionControl->TypeIDToStringID(data2,cdata2,255);
if (error) goto returnError;
if (strcmp(cdata1, "layerSectionStart")==0)*result=2;
else if (strcmp(cdata1, "layerSectionEnd")==0)*result=1;
else if (strcmp(cdata1, "layerSectionContent")==0)*result=0;
else *result =-1;
returnError:
return error;
}
You can now build hierarchy.
regards,
Momir
Copy link to clipboard
Copied
Thanks for the response Momir! However, I don't entirely see how to apply this in my app (working with the iOS connection SDK).
For example, what is SPErr? And the use of AMAutoPlugin? Also, why are you returning an error? What information is it giving you?
Copy link to clipboard
Copied
Sorry i did not pay attention to tags.
This is C++ automation.
Again sorry
Regards,
Momir