Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 980)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshLoader.h	(revision 989)
@@ -114,4 +114,5 @@
 			unsigned	long	long_actual;
 			size_t					currentSubMesh;
+			bool						mError;
 
 			struct GeometryElement
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 988)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshViewUI.h	(revision 989)
@@ -71,4 +71,5 @@
 enum	SimplificationType
 {
+	NO_SIMPLIFICATION,
 	MESHSIMP,
 	HOJAS,
@@ -121,6 +122,6 @@
 	inline void cb_menuFileSave_i(fltk::Item*, void*);
 	static void cb_menuFileSave(fltk::Item*, void*);
-	inline void cb_menuOpenSaveAs_i(fltk::Item*, void*);
-	static void cb_menuOpenSaveAs(fltk::Item*, void*);
+	inline void cb_menuFileSaveAs_i(fltk::Item*, void*);
+	static void cb_menuFileSaveAs(fltk::Item*, void*);
 
 	inline void cb_menuMeshInfo_i(fltk::Item*, void*);
@@ -131,6 +132,6 @@
 	static void	cb_menuFileTransformSharedVertex(fltk::Item* o, void* v);
 
-	inline void cb_menuOpenQuit_i(fltk::Item*, void*);
-	static void cb_menuOpenQuit(fltk::Item*, void*);
+	inline void cb_menuFileQuit_i(fltk::Item*, void*);
+	static void cb_menuFileQuit(fltk::Item*, void*);
 	inline void cb_menuEditUndo_i(fltk::Item*, void*);
 	static void cb_menuEditUndo(fltk::Item*, void*);
@@ -201,4 +202,7 @@
 	static void cb_mLogo(fltk::InvisibleBox*, void*);
 
+	//	Shows build process.
+	void	activeBuildProcess();
+
 	//	Shows the stripify panel.
 	void	showStripify();
@@ -271,4 +275,7 @@
 	void	openMeshFile();
 
+	//	Check if file exists.
+	bool	fileExists(const char	*fileNameMesh);
+
 	public:
 
@@ -281,10 +288,10 @@
 	fltk::Item					*menuFileOpen;
 	fltk::Item					*menuFileSave;
-	fltk::Item					*menuOpenSaveAs;
+	fltk::Item					*menuFileSaveAs;
 	fltk::Item					*menuMeshInfo;
 	fltk::Item					*menuMeshExportOBJ;
 	fltk::Item					*menuFileTransformSharedVertex;
 
-	fltk::Item					*menuOpenQuit;
+	fltk::Item					*menuFileQuit;
 	fltk::ItemGroup			*menuEdit;
 	fltk::Item					*menuEditUndo;
Index: GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshSaver.h
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshSaver.h	(revision 980)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/include/GeoMeshSaver.h	(revision 989)
@@ -110,5 +110,5 @@
 			//	Gets the material of the mesh.
 			String	getMaterialName();
-
+			
 			//	Saves a Mesh into a file.
 			int	save(Mesh	*geoMesh,	const	char	*fileNameMesh);
Index: GTP/trunk/Lib/Geom/shared/GeoTool/out.objf
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/out.objf	(revision 988)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/out.objf	(revision 989)
@@ -3,219 +3,268 @@
 #by Francine Evans
 
-t 1413 1414 1412
-q 1415
-q 1399
-q 1400
-q 1398
-q 1401
-q 1402
-q 1403
-q 1404
-q 1405
-q 1406
-q 1407
-q 1408
-q 1409
-q 1410 1411
-t 1395 1396 1394
-q 1397
-q 1381
-q 1382
-q 1380
-q 1383
-q 1384
-q 1385
-q 1386
-q 1387
-q 1388
-q 1389
-q 1390
-q 1391
-q 1392 1393
-t 1377 1378 1376
-q 1379
-q 1363
-q 1364
-q 1362
-q 1365
-q 1366
-q 1367
-q 1368
-q 1369
-q 1370
-q 1371
-q 1372
-q 1373
-q 1374 1375
-t 1359 1360 1358
-q 1361
-q 1345
-q 1346
-q 1344
-q 1347
-q 1348
-q 1349
-q 1350
-q 1351
-q 1352
-q 1353
-q 1354
-q 1355
-q 1356 1357
-t 1340 1341 1339
-q 1342
-q 1312
-q 1313
-q 1311
-q 1314
-q 1319
-q 1320
-q 1323
-q 1324
-q 1327
-q 1328
-q 1331
-q 1332
-q 1335 1336
-t 1294 1295 1293
-q 1305
-q 1304
-q 1301
-q 1300
-q 1297
-q 1296
-q 1298
-q 1299
-q 1302
-q 1303
-q 1306
-q 1307
-q 1291
-q 1290 1292
-t 1284 1285 1283
-q 1286
-q 1287
-q 1289
-q 1275
-q 1276 1275
-q 1252 1275
-q 1255 1275
-q 1277
-q 1287
-q 1278
-q 1279 1278
-q 1259 1278
-q 1257
-q 1277 1257
-q 1255
-q 1256 1255
-q 1254
-q 1252 1254
-q 1253 1254
-q 1274 1254
-q 1273
-q 1256
-q 1258
-q 1257 1258
-q 1259 1258
-q 1260
-q 1273
-q 1262 1273
-q 1272 1273
-q 1270 1273
-q 1271 1274
-t 1271 1268 1270 1269
-t 1288 1283 1288 1287
-q 1280
-q 1279
-q 1261
-q 1259 1261
-q 1260 1261
-q 1262 1261
-q 1263
-q 1280
-q 1281
-q 1288 1281
-q 1282 1281
-q 1265
-q 1263
-q 1264
-q 1262 1264
-q 1272 1264
-q 1266
-q 1265
-q 1267 1282
-t 1453 1452 1453 1479
-q 1478
-q 1475
-q 1474
-q 1471
-q 1470
-q 1467
-q 1466
-q 1463
-q 1462
-q 1459
-q 1458
-q 1455
-q 1454
-q 1452 1453
-t 1477 1476 1477 1451
-q 1450
-q 1448
-q 1449
-q 1456
-q 1457
-q 1460
-q 1461
-q 1464
-q 1465
-q 1468
-q 1469
-q 1472
-q 1473
-q 1476 1477
-t 1421 1420 1421 1447
-q 1446
-q 1443
-q 1442
-q 1439
-q 1438
-q 1435
-q 1434
-q 1431
-q 1430
-q 1427
-q 1426
-q 1423
-q 1422
-q 1420 1421
-t 1445 1444 1445 1419
-q 1418
-q 1416
-q 1417
-q 1424
-q 1425
-q 1428
-q 1429
-q 1432
-q 1433
-q 1436
-q 1437
-q 1440
-q 1441
-q 1444 1445
-t 1343 1317 1316
-q 1315 1316
-q 1321 1316
-q 1325 1316
-q 1329 1316
-q 1333 1316
-q 1337 1343
-t 1309 1338 1310
-q 1334 1310
-q 1330 1310
-q 1326 1310
-q 1322 1310
-q 1318 1310
-q 1308 1309
+t 77 128 77 57
+q 76 57
+q 56
+q 49
+q 51 49
+q 50 49
+q 52 49
+q 59 49
+q 46 49
+q 47 49
+q 58
+q 57 58
+q 53 58
+q 55 58
+q 60 58
+q 48
+q 47
+q 43
+q 46
+q 42
+q 41 42
+q 39
+q 43
+q 44
+q 48 60
+t 39 44 39 40
+q 41 40
+q 45
+q 44
+q 52
+q 55 52
+q 53 52
+q 54
+q 50 54
+q 68
+q 53
+q 67
+q 128 67
+q 138
+q 139 138
+q 144 138
+q 124 138
+q 127
+q 128 127
+q 126
+q 124
+q 125 124
+q 123
+q 144 123
+q 130
+q 125
+q 132
+q 131 132
+q 128 132
+q 77 132
+q 76
+q 130 76
+q 144
+q 145
+q 139
+q 97 139
+q 140
+q 67
+q 141
+q 143 141
+q 142
+q 140 142
+q 97
+q 96 97
+q 95 97
+q 103 97
+q 105 97
+q 102
+q 145
+q 78
+q 76
+q 75 76
+q 74
+q 56 74
+q 50 74
+q 68
+q 69
+q 67 69
+q 70
+q 17
+q 73
+q 18
+q 62 18
+q 20 18
+q 19
+q 17
+q 25 17
+q 28
+q 24
+q 29
+q 23 29
+q 27 29
+q 32 29
+q 34
+q 28
+q 33
+q 25 33
+q 11 33
+q 15
+q 34
+q 13
+q 32
+q 16 32
+q 31
+q 27 31
+q 26
+q 30 26
+q 25 26
+q 19
+q 21
+q 20
+q 22 20
+q 66
+q 62
+q 65 62
+q 61 62
+q 63 62
+q 72
+q 73
+q 71
+q 70 71
+q 67
+q 72 67
+q 63
+q 143
+q 135
+q 142 135
+q 96
+q 98
+q 95 98
+q 99 98
+q 100 98
+q 137
+q 135 137
+q 64 137
+q 38
+q 66
+q 64
+q 65 64
+q 61
+q 136
+q 63 136
+q 135 64
+t 27 26 27 21
+q 23
+q 22
+q 24 22
+q 78
+q 66 78
+q 137 78
+q 100
+q 102 100
+q 101
+q 99 101
+q 106
+q 102 106
+q 105
+q 111 105
+q 110
+q 103 110
+q 90 110
+q 93
+q 111
+q 91 111
+q 92 111
+q 109
+q 106 109
+q 99
+q 108 99
+q 104
+q 95 104
+q 103 104
+q 107
+q 108 107
+q 87 107
+q 88 107
+q 89
+q 103 89
+q 90
+q 83 90
+q 84
+q 93
+q 85
+q 91
+q 81
+q 92
+q 86 92
+q 94
+q 109 94
+q 108 94
+q 87 94
+q 79
+q 86 79
+q 81 79
+q 80
+q 87 80
+q 88
+q 82
+q 89 82
+q 83 82
+q 81 80
+t 81 83 81 84 85
+t 24 78 24 75
+q 17 75
+q 69 74
+t 45 52 45 46 41
+t 14 1 13
+q 8
+q 16
+q 3 16
+q 10
+q 31 10
+q 30 10
+q 9 10
+q 2
+q 3 2
+q 1 2
+q 5
+q 9
+q 12
+q 30 12
+q 25 12
+q 11 12
+q 4
+q 5 4
+q 1 4
+q 7
+q 11 7
+q 15
+q 6
+q 14 6
+q 1 7
+t 1 3 1 8
+t 128 131 128 129
+q 126
+q 134 126
+q 133
+q 125
+q 120 125
+q 121
+q 131
+q 122
+q 129 122
+q 117 122
+q 118
+q 121 118
+q 120 118
+q 116 118
+q 115
+q 117
+q 114 117
+q 119 117
+q 133 134
+t 120 133 120 119
+q 113
+q 114 113
+q 115 113
+q 116 120
+t 38 112 35
+q 36 35
+q 37 38
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 985)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshLoader.cpp	(revision 989)
@@ -15,5 +15,7 @@
 using	namespace	std;
 
+//---------------------------------------------------------------------------
 //	Jump a chunk.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::jumpChunk(FILE	*f)
 {
@@ -24,5 +26,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a chunk.
+//---------------------------------------------------------------------------
 unsigned short GeoMeshLoader::readChunk(FILE	*f)
 {
@@ -35,5 +39,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex element.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexElement(FILE	*f, Mesh	*geoMesh)
 {
@@ -103,5 +109,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex declaration.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexDeclaration(FILE	*f, Mesh	*geoMesh)
 {
@@ -143,5 +151,7 @@
 }//	End readGeometryVertexDeclaration.
 
+//---------------------------------------------------------------------------
 //	Read geometry vertex buffer.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometryVertexBuffer(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -270,9 +280,14 @@
 		cout	<<	"Error: Source not found."
 					<<	endl;
-	}
-
-}
-
+
+		//	Error.
+		mError	=	true;
+	}
+
+}
+
+//---------------------------------------------------------------------------
 //	Read Geometry.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readGeometry(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -361,5 +376,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh operation.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshOperation(	FILE	*f,
 																					Mesh	*geoMesh,
@@ -383,5 +400,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMesh(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -479,4 +498,7 @@
 			cout	<<	"Error: Missing mesh geometry."
 						<<	endl;
+
+			//	Error.
+			mError	=	true;
 		}
 		
@@ -537,5 +559,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a mesh lod information.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMeshLodInfo(FILE	*f, Mesh	*geoMesh)
 {
@@ -572,5 +596,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a submesh name table.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshNameTable(FILE	*f, Mesh	*geoMesh)
 {
@@ -609,5 +635,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read a mesh file.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMesh(FILE	*f, Mesh	*geoMesh, int option)
 {
@@ -741,12 +769,16 @@
 			cout	<<	"Error: Reading failure."
 						<<	endl;
-		}
-	}
-
-}
-
-/*
-		Allocate memory to the array of strips
-*/
+
+			//	Error.
+			mError	=	true;
+		}
+	}
+
+}
+
+
+//---------------------------------------------------------------------------
+//	Allocate memory to the array of strips
+//---------------------------------------------------------------------------
 SubMesh* GeoMeshLoader::BuildStripsGeoSubMesh(SubMesh* geoSubMesh)
 {
@@ -848,5 +880,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Remove degenerate triangles of a submesh given.
+//---------------------------------------------------------------------------
 SubMesh	*	GeoMeshLoader::removeDegenerateTriangles(SubMesh	*geoSubMesh)
 {
@@ -951,5 +985,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Loads a mesh.
+//---------------------------------------------------------------------------
 Mesh* GeoMeshLoader::load(char	*nameFileMesh) 
 {
@@ -961,7 +997,4 @@
 	SubMesh					*geosubmesh;
 
-	//	Initialize the current submesh;
-	currentSubMesh	=	-1;
-	
 	//	Debug.
 	cout	<<	"---------------------------------"
@@ -972,98 +1005,127 @@
 				<<	endl;
 
-	//	Initialize the return value.
-	geoMesh	=	new	Mesh();
+	geoMesh	=	NULL;
 
 	//	Open the mesh file.
-	pFile	=	fopen( nameFileMesh, "rb" );
-
-  if (!pFile)
-  {
+	pFile	=	fopen(nameFileMesh, "rb");
+
+  if (pFile)
+	{
+		//	Initialize the current submesh;
+		currentSubMesh	=	-1;
+
+		//	Initialize the return value.
+		geoMesh	=	new	Mesh();
+
+		//	Count the submeshes
+		//	and next build the geomesh.
+		for (int option = 0; option < 2;option++)
+		{
+			//	Initialize Error.
+			mError	=	false;
+	
+			fread(&uno,sizeof(unsigned short),1,pFile);
+
+			if (uno != M_HEADER)
+			{
+				//	Debug.
+				cout	<<	"Error: Header not found."
+					<<	endl;
+
+				//	Error.
+				mError	=	true;
+			}
+
+			// Read version.
+			fgets(version,255,pFile);
+
+			cout	<<	version	<<	endl;
+
+			if (strcmp(version,"[MeshSerializer_v1.30]\n"))
+			{
+				//	Debug.
+				cout	<<	"Error: Wrong mesh version."
+					<<	endl
+					<<	"Only version 1.3 or older allowed."
+					<<	endl;
+
+				//	Error.
+				mError	=	true;
+			}
+
+			while(!feof(pFile))
+			{
+				chunkID = readChunk(pFile);
+
+				switch (chunkID)
+				{
+					case M_MESH:
+						readMesh(pFile, geoMesh, option);
+						break;
+				}
+			}
+
+			//	Create the submesh array.
+			if (option == SUBMESH_COUNT)
+			{
+				geoMesh->mSubMesh	= new SubMesh[geoMesh->mSubMeshCount];
+			}
+
+			//	Move the curso to the begining of the file.
+			fseek(pFile,0,SEEK_SET);
+		}
+
+		//	Goes to the end of the file.
+		fseek(pFile,0,SEEK_END);
+
+		//	Gets the size of the file.
+		mFileSize	=	ftell(pFile);
+
+		// Close the mesh file.
+		fclose(pFile);
+
+		//	If no error.
+		if (!mError)
+		{
+			for (int submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
+			{
+				//	Gets the actual submesh.
+				geosubmesh	=	&geoMesh->mSubMesh[submesh];
+
+				if (geosubmesh->mType == Geometry::GEO_TRIANGLE_STRIPS)
+				{
+					//	Fill the strips list.
+					geosubmesh	=	BuildStripsGeoSubMesh(geosubmesh);
+				}
+			}
+
+			//	Sets coods between -1 and 1.
+			normalizeModel(geoMesh);
+		}
+	}
+	else
+	{
 		//	Debug.
-		cout	<<	"Error: File "
-					<<	nameFileMesh
-					<<	" not found."
+		cout	<<	"Error: File not found."
 					<<	endl;
+
+		//	File not found.
+		mError	=	true;
+	}
+
+	//	If an error happens.
+	if (mError)
+	{
+		delete	geoMesh;
 		
-		exit(0);
-  }
-
-	//	Count the submeshes
-	//	and next build the geomesh.
-	for (int option = 0; option < 2;option++)
-	{
-		fread(&uno,sizeof(unsigned short),1,pFile);
-
-		if (uno != M_HEADER)
-		{
-			//	Debug.
-			cout	<<	"Error: Header not found."
-						<<	endl;
-		}
-
-		// Read version.
-		fgets(version,255,pFile);
-
-		cout	<<	version	<<	endl;
-
-		if (strcmp(version,"[MeshSerializer_v1.30]\n"))
-		{
-			//	Debug.
-			cout	<<	"Error: Wrong mesh version."
-						<<	endl
-						<<	"Only version 1.3 or older allowed."
-						<<	endl;
-		}
-
-		while(!feof(pFile))
-		{
-			chunkID = readChunk(pFile);
-
-			switch (chunkID)
-			{
-				case M_MESH:
-					readMesh(pFile, geoMesh, option);
-					break;
-			}
-		}
-
-		//	Create the submesh array
-		if (option == SUBMESH_COUNT)
-		{		
-			geoMesh->mSubMesh	= new SubMesh[geoMesh->mSubMeshCount];
-		}
-							
-		//	Move the curso to the begining of the file.
-		fseek(pFile,0,SEEK_SET);
-	}
-
-	//	Goes to the end of the file.
-	fseek(pFile,0,SEEK_END);
-
-	//	Gets the size of the file.
-	mFileSize	=	ftell(pFile);
-	
-	// Close the mesh file.
-	fclose(pFile);
-	
-	for (int submesh = 0;	submesh < geoMesh->mSubMeshCount; submesh++)
-	{
-		//	Gets the actual submesh.
-		geosubmesh	=	&geoMesh->mSubMesh[submesh];
-		
-		if (geosubmesh->mType == Geometry::GEO_TRIANGLE_STRIPS)
-		{
-			//	Fill the strips list.
-			geosubmesh	=	BuildStripsGeoSubMesh(geosubmesh);
-		}
-	}
-	
-	//	Sets coods between -1 and 1.
-	normalizeModel(geoMesh);
-
+		geoMesh	=	NULL;
+	}
+	
 	return	geoMesh;
 }
 
+//---------------------------------------------------------------------------
 //	Sets coords between -1 and 1.
+//---------------------------------------------------------------------------
 void	GeoMeshLoader::normalizeModel(Mesh	*geoMesh)
 {
@@ -1187,5 +1249,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Get the size in bytes of the file.
+//---------------------------------------------------------------------------
 size_t	GeoMeshLoader::getFileSize()
 {
@@ -1193,5 +1257,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Constructor
+//---------------------------------------------------------------------------
 GeoMeshLoader::GeoMeshLoader()
 {
@@ -1200,5 +1266,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Destroyer.
+//---------------------------------------------------------------------------
 GeoMeshLoader::~GeoMeshLoader()
 {
@@ -1206,5 +1274,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read bones of the submesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSubMeshBoneAssignment(FILE* f, SubMesh* geoSubMesh,int option)
 {
@@ -1224,5 +1294,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read bones of the main mesh.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readMeshBoneAssignment(FILE* f, Mesh* geoMesh,int option)
 {
@@ -1243,5 +1315,7 @@
 }
 
-//OSCAR
+//---------------------------------------------------------------------------
+//	Read skeleton link.
+//---------------------------------------------------------------------------
 void GeoMeshLoader::readSkeletonLink(FILE* f, Mesh* geoMesh,int option)
 {
@@ -1259,5 +1333,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Read bounding box settings.
+//---------------------------------------------------------------------------
 void	GeoMeshLoader::readMeshBounds(FILE	*f, Mesh	*geoMesh,	int	option)
 {
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 988)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshViewUI.cpp	(revision 989)
@@ -83,8 +83,15 @@
 //	Save As Callback
 //---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuOpenSaveAs_i(fltk::Item*, void*)
+inline void GeoMeshViewUI::cb_menuFileSaveAs_i(fltk::Item*, void*)
 {
 	fltk::FileChooser *fcho;
 	GeoMeshSaver			*mesh_saver;
+	char							file_name[255];
+	char							message[255];
+	char							*ptr;
+	int								answer_yes;
+	
+	//	Initialize answer to yes.
+	answer_yes	=	1;
 	
 	if (mGeoMesh != NULL)
@@ -99,9 +106,43 @@
 		if (fcho->value())
 		{
-			mesh_saver	=	new	GeoMeshSaver();
-			mesh_saver->save(mGeoMesh,filename_name(fcho->value()));
-			delete	mesh_saver;
+			//	Gets file name.
+			strcpy(file_name,fcho->value());
+
+			//	Cut extension.
+			ptr				=	strtok(file_name,".");
+
+			//	If has extension.
+			if (ptr)
+			{
+				strcpy(file_name,ptr);
+			}
+
+			//	Adds mesh extension.
+			strcat(file_name,".mesh");
+
+			//	If File Exists.
+			if (fileExists(file_name))
+			{
+				//	Compose message.
+				strcpy(message,"Do you want to replace ");
+				strcat(message,file_name);
+				strcat(message,"?");
+
+				//	Question.
+				answer_yes	=	fltk::ask(message);
+			}
+
+			//	If answer yes to replace question.
+			//	or if file not exists.
+			if (answer_yes)
+			{
+				mesh_saver	=	new	GeoMeshSaver();
+
+
+				mesh_saver->save(mGeoMesh,filename_name(file_name));
+
+				delete	mesh_saver;
+			}
 		}
-
 		//	Repaint the window.
 		mMainWindow->redraw();
@@ -111,9 +152,9 @@
 }
 
-void GeoMeshViewUI::cb_menuOpenSaveAs(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuOpenSaveAs_i(o,v);
+void GeoMeshViewUI::cb_menuFileSaveAs(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuFileSaveAs_i(o,v);
 }
 
@@ -210,14 +251,14 @@
 //	Quit Callback
 //---------------------------------------------------------------------------
-inline void GeoMeshViewUI::cb_menuOpenQuit_i(fltk::Item*, void*)
+inline void GeoMeshViewUI::cb_menuFileQuit_i(fltk::Item*, void*)
 {
 	delete	this;
 }
 
-void GeoMeshViewUI::cb_menuOpenQuit(fltk::Item* o, void* v)
-{
-  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
-										->
-										cb_menuOpenQuit_i(o,v);
+void GeoMeshViewUI::cb_menuFileQuit(fltk::Item* o, void* v)
+{
+  ((GeoMeshViewUI*)	(o->parent()->parent()->parent()->user_data()))
+										->
+										cb_menuFileQuit_i(o,v);
 }
 
@@ -710,6 +751,4 @@
 	openMeshFile();
 	
-	//	Show title.
-	mProcessTitle->label("Visualize LodStrips");
 
 	//	If an object is loaded.
@@ -735,9 +774,11 @@
 		//	Free memory.
 		delete	fcho;
-	}
 
 	//	Hide the right panel.
 	hideRightPanel();
 
+	//	Show title.
+	mProcessTitle->label("Visualize LodStrips");
+
 	//	Show the Visulize LodStrips panel.
 	showLodStripSlider();
@@ -745,6 +786,7 @@
 	//	Repaint the window.
 	mMainWindow->redraw();
-}
-
+
+	}
+}
 
 inline void GeoMeshViewUI::cb_menuLodTreesVisualize_i(fltk::Item*, void*)
@@ -752,5 +794,5 @@
 	fltk::FileChooser *fcho;
 	const	char				*lod_file;
-	
+
 	//	Sets menus application state to NONE.
 	mApplicationState	=	NONE;
@@ -762,74 +804,80 @@
 	//	Loads a mesh file.
 	openMeshFile();
-	
-	//	Show title.
-	mProcessTitle->label("Visualize LodTrees");
 
 	/*if (geoMeshView->getLeavesSubmesh()==-1)
-	{
+		{
 		fltk::alert("No se ha seleccionado el submesh de hojas!");
 		return;
-	}*/
-
-	// POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS
-	int leafsSubMeshID = -1;
-	for (int i=0; i<mGeoMesh->mSubMeshCount; i++)
-		if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
-		{
-			leafsSubMeshID=i;
-			break;
-		}
-
-
+		}*/
 
 	//	If an object is loaded.
 	if (mGeoMesh != NULL)
 	{
-		fcho	=	new fltk::FileChooser("",
-				"*.lod",
-				fltk::FileChooser::CREATE,
-				"Open Lod file");
-
-		fcho->exec();
-
-		//	If a file was selected.
-		if (fcho->value())
+		// POR AHORA SE SELECCIONA EL PRIMER SUBMESH QUE NO ES STRIPS COMO HOJAS
+		int leafsSubMeshID = -1;
+
+		for (int i=0; i<mGeoMesh->mSubMeshCount; i++)
 		{
-			//	Build lod strips library.
-
-			std::string lodstripFile(fcho->value());
-			delete fcho;
+			if (mGeoMesh->mSubMesh[i].mType==GEO_TRIANGLE_LIST)
+			{
+				leafsSubMeshID=i;
+				break;
+			}
+		}
+
+		//	If an object is loaded.
+		if (mGeoMesh != NULL)
+		{
 			fcho	=	new fltk::FileChooser("",
-					"*.leafseq",
+					"*.lod",
 					fltk::FileChooser::CREATE,
-					"Open LeafSeq file");
+					"Open Lod file");
 
 			fcho->exec();
 
+			//	If a file was selected.
 			if (fcho->value())
 			{
-				std::string leafseqFile(fcho->value());
-
-				setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
-
-				//	Sets the aplication mode.
-				mApplicationState	=	VISUALIZE_LODTREES;
+				//	Build lod strips library.
+
+				std::string lodstripFile(fcho->value());
+				delete fcho;
+				fcho	=	new fltk::FileChooser("",
+						"*.leafseq",
+						fltk::FileChooser::CREATE,
+						"Open LeafSeq file");
+
+				fcho->exec();
+
+				if (fcho->value())
+				{
+					std::string leafseqFile(fcho->value());
+
+					setLodTreesLibrary(lodstripFile, leafseqFile, mGeoMesh, leafsSubMeshID);
+
+					//	Sets the aplication mode.
+					mApplicationState	=	VISUALIZE_LODTREES;
+				}
 			}
+
+			//	Free memory.
+			delete	fcho;
+
+			//	Hide the right panel.
+			hideRightPanel();
+
+			//	Show title.
+			mProcessTitle->label("Visualize LodTrees");
+
+			//	Show the Visulize LodTree panel.
+			showLodStripSlider();
+			showLodTreeSlider();
+
+			//	Repaint the window.
+			mMainWindow->redraw();
 		}
-
-		//	Free memory.
-		delete	fcho;
-	}
-
-	//	Hide the right panel.
-	hideRightPanel();
-
-	//	Show the Visulize LodTree panel.
-	showLodStripSlider();
-	showLodTreeSlider();
-	
-	//	Repaint the window.
-	mMainWindow->redraw();
-}
+	}
+}
+
 void GeoMeshViewUI::cb_menuLodTreesVisualize(fltk::Item *o, void *v)
 {
@@ -1009,4 +1057,7 @@
 						//	Create the simplification sequence.
 						createSimplificationSequence();
+
+						//	Show build process.
+						activeBuildProcess();
 					}
 
@@ -1054,4 +1105,7 @@
 						delete	mMeshSimplifier;
 						geoMeshView->restoreContext();
+
+						//	Show build process.
+						activeBuildProcess();
 					}
 				}
@@ -1107,8 +1161,8 @@
 inline void GeoMeshViewUI::cb_mButtonBuild_i(fltk::Button*, void*)
 {
-	char			*file_name=NULL;
+	char					*file_name	=	NULL;
 	GeoMeshSaver	*mesh_saver;
 	Serializer		*oSerializer;
-	
+
 	//	Sets the progress bar to process bar.
 	progressBarType	=	BUILD;
@@ -1125,5 +1179,5 @@
 			//	Build the LOD file.
 			case	LODTREES_AUTO:			
-				
+
 				//	Open file chooser dialog.
 				file_name	=	fltk::file_chooser("Build LOD","*","");
@@ -1135,21 +1189,21 @@
 				std::cout << "OK!" << std::endl;
 
-/*				TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
-				auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
-
-				if (auxTreeSimpSequence && mGeoMesh)
-				{
-					LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
-					delete auxLodTreeConstructor;
-				}
-				else
-				{
-					fltk::alert("There is no leaf simplification sequence.");
-					break;
-				}
-
-
-				delete auxTreeSimpSequence;*/
-				
+				/*				TreeSimplificationSequence * auxTreeSimpSequence = new TreeSimplificationSequence();
+									auxTreeSimpSequence->Load(Serializer("leavesSimplification.txt",Serializer::READ));
+
+									if (auxTreeSimpSequence && mGeoMesh)
+									{
+									LodTreeConstructor * auxLodTreeConstructor = new LodTreeConstructor(mGeoMesh,auxTreeSimpSequence);
+									delete auxLodTreeConstructor;
+									}
+									else
+									{
+									fltk::alert("There is no leaf simplification sequence.");
+									break;
+									}
+
+
+									delete auxTreeSimpSequence;*/
+
 
 			case	LODSTRIPS_AUTO:
@@ -1309,4 +1363,16 @@
 
 //---------------------------------------------------------------------------
+//	Active Build process.
+//---------------------------------------------------------------------------
+void	GeoMeshViewUI::activeBuildProcess()
+{
+	//mButtonBuild->set_visible();
+	mButtonBuild->activate();
+
+	//mBuildBar->set_visible();
+	mBuildBar->activate();
+}
+
+//---------------------------------------------------------------------------
 //	Show the stripify panel
 //---------------------------------------------------------------------------
@@ -1572,8 +1638,8 @@
 
 	mButtonBuild->set_visible();
-	mButtonBuild->activate();
+	//mButtonBuild->activate();
 
 	mBuildBar->set_visible();
-	mBuildBar->activate();
+	//mBuildBar->activate();
 }
 //---------------------------------------------------------------------------
@@ -1586,8 +1652,8 @@
 
 	mButtonBuild->set_visible();
-	mButtonBuild->activate();
+	//mButtonBuild->activate();
 
 	mBuildBar->set_visible();
-	mBuildBar->activate();
+	//mBuildBar->activate();
 }
 
@@ -2310,8 +2376,9 @@
 void	GeoMeshViewUI::openMeshFile()
 {
+	Mesh							*mesh_loaded;
 	fltk::FileChooser	*fcho;
 	static	char			char_value[10];
 	static	char			title[256];
-
+	
 	fcho	=	new fltk::FileChooser("",
 																"*.mesh",
@@ -2326,74 +2393,103 @@
 	if (mFileName)
 	{
-		//	Set Window Title.
-		strcpy(title,mFileName);
-		mMainWindow->label(strcat(title," - GeoTool"));
-
-		//	Identify the mesh that stores the leaves
-		idMeshLeaves	=	-1;
-
-		//	Stores the name of the mesh.
-		nombremesh	=	new char[255];
-		strcpy(nombremesh,mFileName);
-
-		//	Delete	the current mesh.
-		delete	mGeoMesh;
-		delete	mUndoMesh;
-
 		//	Loads a new mesh.
-		mGeoMesh		=	geoMeshLoader->load(mFileName);
-
-		//	Reset the undo mesh.
-		mUndoMesh		=	new Mesh();
-		*mUndoMesh	=	*mGeoMesh;
-
-		//	Translate the MB count to a char value.
-		sprintf(char_value,
-				"MB %.3f",
-				(float)geoMeshLoader->getFileSize()/1024/1024);
-
-		mMB->label(char_value);
-
-		//	Visualize mesh.
-		geoMeshView->setMesh(mGeoMesh);
-
-		//	Hide right panel.
-		hideRightPanel();
-
-		//	Quit culling.
-		menuRenderCW->clear_value();
-		menuRenderCCW->clear_value();
-		geoMeshView->deactiveCW();
-		geoMeshView->deactiveCCW();
-
-		//	Deactive solid mode and wire.
-		menuRenderSolid->clear_value();
-		menuRenderWire->clear_value();
-		geoMeshView->deactiveSolid();
-		geoMeshView->deactiveWire();
-
-		//	Fit model in midle.
-		geoMeshView->fit();
-
-		//	Lighting smooth.
-		menuRenderFlat->clear_value();
-		menuRenderSmooth->set_value();
-		geoMeshView->smooth();
-
-		//	Show title.
-		mProcessTitle->label("Mesh Info");
-
-		//	Shows the mesh info.
-		showMeshInfo();
-
-		//	if the mesh is stripified.
-		geoMeshView->setStripColors();
-
-		//	Refresh geometry attributes.
-		refreshApplicationBar();
-	}
-	
+		mesh_loaded		=	geoMeshLoader->load(mFileName);
+
+		//	If no error happens.
+		if (mesh_loaded)
+		{
+			//	Identify the mesh that stores the leaves
+			idMeshLeaves	=	-1;
+
+			//	Delete	the current mesh.
+			delete	mGeoMesh;
+			delete	mUndoMesh;
+
+			//	Assigns mesh loaded.
+			mGeoMesh	=	mesh_loaded;
+			
+			//	Set Window Title.
+			strcpy(title,mFileName);
+			mMainWindow->label(strcat(title," - GeoTool"));
+
+			//	Stores the name of the mesh.
+			nombremesh	=	new char[255];
+			strcpy(nombremesh,mFileName);
+
+			//	Reset the undo mesh.
+			mUndoMesh		=	new Mesh();
+			*mUndoMesh	=	*mGeoMesh;
+
+			//	Translate the MB count to a char value.
+			sprintf(char_value,
+					"MB %.3f",
+					(float)geoMeshLoader->getFileSize()/1024/1024);
+
+			mMB->label(char_value);
+
+			//	Visualize mesh.
+			geoMeshView->setMesh(mGeoMesh);
+
+			//	Hide right panel.
+			hideRightPanel();
+
+			//	Quit culling.
+			menuRenderCW->clear_value();
+			menuRenderCCW->clear_value();
+			geoMeshView->deactiveCW();
+			geoMeshView->deactiveCCW();
+
+			//	Deactive solid mode and wire.
+			menuRenderSolid->clear_value();
+			menuRenderWire->clear_value();
+			geoMeshView->deactiveSolid();
+			geoMeshView->deactiveWire();
+
+			//	Fit model in midle.
+			geoMeshView->fit();
+
+			//	Lighting smooth.
+			menuRenderFlat->clear_value();
+			menuRenderSmooth->set_value();
+			geoMeshView->smooth();
+
+			//	Show title.
+			mProcessTitle->label("Mesh Info");
+
+			//	Shows the mesh info.
+			showMeshInfo();
+
+			//	if the mesh is stripified.
+			geoMeshView->setStripColors();
+
+			//	Refresh geometry attributes.
+			refreshApplicationBar();
+
+			//	Restore simplification state.
+			simplificationState	=	NO_SIMPLIFICATION;
+		}
+	}
 	//	Free memory.
 	delete	fcho;
+}
+
+//---------------------------------------------------------------------------
+//	If file exists.
+//---------------------------------------------------------------------------
+bool	GeoMeshViewUI::fileExists(const char	*fileNameMesh)
+{
+	FILE	*pFile;
+	
+	//	Open the mesh file.
+	pFile	=	fopen(fileNameMesh, "r");
+
+  if (pFile)
+	{
+		return	true;
+	}
+	else
+	{
+		return	false;
+	}
 }
 
@@ -2447,10 +2543,10 @@
 			{
 				fltk::Group* o;
-				o = MainView = new fltk::Group(0, 0, 500, 530);
+				o = MainView = new fltk::Group(0, 0, 570, 530);
 				o->begin();
 
 				{
 					fltk::InvisibleBox* o;
-					o = cframe = new fltk::InvisibleBox(0, 0, 500, 530);
+					o = cframe = new fltk::InvisibleBox(0, 0, 570, 530);
 					o->box(fltk::FLAT_BOX);
 					o->color((fltk::Color)0xffffff00);
@@ -2460,5 +2556,5 @@
 				{
 					GeoMeshView* o;
-					o = geoMeshView = new GeoMeshView(	0,0,500,530,0,this);
+					o = geoMeshView = new GeoMeshView(	0,0,570,530,0,this);
 				}
 
@@ -2471,5 +2567,5 @@
 			{
 				fltk::Group* o;
-				o = MainView = new fltk::Group(500, 0, 300, 530);
+				o = MainView = new fltk::Group(570, 0, 230, 530);
 				o->begin();
 
@@ -2477,5 +2573,5 @@
 					fltk::Button* o;
 					//o = mButtonProcess = new fltk::Button(665, 410, 73, 25, "Process");
-					o = mButtonProcess = new fltk::Button(65, 410, 73, 25, "Process");
+					o = mButtonProcess = new fltk::Button(75, 410, 73, 25, "Process");
 					o->callback((fltk::Callback*)cb_mButtonProcess);
 					o->hide();
@@ -2486,5 +2582,5 @@
 					fltk::ProgressBar* o;
 					//o = mProcessBar = new fltk::ProgressBar(616, 435, 175, 18);
-					o = mProcessBar = new fltk::ProgressBar(16, 435, 175, 18);
+					o = mProcessBar = new fltk::ProgressBar(16, 435, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2493,5 +2589,5 @@
 				{
 					fltk::Button* o;
-					o = mButtonSort = new fltk::Button(65, 375, 73, 25, "Sort");
+					o = mButtonSort = new fltk::Button(75, 375, 73, 25, "Sort");
 					o->callback((fltk::Callback*)cb_mButtonSort);
 					o->hide();
@@ -2501,5 +2597,5 @@
 				{
 					fltk::ProgressBar* o;
-					o = mSortBar = new fltk::ProgressBar(16, 390, 175, 18);
+					o = mSortBar = new fltk::ProgressBar(16, 390, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2508,5 +2604,5 @@
 				{
 					fltk::Button* o;
-					o = mButtonBuild = new fltk::Button(65, 455, 73, 25, "Build");
+					o = mButtonBuild = new fltk::Button(75, 455, 73, 25, "Build");
 					o->callback((fltk::Callback*)cb_mButtonBuild);
 					o->hide();
@@ -2516,5 +2612,5 @@
 				{
 					fltk::ProgressBar* o;
-					o = mBuildBar = new fltk::ProgressBar(16, 480, 175, 18);
+					o = mBuildBar = new fltk::ProgressBar(16, 480, 195, 18);
 					o->hide();
 					o->deactivate();
@@ -2564,5 +2660,5 @@
 
 				{
-					mProcessTitle		= new fltk::Widget(0, 0, 300, 25, "");
+					mProcessTitle		= new fltk::Widget(0, 0, 230, 25, "");
 					fltk::Widget* o	=	mProcessTitle;
 					o->set_vertical();
@@ -2629,5 +2725,5 @@
 
 				{
-					fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 300, 380);
+					fltk::Browser* o = mMeshInfo = new fltk::Browser(0, 20, 230, 380);
 					o->set_vertical();
 					o->callback((fltk::Callback*)cb_mMeshInfo);
@@ -2661,6 +2757,6 @@
 
 				{
-					fltk::Item* o = menuOpenSaveAs = new fltk::Item("Save As");
-					o->callback((fltk::Callback*)cb_menuOpenSaveAs);
+					fltk::Item* o = menuFileSaveAs = new fltk::Item("Save As");
+					o->callback((fltk::Callback*)cb_menuFileSaveAs);
 				}
 
@@ -2676,6 +2772,6 @@
 
 				{
-					fltk::Item* o = menuOpenQuit = new fltk::Item("Quit");
-					o->callback((fltk::Callback*)cb_menuOpenQuit);
+					fltk::Item* o = menuFileQuit = new fltk::Item("Quit");
+					o->callback((fltk::Callback*)cb_menuFileQuit);
 				}
 
Index: GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp
===================================================================
--- GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 985)
+++ GTP/trunk/Lib/Geom/shared/GeoTool/src/GeoMeshSaver.cpp	(revision 989)
@@ -1,12 +1,12 @@
-/*	==========================================================================
+/*==========================================================================
  *	(C) 2005 Universitat Jaume I
- *	==========================================================================
+ *==========================================================================
  *	PROYECT:	GAME TOOLS
- *	==========================================================================*/
-/**	CONTENT:	
-	*
-	*
-	*	@file	GeoMeshSaver.cpp
-/*===========================================================================*/
+ *==========================================================================*/
+/*	CONTENT:	
+ *
+ *
+ *	@file	GeoMeshSaver.cpp
+ *==========================================================================*/
 #include	<GeoMeshSaver.h>
 
@@ -14,18 +14,18 @@
 using	namespace	std;
 
-//------------------------------------------
+//---------------------------------------------------------------------------
 //		Public:
-//------------------------------------------
-
-////////////////////
-//	Constructors.	//
-////////////////////
+//---------------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
+//	Constructors.
+//---------------------------------------------------------------------------
 GeoMeshSaver::GeoMeshSaver()
 {
 }
 
-//////////////////
-//	Destroyer.	//
-//////////////////
+//---------------------------------------------------------------------------
+//	Destroyer.
+//---------------------------------------------------------------------------
 GeoMeshSaver::~GeoMeshSaver()
 {
@@ -33,5 +33,7 @@
 }
 
+//---------------------------------------------------------------------------
 //	Saves a Mesh into a file.
+//---------------------------------------------------------------------------
 int	GeoMeshSaver::save(Mesh	*geoMesh,	const	char	*fileNameMesh)
 {
