@@ -330,6 +330,7 @@ void GatherGameObjectsFromPrefabsAndSave(string directoryPath, bool applyBoundin
330
330
"Entryway Objects" ,
331
331
"RoboTHOR_Assets_Environment"
332
332
} ;
333
+
333
334
string [ ] prefabFiles = GetFilesExcludingDirectories ( directoryPath , "*.prefab" , excludeDirectories ) ;
334
335
335
336
// Filter out prefabs that contain "Sliced" in their names
@@ -338,12 +339,6 @@ void GatherGameObjectsFromPrefabsAndSave(string directoryPath, bool applyBoundin
338
339
int assetsProcessed = 0 ;
339
340
foreach ( string prefabPath in prefabFiles )
340
341
{
341
- // skip if already exist
342
- //if (File.Exists(Path.Combine(savePath, GetRelativePath(assetPath, prefabPath).Replace(".prefab", ".obj"))))
343
- //{
344
- // Debug.Log("Skipping " + prefabPath);
345
- // continue;
346
- //}
347
342
348
343
string relativePrefabPath = GetRelativePath ( assetPath , prefabPath ) ;
349
344
Debug . Log ( "Prefab path: " + relativePrefabPath ) ;
@@ -430,8 +425,6 @@ void SaveEachAsset(GameObject go, string relativeExportPath, bool applyBoundingB
430
425
Debug . Log ( "No bounding box found for " + go . name ) ;
431
426
}
432
427
433
- //Debug.Log("saving mesh1" + center.ToString());
434
-
435
428
//SaveMeshes(relativeExportPath, meshFilters, center, applyBoundingBox, saveSubMeshes, saveSubMeshTransform, false);
436
429
if ( saveCombinedSubmeshes )
437
430
{
@@ -447,9 +440,6 @@ void SaveEachAsset(GameObject go, string relativeExportPath, bool applyBoundingB
447
440
) ;
448
441
}
449
442
450
-
451
- //Debug.Log("saving mesh2");
452
-
453
443
if ( ! skipMaterialExport )
454
444
{
455
445
Debug . Log ( "saving material" ) ;
@@ -557,16 +547,6 @@ public MeshData FillMeshData(MeshFilter meshfilter, string meshName, SimObjPhysi
557
547
}
558
548
}
559
549
560
- // foreach (ColliderInfo cInfo in meshData.primitiveColliders.myPrimitiveColliders)
561
- // {
562
- // if (cInfo.type == "mesh")
563
- // {
564
- // Debug.Log("Mesh Collider found on " + meshData.meshName + " clearing all colliders");
565
- // meshData.primitiveColliders.myPrimitiveColliders.Remove(cInfo);
566
- // break;
567
- // }
568
- // }
569
-
570
550
return meshData ;
571
551
}
572
552
@@ -875,19 +855,6 @@ private void AddCollidersRecursive(Transform sibling, ref MeshData meshData, Gam
875
855
}
876
856
}
877
857
878
- // private bool IsSimObjPhysicsFound(Transform target, GameObject reference)
879
- // {
880
- // // Return true if SimObjPhysics is found on the target or any descendant
881
- // if (target.GetComponent("SimObjPhysics") != null) return true;
882
-
883
- // foreach (Transform child in target)
884
- // {
885
- // if (IsSimObjPhysicsFound(child, reference)) return true;
886
- // }
887
-
888
- // return false;
889
- // }
890
-
891
858
public ColliderInfo GetColliderInfo ( Collider collider )
892
859
{
893
860
string colliderType = collider . GetType ( ) . Name . ToLower ( ) . Replace ( "collider" , "" ) ;
@@ -1340,6 +1307,8 @@ string ExportTexture(Texture2D t)
1340
1307
1341
1308
}
1342
1309
1310
+ //////////////// Alvaro Collider serialization Reference Code Below /////////////////////
1311
+
1343
1312
private static Dictionary < string , object > getJsonTransorm ( Transform transform ) {
1344
1313
return new Dictionary < string , object > ( ) {
1345
1314
{ "position" , transform . position } ,
@@ -1394,9 +1363,7 @@ public static Dictionary<string, object> getCollider(Collider c) {
1394
1363
{ "error" , "Null collider" }
1395
1364
} ;
1396
1365
}
1397
- // else if (c.GetType() == typeof(MeshRenderer)) {
1398
1366
1399
- // }
1400
1367
return co ;
1401
1368
}
1402
1369
@@ -1428,20 +1395,6 @@ public static void ExportProcthorPrimitiveColliders() {
1428
1395
else {
1429
1396
Debug . Log ( $ "----- Error duplicate key { sop . assetID } object name: { sop . objectID } , GO name: { sop . gameObject . name } , index: { i } " ) ;
1430
1397
}
1431
- // var jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(
1432
- // new Dictionary<string, object>() {
1433
- // {"colliders", colliders},
1434
- // {"assetId", sop.assetID}
1435
- // },
1436
- // Newtonsoft.Json.Formatting.None,
1437
- // new Newtonsoft.Json.JsonSerializerSettings() {
1438
- // ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
1439
- // ContractResolver = jsonResolver
1440
- // }
1441
- // );
1442
-
1443
- // Debug.Log($"st {jsonStr}");
1444
-
1445
1398
}
1446
1399
1447
1400
var jsonStr = Newtonsoft . Json . JsonConvert . SerializeObject (
@@ -1463,27 +1416,5 @@ public static void ExportProcthorPrimitiveColliders() {
1463
1416
1464
1417
file . Close ( ) ;
1465
1418
1466
- // using(StreamWriter writetext = new StreamWriter("write.txt"))
1467
- // {
1468
- // writetext.writeLine
1469
- // writetext.WriteLine("writing in text file");
1470
- // }
1471
-
1472
- // var colliderDict = m.ToDictionary(sop => (sop.assetID, new Dictionary<string, object>() {
1473
- // {"colliders", sop.MyColliders.Select(getCollider)},
1474
- // {"assetId", sop.assetID}
1475
- // }));
1476
-
1477
- // var jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(
1478
- // colliderDict,
1479
- // Newtonsoft.Json.Formatting.None,
1480
- // new Newtonsoft.Json.JsonSerializerSettings() {
1481
- // ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
1482
- // ContractResolver = jsonResolver
1483
- // }
1484
- // );
1485
-
1486
- // Debug.Log($"st {jsonStr}");
1487
-
1488
1419
}
1489
1420
}
0 commit comments