xtools 1.5 Beta 1

Discussion of the xtools Toolkit

Moderators: Tom, Kukurykus

xbytor

xtools 1.5 Beta 1

Post by xbytor »

The first beta for the next release is available over on SourceForge. The entire zip file is over 2 meg which makes it a bit impractical to host here. I may, in the future, post individual scripts here, but the most current versions of everything will always be in the sourceforge cvs tree.

You can find the entire package here.

And the CVS tree is here.

Report bugs and make comments either here or there.

Many thanks to Mike Hale for help with the docs and to the many of you out there who have provided code and help over the past couple of years.

Enjoy.
-X
Mike Hale

xtools 1.5 Beta 1

Post by Mike Hale »

Hi X,

Is there a way to use stdlib.hideAllLayers with layersets where it only hides the layers?

I may be using it wrong, but after using this to hide all the layers later when I turn on a layer in a layerset it's still hidden because the layerset is off.

Mike
xbytor

xtools 1.5 Beta 1

Post by xbytor »

You're not using it incorrectly. However, if you want a layer to be visible, you need all of it's parent layersets to be visible.

If I had a script that needed to process layers one at a time and each layer is the only visible layer when it is processed, I would do something like this:

Code: Select allvar layers = Stdlib.getLayersList(doc, false, false);  // get all layers (no layer sets)
var visLayers = Stdlib.getByProperty(doc, "visible", true, true);  // for later restoration.

Stdlib.hideAllLayers(doc);

for (var i = 0; i < layers.length; i++) {
    var layer = layers;
    layer.visible = true;

    // make parents visible
    var p = layer.parent;
    while (p.typename == "LayerSet") {
       p.visible = true;
       p = p.parent;
    }

    // process layer here


    Stdlib.hideAllLayers(doc); // hide layer and it's layer sets
}

// reset visibility state for layers
for (var i = 0; i < visLayers.length; i++) {
   layers.visible = true;
}



-X
Mike Hale

xtools 1.5 Beta 1

Post by Mike Hale »

Hi X,

I started a project to build a database of keys for the different layer types and have been using getterdemo to find the keys.

The output for some types of adjustment layers gets truncated. I think what is happening is when it finds the key 'legacyContentData'(1345). The output ends with the line

<DescValueType.RAWTYPE key="1345" id="1345" sym="1345" data="

I have never seen DescValueType.RAWTYPE but assume that the output is truncated when it tries to display the binary data?

If that is the case, do you know of a way to either escape or suppress the data so the rest of the descriptor is displayed?

Mike
xbytor

xtools 1.5 Beta 1

Post by xbytor »

I fixed the handling or RAW data properties. The binary data gets encoded as a hexadecimal string while it's XML data.

This part is a problem, however:
Code: Select all<DescValueType.RAWTYPE key="1345" id="1345" sym="1345">

The 'sym' value should be a text string, but xtools doesn't know about the mapping. This means that when it tries to construct a descriptor based on this information, it may wind up with the wrong id.

The way to deal with this is to add a line like this in your code:

Code: Select allPSString._add("legacyContentData");

or maybe just

Code: Select allsTID("legacyContentData");

If all you have are numbers for sTID keys, you will eventually run into problems since there is nothing guaranteeing that 'legacyContentData' will map to '1345' from one run to another.

I update sourceforge with the new version of atn2xml.jsx (along with another batch of mods).

Let me know how this works out.

-X
Mike Hale

xtools 1.5 Beta 1

Post by Mike Hale »

Thanks for taking the time to deal with this. I supect that the rest of the descriptor will not have anything new but it will be nice to double check.

And incase I'm missing something, is there a way to get all the updates at sourceforge in one go?

Mike
xbytor

xtools 1.5 Beta 1

Post by xbytor »

There are docs on sourceforge but basically what you have to do is install CVS on your machine and point cvs (either on the command line or via the CVSROOT environment variable) at the ps-script repository.

You can find details here: http://sourceforge.net/cvs/?group_id=173281

The module name you're interested in is 'xtools'.

After you have xtools checked out the first time, you'll be able to do 'cvs update' in your top-level xtools folder and CVS will update your local copy of the repository.

Let me know if you have any problems.

-X
null

xtools 1.5 Beta 1

Post by null »

FWIW, TortoiseCVS is a nice, free CVS client for Windows that integrates into Explorer so you can just right-click on a folder and update. (Sorry if I'm stating the obvious; I'm pretty sure it is one of SF's "recommended" clients.)