We bake lights automatically every night for many of our levels - it results in a hug perforce sync for everyone every morning. I have been wondering if it is possible for the commandlet to detect whether a light bake is actually needed? If not, it could just exit. I tried the following, but it seems to always think a bake is not needed. I am not familiar enough with level loading and commandlets to know if this is possible. In the editor, there is a message onscreen indicating that a bake is needed - I was thinking to check the same indicators that that message uses to know if a bake is needed, inside the commandlet. Namely, (World->NumLightingUnbuiltObjects > 0). But in the commandlet it appears that NumLightingUnbuiltObjects is always 0...
Anyone know if this is possible and how I might go about doing it?
Thank you!
in UResavePackagesCommandlet::PerformAdditionalOperations:
if (bShouldBuildLighting)
{
GetRendererModule().UpdateMapNeedsLightingFullyRebuiltState(World);
bool bNeedBake \= (World\-\>NumLightingUnbuiltObjects \> 0\);
// also check for dirty packages
for (TActorIterator\<ANavigationData\> It(World); It; \+\+It)
{
UPackage\* Package \= It\-\>GetOutermost();
if (Package !\= nullptr \&\& Package\-\>IsDirty() \&\& !Package\-\>HasAnyFlags(RF\_Transient))
{
bNeedBake \= true;
break;
}
}
// Skip bake if lighting already up\-to\-date
if (bNeedBake)
{
… do the bake
}
else {
.. not needed, can skip it
}