Firstly, I am calling this rename function to update a list of uasset names. Here’s the order of operations:
AssetToolsModule.Get().RenameAssets(AssetsToRename);
FAssetRenameManager::RenameAssetsAndVariants()
FAssetRenameManager::FixReferencesAndRename()
const bool bUserAcceptedCheckout = CheckOutPackages(AssetsToRename, ReferencingPackagesToSave, bAutoCheckout);
Inside CheckOutPackages()
// If the checkout was declined (or failed), then fail the entire rename request
if (!bUserAcceptedCheckout)
{
for (FAssetRenameDataWithReferencers& AssetToRename : AssetsToRename)
{
if (!AssetToRename.bRenameFailed)
{
AssetToRename.bRenameFailed = true;
AssetToRename.FailureReason = LOCTEXT(“RenameFailedNotCheckedOutOrWritable”, “Not checked-out or writable.”);
}
}
}
Why does this function force the process to fail if it cannot checkout packages?
We have our own source control pipeline using python scripting and this hard-coded behavior is breaking our workflow.
After I call the rename function, I cleanup redirectors to delete the old uasset names. This also fails if it cannot checkout.
AssetToolsModule.Get().FixupReferencers(Redirectors, false, ERedirectFixupMode::DeleteFixedUpRedirectors);
FAssetFixUpRedirectors::ExecuteFixUp()
Inside ExecuteFixUp()
// Check out all referencing packages, leave redirectors for assets referenced by packages that are not checked out and remove those packages from the save list.
bool bUserAcceptedCheckout = true; // If source control is disabled, assume checkout was selected
if (ISourceControlModule::Get().IsEnabled() && ReferencingPackagesToSave.Num() > 0)
{
TArray<UPackage*> PackagesCheckedOutOrMadeWritable;
TArray<UPackage*> PackagesNotNeedingCheckout;
if (bCheckoutDialogPrompt)
{
bUserAcceptedCheckout = FEditorFileUtils::PromptToCheckoutPackages(false, ReferencingPackagesToSave.Array(), &PackagesCheckedOutOrMadeWritable, &PackagesNotNeedingCheckout);
}
else
{
const bool bErrorIfAlreadyCheckedOut = false;
const bool bConfirmPackageBranchCheckOutStatus = false;
FEditorFileUtils::CheckoutPackages(ReferencingPackagesToSave.Array(), &PackagesCheckedOutOrMadeWritable, bErrorIfAlreadyCheckedOut, bConfirmPackageBranchCheckOutStatus);
}
For both of these operations - RenameAssets() and FixupReferencers() - Could this behavior be sidestepped by an optional function parameter that allows us to perform the rename without the forced checkout?