Add rename tool
This commit is contained in:
parent
6cc9565548
commit
384871f076
14 changed files with 305 additions and 0 deletions
BIN
Plugins/RenameTool/Content/Blueprints/EUW_RenameTool.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/RenameTool/Content/Blueprints/EUW_RenameTool.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/RenameTool/Content/Blueprints/LettersCaseEnum.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/RenameTool/Content/Blueprints/LettersCaseEnum.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/RenameTool/Content/Blueprints/RenameResultObject.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/RenameTool/Content/Blueprints/RenameResultObject.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Plugins/RenameTool/Content/Blueprints/WBP_RenameResult.uasset
(Stored with Git LFS)
Normal file
BIN
Plugins/RenameTool/Content/Blueprints/WBP_RenameResult.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
47
Plugins/RenameTool/README.md
Normal file
47
Plugins/RenameTool/README.md
Normal file
|
@ -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
|
34
Plugins/RenameTool/RenameTool.uplugin
Normal file
34
Plugins/RenameTool/RenameTool.uplugin
Normal file
|
@ -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
|
||||
}
|
||||
]
|
||||
}
|
BIN
Plugins/RenameTool/Resources/Icon128.png
(Stored with Git LFS)
Normal file
BIN
Plugins/RenameTool/Resources/Icon128.png
(Stored with Git LFS)
Normal file
Binary file not shown.
20
Plugins/RenameTool/Source/RenameTool/Private/RenameTool.cpp
Normal file
20
Plugins/RenameTool/Source/RenameTool/Private/RenameTool.cpp
Normal file
|
@ -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)
|
|
@ -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;
|
||||
}
|
|
@ -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<FContentBrowserModule>("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<FContentBrowserModule>("ContentBrowser");
|
||||
ContentBrowserModule.GetOnAssetSelectionChanged().Remove(AssetSelectionChangedDelegateHandle);
|
||||
}
|
||||
|
||||
if (GEditor)
|
||||
{
|
||||
GEditor->GetSelectedActors()->SelectionChangedEvent.Remove(ActorSelectionDelegateHandle);
|
||||
}
|
||||
}
|
15
Plugins/RenameTool/Source/RenameTool/Public/RenameTool.h
Normal file
15
Plugins/RenameTool/Source/RenameTool/Public/RenameTool.h
Normal file
|
@ -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;
|
||||
};
|
|
@ -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);
|
||||
};
|
27
Plugins/RenameTool/Source/RenameTool/Public/RenameToolBase.h
Normal file
27
Plugins/RenameTool/Source/RenameTool/Public/RenameToolBase.h
Normal file
|
@ -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();
|
||||
};
|
35
Plugins/RenameTool/Source/RenameTool/RenameTool.Build.cs
Normal file
35
Plugins/RenameTool/Source/RenameTool/RenameTool.Build.cs
Normal file
|
@ -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",
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue