I've been trying to write a script that lets a user indicate two layers/groups, and then output the difference in position between them (of their topleft most points) like so:
var calculated_offset = [group.bounds.value - originGroup.bounds.value, group.bounds.value - originGroup.bounds.value];
Now, getting the first layer is fairly trivial:
But I can't think of a good way to let the user switch their selection, and then start the comparison.
I've written script for a dialog that requests for an exact match name, and then a recursive function to find the correct (grouped) layer, but the find function takes a long time, and a non-fuzzy search is terribly user-unfriendly.
I've also tried creating a new window, and then taking in a first and then a second selection, but since these modal dialogs are blocking windows, that fell flat.
Answers could include ideas to:
- Let users select a second layer after being prompted
- Implement a fast (< 4s at ~100 nested layers) (fuzzy) search
- Access the multiple layers that the user has selected
- Make the window non-blocking
- An alternative way to get the offset between two layers