Hey, just tried in in Photoshop CC and it works perfectly!
Great work, thanks.
A question:
Any chance that the resulting bones are not all horizontally aligned but point to the next bone in the hierarchy, so we get a real skeleton?
I guess in the script it would mean a 2-pass approach going through the whole tree prior to the generation and building up the hierarchy in memory. Then an arbitrary bone could check if it had children and set its direction to the anchor of the child.
This would make it even more killer...
All the best
Martin