Hello!
When importing .mtlx files that contain textures with the same name (but different filepaths), only the first texture is imported.
This seems to be due to the function CreateTextureNode() in MaterialXSurfaceShaderAbstract.h:
Line 342:
if(MaterialX::InputPtr InputFile = Node->getInput("file"); InputFile && (InputFile->hasValue() || InputFile->hasInterfaceName()))
{
FString Filepath{ InputFile->hasValue() ? InputFile->getValueString().c_str() : InputFile->getInterfaceInput()->getValueString().c_str()};
const FString FilePrefix = GetFilePrefix(InputFile);
Filepath = FPaths::Combine(FilePrefix, Filepath);
const FString Filename = FPaths::GetCleanFilename(Filepath);
const FString TextureNodeUID = TEXT("\\Texture\\") + Filename;
//Only add the TextureNode once
TextureNode = const_cast<UInterchangeTexture2DNode*>(Cast<UInterchangeTexture2DNode>(NodeContainer.GetNode(TextureNodeUID)));
if(TextureNode == nullptr)
{
TextureNode = NewObject<TextureTypeNode>(&NodeContainer);
As scene above, the TextureNodeUID is made unique only by the clean filename of the texture. This means it will fail to generate the right number of nodes when your textures are organized:
../diffColor/texture.tif
../opacity/texture.tif
Would it be possible to support the above file structure? Or is there a work around that can be done?
Expected results:
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-264945 in the post.
0 |
Component | UE - Editor - Content Pipeline - Import and Export |
---|---|
Affects Versions | 5.5 |
Target Fix | 5.6 |
Fix Commit | 41522031 |
---|
Created | Apr 2, 2025 |
---|---|
Resolved | Apr 10, 2025 |
Updated | Apr 16, 2025 |