It looks like when reimporting a texture asset into the engine after loading a level, you will be confronted with the File Selection box and not the reimport successful notification. In fact if you open the Texture before the level loads you see the Import Option in the Texture Editor after which loading the map does not affect the asset, but if not opened the same texture will lose the Import Setting after loading the map.
Opening Texture Editor Before Loading Map:
[Image Removed]
Opening Texture Editor After Loading Map:
[Image Removed]
*Sample Project can be downloaded from Google Driver [Link Removed]*
From User:
A debug session showed that the SourceData variable in UAssetImportData for the broken assets wasn't set. This value is supposed to be set in the UAssetImportData::Serialize function. However, this function is not always being called.
Some more investigation showed that the reason Serialize is not called is that the RF_NeedLoad flag is is not set on the UAssetImportData object.
It was observed that the AssetImportData was loaded properly when it was used in a small level. The reason for the different behaviour is a branch in FLinkerLoad::CreateExport. Somewhere in the middle of the function there is the following piece of code:
if(FPlatformProperties::RequiresCookedData() || IsAsyncLoading() || Export.bForcedExport || LinkerRoot->ShouldFindExportsInMemoryFirst() )
Here we see a branch that is entered when AsyncLoading is enabled. In this branch the RF_NeedLoad flag is only being set under certain conditions:
if (!Export.Object->HasAnyFlags(RF_LoadCompleted) && (Export.Object->HasAnyFlags(RF_DefaultSubObject) || (ThisParent && ThisParent->HasAnyFlags(RF_ClassDefaultObject)))) { Export.Object->SetFlags(RF_NeedLoad | RF_NeedPostLoad | RF_NeedPostLoadSubobjects | RF_WasLoaded); }
At this point the only flag set on the UAssetImportData object is RF_Async.
In UTexture::PostInitProperties it can indeed be observed that the UAssetImportData is constructed without any flags.
At this point I am not sure how to properly solve the problem. I am pretty certain the RF_NeedLoad flag needs to be set on the UAssetImportData objects somehow. But I don't understand the system well enough to decide how that should be achieved.
RESULTS: The Normal Map will import withour File Selection, but the MRA Map will not import, it has lost its file source location.
EXPECTED: Both Textures keep their Source Locations on opening the map.
Head over to the existing Questions & Answers thread and let us know what's up.
1 |
Component | UE - Editor - Content Pipeline - Import and Export |
---|---|
Affects Versions | 4.10 |
Target Fix | 4.18 |
Created | Dec 15, 2015 |
---|---|
Resolved | Sep 5, 2017 |
Updated | Jun 23, 2018 |