Example #1
0
void	UnwrapMod::RebuildEdges()
	{
	if (mode == ID_SKETCHMODE)
		SetMode(ID_MOVE);


	for (int ldID = 0; ldID < mMeshTopoData.Count(); ldID++)
	{
		MeshTopoData *ld = mMeshTopoData[ldID];
		ld->SetTVEdgeInvalid();
		ld->SetGeoEdgeInvalid();
		ld->BuildTVEdges();
		ld->BuildVertexClusterList();

	}

/*
BitArray holdVSel(vsel);


	BOOL holdSyncMode = fnGetSyncSelectionMode();
	fnSetSyncSelectionMode(FALSE);


	TVMaps.BuildEdges(  );
	//PELT
	TVMaps.BuildGeomEdges(  );

	if (esel.GetSize() != TVMaps.ePtrList.Count())
		{
		esel.SetSize(TVMaps.ePtrList.Count());
		esel.ClearAll();
		}

	if (gesel.GetSize() != TVMaps.gePtrList.Count())
		{
		gesel.SetSize(TVMaps.gePtrList.Count());
		gesel.ClearAll();
		}

	//FP 05/26/06 : PELT Mapping - CER Bucket #370291
	//When the topology of the object changes, the seams bits array need to be updated.  
	//By clearing it there, the update will be done each time the topology changes
	if (peltData.seamEdges.GetSize() != TVMaps.gePtrList.Count())
		{
		peltData.seamEdges.SetSize(TVMaps.gePtrList.Count());
		peltData.seamEdges.ClearAll();
		}




	vsel = holdVSel;

	fnSetSyncSelectionMode(holdSyncMode);

	usedVertices.SetSize(TVMaps.v.Count());
	usedVertices.ClearAll();

	for (int i = 0; i < TVMaps.f.Count(); i++)
		{
		int faceIndex = i;
		for (int k = 0; k < TVMaps.f[faceIndex]->count; k++)
			{
			if (!(TVMaps.f[faceIndex]->flags & FLAG_DEAD))
				{
				int vertIndex = TVMaps.f[faceIndex]->t[k];
				usedVertices.Set(vertIndex);
				if (objType == IS_PATCH)
					{
					if ((TVMaps.f[faceIndex]->flags & FLAG_CURVEDMAPPING) && (TVMaps.f[faceIndex]->vecs))
						{
						if (TVMaps.f[faceIndex]->flags & FLAG_INTERIOR)
							{
							vertIndex = TVMaps.f[faceIndex]->vecs->interiors[k];
							if ((vertIndex >=0) && (vertIndex < usedVertices.GetSize()))
								usedVertices.Set(vertIndex);
							}
						vertIndex = TVMaps.f[faceIndex]->vecs->handles[k*2];
						if ((vertIndex >=0) && (vertIndex < usedVertices.GetSize()))
							usedVertices.Set(vertIndex);
						vertIndex = TVMaps.f[faceIndex]->vecs->handles[k*2+1];
						if ((vertIndex >=0) && (vertIndex < usedVertices.GetSize()))
							usedVertices.Set(vertIndex);
						}
					}
				}
			}
		}

	//PELT
	for (int i = 0; i < peltData.springEdges.Count(); i++)
	{
		int vertIndex = peltData.springEdges[i].v1;
		if (vertIndex != -1)
			usedVertices.Set(vertIndex);
		vertIndex = peltData.springEdges[i].v2;
		if (vertIndex != -1)
			usedVertices.Set(vertIndex);

		vertIndex = peltData.springEdges[i].vec1;
		if ( (vertIndex != -1) && (vertIndex < usedVertices.GetSize()))
			usedVertices.Set(vertIndex);
		vertIndex = peltData.springEdges[i].vec2;
		if ( (vertIndex != -1) && (vertIndex < usedVertices.GetSize()))
			usedVertices.Set(vertIndex);

	}
	BuildEdgeDistortionData();
*/
}
Example #2
0
void UnwrapMod::ApplyGizmoPrivate(Matrix3 *defaultTM)
{
	BOOL wasHolding = FALSE;
 	if (theHold.Holding())
		wasHolding = TRUE;


	if (!theHold.Holding())
	{
		theHold.Begin();
	}
	HoldPointsAndFaces();	


	//add vertices to our internal vertex list filling in dead spots where appropriate

	//get align normal
	//get fit data


	Matrix3 gtm(1);
	TimeValue t = 0;
	if (ip) t = ip->GetTime();
	if (defaultTM)
		gtm = *defaultTM;
	else
	{
		if (tmControl)
		{
			
			gtm = GetMapGizmoMatrix(t);

			if (!fnGetNormalizeMap())
			{
				for (int i = 0; i < 3; i++)
				{
					Point3 vec = gtm.GetRow(i);
					vec = Normalize(vec);
					gtm.SetRow(i,vec);
				}
			}

		}

	}

	for (int ldID = 0; ldID < mMeshTopoData.Count(); ldID++)
	{
		MeshTopoData *ld = mMeshTopoData[ldID];
		Matrix3 tm(1);
		tm = mMeshTopoData.GetNodeTM(t,ldID)* Inverse(gtm);
		ld->ApplyMap(fnGetMapMode(), fnGetNormalizeMap(), tm, this);
		ld->SetTVEdgeInvalid();
		ld->BuildTVEdges();
		ld->BuildVertexClusterList();
		
	}


	if (!wasHolding)
	{
		theHold.Accept(GetString(IDS_PW_PLANARMAP));
	}

	RebuildEdges();
	theHold.Suspend();
	fnFaceToEdgeSelect();
	theHold.Resume();

//	ConvertFaceToEdgeSel();
//	TVMaps.edgesValid= FALSE;
	//update our views to show new faces

	InvalidateView();

}