diff --git a/Plugins/RenameTool/Content/Blueprints/EUW_RenameTool.uasset b/Plugins/RenameTool/Content/Blueprints/EUW_RenameTool.uasset new file mode 100644 index 0000000..40eadf0 --- /dev/null +++ b/Plugins/RenameTool/Content/Blueprints/EUW_RenameTool.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44509e531e89b0effa2bcbca8f4bdf4cba989f2be01d50aa94f325d2bd40eab8 +size 405982 diff --git a/Plugins/RenameTool/Content/Blueprints/LettersCaseEnum.uasset b/Plugins/RenameTool/Content/Blueprints/LettersCaseEnum.uasset new file mode 100644 index 0000000..1f6ad84 --- /dev/null +++ b/Plugins/RenameTool/Content/Blueprints/LettersCaseEnum.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a99e0f5fac87e0f1ff558570b9c7e999db2aded772e8fed827a75a13c8b31ff +size 2643 diff --git a/Plugins/RenameTool/Content/Blueprints/RenameResultObject.uasset b/Plugins/RenameTool/Content/Blueprints/RenameResultObject.uasset new file mode 100644 index 0000000..c148423 --- /dev/null +++ b/Plugins/RenameTool/Content/Blueprints/RenameResultObject.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c82202962677a28415f24165ecf21ff344775a0b1684c1382618fa6f8b2590ea +size 9790 diff --git a/Plugins/RenameTool/Content/Blueprints/WBP_RenameResult.uasset b/Plugins/RenameTool/Content/Blueprints/WBP_RenameResult.uasset new file mode 100644 index 0000000..955e001 --- /dev/null +++ b/Plugins/RenameTool/Content/Blueprints/WBP_RenameResult.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e0949d2070dc3962382f7ac411213ff6e6eb8d5179cf0cb7b1912fa25c7c694 +size 96115 diff --git a/Plugins/RenameTool/README.md b/Plugins/RenameTool/README.md new file mode 100644 index 0000000..e34049a --- /dev/null +++ b/Plugins/RenameTool/README.md @@ -0,0 +1,47 @@ +# Rename Tool + +Rename Tool Editor Plugin. Batch rename Assets and Actors easily. Change prefix, suffix, replace substring, modify letter case, add numbering and more. + +## Features + +Main features +- Rename assets in the Content Browser +- Rename Actors in the Level (World) +- Batch rename by selection +- Helper function library + +Rename features +- Add/remove Prefix +- Add/remove Suffix +- Replace substring +- Change letter case +- Add numbering + +## How to use + +1. In Project Settings/Plugins enable "Rename Tool" plugin +1. In the Content Browser navigate to Plugins/Rename Tool Content/Blueprints and, right click Run Editor Utility Widget +1. Right-click EUW_RenameTool and select "Run Editor Utility Widget" +1. Select assets in Content Browser and/or Actors in the Level +1. Set up Rename Details +1. (Optionally) Use the "Update Preview" button to see the rename result before executing +1. Click "Execute Rename on Selection" to rename the selected objects + +## Contents + +Code Modules: +- RenameTool (Editor) + +Number of Blueprints: 2 + +Number of C++ Classes: 2 + +Supported Development Platforms: Windows, MacOS + +Supported Target Build Platforms: All (Editor plugin) + +## Important/Additional Notes +- Full C++ source code included + +## Support +gamecoretools@gmail.com diff --git a/Plugins/RenameTool/RenameTool.uplugin b/Plugins/RenameTool/RenameTool.uplugin new file mode 100644 index 0000000..89f954f --- /dev/null +++ b/Plugins/RenameTool/RenameTool.uplugin @@ -0,0 +1,34 @@ +{ + "FileVersion": 3, + "Version": 1, + "VersionName": "1.1", + "FriendlyName": "Rename Tool", + "Description": "Rename Tool Editor Plugin. Batch rename Assets and Actors easily. Change prefix, suffix, replace substring, modify letter case, add numbering and more.", + "Category": "Game Core Tools", + "CreatedBy": "Game Core Tools", + "CreatedByURL": "", + "DocsURL": "", + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/c6e227383f754209ab1eeb294aa0f6d6", + "SupportURL": "", + "EngineVersion": "5.4.0", + "CanContainContent": true, + "Installed": true, + "Modules": [ + { + "Name": "RenameTool", + "Type": "Editor", + "LoadingPhase": "Default", + "PlatformAllowList": [ + "Win64", + "Mac", + "Linux" + ] + } + ], + "Plugins": [ + { + "Name": "EditorScriptingUtilities", + "Enabled": true + } + ] +} \ No newline at end of file diff --git a/Plugins/RenameTool/Resources/Icon128.png b/Plugins/RenameTool/Resources/Icon128.png new file mode 100644 index 0000000..11372e8 --- /dev/null +++ b/Plugins/RenameTool/Resources/Icon128.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5441cd5d6e0f6ec5c055f111d806b0209057e1bee9a58e8edc42950e443eeba9 +size 7230 diff --git a/Plugins/RenameTool/Source/RenameTool/Private/RenameTool.cpp b/Plugins/RenameTool/Source/RenameTool/Private/RenameTool.cpp new file mode 100644 index 0000000..8398aea --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Private/RenameTool.cpp @@ -0,0 +1,20 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#include "RenameTool.h" + +#define LOCTEXT_NAMESPACE "FRenameToolModule" + +void FRenameToolModule::StartupModule() +{ + // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module +} + +void FRenameToolModule::ShutdownModule() +{ + // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, + // we call this function before unloading the module. +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(FRenameToolModule, RenameTool) \ No newline at end of file diff --git a/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBPLibrary.cpp b/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBPLibrary.cpp new file mode 100644 index 0000000..12e4c48 --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBPLibrary.cpp @@ -0,0 +1,36 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#include "RenameToolBPLibrary.h" + + +FString URenameToolBPLibrary::RemovePrefix(const FString& Original, const FString& Prefix, ESearchCase::Type SearchCase) +{ + if(!Prefix.IsEmpty()) + { + if(Original.StartsWith(Prefix)) + { + FString LeftS; + FString RightS; + Original.Split(Prefix, &LeftS, &RightS, SearchCase, ESearchDir::FromStart); + return RightS; + } + } + + return Original; +} + +FString URenameToolBPLibrary::RemoveSuffix(const FString& Original, const FString& Suffix, ESearchCase::Type SearchCase) +{ + if(!Suffix.IsEmpty()) + { + if(Original.EndsWith(Suffix)) + { + FString LeftS; + FString RightS; + Original.Split(Suffix, &LeftS, &RightS, SearchCase, ESearchDir::FromEnd); + return LeftS; + } + } + + return Original; +} diff --git a/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBase.cpp b/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBase.cpp new file mode 100644 index 0000000..d0c078e --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Private/RenameToolBase.cpp @@ -0,0 +1,47 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#include "RenameToolBase.h" + +#include "ContentBrowserModule.h" +#include "SceneOutlinerDelegates.h" +#include "Engine/Selection.h" + +void URenameToolBase::NativeConstruct() +{ + Super::NativeConstruct(); + BindToOnSelectionChanged(); +} + +void URenameToolBase::NativeDestruct() +{ + UnBindAll(); + Super::NativeDestruct(); +} + +void URenameToolBase::BindToOnSelectionChanged() +{ + if (FModuleManager::Get().IsModuleLoaded("ContentBrowser")) + { + FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked("ContentBrowser"); + AssetSelectionChangedDelegateHandle = ContentBrowserModule.GetOnAssetSelectionChanged().AddUFunction(this, FName("OnSelectionChanged")); + } + + if (GEditor) + { + ActorSelectionDelegateHandle = GEditor->GetSelectedActors()->SelectionChangedEvent.AddUFunction(this, FName("OnSelectionChanged")); + } +} + +void URenameToolBase::UnBindAll() const +{ + if (FModuleManager::Get().IsModuleLoaded("ContentBrowser")) + { + FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked("ContentBrowser"); + ContentBrowserModule.GetOnAssetSelectionChanged().Remove(AssetSelectionChangedDelegateHandle); + } + + if (GEditor) + { + GEditor->GetSelectedActors()->SelectionChangedEvent.Remove(ActorSelectionDelegateHandle); + } +} diff --git a/Plugins/RenameTool/Source/RenameTool/Public/RenameTool.h b/Plugins/RenameTool/Source/RenameTool/Public/RenameTool.h new file mode 100644 index 0000000..669d431 --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Public/RenameTool.h @@ -0,0 +1,15 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "Modules/ModuleManager.h" + +class FRenameToolModule : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; +}; diff --git a/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBPLibrary.h b/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBPLibrary.h new file mode 100644 index 0000000..908c1fc --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBPLibrary.h @@ -0,0 +1,29 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "RenameToolBPLibrary.generated.h" + +class FString; +class UStaticMesh; + +/** + * + */ +UCLASS() +class RENAMETOOL_API URenameToolBPLibrary : public UBlueprintFunctionLibrary +{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Rename Tool") + static FString RemovePrefix( + const FString& Original, const FString& Prefix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase); + + UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Rename Tool") + static FString RemoveSuffix( + const FString& Original, const FString& Suffix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase); +}; diff --git a/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBase.h b/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBase.h new file mode 100644 index 0000000..e4d216a --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/Public/RenameToolBase.h @@ -0,0 +1,27 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "EditorUtilityWidget.h" +#include "RenameToolBase.generated.h" + +UCLASS(Abstract) +class RENAMETOOL_API URenameToolBase : public UEditorUtilityWidget +{ + GENERATED_BODY() + +protected: + virtual void NativeConstruct() override; + virtual void NativeDestruct() override; + + void BindToOnSelectionChanged(); + void UnBindAll() const; + +public: + FDelegateHandle AssetSelectionChangedDelegateHandle = FDelegateHandle(); + FDelegateHandle ActorSelectionDelegateHandle = FDelegateHandle(); + + UFUNCTION(BlueprintImplementableEvent) + void OnSelectionChanged(); +}; diff --git a/Plugins/RenameTool/Source/RenameTool/RenameTool.Build.cs b/Plugins/RenameTool/Source/RenameTool/RenameTool.Build.cs new file mode 100644 index 0000000..060bb78 --- /dev/null +++ b/Plugins/RenameTool/Source/RenameTool/RenameTool.Build.cs @@ -0,0 +1,35 @@ +// Copyright 2024 Game Core Tools. All Rights Reserved. + +using UnrealBuildTool; + +public class RenameTool : ModuleRules +{ + public RenameTool(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + "RenderCore", + "UnrealEd", + "StaticMeshDescription", + "MeshDescription", + "Blutility", + "UMG", + } + ); + + PrivateDependencyModuleNames.AddRange( + new string[] + { + "CoreUObject", + "Engine", + "Slate", + "SlateCore", + "SceneOutliner", + } + ); + } +}