Batch rename UE4 assets

I would like to rename a lot of data on UE4 at one go. Is there any way to do it?

1 Like

There’s a plugin called MORT (Multiple Object Rename Tool) that’s indispensable for this.

The UE4’s Scripting the Editor using Python is the Unreal-way of batch renaming UE4 assets as it also rename the references properly.

After activating Python plugin, you can modify the following script:

Below is the script I used to rename all my animation assets under /Game/DynamicSwordAnimset/ with the ff. search/replace texts:

  1. eqip to equip (case-sensitive)

  2. Eqip to Equip (case-sensitive)

     import unreal
    

    asset_location = “/Game/DynamicSwordAnimset/”
    rename_dict = {
    “eqip”: “equip”
    , “Eqip”: “Equip”
    }

    with unreal.ScopedEditorTransaction(“Rename Script Transaction”) as trans:
    for replace_key in rename_dict:
    replace_with = rename_dict[replace_key]
    unreal.log("* Replace: {} → {}".format(replace_key, replace_with))
    asset_names = unreal.EditorAssetLibrary.list_assets(asset_location)
    for asset_name in asset_names:
    if replace_key in asset_name:
    new_name = asset_name.replace(replace_key, replace_with)
    unreal.log(" Renaming {} into {}".format(asset_name, new_name))
    unreal.EditorAssetLibrary.rename_asset(asset_name, new_name)
    unreal.log(“Done!”);
    Just replace asset_location with the asset location you want the script to search recursively. Then replace the eqip and Eqip with the search/replace text you want.

Save the script anywhere (though preferrably store it in your /Game/Content/Python). Then bring up your console command in UE4 editor and type py {your-python-script-location}

You’ll get the output similar below:

    LogPython:     Renaming /Game/DynamicSwordAnimset/BlendSpaces/Idle_Eqip_BS.Idle_Eqip_BS into /Game/DynamicSwordAnimset/BlendSpaces/Idle_Equip_BS.Idle_Equip_BS
    /Game/DynamicSwordAnimset/BlendSpaces/Idle_Equip_BS
    LogSavePackage: Moving '../../../../../../../UE4_Projects/YourUE4Proj/Saved/Idle_Equip_BS8DFFE8D14C05571D78469CB80BC2E6C1.tmp' to '../../../../../../../UE4_Projects/YourUE4Proj/Content/DynamicSwordAnimset/BlendSpaces/Idle_Equip_BS.uasset'
    LogUObjectHash: Compacting FUObjectHashTables data took   0.55ms
    LogUObjectHash: Compacting FUObjectHashTables data took   1.25ms
    LogUObjectHash: Compacting FUObjectHashTables data took   0.51ms
    LogPython:     Renaming /Game/DynamicSwordAnimset/BlendSpaces/Walk_Eqip_BS.Walk_Eqip_BS into /Game/DynamicSwordAnimset/BlendSpaces/Walk_Equip_BS.Walk_Equip_BS
    /Game/DynamicSwordAnimset/BlendSpaces/Walk_Equip_BS
    LogSavePackage: Moving '../../../../../../../UE4_Projects/YourUE4Proj/Saved/Walk_Equip_BS3A1CB7584D3BACEC9B189ABEA2A93660.tmp' to '../../../../../../../UE4_Projects/YourUE4Proj/Content/DynamicSwordAnimset/BlendSpaces/Walk_Equip_BS.uasset'
    LogUObjectHash: Compacting FUObjectHashTables data took   0.50ms
    LogUObjectHash: Compacting FUObjectHashTables data took   1.17ms
    LogUObjectHash: Compacting FUObjectHashTables data took   0.76ms
    LogPython: Done!
3 Likes

Thank you very much
informative

with ue4 4.22 u can create your own Editor widget.

Example Blueprint:

7 Likes

Yep, thanks!

Multi-Objects Renaming tool (MORT) is a simple editor improvement that adds one often used function to automate editing of tons actors\objects names (except folders) in the World Outliner and Content Browser.

Waiting for boxing day. :slight_smile: