Page 1 of 1

Having trouble with PresetsManager.jsx

Posted: Fri Jul 15, 2011 9:23 pm
by Mike Hale
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.

Having trouble with PresetsManager.jsx

Posted: Sat Jul 16, 2011 6:24 am
by Mike Hale
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');

Having trouble with PresetsManager.jsx

Posted: Sat Jul 16, 2011 8:37 pm
by xbytor
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.

Having trouble with PresetsManager.jsx

Posted: Sat Jul 16, 2011 10:24 pm
by Mike Hale
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.

Having trouble with PresetsManager.jsx

Posted: Sun Jul 17, 2011 5:40 pm
by xbytor
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.