Having trouble with PresetsManager.jsx

Discussion of the xtools Toolkit

Moderators:xbytor, DavideBarranca, Paul MR

Post Reply
Mike Hale
Having trouble with PresetsManager.jsx

Post by Mike Hale » Fri Jul 15, 2011 9:23 pm

Hi X,

The code below throws a general error on the executeAction line of the code in the saveAllPresets function. I may be doing something wrong but thought I would let you know.
Code: Select all//@show include
//@includepath "/c/Program Files/Adobe/xtools;/Developer/xtools"
//@include "xlib/stdlib.js"
//@include "xlib/PresetsManager.jsx"

var f = new File('~/desktop/sample.pat');
var mgr = new PresetsManager();

// I get an error with this line
mgr.saveAllPresets(PresetType.PATTERNS, f);


PS I did a CSV update so I should be current.

Mike Hale

Having trouble with PresetsManager.jsx

Post by Mike Hale » Sat Jul 16, 2011 6:24 am

I think the problem is saveAllPresets when called with patterns uses 'PttR' when it needs to be 'Ptrn'. Same with resetPreset. I think that patterns need to be like brushes where id and classID match, that isCode: Select allPresetType.PATTERNS       = new PresetType("Patterns", 'PttR', 'Ptrn');should beCode: Select allPresetType.PATTERNS       = new PresetType("Patterns", 'Ptrn', 'Ptrn');

xbytor

Having trouble with PresetsManager.jsx

Post by xbytor » Sat Jul 16, 2011 8:37 pm

I think the problem is more likely that I'm using the id instead of the classID. Line 202 should be

Code: Select all  ref.putProperty(cTID('Prpr'), presetType.classID);

It's still may be failing, but now for a completely different reason. sourceforge.net is having cvs problems so it may be a bit before I can get this sorted out and checked in.

Mike Hale

Having trouble with PresetsManager.jsx

Post by Mike Hale » Sat Jul 16, 2011 10:24 pm

xbytor wrote:I think the problem is more likely that I'm using the id instead of the classID. I tried that before I suggested the change to PresetType.PATTERNS. Although changing the function from using id to classID does fix patterns it breaks gradients and maybe others.

xbytor

Having trouble with PresetsManager.jsx

Post by xbytor » Sun Jul 17, 2011 5:40 pm

Although changing the function from using id to classID does fix patterns it breaks gradients and maybe others.

OK. I'll check on this when I have more free time.

Post Reply