Is there a way to fix up redirectors via python? Did a search for redirectors and came up with nothing useful.
+1. I have the same question.
@anonymous_user_6090db57 have you tried
unreal.AssetTools.rename_assets()
and
unreal.AssetRenameData
.
I haven’t, but they look promising. Nothing is mentioned about redirecting with those, so I hope they will work that out for you.
so I found a faint clue:
unreal.AssetData.is_redirector()
tells me that redirector is an asset itself. However, this makes me think that with Python scripting, redirection may not be as straightforward as it looks in the Editor: You would work through a bunch of “secondary” redirector assets to fix other assets. So some associations must be made bottom-up. Seems a daunting task to me…
any update with this ?
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.