/** * Element Groups are used to associate faces that share UV seams. In this * way, we can easily select UV shells by grouping all elements as opposed * to iterating through and checking nearby faces every time. */ private void RefreshElementGroups(pb_Object pb) { foreach(pb_Face f in pb.faces) f.elementGroup = -1; pb_IntArray[] sharedUVs = pb.sharedIndicesUV; int eg = 0; foreach(pb_IntArray pint in sharedUVs) { if(pint.array.Length < 2) continue; pb_Face[] faces = GetFaces(pb, pint); int cur = pb.UnusedElementGroup(eg++); foreach(pb_Face f in faces) { if(f.elementGroup > -1) { int g = f.elementGroup; foreach(pb_Face fin in pb.faces) if(fin.elementGroup == g) fin.elementGroup = cur; } f.elementGroup = cur; } } }