What's new

How can I export a single layer [C++] plugin (lost all hope)

#1
I've built a Windows Phoshop CS6 / CSS C++ plugin; how it works is it exports each layer in the document (By name) with it's proper image format (png, jpg, etc), my issue is:



I have to turn off visibility on each other layer in order to export the one layer (I have to loop through all the layers and apply event hide / show) like this:

error = sPSActionControl->Play(&result, eventHide, desc2, plugInDialogSilent);
if (error) goto returnError;


error = sPSActionControl->Play(&result, eventShow, desc, plugInDialogSilent);
if (error) goto returnError;


What I would like to do is export the layer itself as an object /Element directly.


Do you know off the top of your head if I am able to pass in any predefined key or an event to 'sPSActionControl' that would allow me to export out a single layer (Without having to change any layer visibility)? Or preferably a function to pass in a layer ID and export that directly? ExportLayerByID(1, "myLayer.png"); This is how I get my layers ID (Pulled from my Photoshop listener):


PIUGetInfoByIndexIndex(layCounter, activeDocID, classLayer, classDocument, 0, &descLayer, NULL);


I would like to do something like this:


error = sPSActionList->PutData(desc, keyThatIDontKnowExists, TheLayerToExport);
Thanks for any help, this is killing me.
 
#2
Have you tried out the provided Adobe Photoshop script "Export Layers to Files" found under: /Applications/Adobe Photoshop CC 2015.5/Presets/Scripts on a Mac and similar location on a PC?

I may not understand you issue and maybe this available script does not do the exact job you want yet thought it actually exported all Layers out to Files. I could be wrong on this front yet thought it was worth mentioning.

John Wheeler
 
#3
Have you tried out the provided Adobe Photoshop script "Export Layers to Files" found under: /Applications/Adobe Photoshop CC 2015.5/Presets/Scripts on a Mac and similar location on a PC?

I may not understand you issue and maybe this available script does not do the exact job you want yet thought it actually exported all Layers out to Files. I could be wrong on this front yet thought it was worth mentioning.

John Wheeler
Hey John, thanks for your reply I did check the 'Export Layers to Files' before but unfortunately it just duplicates each of the layers recursively and exports each new document as a file. I already have a working system with what I have when I hide each layer, looking for a way to do it without having to use these stupid actions or dealing with flattening / overhead of the scripting logic they use.

Screenshot_56.png

Thanks again!
 
Last edited:

Top