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
  • Add image resource to the ''.r'' file

    Hi,

    I'd like to embed small (16x16 pix) image resources (ex. png, jpeg) into the ''.r'' file. How can I do this?Add image resource to the ''.r'' file
    You can use the 'read' command. See ''Building and Managing Programs in MPW'' for a complete reference to Rez:

    http://developer.apple.com/tools/mpw-tools/books.html#Building
  • domain names
  • Mac- PS CS2 font issue (probably)...

    Hi all!-

    I just rearranged all of my fonts (using font agent pro) and now, any time I do ANYTHING, I get ''Could not complete your request because of a program error'' I've never had a problem with CS2- and I'm thinking it must be a font that is now turned off that it needs to access. Is there a list of fonts available that PS needs?

    I can manually turn those on- if I just knew hat they were.

    Or maybe it's something completely different.

    Any help is greatly appreciated!

    PSD CS File Format Documentation -...

    Hi,



    I'm trying to find the PSD file format documentation that details the byte order of PSD files for Photoshop CS1,2 and 3.



    I'm trying to write a PhP parser to modify Text Strings within Text Layers of a PSD file.

    This bit i can manage, I can find the layer, and find the text string i want to change, but changing it renders the PSD file unopenable, i assume because somewhere there is a block detailing the byte length of the Text String within the Text Layer??



    So i'm trying to figure out where this is in the layer, and if anything else needs changing when i change the Text String within the text layer.



    Is this actually possible as well, or am i wasting my time because it is compressed into the image data aswell?



    Any info would help.

    Thanks
    PSD CS File Format Documentation -...
    Hi Simon,



    If you're interested in a script that does what you're trying to do, then contact me by email and I'll provide you some further info.

    making photoshop6 work on tiger

    has any one got ps6 to work on tiger?
    making photoshop6 work on tiger
    %26gt;has any one got ps6 to work on tiger?



    Are you using the Photoshop SDK, a tool for programmers?





    Aandi Inston

    Storing generic byte stream to Registry

    I see that I can store integers, text strings, etc. to the Photoshop registry.

    I need to store a large (sometimes multi-MB) stream of data to the registry.

    Can this be done?



    I won't know the size of the data stream until after the filter is applied (the user interacts with a dialog box that will determine how much data is generated).



    Is there a registry command for storing large (variable-sized) sets of data?



    Thanks.



    Matt Rhodes

    Zaxwerks, Inc.
    Storing generic byte stream to Registry
    I would recommend writing a file and storing its location to the

    registry. If you take something designed to store a few KB of

    information and pump megabytes into it, performance isn't the only

    thing likely to suffer.



    Aandi Inston

    Developing brushes

    Hey, I'm new to the SDK and I'm wondering what is the best way to add additional brushes to Photoshop? Is there some skeleton code one can use that offers basic brush functionality? (resizing, opacity etc)

    I read somewhere that this was not possible but surely it can not be so...Developing brushes
    Hi, I'm brand new to the SDK so I can't answer your question, but I am looking for the same answer.
    The FAQ says:

    3.1.3 What can I not do with the Photoshop API?
    No non-modal plug-ins.
    No plug-in tools.
    No plug-in floating windows.
    No plug-in palettes.
    No plug-in brushes.
    No adding or changing menus.

    - ?! Which seems to make the SDK COMPLETELY USELESS to me. All I want to do was create a custom brush tip out of a full-color image instead of just grayscale so that it can take advantage of the brush settings like scatter, and angle jitter, and pressure sensitivity.

    I'll post if I find anything.Developing brushes
    Yes I agree, I think Photoshop is sub-par in this respect. I write a lot of tools for other art packages (3DS Max, Maya) and they have completely customisable UIs, so I can't see why Photoshop's SDK limits the creation of non-modal windows for your own tools.
  • help blackheads
  • lock file
  • Filter plugin kills interractive drag

    A customer just pointed out some unusual behavior in my windows filter

    plugin. After running the plugin, Photoshop is no longer able to do

    interractive dragging of pixel data.



    It's just the interactive drag that is broken. The operation completes

    normally, with the pixel data jumping into place after the mouse button is

    released. This affects floating selections, and moving of layer data with

    the move tool. Restarting Photoshop clears up the problem.



    Any ideas what I could be changing in Photoshop to make this happen?

    ReadPixelsFromLevel fails with error...

    I've got a problem with certain calls to ReadPixelsFromLevel failing with an error code 'MRAP'. This error is not declared anywhere in the SDK headers. Has anyone seen this before and knows what it means?



    The error only happens in one situation: the image must be in 16-bit mode (any color space), and I request a quite small image pyramid level (bounds in the order of 100x100 to 1000x1000 pixels). But although it's a small level, it's not the smallest available, so that is not the trigger either.
    ReadPixelsFromLevel fails with error...
    MRAP is PARM backwards - this is a byte swap issue.



    Re the actual error, I've found the channel op suite to function somewhat

    differently in 16 bit mode. Make sure the source rect does not extend

    outside the image rectangle.
    ReadPixelsFromLevel fails with error...
    AH! Well spotted. Thanks, Curvemeister.



    Going to hunt this little bugger down now.

    This is plain weird. ReadPixelsFromLevel on 16 bit images fails for all levels but level 0. I'm quite certain that PixelMemoryDesc is set correctly, and the bounds I ask for are coming directly from GetDataBounds() for the respective level.



    This all works wonderfully in 8bit and 32bit modes. Only 16bit seems to behave badly.



    Example:



    An image of 640x513 returns for level 1 bounds (0, 0, 320, 257).



    ReadPixelsFromLevel is called with these parameters for this case:

    PixelMemoryDesc=(rowBits=5120, colBits=16, depth=16, bitOffset=0)

    buffer of size 164480 bytes (640 bytes per row)

    bounds=(t=0,r=320,b=257,l=0)

    level=1



    And it returns PARM error. I don't get what I'm doing wrong here.

    I found the solution myself. The key is that the image pyramid can even change bit depth for lower levels. Turns out for my 16 bit images, only level 0 had a depth of 16 bit, all others only 8 bit.



    Note to self: always call GetDepth() even if you think you know what the depth should be.

    Photoshop Type Library Error

    Hi,



    Anyone can tell me the cause of this error ''Additional information: QueryInterface for interface PhotoshopTypeLibrary.IPhotoshopApplication failed.''.



    I'm using photoshop cs3 type library in VB.Net. Below is my codes



    Imports PhotoshopTypeLibrary



    Sub Main()

    Dim oPhoto As PhotoshopApplication

    Dim gControl As IActionControl

    Dim ophotoDoc As IAutoPSDoc



    oPhoto = New PhotoshopApplication

    gControl = oPhoto.MakeControlObject



    End Sub



    I'm using this code in CS2 but when I installed the CS3 the code is not working. Please help me to solve this error. Thanks in advance.



    Thanks



    Regards,

    Buddy

    Trying to figure out bug I can't...

    I've release a freeware plug-in but one person is seeing an error message in Photoshop CS2 (Windows XP, 3GB RAM) and therefore can't use the plugin.

    ''Could not complete the White Balance / Highlight Recovery v.1.0.2 command because of a program error.''

    http://www.pbase.com/image/101560453/large.jpg



    The user can run other 3rd party plugins. I have a CS2 / WinXP /512MB RAM machine and can't reproduce it.


    White balance plugin download page



    I tried making a version that would report the specific *gResult (int16 result) error code but it seems that the plugin doesn't even get that far.



    Any ideas would be appreciated!
    Trying to figure out bug I can't...
    Why don't you go one small step further than freeware: open source the code and then we can all take a look at the problem.



    If you need a public repository for it, you're welcome to join my plugins at https://www.telegraphics.com.au/fisheye (of course as open source you retain your copyright no matter where the code is served).
    Trying to figure out bug I can't...
    Hi Toby,



    Thanks for the reply and I appreciate you suggesting that I turn the plugin open source. I have been digesting the idea (and am still digesting it)... are there any commercial benefits for doing so? Would other people even be interested in taking that open source code? (Though such code might be useful for those wanting to create their first plug-in as the SDK examples aren't intended to have bells and whistles like a bigger preview you can drag around and zoom.) I've not figured out any commercial benefit.



    2- As far as my problem goes, it seems that changing my compiler settings (Visual c++) to something ''normal'' did the trick. I don't know which settings did the trick though.

    Figured it out: I enabled SSE2 instructions, which won't work on older processors.

    Post Ps CS Color Picker issues

    As of Photoshop CS (I believe) my windows filter plugin's color picker no
    longer works correctly.

    The picker comes up, and the dialog controls, including the buttons, radio
    buttons, and numeric fields function correctly. Clicks on the client area
    of the picker, including the square color area and vertical slider, just
    generate a beep.

    If I go back to earlier versions of Photoshop, the picker works fine - it's
    just for CS and later. Any thoughts or guesses are welcome.
  • transfer file
  • [MAC CS2] Save a document in jpeg format

    Hello,



    I'm new in the PhotoShop SDK !



    I would like to save an open document in JPEG format but I don't know how I can do !



    In this moment I use FrameSelect sample code to understand SDK.



    Could you help me ?



    Thanks
  • help blackheads
  • BrowseUrl on OSX?

    I'm writing a plugin that makes use of the BrowseUrl proc from the Suite PEA GetFileList suite. It works perfectly fine on Windows XP/Vista, but does nothing on OSX 10.4. I've ran the code through the debugger and the call doesn't return an error, so I'm at a loss. Does anyone have any experience with using this on OSX?



    Regards,

    Ervin