Download

Iteration and editor map saving dilemma

Hi! I am running my code from inside Editor Blueprint. It opens map, does some modifications, saves it, opens another…

pseudo code:

for i to n do
{
load map i
alter map i
save map i
}

It all works fine, for example, is somewhere in the middle of this I use “Fbx Scene Load” dialog window task. But if not, then map simply is not saved, because when inside the loop, editor probably does not have enough time to update internally, mark itself as dirty or something like that.What is interesting, this level map save function nevers fails:



		const bool bPromptUserToSave = false;
		const bool bSaveMapPackages = true;
		const bool bSaveContentPackages = true;
		const bool bFastSave = false;
		const bool bNotifyNoPackagesSaved = false;
		const bool bCanBeDeclined = false;
		
		if (!FEditorFileUtils::SaveDirtyPackages(bPromptUserToSave, bSaveMapPackages, bSaveContentPackages, bFastSave, bNotifyNoPackagesSaved, bCanBeDeclined))
		{
			UE_LOG(LogTemp, Error, TEXT("WHELP WE WERE NOT SAVED!"));
			break;
		}


So, I started to digg in, but never came up with a solution. Probably Fbx Scene Load somehow runs in the background thread, which allows to exit from inside my for…to loop for a few frames, which results in map being properly loaded and set as dirty. Bot how can I do this without importing any kind of fbx file in the first place? Any ideas?