What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

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


i73

Member
Messages
6
Likes
0
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.
 

thebestcpu

Guru
Messages
2,994
Likes
2,760
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
 

i73

Member
Messages
6
Likes
0
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:

i73

Member
Messages
6
Likes
0
Thanks, yeah I already have a question up on every fourm I could find about this :p,
Take care.
 

Top