Getting layer's parent using ActionManager
Is there a way, to get layer's parent using ActionManager? There is an simple way by layer.parent, but this seems to be rather slow, I would appreciate fast access, but could not get an idea how to do it.
Is there a way, to get layer's parent using ActionManager? There is an simple way by layer.parent, but this seems to be rather slow, I would appreciate fast access, but could not get an idea how to do it.
The layer descriptor does not have a 'parent' key. It does have a key with the stringID of "layerSection".
To Action Manger a layerSet is really two layers. One has the value of 'layerSectionStart' in the "layerSection" key. That is the layer that you can see in the Photoshop GUI. It marks the top of a layerSet. The bottom of the layerSet is a hidden layer with the value of "layerSectionEnd" in the "layerSection" key. You can not make that hidden layer active and some of the key have different values than the matching 'top'. For example if the layerSet visible in Photoshop is 'Group 1' then the name for the end of the layerSet is '</Group 1>'.
I think you could find the parent of a layer using Action Manager if you first got the index of the layer in question. Then loop backwards using the index and searching the "layerSection" key for 'layerSectionStart'. If you run into a "layerSectionEnd" before you find the start you need to keep track of that to be sure you find the correct 'start'. Doing something like this is on my list of things to do, I just haven't gotten to it yet.
Altough looping by index in Action Manager is much faster than loop in the DOM, I an not sure that finding the parent with Action Manger would be faster than just making the layer active and using the DOM to find the parent.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.