bool SmoothingGroupUIHandler::GetSmoothingGroups (EPolyMod *pMod, DWORD *anyFaces, DWORD *allFaces, bool useSel) {
	bool ret = true;
	// Initialization:
	*anyFaces = 0;
	if (allFaces) *allFaces = ~0;

	bool useStackSelection = pMod->getParamBlock()->GetInt (epm_stack_selection) != 0;

	ModContextList list;
	INodeTab nodes;
	pMod->EpModGetIP()->GetModContexts (list, nodes);
	for (int i=0; i<list.Count(); i++)
	{
		EditPolyData *pData = (EditPolyData *) list[i]->localData;
		if (!pData) continue;
		MNMesh *pMesh = pData->GetMeshOutput();
		if (!pMesh) {
			ret = false;
			continue;
		}

		DWORD l_selFlag = useStackSelection ? MN_EDITPOLY_STACK_SELECT:MN_SEL;

		for (int j=0; j<pMesh->numf; j++)
		{
			if (useSel && !pMesh->f[j].GetFlag (l_selFlag)) 
				continue;
			if (pMesh->f[j].GetFlag (MN_DEAD)) 
				continue;

			*anyFaces |= pMesh->f[j].smGroup;
			if (allFaces) *allFaces &= pMesh->f[j].smGroup;
		}
	}
	nodes.DisposeTemporary ();

	if (allFaces) *allFaces &= *anyFaces;
	return ret;
}
MNMesh *EditPolyMod::EpModGetOutputMesh (INode *pNode) {
	EditPolyData *pData = GetEditPolyDataForNode (pNode);
	if (!pData) return NULL;
	return pData->GetMeshOutput();
}