This commit is contained in:
2025-07-14 22:24:27 +08:00
parent daacc18ecf
commit 4af19ef574
7722 changed files with 72086 additions and 0 deletions

View File

@ -0,0 +1,48 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/// Copyright 2019 (C) Bruno Xavier B. Leite
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "IOBJPoolEditor.h"
#include "OBJPoolEditor.h"
#include "OBJPoolStyle.h"
#include "OBJPoolEditor_Shared.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define LOCTEXT_NAMESPACE "Synaptech"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void OBJPoolEditor::StartupModule() {
FOBJPoolStyle::Initialize();
//
IAssetTools &AssetTools = FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools").Get();
SY_AssetCategory = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT("Synaptech")),LOCTEXT("SynaptechCategory","Synaptech"));
//
{
TSharedRef<IAssetTypeActions> ACT_OBJP = MakeShareable(new FATA_OBJP); AssetTools.RegisterAssetTypeActions(ACT_OBJP);
TSharedRef<IAssetTypeActions> ACT_PWP = MakeShareable(new FATA_PWP); AssetTools.RegisterAssetTypeActions(ACT_PWP);
TSharedRef<IAssetTypeActions> ACT_CHP = MakeShareable(new FATA_CHP); AssetTools.RegisterAssetTypeActions(ACT_CHP);
TSharedRef<IAssetTypeActions> ACT_SHP = MakeShareable(new FATA_SHP); AssetTools.RegisterAssetTypeActions(ACT_SHP);
}
}
void OBJPoolEditor::ShutdownModule() {
FOBJPoolStyle::Shutdown();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
IMPLEMENT_MODULE(OBJPoolEditor,OBJPoolEditor);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,89 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/// Copyright 2019 (C) Bruno Xavier B. Leite
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "OBJPoolEditor.h"
#include "OBJPoolEditor_Shared.h"
#include "Kismet2/KismetEditorUtilities.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define LOCTEXT_NAMESPACE "Synaptech"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UOBJPoolFactory::UOBJPoolFactory(const class FObjectInitializer &OBJ) : Super(OBJ) {
SupportedClass = UObjectPool::StaticClass();
bEditAfterNew = true;
bCreateNew = true;
}
UObject* UOBJPoolFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) {
check(Class->IsChildOf(UObjectPool::StaticClass()));
return FKismetEditorUtilities::CreateBlueprint(Class,InParent,Name,BPTYPE_Normal,UBlueprint::StaticClass(),UBlueprintGeneratedClass::StaticClass(),TEXT("AssetTypeActions"));
}
FText FATA_OBJP::GetAssetDescription(const FAssetData &AssetData) const {
return FText::FromString(FString(TEXT("Blueprintable Object-Pool Component.")));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UPWPoolFactory::UPWPoolFactory(const class FObjectInitializer &OBJ) : Super(OBJ) {
SupportedClass = UPawnPool::StaticClass();
bEditAfterNew = true;
bCreateNew = true;
}
UObject* UPWPoolFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) {
check(Class->IsChildOf(UPawnPool::StaticClass()));
return FKismetEditorUtilities::CreateBlueprint(Class,InParent,Name,BPTYPE_Normal,UBlueprint::StaticClass(),UBlueprintGeneratedClass::StaticClass(),TEXT("AssetTypeActions"));
}
FText FATA_PWP::GetAssetDescription(const FAssetData &AssetData) const {
return FText::FromString(FString(TEXT("Blueprintable Pawn Object-Pool Component.")));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UCHPoolFactory::UCHPoolFactory(const class FObjectInitializer &OBJ) : Super(OBJ) {
SupportedClass = UCharacterPool::StaticClass();
bEditAfterNew = true;
bCreateNew = true;
}
UObject* UCHPoolFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) {
check(Class->IsChildOf(UCharacterPool::StaticClass()));
return FKismetEditorUtilities::CreateBlueprint(Class,InParent,Name,BPTYPE_Normal,UBlueprint::StaticClass(),UBlueprintGeneratedClass::StaticClass(),TEXT("AssetTypeActions"));
}
FText FATA_CHP::GetAssetDescription(const FAssetData &AssetData) const {
return FText::FromString(FString(TEXT("Blueprintable Character Object-Pool Component.")));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
USHPoolFactory::USHPoolFactory(const class FObjectInitializer &OBJ) : Super(OBJ) {
SupportedClass = USharedObjectPool::StaticClass();
bEditAfterNew = true;
bCreateNew = true;
}
UObject* USHPoolFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) {
check(Class->IsChildOf(USharedObjectPool::StaticClass()));
return FKismetEditorUtilities::CreateBlueprint(Class,InParent,Name,BPTYPE_Normal,UBlueprint::StaticClass(),UBlueprintGeneratedClass::StaticClass(),TEXT("AssetTypeActions"));
}
FText FATA_SHP::GetAssetDescription(const FAssetData &AssetData) const {
return FText::FromString(FString(TEXT("Blueprintable Shared-Pool Component.")));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#undef LOCTEXT_NAMESPACE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,75 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/// Copyright 2019 (C) Bruno Xavier B. Leite
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "OBJPoolStyle.h"
#include "Styling/SlateStyle.h"
#include "OBJPoolEditor_Shared.h"
#include "Interfaces/IPluginManager.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define PLUGIN_BRUSH(RelativePath,...) FSlateImageBrush(FOBJPoolStyle::InContent(RelativePath,TEXT(".png")),__VA_ARGS__)
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TSharedPtr<FSlateStyleSet> FOBJPoolStyle::StyleSet = nullptr;
TSharedPtr<ISlateStyle> FOBJPoolStyle::Get() {return StyleSet;}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
FString FOBJPoolStyle::InContent(const FString &RelativePath, const TCHAR* Extension) {
static FString Content = IPluginManager::Get().FindPlugin(TEXT("ObjectPool"))->GetContentDir();
return (Content/RelativePath)+Extension;
}
FName FOBJPoolStyle::GetStyleSetName() {
static FName StyleName(TEXT("OBJPoolStyle"));
return StyleName;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void FOBJPoolStyle::Initialize() {
if (StyleSet.IsValid()) {return;}
//
const FVector2D Icon16x16(16.f,16.f);
const FVector2D Icon128x128(128.f,128.f);
//
StyleSet = MakeShareable(new FSlateStyleSet(GetStyleSetName()));
StyleSet->SetContentRoot(IPluginManager::Get().FindPlugin(TEXT("ObjectPool"))->GetContentDir());
//
StyleSet->Set("ClassIcon.PawnPool", new PLUGIN_BRUSH(TEXT("Icons/Pawn_16x"),Icon16x16));
StyleSet->Set("ClassIcon.ObjectPool", new PLUGIN_BRUSH(TEXT("Icons/Pool_16x"),Icon16x16));
StyleSet->Set("ClassIcon.CharacterPool", new PLUGIN_BRUSH(TEXT("Icons/Character_16x"),Icon16x16));
StyleSet->Set("ClassIcon.SharedObjectPool", new PLUGIN_BRUSH(TEXT("Icons/Shared_16x"),Icon16x16));
StyleSet->Set("ClassIcon.PooledProjectile", new PLUGIN_BRUSH(TEXT("Icons/Projectile_16x"),Icon16x16));
StyleSet->Set("ClassIcon.PooledSplineProjectile", new PLUGIN_BRUSH(TEXT("Icons/SplineProjectile_16x"),Icon16x16));
//
StyleSet->Set("ClassThumbnail.PawnPool", new PLUGIN_BRUSH(TEXT("Icons/Pawn_128x"),Icon128x128));
StyleSet->Set("ClassThumbnail.ObjectPool", new PLUGIN_BRUSH(TEXT("Icons/Pool_128x"),Icon128x128));
StyleSet->Set("ClassThumbnail.CharacterPool", new PLUGIN_BRUSH(TEXT("Icons/Character_128x"),Icon128x128));
StyleSet->Set("ClassThumbnail.SharedObjectPool", new PLUGIN_BRUSH(TEXT("Icons/Shared_128x"),Icon128x128));
StyleSet->Set("ClassThumbnail.PooledProjectile", new PLUGIN_BRUSH(TEXT("Icons/Projectile_128x"),Icon128x128));
StyleSet->Set("ClassThumbnail.PooledSplineProjectile", new PLUGIN_BRUSH(TEXT("Icons/SplineProjectile_128x"),Icon128x128));
//
FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
};
void FOBJPoolStyle::Shutdown() {
if (StyleSet.IsValid()) {
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleSet.Get());
ensure(StyleSet.IsUnique());
StyleSet.Reset();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#undef PLUGIN_BRUSH
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,28 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
/// Copyright 2019 (C) Bruno Xavier B. Leite
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "Runtime/SlateCore/Public/Styling/SlateStyleRegistry.h"
#include "Runtime/SlateCore/Public/Styling/SlateStyle.h"
#include "Editor/UnrealEd/Public/ClassIconFinder.h"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class FOBJPoolStyle {
private:
static TSharedPtr<FSlateStyleSet> StyleSet;
static FString InContent(const FString &RelativePath, const TCHAR* Extension);
public:
static void Initialize();
static void Shutdown();
static FName GetStyleSetName();
static TSharedPtr<ISlateStyle> Get();
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////