Assets and Files with Duplicate Base Filenames Differing Only By Extension

I’m porting a bunch of code that works in a couple of other engines. Our artists have a large amount of existing content that works with this code. I want to make their content uassets… drag-able and drop-able in the Unreal editor. I’ve got a couple of problems.

  1. These pieces of content often have dependencies on each other, and they are named the same with only different file extensions. For example, “foo.midisong” internally references “foo.mid” and “foo.patch”. And “foo.patch” references “foo.wav”. All of those might be in the same directory. Best as I can tell, if I make UFactories for those file extensions, and drop a folder containing those 4 files in it into my game’s content directory things go a bit sideways. UnrealEd, seeing supported file types, notifies the user that there is content that can be imported. But… since all 4 files have the same base name, they all try to save to “foo.uasset”.

Am I missing something? Is there a way around this? I can’t really have the sound designers go change all of these names and the internal references. I’d have to a) write a tool, and then b) ask them to change their naming convention, and then c) write a tool that “linted” their authored content looking for cases where they forgot (b).

  1. I could just not make factories for the “sub-types.” In this example, only make a factory for “.midisong” and not for “.mid”, “.patch”, or “.wav”… but that doesn’t really help me, because Unreal supports “.wav” assets “out-of-the-box”… so it always notifies the user that they are available for import, and there is always the possibility they will “base-name-collide” with another asset in that directory.

Anyone got any ideas?

Thanks,

Hmmm, rock meet hard place. Ideally your content authors wouldn’t name everything the same as that causes no end of issues (as you are finding out). Hell, Windows hides extensions by default which would make things look like a mess in the first place.

The best way to probably handle this would make the import process rename the files (foo.wav becomes foo_Wav.uasset, foo.patch becomes foo_Patch.uasset, etc) and then fix up any references or calls to that data programmatically. Or, bite the bullet, write a tool that does that rename process (and does the renames/moves in Perforce or whatever source control you’re using), and then import everything.

Sad. I don’t know anyone that doesn’t turn off the “hide extension” option on Windows. The simple solution to this type of problem would have been to add the .uasset extension AFTER the original extension. foo.wav -> foo.wav.uasset, foo.patch -> foo.patch.uasset. Then everyone wins.

:frowning:

The problem with that approach is you could have some funkiness with systems that only expect one “.” followed by an extension and don’t start from the end of the string, so it thinks .wav.uasset is some unique datatype rather than just a .uasset. I think Perforce actually does that (or used to, maybe they fixed that).

Honestly, I would take the tool approach. You can write it pretty quick as a one off C# or Python script, get your data unique and setup - and then import it all.