Thursday, September 9, 2010

Backward Compatibility Variant Conversion (Mac OSX)

July 23, 2009 by brush  
Filed under Painter Brushes, Variant xml

Updated: March 6, 2010

The conversion scripts are now open source, and a link to an editable version has been included. Currently, they only appear to be compatible with version 2.3 of TextWrangler (download link to this version has been updated).

This is a demonstration of using custom AppleScripts in TextWrangler to enable backward version compatibility of Corel Painter brush variant xml files. Note that this only applies to version 7 and above, as previous versions were not in a cross-platform xml format.

Please note that whilst it is possible that these scripts may work in other versions of Mac OSX, they have only been tested in Leopard (10.5.7).

About xml Version Compatibility
The brush variant xml file contains all the brush control settings which make up the individual variant (Captured dab variants also require a separate jpg image file). Although the developers do their upmost to ensure forward version compatibility of our custom brush variants, additions and advances in the brush engine have necessitated additional lines and other changes in the xml which give rise to error messages when opened in a Painter version older than the one in which it was created.

The conversion scripts have been created to backward convert the xml so that the file becomes version native, whilst at the same time, giving details of instances where it is not possible to convert to a particular version (for example, the Dab Type: Artists’ Oils is only supported in Painter IX and above).

Who Could Benefit From These Scripts?
Any Mac Corel Painter user with a Painter version below Painter 11. In fact any Mac OSX user/educator wishing to share/distribute their own user created custom Painter brush variants with other users who may have older versions of the software; effectively distributing to a wider user base.

Note that these scripts are not intended to backward convert default Painter brush variant xml files (i.e. variants from the default Painter Brushes library. It is quite likely that you will encounter script incompatibility warnings if you attempt to do so.

Disclaimer
Although these scripts have been tested, it is important that before editing your brush variant xml files, you first ensure that you have a backup copy of the originals. Whilst every endeavor has been made to ensure that the converted xml documents will work correctly and without xml errors in the target Painter versions, this cannot be guaranteed.

Neither David Gell nor jitterbrush.com accept responsibility for any loss of data or performance issues relating to your computer as a result of downloading or using these scripts.

Terms of Use
The conversion scripts are now open source. You are free to edit and improve their performance/ features or functionality at your own risk.

1. Download and Install the TextWrangler Application

TextWrangler is a freeware text editor for Mac OSX, created by Bare Bones Software. Unfortunately, the scripts gave errors when used in the latest 3.1 version of Textwrangler, but a currently compatible 2.3 version can be downloaded from the following link atĀ Brothersoft.

After first installing to your applications folder, it may be necessary to first launch and then close the application in order that a TextWrangler > Scripts folder is installed at the following location;

Users[user name]/Library/Application Support/TextWrangler/Scripts/

2. Download and Install the Variant xml Convert AppleScripts

media_1248339918819.png
Variant_xml_Convert.zip (231 KB) in non-editableĀ Run Only format.Download Button image

After unzipping, place the Variant_xml_Convert folder and contents at the top level of the;

Users[user name]/Library/Application Support/TextWrangler/Scripts/ folder as shown in the above Finder screenshot.

The above scripts are recommended for normal use and are not editable. However, the following download version below contains identical scripts in fully editable format, for those familiar with AppleScript, who may wish to modify/ improve them;

CP_Variant_xml_editable.zip (634 KB) in script editable format.

3. Download the Sample Mystery Variants

The mystery_variants is a sample folder containing 6 custom variant xml files created in various Painter versions. I recommend that you test the conversion scripts on these files first, before working with variant xml files from actual custom brush libraries/categories, just to familiarize yourself with how the scripts work.

Download mystery_variants.zip (9 KB)Download Button image

_

_

4. Open the Mystery Variant xml files in the Finder

media_1248345673595.png

After unzipping the mystery_variants folder, double click the folder to reveal the folder contents in the Finder.

5. Open the Mystery Variant xml Files in TextWrangler

media_1248355276637.png

Click on any file name in the Finder window to highlight it, then choose Edit > Select All from the menu bar (Command + A).
Next, right click (Option + Click) in the Finder results window and choose Open With > TextWrangler from the contextual menu.

Note: for my convenience, I had already changed the file association for the xml files to open with TextWrangler as the default. If you have not done this, you should find TextWrangler listed near the bottom of the contextual menu. In this case, your document icons would also be different to those shown.

Under normal circumstances and depending on the version, a brush library or category would contain other files such as those with extensions jpg, nib and stk. Additionally, there may be c_ suffixed files (cached variant files which should not be included in a distributed library/category) and CategoryData.xml files, none of which are applicable for conversion. In this case, a Finder search using the following term should prevent unwanted files from appearing in the Finder results window;

xml NOT c_ NOT Category

6. Documents Open in TextWrangler

media_1248363476438.png

In the above screenshot, you can now see that the documents have opened in TextWrangler.

7. Accessing the Scripts and what they do

media_1248364087533.png

With TextWrangler the front application, clicking on the scripts icon in the menu bar will reveal the scripts menu. The item Variant xml Convert actually references the script folder of the same name which we previously installed. To the right of this, you will see that the folder contains fifteen scripts which have been designed to operate as follows;

Identify Painter xml Version
This script checks and identifies the native Painter xml version format of the currently open document. No changes are made to the current document.

00_Check Version Compatibility
In the conversion workflow this is either the first or second script to run (after identifying the Painter version). This script checks that the xml is version native, and provides information such as the oldest Painter version the document could be converted to. No changes are made to the current document.

01_Convert P11 to PX through to 10_Convert P8 to P7
The naming convention used for these scripts is shown in the following example;
01_Convert P11 to PX will convert a Painter 11 native xml document into a Painter X native xml document (the target version).

Running any of the above scripts first checks that the current document is version native, and informs if the xml version is incorrect for the script. It also searches for other compatibility issues which may give errors in the target Painter version. If the document passes these validation checks, conversion to the target version is automatic.

During conversion, the above scripts will also restore any missing dab-flags (such as SaveRestoreDamping), and replace any occurrence of Rotation Expression with Bearing. Note that Rotation expression is currently only compatible with the optional Wacom 6D Art Pen (Art Marker), and Painter versions IX and above. If you wish to leave Rotation expression intact, then you can use the 11_P11 to PX_Rotation through to 13_PX to PIX_Rotation scripts as an alternative.

11_P11 to PX_Rotation through to 13_PX to PIX_Rotation
These perform exactly the same as their counterparts, except that any occurrence of Rotation expression is left intact, for use with the Wacom 6D Art Pen (Art Marker).

New Hard Media Variants
The new Hard Media section was added in Painter 11. For the purpose of identification in the scripts, any variant with a min-x, min-y, max-x or max-y-squeeze value of less than 1.0 in the xml document, combined with a Dab type of either Circular or Captured will be defined as a New Hard Media variant, only compatible with Painter 11 and above.

When backward conversion is possible, any oil-profile associated with the new Hard Media variants in the xml document is replaced with “SoftRound”

SaveColors Flag
The SaveColors flag in the xml document (pen-control-flags=”SaveColors”>), occurs when the Save Current Colors box has been checked in the Save Variant dialog. Due to a bug in Painter, any custom variant created from a starting variant which has been assigned the Save Colors attribute, will also be assigned SaveColors, even if the respective box was unchecked in the Save Variant dialog at the time of saving.

Whilst SaveColors is not a bug when intentionally assigned, it can be obstructive to workflow, as selecting one of these variants at default settings will automatically change the Main and Additional colors in the Colors palette, to those saved with the variant. The conversion scripts do not remove the SaveColors flag but I just wanted you to be aware of it, and what it does.

8. Select a Document and Choose a Script

media_1248375070542.png

O.K. its time to test the scripts on the sample variant files. Don’t be afraid to experiment with trying any of the convert scripts on the documents. You cannot break anything, and as the scripts do not automatically save any changes, choosing Revert from the TextWrangler file menu will revert the document to the original as saved state.

In the above example, I have the Mystery 1.xml document selected in TextWrangler and have chosen the 00_Check Version Compatibility script from the TextWrangler scripts menu > Variant xml Convert section. As you can see, the resulting dialog tells me that that this is an Artists’ Oils dab type variant (dab-type=”DigitalOilTool”), which is only supported in Painter IX and above. This means that where applicable, the document could only be successfully converted as far back as Painter IX.

Happy converting!

  • Share/Bookmark

Related Posts

  1. Restoring Missing Painter Variant xml dab-flags (Mac OSX Leopard)
  2. xml File Association in 2 Clicks
  3. Pattern Rendering Variants Using the Plug-in Method
  4. Lifting the Dampers off SaveRestoreDamping

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

Spam Protection by WP-SpamFree

Optimized by SEO Ultimate