@@ -503,7 +503,10 @@ void LLFloaterModelPreview::onClickCalculateBtn()
503
503
mUploadModelUrl .clear ();
504
504
mModelPhysicsFee .clear ();
505
505
506
- gMeshRepo .uploadModel (mModelPreview ->mUploadData , mModelPreview ->mPreviewScale ,
506
+ lod_sources_map_t lod_sources;
507
+ fillLODSourceStatistics (lod_sources);
508
+
509
+ gMeshRepo .uploadModel (mModelPreview ->mUploadData , lod_sources, mModelPreview ->mPreviewScale ,
507
510
childGetValue (" upload_textures" ).asBoolean (),
508
511
upload_skinweights, upload_joint_positions, lock_scale_if_joint_position,
509
512
mUploadModelUrl , mDestinationFolderId , false ,
@@ -1317,8 +1320,84 @@ void LLFloaterModelPreview::createSmoothComboBox(LLComboBox* combo_box, float mi
1317
1320
std::string label = (++ilabel == SMOOTH_VALUES_NUMBER) ? " 10 (max)" : llformat (" %.1d" , ilabel);
1318
1321
combo_box->add (label, value, ADD_BOTTOM, true );
1319
1322
}
1323
+ }
1324
+
1325
+ std::string get_source_file_extr (const std::string& filename)
1326
+ {
1327
+ if (std::string::npos != filename.rfind (" .gltf" )
1328
+ || std::string::npos != filename.rfind (" .glb" ))
1329
+ {
1330
+ return " gltf" ;
1331
+ }
1332
+ else if (std::string::npos != filename.rfind (" .dae" ))
1333
+ {
1334
+ return " dae" ;
1335
+ }
1336
+ else if (std::string::npos != filename.rfind (" .slm" ))
1337
+ {
1338
+ return " slm" ;
1339
+ }
1340
+ else
1341
+ {
1342
+ return " unknown file" ;
1343
+ }
1344
+ }
1320
1345
1346
+ void LLFloaterModelPreview::fillLODSourceStatistics (LLFloaterModelPreview::lod_sources_map_t & lod_sources) const
1347
+ {
1348
+ lod_sources.clear ();
1321
1349
1350
+ // This doesn't nessesarily reflect the actual source of meshes, just user choices,
1351
+ // some meshes could have been matched from different lods, but should be good
1352
+ // enough for statistics.
1353
+ for (S32 lod = 0 ; lod <= LLModel::LOD_HIGH; ++lod)
1354
+ {
1355
+ const std::string &lod_string = lod_name[lod];
1356
+ if (mLODMode [lod] == LLModelPreview::USE_LOD_ABOVE)
1357
+ {
1358
+ lod_sources[lod_string] = " lod above" ;
1359
+ }
1360
+ else if (mLODMode [lod] == LLModelPreview::MESH_OPTIMIZER_AUTO
1361
+ || mLODMode [lod] == LLModelPreview::MESH_OPTIMIZER_PRECISE
1362
+ || mLODMode [lod] == LLModelPreview::MESH_OPTIMIZER_SLOPPY)
1363
+ {
1364
+ lod_sources[lod_string] = " generated" ;
1365
+ }
1366
+ else if (mLODMode [lod] == LLModelPreview::LOD_FROM_FILE)
1367
+ {
1368
+ const std::string& file = mModelPreview ->mLODFile [lod];
1369
+ lod_sources[lod_string] = get_source_file_extr (file);
1370
+ }
1371
+ else
1372
+ {
1373
+ lod_sources[lod_string] = " unknown source" ;
1374
+ }
1375
+ }
1376
+ if (mModelPreview ->mLODFile [LLModel::LOD_PHYSICS].empty ())
1377
+ {
1378
+ if (mModelPreview ->mPhysicsSearchLOD >= 0 && mModelPreview ->mPhysicsSearchLOD <= 3 )
1379
+ {
1380
+ lod_sources[" physics" ] = lod_name[mModelPreview ->mPhysicsSearchLOD ];
1381
+ }
1382
+ else
1383
+ {
1384
+ lod_sources[" physics" ] = " none" ;
1385
+ }
1386
+ }
1387
+ else
1388
+ {
1389
+ const std::string& file = mModelPreview ->mLODFile [LLModel::LOD_PHYSICS];
1390
+ if (std::string::npos == file.rfind (" cube.dae" ))
1391
+ {
1392
+ // There is a chance it will misfire if someone tries to upload a cube.dae mesh,
1393
+ // but should be negligible enough.
1394
+ lod_sources[" physics" ] = get_source_file_extr (file);
1395
+ }
1396
+ else
1397
+ {
1398
+ lod_sources[" physics" ] = " bounding box" ;
1399
+ }
1400
+ }
1322
1401
}
1323
1402
1324
1403
// -----------------------------------------------------------------------------
@@ -1656,7 +1735,10 @@ void LLFloaterModelPreview::onUpload(void* user_data)
1656
1735
mp->mModelPreview ->saveUploadData (upload_skinweights, upload_joint_positions, lock_scale_if_joint_position);
1657
1736
}
1658
1737
1659
- gMeshRepo .uploadModel (mp->mModelPreview ->mUploadData , mp->mModelPreview ->mPreviewScale ,
1738
+ lod_sources_map_t lod_sources;
1739
+ mp->fillLODSourceStatistics (lod_sources);
1740
+
1741
+ gMeshRepo .uploadModel (mp->mModelPreview ->mUploadData , lod_sources, mp->mModelPreview ->mPreviewScale ,
1660
1742
mp->childGetValue (" upload_textures" ).asBoolean (),
1661
1743
upload_skinweights, upload_joint_positions, lock_scale_if_joint_position,
1662
1744
mp->mUploadModelUrl , mp->mDestinationFolderId ,
0 commit comments