Tuesday, December 6, 2011

Some progress on modeless dialogs...

Hi all,



The last couple of weeks I've been trying to get floating tool windows into photoshop. I'm trying a lot of things and came across this:



Load up the ''FrameSelect'' example project and change the DoUI() function to this:



//-------------------------------------------

SPErr DoUI ()

{

SPErr error = noErr;



//int item = kDNoUI; // Error value.



SaveParameters(); // Save our parameters, just in case.

if (sADMDialog != NULL)

{

sADMDialog-%26gt;Create

(

gPlugInRef,

''FrameSelection'',

kDialogID,

kADMTabbedFloatingDialogStyle,

DoUIInit,

NULL, /* No user data */

0//InOptions = 0

);

}



//if (item != kDOk_button)

// {

// error = 'STOP'; //'STOP' = kUserCancel;

// RestoreParameters();

// }



return error;



}

//-------------------------------------------



The sADMDialog-%26gt;Create functon replaces the sADMDialog-%26gt;Modal function that was there. This is all in the standard PS SDK, just had to go hunting through some header files. When yo run this code you sort of have a floating tabbed tool window. There are still some odd thing that happen but this might get some people on the right track.



G
  • help blackheads
  • ADM Tracker Suite and Short Cut Keys

    Hi all,



    Has anyone had any experience with the Trackers suite? Specificially if there is a way to turn off/deactivate short cut key commands getting to the main photoshop window. I have some text boxes in a dialog which works fine except that key presses are also registered by photoshop and trigger short cut commands when I type into the text boxes.



    I've just started looking through the doco but can't find anythng specific.



    TNKS!



    G

    Tools required for Win 64 build

    What tools are required to build a 64 bit Windows plugin?
  • migrating existing portal
  • SDK makes me to call the feature of...

    Dear sir,



    #I'm sorry for my poor English

    #and the lack of my knowledge about Photoshop SDK.



    I use Photoshop CS2 on WindowsXP.



    As you know, we can start Photoshop with cmd.exe like a following:



    C:\%26gt;C:\Program Files\Adobe\Adobe Photoshop CS2\Photoshop.exe



    First, I would like to know whether it is possible to

    apply one 'Filter' like a 'AddNoise' without starting Photoshop or not.

    For example:



    C:\%26gt;C:\Program Files\Adobe\Adobe Photoshop CS2\Photoshop.exe -from a.tif -to b.tif -filter addNoise



    (*)a.tif is source image, b.tif is destinate image.



    I beleive that it is NOT possible...



    Next, I would like to know whether Photoshop SDK dose make me to execute

    the feature of Photoshop from other application or not.

    Ohter application is my custom software programmed by C++.

    i.e. I would like to call the feature of Photoshop as library function

    without starting Photoshop.



    JavaScript Object makes me to execute the feature of Photoshop,

    but I need to start Photoshop.exe for this.



    I would be happy if someone tell me any informations about it.



    Again, I'm sorry for the lack of my knowledge about Photoshop SDK

    from the bottom of my heart.



    Best regards,



    --katsu
    SDK makes me to call the feature of...
    Katsu,



    Photoshop can be used this way using automation. The automation SDK is

    included on the Photoshop cs2 CD.
    SDK makes me to call the feature of...
    Photoshop will always need to run. It always does the work. So you

    might like to think of your question in a different way: can I have

    Photoshop do the work without seeing anything on screen? I don't have

    an answer for you.



    Aandi Inston

    Curvemeister,



    Thank you very much for your reply.

    I didn't know well the Photoshop's automation.

    So, your infomation is very helpful for me.

    Again, thank you very much.



    Aandi Inston,



    Yes, my question is:



    can I have Photoshop do the work without seeing anything on screen?



    Now, I download Photoshop's SDK and read the manual pdf of

    Photoshop API and Automation.

    Though I'm not sure, I guess that I can do so. :)



    Again, thank you very much for your kindness.



    Best regards,



    --katsu

    Aandi Inston,



    About my question,



    %26gt;can I have Photoshop do the work without seeing anything on screen?



    After I have read SDK documentations,

    I find that I can NOT do so...

    Instead of it, I guess that Photoshop can be hidden to task bar.



    Anyway, thank you very much for your infomation.



    --katsu

    Format plug-in: Setting file...

    Hello,



    I am currently writing a plug-in to import a proprietary image format into Photoshop. The people who will use this plug-in believe it would be useful to have some file information displayed in the File Info dialog.



    The problem I'm running into is finding the functions necessary to set these properties in the File Info dialog, as currently they are all entirely blank.



    As a simple example, if I wanted to have the Document Title, Author, Description and Keywords read ''Hello, world!'' after I've read in an image, what functions would my plug-in have to call to set each of these text fields?

    Is there a struct that my plug-in needs to modify, or a group of get/set functions to change these properties?



    Any information would be extremely helpful, as documentation on the subject is very difficult to find in the SDK.



    Thanks a lot!



    Jack
    Format plug-in: Setting file...
    You're in luck: this is what my DITABIS File Format plugin does. You can inspect the GPL code @ http://www.telegraphics.com.au/svn/ditabis/trunk/



    The important code:



    %26gt; pb-%26gt;propertyProcs-%26gt;setPropertyProc(kPhotoshopSignature,propCaption,0, 0,h);



    Contact me for more help if you need to.
    Format plug-in: Setting file...
    Thanks for your help, Toby.

    I've got an idea of how to configure the properties at this point. Simple properties work now, but I am still running into a bit of trouble setting complex options such as the Caption tag. I create a handle, populate it with the null-terminated string for the caption, and then I use setPropertyProc to link that handle to propCaption. The code would go something like this:



    %26gt;Handle h = sPSHandle-%26gt;New( captionLength );

    %26gt;if( h )

    %26gt;{

    %26gt; Boolean locked;

    %26gt; Ptr p;

    %26gt;

    %26gt; sPSHandle-%26gt;SetLock( h, true, %26amp;p, %26amp;locked );

    %26gt; // In here, use memcpy to copy a typical C string into p

    %26gt; sPSHandle-%26gt;SetLock( h, false, %26amp;p, %26amp;locked );

    %26gt;

    %26gt;sPSProperty-%26gt;setPropertyProc(kPhotoshopSignature,propCaption,0,0,h);

    %26gt;}



    Basically when I run my plugin and open a file, the Description field is still blank, as it was before I tried to populate the fields.



    Is there something wrong with my approach? Incidentally, I also encounter the same problem when I use the same property and handle suite methods that you do (FormatRecord-%26gt;PropertyProcs and FormatRecord-%26gt;HandleProcs instead of sPSProperty and sPSHandle respectively). From looking at other available code online, I'm assuming that there isn't a difference in behaviour. Please correct me if I'm wrong! :)

    Sorry, the formatting ate a lot of my newlines and made my code fairly unreadable. Here is that code section, again:



    %26gt; Handle h = sPSHandle-%26gt;New( captionLength );

    %26gt;

    %26gt; if( h )

    %26gt;

    %26gt; {

    %26gt;

    %26gt; Boolean locked;

    %26gt;

    %26gt; Ptr p;

    %26gt;

    %26gt;

    %26gt; sPSHandle-%26gt;SetLock( h, true, %26amp;p, %26amp;locked );

    %26gt;

    %26gt;

    %26gt; // In here, use memcpy to copy a typical C string into p

    %26gt;

    %26gt;

    %26gt; sPSHandle-%26gt;SetLock( h, false, %26amp;p, %26amp;locked );

    %26gt;

    %26gt;

    %26gt; sPSProperty-%26gt;setPropertyProc(kPhotoshopSignature,propCaption,0,0,h);

    %26gt;

    %26gt;}

    It's quite a while since I wrote that code, but you can see from the source code I linked that propCaption is not a string - it's IPTC formatted data. Look at this file to see how I construct it:



    http://www.telegraphics.com.au/svn/ditabis/trunk/metadata.c



    Some links from google...



    * http://www.controlledvocabulary.com/imagedatabases/iptc_naa.html

    * http://libiptcdata.sourceforge.net/docs/iptc-overview.html

    Thanks so much, Toby! Your code really helped me out, and now all the properties I need display properly.



    Cheers!

    Most welcome, Jack - glad I could help.

    Photoshop CS4 SDK and 64-bit Windows

    Will there be an SDK for 64-bit Windows or do we just use the CS3 SDK and compile plug-ins in x64 mode?



    Does CS4 support both 32-bit plug-ins and 64-bit plug-ins when the 64-bit version of Photoshop is installed?
    Photoshop CS4 SDK and 64-bit Windows
    That's a very good question, Tom.



    I'd be interested to know how I can make my plugins run on 64-bit CS4.



    http://telegraphics.com.au/sw/
    Photoshop CS4 SDK and 64-bit Windows
    Well, now that Photoshop CS4 has released, we have some answers. Yes, there is an SDK at http://www.adobe.com/devnet/photoshop/sdk/. Yes, both 32-bit and 64-bit environments are supported on Vista-64. This is done by installing 32-bit and 64-bit versions of Photoshop.



    Nicely done!

    From what I can see the plugin interface is virtually identical between 32 and 64 bits, the code just needs a rebuild in many cases. Of course, design changes may be in order if a particular plugin needs 64 bit capability to exceed boundaries.



    -Noel

    PSD per-layer metadata

    I would like to add custom metadata fields to layers and layer sets within PSDs and I can't see if this is even possible. XMP metadata seems to apply to the file level only, and I can't find anything in the CS3 SDK or scripting references related to what I'd like to do.



    Does anyone have any pointers?



    Thanks, Ian
    PSD per-layer metadata
    %26gt; Does anyone have any pointers?



    Patience...



    This functionality does not exist in CS3, but you could always co-opt an

    existing metadata field to map metadata to layers. This would require that the

    layer names be unique so that the information would persist, but it is possible.



    -X

    --

    for photoshop scripting solutions of all sorts

    contact: xbytor@gmail.com
    PSD per-layer metadata
    Thanks xbytor, that's certainly an approach to consider. One piece necessary for that to succeed for me would be that my plugin is notified when layers or layer sets are modified in certain ways, for example if a layer has metadata in the parallel data structure and the layer is copied, I need to copy the metadata in real-time too. I haven't investigated much, but it seems like the Listener example plugin is going to help me out here.
  • help blackheads
  •