When importing an asset like a Texture asset using the steps mentioned in the Repro steps, the imported asset does not have the correct relative path listed under the newly-created asset's "Source File" property. I noticed that this issue does not occur with assets imported in the Project/Content or Project/Plugins/Content directories, but only with the Engine and Engine Plugin directories.
After digging around a bit in the code, I believe the issue lies somewhere either in the UAssetImportData::SanitizeImportFilename, FPaths::MakePathRelativeTo, or FFileManagerGeneric::DefaultConvertToRelativePath functions. I have not had time to dive deeper into the issue, but I can update this thread should I find a more specific location where the problem lies.
I noticed this issue since we keep source files for our assets in a /ContentSource directory that mirrors that of the asset, which resides in the /Content directory. This pertains to Project, Project Plugin, Engine, and Engine Plugin content. I am working on creating a validator that validates an asset's source file is in its proper location. However, due to this bug where Engine and Engine Plugin assets have their source file relative paths incorrectly generated, the validator is blocked. Using FPaths::ConvertRelativePathToFull to convert the source file names into absolute, full paths ends up returning a janky result for content residing in Engine and Engine Plugins, all because the Engine and Engine Plugin assets have an incorrect source file path to begin with.
If this is not already a known issue, could this bug get ticketed? Is there a workaround that you can provide for us in the meantime so that our source files are properly generated in all of these scenarios?
1. In either the"Engine/Plugins/______/Content" directories, add a series of 3 nested folders so that an asset can be placed deep in the directory like so:
1. "Engine/Plugins/______/Content/Folder1/Folder2/Folder3/"
2. Then, create a "/ContentSource" folder that mirrors the directory you just created:
1. "Engine/Plugins/______/ContentSource/Folder1/Folder2/Folder3/Asset.uasset"
3. Have a PNG file residing in the "/ContentSource" directory like so:
1. "Engine/Plugins/______/ContentSource/Folder1/Folder2/Folder3/Image.png"
4. Import this PNG into the content browser, in the "/Content" directory. The newly created Texture asset should now be in this directory:
1. "Engine/Plugins/______/Content/Folder1/Folder2/Folder3/T_TextureAsset.uasset"
5. Now, either by hovering over the T_TextureAsset.uasset or by clicking into the texture asset, you will see that the "Source File" section has a relative source file path that is not relative to the current location of this newly created asset. It will look something like this:
1. "*../../Plugins/______/*ContentSource/Folder1/Folder2/Folder3/Image.png
2. This relative asset path is incorrect, as it should be "*../../../../*ContentSource/Folder1/Folder2/Folder3/Image.png"
All the steps above can be repeated but for an asset/sourceFile residing within Engine/Content, and a similar issue appears. This also happens for Static Mesh assets and Skeletal Mesh assets (potentially more, I have only worked with Texture and Static Mesh assets. I believe any assets that can be imported in this way will repro the issue).
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-231130 in the post.
0 |
Component | UE - Editor - Content Pipeline |
---|---|
Affects Versions | 5.4 |
Target Fix | 5.6 |
Created | Nov 21, 2024 |
---|---|
Updated | Nov 21, 2024 |