Create Custom Metadata Panels in CS5 with XML
May 19, 2010So you got all excited about metadata in CS5 and want to create your own namespace and properties and custom UI layout, etc. etc. Well, that’s very cool because you can do most of that very simply if you know your way around hacking a bit of XML.
Before we start, you should understand the benefits and downsides in creating your own schema. Benefits include
- optimization of UI into one panel for critical properties
- support for properties that are not available in the standard panels
- integration with other systems that use your custom properties
Downsides include:
- maintenance of namespaces and property versions over time
- distribution of panel if others need to view your custom properties
- possible learning curve frustration
Most folks want to create their own panel for 2 main reasons:
- optimize the editing and viewing of metadata
- add support for custom properties
The following provides an overview and description of the Generic panel SDK sample properties.xml file. It shows how the XML structure and definition is related to the UI and interaction that is shown in the File Info dialog.
Get the SDK
The first step is to download the latest XMP FileInfo SDK 5.1 libraries from XMP Developer Center. After unzipping the libraries you will find within the Tools folder another folder called Generic. We will be using the components of that folder to create custom panels
Copy the Generic Folder
Copy the Generic to:
MAC OS: /Library/Application/Support/Adobe/XMP/Custom File Info Panels/3.0/panels/
WINDOWS XP: C:\Program Files\Common Files\Adobe\XMP\Custom File Info Panels\3.0\panels\
WINDOWS VISTA: C:\Program Files (x86)\Common Files\Adobe\XMP\Custom File Info Panels\3.0\panels\
The above is the easiest place to add custom panels if you have admin privileges since it is the location for the existing set installed with CS5.
The user specific locations are:
MAC OS: /Users/<username>/Library/Application Support/Adobe/XMP/Custom File Info Panels/3.0/panels
WINDOWS XP: C:\Document and Settings\<username>\Application Data\Adobe\XMP\Custom File Info Panels\3.0\panels
WINDOWS 7/VISTA: C:\Users\<username>\AppData\Roaming\Adobe\XMP\Custom File Info Panels\3.0\panels
If you use the user specific locations you will need to add the above path to the Flash Global Security Settings Manager:
- Click on the Edit Locations… drop down and select Add Location…
- Paste in the path as above (replacing <username> with your specific data)
- Check to see location is added in the Manager
- Copy Generic folder to location
- Load up a CS5 app and check the File Info Dialog to see if it has been added (be sure to scroll the dialog and the drop menus to see if it might be hidden)
Since the Panels are Flex/Flash based and are being run locally, the panel path needs to be recognized by the Flash player as OK to run.
Modify the Properties.xml File
The Properties.xml file is located in the Generic folder and defines the namespaces, properties and basic UI of the panel. So get out your favorite text editor – I suggest TextWrangler for the Mac since it is free and highlights the text nicely making it easier to read. Do NOT use Word or other word processing editors unless you know that you are saving the file as pure text and not RTF or doc format. Now let’s look at the content of the file:
The area we want to mess with is within the <xmp_definitions> </xmp_definitions> tags, starting with:
<xmp_schema prefix=”custom” namespace=“http://my.custom.namespace/” label=“$$$/Custom/Schema/Label=Custom Properties” description=“$$$/Custom/Schema/Description=This example panel contains most of the options available for the ‘Generic Panel’.”>
<xmp_schema – defines the beginning of the schema definition
prefix= this defines a variable name for the namespace URL, like a short reference name to be used only within this panel
namespace= define that namespace that you want your properties to be defined within
label= defines the Title of the panel NOT the Tab name – that is defined in the manifest.xml file
$$$/Custom/Schema/Label= defines the localization property that is used to store the different language versions. If you go into the Generic/loc/ folder and open the “Generic_de_DE.dat” file in the text editor, you will see how the localization property is mapped to the German value. If you are not localizing the panel, you can remove this property and just define the value, for example: label=”My Custom Label”
description= defines the description for the panel that is shown when the user rolls over the Tab Name.
$$$/Custom/Schema/Description= as described above, this is used for localization purpose, you can choose to include or not depending on your internationalization needs.
Simple Properties
Simple properties like, text, data, numbers, true/false are defined in one line entries of the form:
<xmp_property name=”Text” category=”external” label=”Text Field:” type=”text”/>
If you noticed I removed the localization variables for simplicity.
<xmp_property – defines the element that will describe the property
name= defines the UI widget that will be used to display the property type. Includes the following simple types:
- Text – used for properties that can only hold a single value, like Country or City or Name
- TextML – used for properties that hold a single value but can be verbose, like description
- Boolean – used for check box like options, on or off, like male or female, or review status: yes/no
- Date – used for entering a single date, the calendar widget is the UI
- Integer – used for entering numbers, works with the ui:format variable to define the units, like cm, in
category= defines whether the field is displayed for editing (external) or read only (internal).
label= defines what label description is shown in the UI before the entry/display field
type= defines the type of value that can be stored in the property, works with the property_name variable:
- text = contains textual data
- boolean = if the checkbox is selected, the value of “True” will be set for the property
- date = the date will be stored in the property as yyyy-mm-dd
- integer = only the numeric value will be stored in the property, not the prefixes or suffixes
UI Control Properties
- ui:height= defines the height of the input field, can be absolute “=15” or relative “=10%”
- ui:width= defines the width of the input field, can be absolute “=15” or relative “=10%”
- ui:format=defines the prefix “re: {0}” or suffix “{0} cm” that is appended to the view of the value. The prefix or suffix content is NOT added to the value stored in the metadata
- ui:multiline= defined as “true” or “false”, works best when combined with an the appropriate property_name and type
The above UI variables can be included with any of the property definitions BUT may or may not work or make sense depending on the types of properties. Remember that in the Generic panel, each property is provided with a single horizontal space that it occupies. Customizations are restricted to the labels and entry field properties.
Simple Properties Choices
These definitions allow us to create drop down and multiple choice entries for the panel.
<xmp_property name=”ClosedChoice” category=”external” label=”Closed-Choice Input:” type=”closedchoice” element_type=”text”>
name = defines the UI widget that will be used to display the property type. Also includes the following simple types:
- ClosedChoice – defines the UI widget for a closed list of values that the user can chose from.
- OpenChoice – defines the UI widget for a list of values the user can chose from or they can write their own in
type = defines the type of property that will store the values, works together with the name property
- closedchoice – works with ClosedChoice to limit the selection of variables
- openchoice – works with OpenChoice to provide selection and option to provide custom entry
element_type = defines variable type that is stored in the property, similar to type for simple properties
Once the property and widget is defined, the choices for the drop need to be enumerated.
<xmp_choice raw_value=”” label=”(select color)”/>
xmp_choice – defines the elements that will provide the choices, each choice will have it’s own entry.
raw_value = defines the value that is stored in the property, in the above case it is set to null if the user has not selected anything. Here is where you define what value you want stored in the metadata.
label = defines what is shown in the UI, since this is the first xmp_choice definition it is the default view and provides instructions on selecting the values.
Arrays
Arrays are useful for defining properties that can contain multiple values, like keywords, or contributors.
<xmp_property name=”TextArray” category=”external” label=”Text Array Input:” type=”bag” element_type=”text”/>
type = defines the array type which can be:
- bag – meaning it is unstructured and a ‘bag’ of values
- seq – meaning it is sequential and their is value in the sequence of values
The default display separator for values is the “;” semicolon. However, if you enter values with a “,” comma it will be converter to a semicolon. There are ways to change this but are beyond the scope of this intro.
There are some localization definitions that I am not going into, maybe that will be another post if people are interested. I hope this is a good start on how to understand what the Generic panel is about and how to begin to use it to create custom schemas.
Posted in Adobe, CS5, FileInfo, metadata, Uncategorized, xmp | Tagged adobe, CS5, FileInfo, panels, UI, xml, xmp |
This is great. The first descriptive yet not too technical walk through I’ve found. Thank you!
by Brian May 19, 2010 at 2:32 pmGunar,
by Danny May 19, 2010 at 8:27 pmThis is very helpful! I appreciate instructions that actually…instruct. Hope to see you again soon.
Danny
Great walkthrough for how to get a basic panel running! This is where I started 3 months ago, and had I had this, I would have been much farther along now.
So here I am learning FlexBuilder 3 for a one-off FileInfo Panel. Spent most of the Trial software period figuring out that I need to install Ant, the Eclipse plugin, and a variety of other things. Finally, after forgetting most of what I did to make it suddenly possible to publish my custom panel, I am able to make something that works as I hoped (almost).
End of the trial software period, and I try to buy FlexBuilder, but alas it is no longer available. Since I’m trying to do this once, and don’t use Flex for anything anytime but this one task, I didn’t document everything I needed to make it work, and now can’t finish my job.
Now, armed with the trial of FlashBuilder 4, I can’t figure out where to get ANT, or how to start a new project with the settings for a FileInfo panel.
by Alex June 3, 2010 at 1:20 pmWhat am I missing, where do I get it, and how do I thank you properly for a great blog?
Wow, I admire your effort. I assume you have looked through the latest SDK? It has updated instructions and a new plugin for FlashBuilder4. Here is a quick snippet of the readme file:
The tools/ folder contains two Jar-files that contains Eclipse plug-ins for
Flex Builder 3 and FlashÆ Builderô 4:
* com.adobe.xmp.sdk.fileinfo_1.0.2
* com.adobe.xmp.sdk.fileinfo_fb4_1.1.0
Important: You must have the ANT plug-in installed in your Eclipse or
Flash Builder environment.
1) Place the Jar file in your eclipse/plugins/ folder or FlashBuilder plugins/ folder.
2) Start up Eclipse or Flash Builder
3) Go to File > New > Project …
4) Expand XMP and choose Custom Panel
5) Complete the Wizard steps to create a new Project.
6) Edit the build/build.properties file to update the location of the
FileInfo SDK to reflect your installation, if needed.
7) Update the project’s MXML file so the defaults.css stylesheet points to
your installation of the FileInfo SDK, if needed.
I hope that helps somewhat.
by Gunar June 4, 2010 at 9:00 amHi Gunar,
Great Instructions. I been searching for ages trying to find an easy to follow guide to acheive this. I had one question though. I had previously created a file info panel for CS3, but i’m now worried that any new panel wont be able to read the old data? Is there anyway to make sure the old fields are mapped correctly to the new fields?
Thanks in advance, Jason.
by Jason Freestone June 20, 2010 at 10:42 pmThe new panels will read the metadata in your CS3 panel as long as the same namespaces and properties are defined. The easiest way to test is to create a sample file in CS3 that has all the values assigned to the properties in your panel and then open it up in CS4/CS5 and take a look. Another way would be to export the XMP from a file created in CS3 and one in CS4/CS5 and compare them with a text based versioning tool. You could also create templates in CS3 and apply them in CS4/CS5 to see if that works as well.
by Gunar June 21, 2010 at 7:10 amThanks for the Generic panel info…it works well..I’ve even filled it with fields for my purposes…just one question…
Can I rename the File info tab name “Generic Panel” to my own custom name somewhere in the xml files ..or is this in the swf file?
If I could do this, my immediate problems are solved!
by John July 21, 2010 at 8:56 pmThe name of the panel tab is defined in another file called “manifest.xml”. That was done for performance reasons – each panel file doesn’t have to be loaded to get the panel name.
by Gunar July 22, 2010 at 8:20 amHello Gunar,
I wrote several xmp panels to capture custom metadata so that it can be injested into our DAM workflow. I am now struggling with porting over the old panels into CS4/5 and I can’t seem to get it to work.
I was able to get the panels to appear but not the previous data.
Any suggestions?
Thanks in advance,
by Morgan Chong July 22, 2010 at 9:44 amMorgan
Morgan – the biggest challenge I have seen is getting the data types right to display and retain edits. For that you will need to refer to the XMP specifications – look up the specific property name and make sure the data type is defined properly in your panel.
by Gunar July 23, 2010 at 8:01 amI had that exact problem bringing in a field into a DAM application.
The problem ended up being the data type. the XMP panel field was type = “date” where in the DAM app it was expecting a “text” field. When I changed the DAM app custom field to “date” it injested the data just fine.
by John July 28, 2010 at 5:19 pmHi Gunar,
I have a simple formatting question for panels in CS4. I’m new to editing xmp panels and was wondering what type of code i need to write in order to get two separate input fields to appear on one line beside each other in the pannel. Im trying to get them to look like the “state/province” and “country/territory in the Orgins panel in photoshop.
Thanks for your help
by Joel McCurdy July 23, 2010 at 12:06 pmCan’t be done with the generic panels. Each property gets it’s own line. The only way to achieve what you want is to create a Flex based panel.
by Gunar July 25, 2010 at 2:19 amHi Gunar,
One other quick question. I have customized multiple generic panels but only one will show up when I open an image and retrieve file info in Photoshop. Is there something I need to change in the manifest in order for all the panel I have edited to show?
Thanks for all your help.
Joel
by Joel McCurdy July 26, 2010 at 10:59 amHmm. Try modifying the manifest.xml file to make sure they are unique for each panel – if they are the same it might only be picking up one panel.
by Gunar July 27, 2010 at 9:53 pmHi, I’ve sucessfully created a custom panel based on generic and it works great from file info.
However, when putting the xml properties file in the “custom” folder for Bridge, it shows up in the Metadata pane, but is blank (no name no fields) it is checked on in the metadata preferences in Bridge.
What could cause this considering it works great from File Info?
by John July 27, 2010 at 9:55 amI’ve found the issue: but I don’t understand it.
When I remove the zstrings it won’t show up in bridge meta panel…but does in File info.
Do I need these zstring lines when using the generic panel? I thought they could just be removed entirely.
These are the lines in question:
and
by John July 27, 2010 at 11:53 amInteresting, perhaps this is a bug in Bridge? You don’t need the zStrings for the generic panel in File Info but I was unaware that it caused issues in Bridge. Sounds like you found a work around by reintroducing the zStrings.
by Gunar July 27, 2010 at 9:55 pmIt is strange indeed.
One would expect if file info works, the Bridge panel would pick it up the same.
I did notice something though…
In the “Custom” Folder for Bridge, there is a “loc” folder. When you bring in the generic panel to the Panels folder, it automatically creates a localization us eng dat file in the “Custom” “loc” folder. (even before adding the .xml file to “Custom”)
Maybe this is just for a default of English or something, but it makes me think any xml properties file in the custom folder needs localization.
All this aside, leaving in the zstrings allows things to work perfectly.
by John July 28, 2010 at 8:55 amHi there,
I have build a new XMP panel using Flex. It works, together with the custom XML file it also shows the panel data inside Bridge metadata panel. The panels I build are based on old (CS3) panel information.
For some reason that I do not understand all popups do show the information that was attached using Bridge CS3, but the text fields do not. I have been looking at my namespace and field names but I can’t find the bug.
There must be something wrong but what? Is there anyone out there that is willing to look at my custom panel and help me out?
If so I can send you the Flex project and all files by email.
Kind Regards,
by Pieter September 24, 2010 at 12:35 amPieter
Hi Gunner,
I dont know if your still checking this but any help would be appreciated. I am having trouble getting my CS4 custom XMP panels to accept metadata from drop down menus applied in CS3.
To clarify, if an artist’s name was selected from a drop down menu in CS3, that same file will not display the entered value when opened with CS4 even though the panels and theirs fields/values are the same.
Thanks!
-Joel
by Joel McCurdy November 18, 2010 at 11:13 am