Fix redirectors via python.

Hi everyone,

i found this

i needed to change I little the python script but it work for me

you need to create a simple plugin C++ to add the functionality to python

here the python updated

    #https://github.com/20tab/UnrealEnginePython/issues/712
    def fix_up_all_redirections(self):
        redirectors = []
        lst = unreal.EditorAssetLibrary.list_assets('/Game/', True, True)
        for path in lst:
            path = path.split(".")[0]
            if unreal.EditorAssetLibrary.does_directory_exist(path):
                continue
            if unreal.EditorAssetLibrary.does_asset_exist(path):
                asset_data = unreal.EditorAssetLibrary.find_asset_data(path)
                asset_class = str(asset_data.asset_class_path.asset_name )
                if (asset_class == 'ObjectRedirector'):
                    redirectors.append(path)

            
        redirector_list = [redirector for redirector in redirectors]
        print(redirector_list)
        unreal.LayeredMaterialLibrary.fixup_referencers(redirector_list)

BTW
Don’t forget to save everything after fix-up otherwise you lose all links after restart
unreal.EditorAssetLibrary.save_directory(‘/Game/’, False, True)

have a nice day.

1 Like