improved version committed to rev 13562, to allow for the case where a group contains both a clip and a mask
improved version committed to rev 13562, to allow for the case where a group contains both a clip and a mask