@@ -1140,7 +1140,7 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
1140
1140
blobsProfiler .Log (blobsProfiler .L_DEBUG , " Module panel setup for module: " .. moduleName .. " (" .. luaState .. " )" )
1141
1141
1142
1142
local moduleTab = vgui .Create (usePanelType , statePanel )
1143
- statePanel :AddSheet ( moduleName , moduleTab , moduleData .Icon )
1143
+ local moduleSheet = statePanel :AddSheet ( moduleName , moduleTab , moduleData .Icon )
1144
1144
1145
1145
if luaState == " Client" and moduleData .UpdateRealmData and moduleData .PreloadClient then
1146
1146
blobsProfiler .Log (blobsProfiler .L_DEBUG , " Preloading client data for module: " .. moduleName )
@@ -1172,7 +1172,7 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
1172
1172
if not firstSubModule [moduleName ] then firstSubModule [moduleName ] = {name = subModuleName , data = subModuleData } end
1173
1173
1174
1174
local subModuleTab = vgui .Create (" DPanel" , moduleTab )
1175
- moduleTab :AddSheet ( subModuleName , subModuleTab , subModuleData .Icon )
1175
+ local subModuleSheet = moduleTab :AddSheet ( subModuleName , subModuleTab , subModuleData .Icon )
1176
1176
1177
1177
if luaState == " Client" and subModuleData .PreloadClient and subModuleData .UpdateRealmData then
1178
1178
blobsProfiler .Log (blobsProfiler .L_DEBUG , " Preloading client data for " .. moduleName .. " submodule: " .. subModuleName )
@@ -1225,6 +1225,34 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
1225
1225
subModuleData .ClientTab = subModuleTab
1226
1226
elseif luaState == " Server" then
1227
1227
subModuleData .ServerTab = subModuleTab
1228
+
1229
+ subModuleSheet .Tab .PaintOver = function (s ,w ,h )
1230
+ if blobsProfiler .Modules [moduleName ].childrenReceiving and blobsProfiler .Modules [moduleName ].childrenReceiving [moduleName .. " ." .. subModuleName ] then
1231
+ local recvTbl = blobsProfiler .Modules [moduleName ].childrenReceiving [moduleName .. " ." .. subModuleName ]
1232
+ local recvChunks = recvTbl .receivedChunks and # recvTbl .receivedChunks or 0
1233
+ local totChunks = recvTbl .totalChunks or 1
1234
+ local perc = recvChunks / totChunks
1235
+
1236
+ local dynamicH = (moduleTab .GetActiveTab and moduleTab :GetActiveTab () == s ) and h - 7 or h -- this is SO dumb
1237
+ local startY = (moduleTab .GetActiveTab and moduleTab :GetActiveTab () == s ) and 0 or 1
1238
+
1239
+ draw .RoundedBoxEx (4 , 0 , startY , perc * w , dynamicH , Color (255 ,255 ,0 ,50 ), true , true )
1240
+ elseif blobsProfiler .Modules [moduleName ].SubModules [subModuleName ].flashyUpdate then
1241
+ if (moduleTab .GetActiveTab and moduleTab :GetActiveTab () == s ) then -- TODO: DPanel subModuleTabs will never stop flashing
1242
+ blobsProfiler .Modules [moduleName ].SubModules [subModuleName ].flashyUpdate = nil
1243
+ return
1244
+ end
1245
+
1246
+ local flashState = math.floor (CurTime () / 0.35 ) % 2 == 0
1247
+
1248
+ if flashState then
1249
+ local dynamicH = (moduleTab .GetActiveTab and moduleTab :GetActiveTab () == s ) and h - 7 or h -- this is SO dumb
1250
+ local startY = (moduleTab .GetActiveTab and moduleTab :GetActiveTab () == s ) and 0 or 1
1251
+
1252
+ draw .RoundedBoxEx (4 , 0 , startY , w , dynamicH , Color (0 ,255 ,0 ,50 ), true , true )
1253
+ end
1254
+ end
1255
+ end
1228
1256
end
1229
1257
moduleTab :OnActiveTabChanged (nil , moduleTab :GetActiveTab ())
1230
1258
end
@@ -1285,6 +1313,38 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
1285
1313
moduleData .ClientTab = moduleTab
1286
1314
elseif luaState == " Server" then
1287
1315
moduleData .ServerTab = moduleTab
1316
+
1317
+ moduleSheet .Tab .PaintOver = function (s ,w ,h )
1318
+ -- 'Total' indicator progress bar of all submodules progress
1319
+ if blobsProfiler .Modules [moduleName ].childrenReceiving then
1320
+ local totRecv = 0
1321
+ local totChunks = 1
1322
+
1323
+ for moduleN , moduleRD in pairs (blobsProfiler .Modules [moduleName ].childrenReceiving ) do
1324
+ totRecv = totRecv + (moduleRD .receivedChunks and # moduleRD .receivedChunks or 0 )
1325
+ totChunks = totChunks + (moduleRD .totalChunks or 1 )
1326
+ end
1327
+
1328
+ local totalPerc = totRecv / totChunks
1329
+
1330
+ local dynamicH = (statePanel .GetActiveTab and statePanel :GetActiveTab () == s ) and h - 7 or h -- this is SO dumb
1331
+ local startY = (statePanel .GetActiveTab and statePanel :GetActiveTab () == s ) and 0 or 1
1332
+ draw .RoundedBoxEx (4 , 0 , startY , totalPerc * w , dynamicH , Color (255 ,255 ,0 ,50 ), true , true )
1333
+ elseif blobsProfiler .Modules [moduleName ].flashyUpdate then
1334
+ if (statePanel .GetActiveTab and statePanel :GetActiveTab () == s ) then -- TODO: DPanel subModuleTabs will never stop flashing
1335
+ blobsProfiler .Modules [moduleName ].flashyUpdate = nil
1336
+ return
1337
+ end
1338
+
1339
+ local flashState = math.floor (CurTime () / 0.35 ) % 2 == 0
1340
+
1341
+ if flashState then
1342
+ local dynamicH = (statePanel .GetActiveTab and statePanel :GetActiveTab () == s ) and h - 7 or h -- this is SO dumb
1343
+ local startY = (statePanel .GetActiveTab and statePanel :GetActiveTab () == s ) and 0 or 1
1344
+ draw .RoundedBoxEx (4 , 0 , startY , w , dynamicH , Color (0 ,255 ,0 ,50 ), true , true )
1345
+ end
1346
+ end
1347
+ end
1288
1348
end
1289
1349
end
1290
1350
@@ -1368,14 +1428,20 @@ local function handleSVDataUpdate(rawModuleName, dataTable)
1368
1428
blobsProfiler .Log (blobsProfiler .L_DEBUG , " requestData module: " .. rawModuleName )
1369
1429
1370
1430
if # moduleSplit == 2 then -- ew
1371
- subModule = moduleSplit [2 ]
1431
+ subModule = moduleSplit [2 ]
1432
+
1433
+ if blobsProfiler .Modules [moduleName ].childrenReceiving [moduleName .. " ." .. subModule ] then
1434
+ blobsProfiler .Modules [moduleName ].childrenReceiving [moduleName .. " ." .. subModule ] = nil
1435
+ end
1372
1436
end
1373
-
1437
+
1374
1438
if not subModule then
1375
1439
if blobsProfiler .Modules [moduleName ] then
1376
1440
blobsProfiler .SetRealmData (" Server" , moduleName , dataTable )
1377
1441
blobsProfiler .Modules [moduleName ].retrievingData = false
1378
1442
1443
+ blobsProfiler .Modules [moduleName ].flashyUpdate = true
1444
+
1379
1445
if blobsProfiler .Modules [moduleName ].BuildPanel then
1380
1446
blobsProfiler .Modules [moduleName ].BuildPanel (" Server" , blobsProfiler .Modules [moduleName ].ServerTab )
1381
1447
blobsProfiler .Log (blobsProfiler .L_DEBUG , " Module.BuildPanel completed for module " .. moduleName .. " (Server)" )
@@ -1386,6 +1452,9 @@ local function handleSVDataUpdate(rawModuleName, dataTable)
1386
1452
blobsProfiler .SetRealmData (" Server" , rawModuleName , dataTable )
1387
1453
blobsProfiler .Modules [moduleName ].SubModules [subModule ].retrievingData = false
1388
1454
1455
+ blobsProfiler .Modules [moduleName ].flashyUpdate = true
1456
+ blobsProfiler .Modules [moduleName ].SubModules [subModule ].flashyUpdate = true
1457
+
1389
1458
if blobsProfiler .Modules [moduleName ].SubModules [subModule ].BuildPanel then
1390
1459
blobsProfiler .Modules [moduleName ].SubModules [subModule ].BuildPanel (" Server" , blobsProfiler .Modules [moduleName ].SubModules [subModule ].ServerTab )
1391
1460
blobsProfiler .Log (blobsProfiler .L_DEBUG , " Module.BuildPanel completed for " .. moduleName .. " submodule " .. subModule .. " (Server)" )
@@ -1402,6 +1471,9 @@ net.Receive("blobsProfiler:requestData", function()
1402
1471
local currentChunk = net .ReadUInt (16 )
1403
1472
local chunkData = net .ReadData (blobsProfiler .svDataChunkSize )
1404
1473
1474
+ local moduleSplit = string .Explode (" ." , moduleName )
1475
+ local moduleParent = moduleSplit [1 ]
1476
+
1405
1477
if not blobsProfiler .chunkModuleData [moduleName ] then
1406
1478
blobsProfiler .chunkModuleData [moduleName ] = {
1407
1479
totalChunks = totalChunks ,
@@ -1415,11 +1487,21 @@ net.Receive("blobsProfiler:requestData", function()
1415
1487
1416
1488
table.insert (blobsProfiler .chunkModuleData [moduleName ].receivedChunks , chunkData )
1417
1489
1490
+ blobsProfiler .Modules [moduleParent ].childrenReceiving = blobsProfiler .Modules [moduleParent ].childrenReceiving or {}
1491
+ blobsProfiler .Modules [moduleParent ].childrenReceiving [moduleName ] = blobsProfiler .chunkModuleData [moduleName ]
1492
+
1418
1493
if # blobsProfiler .chunkModuleData [moduleName ].receivedChunks == totalChunks then
1419
1494
local fullData = table.concat (blobsProfiler .chunkModuleData [moduleName ].receivedChunks )
1420
1495
blobsProfiler .chunkModuleData [moduleName ] = util .JSONToTable (util .Decompress (fullData ))
1421
1496
1422
1497
handleSVDataUpdate (moduleName , blobsProfiler .chunkModuleData [moduleName ])
1498
+
1499
+ blobsProfiler .chunkModuleData [moduleName ] = nil
1500
+ blobsProfiler .Modules [moduleParent ].childrenReceiving [moduleName ] = nil
1501
+
1502
+ if table .Count (blobsProfiler .Modules [moduleParent ].childrenReceiving ) == 0 then
1503
+ blobsProfiler .Modules [moduleParent ].childrenReceiving = nil
1504
+ end
1423
1505
end
1424
1506
end )
1425
1507
0 commit comments