Hi,
Can anyone help me to solve this: how to ungroup the selected grouped items?
Thanks you in advanced
//A
The idea of moving them out one by one is clever. But it should be an easier way to include it in Scriptographer... Anyways, here is my version of the idea! I'm not sure if the "While loop is more risky".
while(group.hasChildren()){ document.activeLayer.appendBottom(group.children[0]); }
Thanks for the help.
//A
Back on the computer
My suggestion failed in a couple of ways....
Setting the parent to layer does not remove from the group - because the attribute is readonly -- helps if one scrolls down a bit in the reference :-(
The group is deleted as a side effect when the last item is appended to the parent layer - so no need for a group.remove().
When adding a group it can be left empty and needs removing if unused - I assumed this would be the same!
An improvement to the method, by the way, is to have
while(gp.children.length) {
gp.parent.appendBottom(gp.children[0]);
}
which deals with groups in groups.
I have not yet checked the code to leave the ungrouped items at the right place in the stacking order in the parent ... too late in the evening.