Hello,
I am working on automation for renaming assets via a python script.
I order to take care of fixing up the redirectors I had to expose the functionality via C++
I can now source it in Python and everything works fine, except for the ERedirectFixupMode argument.
I would like that the unused redirectors will be silently destroyed (in our case marked for delete in P4). That because I am planning to run the automation script headless, so I decided to use the DeleteFixedUpRedirectors enumerator element.
Unfortunatelly though UE still prompt me with the window that asks me whether I want to delete or keep the redirector files, which is the same than using the element PromptForDeletingRedirectors
Here below is reported the code.
Is it even possible to avoid the prompting of the confirmation window? If yes, how?
Thanks in advance and have you all a lovely day
Francesco
void UReferencesUtils::FixupReferencers(TArray<FString> ObjectPaths) {
// NOTE source code from FPathContextMenu::ExecuteFixUpRedirectorsInFolder
TArray<UObjectRedirector*> Redirectors;
for (auto ObjectPath : ObjectPaths) {
UObject* LoadedObject = LoadObject<UObject>(NULL, *ObjectPath, NULL, ELoadFlags::LOAD_None, NULL);
if (LoadedObject) {
auto Redirector = CastChecked<UObjectRedirector>(LoadedObject);
Redirectors.Add(Redirector);
}
}
// Load the asset tools module
// TODO: figure out if it is possible to not pass by the "delete unreferenced redirector" option
FAssetToolsModule& AssetToolsModule = FModuleManager::LoadModuleChecked<FAssetToolsModule>(TEXT("AssetTools"));
AssetToolsModule.Get().FixupReferencers(Redirectors, false, ERedirectFixupMode::PromptForDeletingRedirectors);
}
type or paste code here