General idea is to capture adjustment layer settings and save them to JSON file for future preset etc. I was hoping to capture raw data ( getData(stringIDToTypeID('legacyContentData'))) and store it in JSON file base64 encoded.
I'm able to capture raw data but I'm not able to restore it to the adjustment layer using putData or something similar.
Capture raw data of adjustment layer:
... var doc = app.activeDocument; var layer = doc.activeLayer; ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt")); var desc = executeActionGet(ref).getList(stringIDToTypeID('adjustment')).getObjectValue(0); rawData = desc.getData(stringIDToTypeID('legacyContentData')); ...
Trying to restore raw data:
var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putEnumerated(cTID('AdjL'), cTID('Ordn'), cTID('Trgt')); desc.putReference(cTID('null'), ref); aldesc = new ActionDescriptor(); aldesc.putEnumerated(sTID("presetKind"), sTID("presetKindType"), sTID("presetKindCustom")); var list1 = new ActionList(); // Not sure what to do here ... aldesc.putList(cTID('Adjs'), list1); desc.putObject(cTID('T '), id, aldesc); executeAction(cTID('setd'), desc, mode);
Help would be appreciated.