Copy link to clipboard
Copied
hi,everyone:
recently,I load photoshop cs4 sdk from adobe.com developer center,and Take simpleformat example as a reference, to complete read and write file formats supported by phoptoshop .now,I realized the file format to read and write ,but I found a problem:
In the Layers panel,It shows that the background layer not layer ,You can manually create a new layer, changed its name,but I would like to open the file automatically to become a layer and its same name as the original,
Who can help me ?
Copy link to clipboard
Copied
Are you trying to set the layer name after open or are you trying to bring in a layered document?
If you save a document with no background to SimpleFormat and then reopen the document SimpleFormat will create a layered document for you.
If you save a background document and do the same via SimpleFormat it will come in as a document with a background.
If you are trying to change the name after the open occurs I would suggest making an automation plug-in that listens for the SimpleFormat open of a document and then edits the layer names accordingly. You can look at the TextFormat + TextAuto example pair and see how they work together to open a text document and create a text layer. Not exactly what you are looking for but a similar approach.
Copy link to clipboard
Copied
thanks Tom.Thank you for giving me good suggestions.I've realized it as you approach.However, I do not want to implement it together with the lister and fileformat plugin.I would like to achieve independence in fileformat plugin.That is, when I open the picture with fileformat plugin, it is a layer but it is not the background layer .I found some fileformat plugins which reads the image,It directly shows a layer no longer is the default background layer.It only can be achieved in the fileformat plugin.I did some try fileformat example:
first:I created a thread,Purpose is to monitor the background layer appears, run it.
sencod:I get some suites,Part code:
Copy link to clipboard
Copied
first:I created a thread,Purpose is to monitor the background layer appears, run it.
sencod:I get some suites,Part code:
sSPBasic->AcquiresSuit(KPSActionControlSuite,KPSActonControlSuiteversion,(const **)&sSPsActionContorl);
last:PIActiondescriptor result=NULL;
sSPsActionContorl->play(&result,eventSet,description,PlugIndiaologSilent);
then I call the play function, use the event eventSet, change the background layer to layer, and then rename.
However, I can not always get sPSActionControl,It shows the wrong pointer,why?
mr Tom, can you give me better suggestions?Others give me a better solution?
Perhaps cs4 sdk the bug? It can not read the document, does it show directly a layer?
Copy link to clipboard
Copied
You cannot use the "play" routine in a *non* automation plug-in type. Although it may work in some cases it is not recommended. Check the result from the play call. You are probably getting an error.
Copy link to clipboard
Copied
Thanks Tom again ,In simpleformat plugin example,I can't get SPSACtionContorl, why? However, I can get the SPSActionReferrence, SPSActionDescriptor by SsSPBasic-> AcqireSuite ();
In the listener plugin example, I was able to get sPSActionControl bySsSPBasic-> AcqireSuite (),then,CallsSPsActionContorl->play(&result,eventSet,description,PlugIndiaologSilent); 1 Realized the background layer into a layer at the same time changed the layer name which i want to change.
So ,Why I can achieve in the listener example, can not be achieved in simpleformat example?
Copy link to clipboard
Copied
I probably did not express my question clearly, refer to the following picture:
pictrue 1 pictrue 2
In pictrue 1 ,"背景" means background, “图层”means layer ,They are all Chinese。
My question is,In simpelformat plugin example,After reading the image directly shows the layer, not the background layer?
That is, to directly show pictrue 2, not the picture 1?
I found some reading and writing plug-ins can achieve it, but I do not know how to achieve it in simpleformat plugin example。
Mr Tom Do you have a better suggestion? anyone have a better solution?
Copy link to clipboard
Copied
Reminder: the above is pictrue1, the following is pictrue2, sorry,System does not have to put a good picture.
Copy link to clipboard
Copied
So ,Why I can achieve in the listener example, can not be achieved in simpleformat example?
Photoshop is not designed to handle automation commands while inside a file format plug-in. Photoshop has many plug-in types. Listener is an automation plug-in. SimpleFormat is a file format plug-in. Although you can acquire the suite and use some of the functions in a fileformat plug-in the 'play' function is off limits in a file format plug-in and should not be used.
You should configure the Listener plug-in to listen for the opening of SimpleFormat files. The Listener plug-in should be modified to 'play' an event to itself to perform the changing of the background layer to a layer and changing the layer name.
Copy link to clipboard
Copied
thanks Tom agagin,I see what you mean,that is ,In the listener plugin example,If 1 listen to open a file,Then I can call "play", modify the background layer to a layer,Change the name of the layer,Is not it?
However, I found a plug-read format, it opens a file, it shows a layer directly, Without automation plugin.This is where my biggest confusion.
Thank you for your help many times, I keep in mind.I hope you will come to China and to Beijing.