• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Multiple plugins for the same file type

New Here ,
Apr 21, 2006 Apr 21, 2006

Copy link to clipboard

Copied

I'm making a format plug-in that operates on DirectX DDS files. Photoshop already had a plug-in to open them, but I want mine to take priority (without deleting the original plug-in).
According to the documentation in the SDK in a situation like this Photoshop is supposed to call my plug-in with formatSelectorFilterFile and then does something afterward to determine priority. This never actually happens. In my .r resource file I have the following lines:

FmtFileType { '8B1F ', '8BIM' },
//ReadTypes { { '8B1F', ' ' } },
FilteredTypes { { '8B1F', ' ' } },
ReadExtensions { { 'DDS ' } },
WriteExtensions { { 'DDS ' } },
FilteredExtensions { { 'DDS ' } },

Is there more I have to do to let photoshop know that my plug-in is associated with reading and writing DDS files? I haven't found anything in the documentation that is helpful. Thanks!
TOPICS
SDK

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
New Here ,
May 31, 2006 May 31, 2006

Copy link to clipboard

Copied

I believe (according to the docs) Photoshop tries every format plug-in until it finds one that will read/write the format in question. I think you will need to get PS to find your plug-in before the other one. I don't have the documentation here, but I believe it searches the plug-in names in alphabetical order.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Jun 02, 2006 Jun 02, 2006

Copy link to clipboard

Copied

The priority PiPL property controls that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 13, 2009 Nov 13, 2009

Copy link to clipboard

Copied

This is an old discussion, however I guess the original question was not answered, so I'm brining it up again. PS format plugins documentation explicitly mentions formatSelectorFilterFile as the first selector that the plugin receives in case of multiple plugins that support a given file extentsion. The plugin uses it as a chance to, say, examine the file's header and determine whether it can actually handle the specified file, which is a common case when multiple file formats use the same file extension.

The problem: in our expereince a format plugin is never invoked with formatSelectorFilterFile and the calling sequence always starts with formatSelectorReadPrepare followed by formatSelectorReadStart etc. Assuming there are two distinct types of valid files that are handled by two separate plugins (or a Photoshop build-in type and a custom plugin) lack of formatSelectorFilterFile selector means a plugin never has a chance to say "this is not my file, let the other plugin handle it", because returning formatCannotRead value at any other selector just causes the whole read process to fail and the other plugin is never invoked. The priority PiPL property indeed determines the order in which the plugins are invoked, however it obviosuly cannot solve the problem for both plugins, since its symmetric.

Is there anything we are missing or the format plugin documentation is completely out of date (as usually it refers to PS version 5...)? If its the later, I wonder what the correct way to address this problem is...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Nov 16, 2009 Nov 16, 2009

Copy link to clipboard

Copied

Yes, you're missing the PiPL properties that say to filter the file type.

The logic really hasn't changed in a long time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 16, 2009 Nov 16, 2009

Copy link to clipboard

Copied

Awesome!

Our problem was that we experimented wth the sample plugin that has the following line in its PIPL:

FilteredTypes { { '8B1F', '    ' } },

which has nothing to do with the .sme files it open, therefore having two sample plugins (with different PIPL/names) still doesn't trigger the selector when opening an sme file.

Thanks a lot, Chris - you've just saved us a lot of work and made our life much easier!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 11, 2010 May 11, 2010

Copy link to clipboard

Copied

I'm sorry, I'm having the same problem and I'm just not seeing the solution here.

1. How do you set "PiPL properties that say to filter the file type."?

2. How do you set the priority to of my plugin to be higher than the default plugin?

I mean, I get that there's something that causes photoshop to choose the default over mine. That makes sense, and it's clear both in documentation and what's happening. What I'm not seeing is how to tell photoshop to stfu and at least attempt to call my filter.

here's what I have:

                FmtFileType { 'TGA ', '8BIM' },
                //ReadTypes { { '8B1F', '    ' } },
                FilteredTypes { { '8B1F', '    ' } },
                ReadExtensions { { 'TGA ' } },
                WriteExtensions { { 'TGA ' } },
                FilteredExtensions { { 'TGA ' } },

Here's what's happening: It's not calling my plugin in the open file dialog.

Here's what I want to have happen: Call my plugin to see if it can open the file, or if another plugin needs to handle this file.

How do I make that happen?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 12, 2010 May 12, 2010

Copy link to clipboard

Copied

1) Change the PiPL properties for your plugin

2) See (1)

You say that you can always read TGA, so the filter call never gets made.

And did you change the priority on your plugin?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2010 May 13, 2010

Copy link to clipboard

Copied

What do you mean by:

"You say that you can always read TGA, so the filter call never gets made.

And did you change the priority on your plugin?"

Are you telling me that's what I'm doing wrong?

or are you asking if I'm always reading the TGA so the filter call never gets made?

Photoshop's TGA format reader is getting called, and thus (since it's a TGA format compliant file)

Photoshop's reader is reading it in, and my plugin is never getting called. It works if I go through the 'Open As' dialog,

but well I'm lazy and I expect my artists to be lazy so they shouldn't have to use 'Open As' Every time.

Yes, I changed the Priority on the plugin. Though your 'documentation' is somewhat ambiguous:

"int16

PIPriorityProperty 0x70727479L ('prty')

Plug-in load order. Also used to control the order in which items with the same name show up in menus. Lower numbers (including negative ones) load first. If NULL, the default is zero."

and:

"If more than one format module can read the file, Photoshop uses the following priority scheme to determine which plug-in module to use:

  1. The module with the first PICategoryProperty string (sorted alphabetically) is used. Modules with no PICategoryProperty will default to their PINameProperty for this comparison.
  2. If two or more modules have matching category names, the module with the highest PIPriorityProperty value is used.
  3. If two or more modules have matching category and priority, the module that is selected is undefined."

I'm guessing I should go for a higher number if I want it called first.

Also worth noting, your the PDF says PIPriorityProperty is an int16. The SDK says int32.

So... what I'm trying to say is, any ideas as to what I'm doing/not doing in my code to get my plugin in front of the other.

I'm hoping for more description than 'rtfm' or 'change stuff and if that doesn't work do it again'.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 13, 2010 May 13, 2010

Copy link to clipboard

Copied

Um, try reading the documentation again.

And comment out the ReadExtensions line.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 14, 2010 May 14, 2010

Copy link to clipboard

Copied

Solution: (reads TGA's and BCT files (proprietary file type), writes TGA's)

        Priority { 1000 },

        WriteExtensions { { 'TGA ' } },

        FilteredExtensions { { 'TGA ', 'BCT ' } },

Alright, I'm posting this because well, I had this question and I

                    believe others had this question.

And "Um,  try reading the documentation again."

                    wasn't a very good answer.

Here's what the manual says about filter priority:

"If more than one format module can read the file,

     Photoshop uses the following priority scheme

     to determine which plug-in module to use:

     1. The module with the first PICategoryProperty string (sorted alphabetically)

          is used. Modules with no PICategoryProperty will default to their

          PINameProperty for this comparison.

     2. If two or more modules have matching category names,

          the module with the highest PIPriorityProperty value is used.

     3. If two or more modules have matching category and priority,

          the module that is selected is undefined."

So... truth of the matter is, I never set the Category. The Parameter

     (and I use that term loosely) is 'Category'. I tried setting it to "AAA"

     to get into a category alphabetically in front of whatever the Photoshop

     Targa default plugin category is. So we ignore this, it's dead to us.

     Same thing with the name.

Priority { 1000 }, <- Sets the priority to be higher than photoshop's default.

Now that we've got our priority set up, we need to tell photoshop what

     type of resource this plugin is.

WriteExtensions { { 'TGA ' } }, <- Tells the photoshop that this plugin writes

                                                  TGA files.

FilteredExtensions { { 'TGA ', 'BCT ' } }, <- Tells photoshop that this plugin

                                                                 can filter TGA and BCT files.

By telling photoshop to filter these files, it invokes the plugin whenever

     photoshop attempts to read a file with one of these extensions.

There you have it, 3 lines that tell photoshop to put this plugin in front of the

     defaults, open TGA's and BCT files, and write TGA's.

Here's what I didn't need:

FmtFileType { 'TGA ', '8BIM' },      <- I'm a windows programmer

                                                       so it's not needed

//ReadTypes { { '8B1F', '    ' } },  <- no need for useless

                                                       comments in my code, thx

FilteredTypes { { '8B1F', '    ' } },<- I believe this was redundant

                                                       with the FilteredExtensions line

ReadExtensions { { 'TGA ' } },       <- This line caused my plugin to

                                                       attempt to load ALL TGA's

                                                       Regardless of whether the

                                                       filter returned fmtCannotRead

On a final note, because a coworker is concerned that Cox might not

know what RTFM stands for, which would be why he keeps saying it

without actually saying it, RTFM == Read the F###ing Manual.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
May 14, 2010 May 14, 2010

Copy link to clipboard

Copied

LATEST

No, I didn't want you to Read The Full Manual.

I only wanted you to read the part you quoted, which happened to explain a couple of your mistakes.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines