I've run into this unexpected behavior when you ask the visibility of a layer via AM:
Suppose you have a layerset and inside that layerset a layer, both visible.
If you hide the layerset, then the layer also becomes invisible, which is normal, and it's eye icon turns grey.
If you query the visibility of the layer via the DOM, you will get false as expected:
Code: Select all
activeDocument.activeLayer.visible
but if you query the visibility with AM, then you get true.
Code: Select all
var ref = new ActionReference();
ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "Vsbl" ));
ref.putIndex( charIDToTypeID( "Lyr " ), 1);
executeActionGet(ref).getBoolean(charIDToTypeID( "Vsbl" ));
Because I am working on very large documents I need AM for speed. The problem is that if I want to know the "real" visibility of the layer via AM, I am also needing to query the visibility of their parents each time and this is causing lots of extra calculations lowering down considerably the performance of the script.
I don't know if this is really a bug; seems an intended behavior, maybe I am just missing how to properly query the visibility with AM.
Do you know how to query the "real" visibility of a layer using AM ?