The TAPython devs were very helpful and did most of the work in making a script that automates wav file import and cue creation. Here’s the snippet that has an issue in UE4:
#2. load the create wave asset
assetWavCurrent = unreal.load_asset(strPathWavUE)
#3. create the cue asset from the loaded wave asset
factory = unreal.SoundCueFactoryNew()
factory.set_editor_property(“InitialSoundWaves”, [assetWavCurrent])
strPathCueUE = f’/Game/{strProjectName}cue/{os.path.dirname(strPathLocal)}'.replace(“\”, “/”)
strCue = os.path.basename(strPathWavCurrent).split(‘.’)[0] + ‘_CUE’
assetCueCurrent = asset_tools.create_asset(strCue, strPathCueUE, unreal.SoundCue, factory)
It works fine in UE5! But in EU4, the following line:
factory.set_editor_property(“InitialSoundWaves”, [assetWavCurrent])
Throws this error:
LogPython: Error: Exception: SoundCueFactoryNew: Property ‘InitialSoundWaves’ for attribute ‘InitialSoundWaves’ on ‘SoundCueFactoryNew’ is protected and cannot be set
I took a look at the Unreal documentation, but it’s non-existant. Just function and property names. No examples, no detail, no explanations on how to work with the python functions: unreal.SoundCueFactoryNew — Unreal Python 4.26 (Experimental) documentation
I tried changing the line to:
factory.set_editor_property(“InitialSoundWave”, [assetWavCurrent])
But it throws the same error for that property. What’s the proper way of using Python for wav & cue asset creation in UE4?