Description

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.

Steps to Reproduce
  1. Open the linked test project
  2. Open the Texture Editor for the Fern Leaf Normal Map (Texture2D'/Game/Textures/Foliage/Fern01_NRM.Fern01_NRM')
  3. Close the Texture Editor
  4. Open the Level01_Persistent01_Name01 Level (World'/Game/Maps/Level01_Name01/Level01_Persistent01_Name01.Level01_Persistent01_Name01')
  5. Attempt to reimport the Fern01_MRA Texture (Texture2D'/Game/Textures/Foliage/Fern01_MRA.Fern01_MRA')
  6. Cancel Import File Selection Window
  7. Open the Texture Editor for Fern01_MRA

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.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

1
Login to Vote

Fixed
Fix Commit3626655
Main Commit3628687
Release Commit3643070
CreatedDec 15, 2015
ResolvedSep 5, 2017
UpdatedJun 23, 2018
View Jira Issue