Fixed bug in Generate LOD Lights when ymaps had no entities

This commit is contained in:
dexy 2019-01-22 10:03:28 +11:00
parent 38b9b8fc0a
commit 239ff7fd8e

View File

@ -111,7 +111,7 @@ namespace CodeWalker.Project.Panels
foreach (var ymap in projectYmaps) foreach (var ymap in projectYmaps)
{ {
if (ymap?.AllEntities == null) continue;
foreach (var ent in ymap.AllEntities) foreach (var ent in ymap.AllEntities)
{ {
if (ent.Archetype == null) continue; if (ent.Archetype == null) continue;
@ -253,6 +253,7 @@ namespace CodeWalker.Project.Panels
return; return;
} }
UpdateStatus("Creating new ymap files...");
var lodymap = new YmapFile(); var lodymap = new YmapFile();
var distymap = new YmapFile(); var distymap = new YmapFile();
@ -281,11 +282,11 @@ namespace CodeWalker.Project.Panels
lodymap._CMapData.entitiesExtentsMin = eemin; lodymap._CMapData.entitiesExtentsMin = eemin;
lodymap._CMapData.entitiesExtentsMax = eemax; lodymap._CMapData.entitiesExtentsMax = eemax;
lodymap._CMapData.streamingExtentsMin = semin - 1000f; lodymap._CMapData.streamingExtentsMin = semin - 1000f;
lodymap._CMapData.streamingExtentsMax = semax + 1000f; lodymap._CMapData.streamingExtentsMax = semax + 1000f; //vanilla = ~1km
distymap._CMapData.entitiesExtentsMin = eemin; distymap._CMapData.entitiesExtentsMin = eemin;
distymap._CMapData.entitiesExtentsMax = eemax; distymap._CMapData.entitiesExtentsMax = eemax;
distymap._CMapData.streamingExtentsMin = semin - 5000f; //make it huge distymap._CMapData.streamingExtentsMin = semin - 5000f; //make it huge
distymap._CMapData.streamingExtentsMax = semax + 5000f; distymap._CMapData.streamingExtentsMax = semax + 5000f; //vanilla = ~3km
lodymap.LODLights = ll; lodymap.LODLights = ll;
distymap.DistantLODLights = dl; distymap.DistantLODLights = dl;
@ -305,6 +306,9 @@ namespace CodeWalker.Project.Panels
lodymap._CMapData.parent = distymap._CMapData.name; lodymap._CMapData.parent = distymap._CMapData.name;
UpdateStatus("Adding new ymap files to project...");
ProjectForm.Invoke((MethodInvoker)delegate ProjectForm.Invoke((MethodInvoker)delegate
{ {
ProjectForm.AddYmapToProject(lodymap); ProjectForm.AddYmapToProject(lodymap);