-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8b23c3
commit aef60f8
Showing
14 changed files
with
245 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Source/MounteaInventoryEquipment/Private/Definitions/MounteaInventoryItemsLibrary.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// // All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
|
||
#include "Definitions/MounteaInventoryItemsLibrary.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Source/MounteaInventoryEquipment/Public/Definitions/MounteaInventoryItemsLibrary.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// // All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Engine/DataAsset.h" | ||
#include "MounteaInventoryItemsLibrary.generated.h" | ||
|
||
/** | ||
* | ||
*/ | ||
UCLASS(BlueprintType, Blueprintable, EditInlineNew, ClassGroup="Mountea", DisplayName="Inventory Item Blueprints Library") | ||
class MOUNTEAINVENTORYEQUIPMENT_API UMounteaInventoryItemsLibrary : public UDataAsset | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
|
||
protected: | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ventoryEquipmentEditor/Private/AssetActions/FMounteaInventoryItemBlueprintAssetAction.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
#include "FMounteaInventoryItemBlueprintAssetAction.h" | ||
|
||
#include "Definitions/MounteaInventoryItemBlueprint.h" | ||
#include "Helpers/FMounteaInventoryEquipmentEditorConsts.h" | ||
|
||
#define LOCTEXT_NAMESPACE "FMounteaInventoryItemBlueprintAssetAction" | ||
|
||
FMounteaInventoryItemBlueprintAssetAction::FMounteaInventoryItemBlueprintAssetAction() | ||
{ | ||
} | ||
|
||
FText FMounteaInventoryItemBlueprintAssetAction::GetName() const | ||
{ | ||
return LOCTEXT("MounteaInventoryItemBlueprintAssetAction_Name", "Item Blueprint"); | ||
} | ||
|
||
FColor FMounteaInventoryItemBlueprintAssetAction::GetTypeColor() const | ||
{ | ||
return FColor::Yellow; | ||
} | ||
|
||
UClass* FMounteaInventoryItemBlueprintAssetAction::GetSupportedClass() const | ||
{ | ||
return UMounteaInventoryItemBlueprint::StaticClass(); | ||
} | ||
|
||
uint32 FMounteaInventoryItemBlueprintAssetAction::GetCategories() | ||
{ | ||
if (FModuleManager::Get().IsModuleLoaded("AssetTools")) | ||
{ | ||
return FAssetToolsModule::GetModule().Get().FindAdvancedAssetCategory(AdvancedMenuCategoryName); | ||
} | ||
|
||
return EAssetTypeCategories::Misc; | ||
} | ||
|
||
const TArray<FText>& FMounteaInventoryItemBlueprintAssetAction::GetSubMenus() const | ||
{ | ||
static const TArray<FText> AssetTypeActionSubMenu | ||
{ | ||
AdvancedMenuSubCategoryName_02 | ||
}; | ||
return AssetTypeActionSubMenu; | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE |
55 changes: 55 additions & 0 deletions
55
...InventoryEquipmentEditor/Private/AssetActions/FMounteaInventoryItemBlueprintAssetAction.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
#pragma once | ||
|
||
#include "AssetTypeActions_Base.h" | ||
#include "Utils/MounteaInventoryEquipmentEditorUtilities.h" | ||
|
||
class FMounteaInventoryItemBlueprintAssetAction : public FAssetTypeActions_Base | ||
{ | ||
public: | ||
|
||
FMounteaInventoryItemBlueprintAssetAction(); | ||
|
||
virtual FText GetName() const override; | ||
virtual FColor GetTypeColor() const override; | ||
virtual UClass* GetSupportedClass() const override; | ||
virtual uint32 GetCategories() override; | ||
|
||
virtual const TArray<FText>& GetSubMenus() const override; | ||
|
||
virtual bool CanFilter() override | ||
{ return false; }; | ||
|
||
virtual void BuildBackendFilter(FARFilter& InFilter) override | ||
{ | ||
FilterAddNativeParentClassPath(InFilter, GetSupportedClass()); | ||
|
||
// Add to filter all native children classes of our supported class | ||
TArray<UClass*> NativeChildClasses; | ||
TArray<UClass*> BlueprintChildClasses; | ||
FMounteaInventoryEquipmentEditorUtilities::GetAllChildClassesOf(GetSupportedClass(), NativeChildClasses, BlueprintChildClasses); | ||
for (const UClass* ChildNativeClass : NativeChildClasses) | ||
{ | ||
FilterAddNativeParentClassPath(InFilter, ChildNativeClass); | ||
} | ||
|
||
InFilter.ClassPaths.Add(UBlueprint::StaticClass()->GetClassPathName()); | ||
InFilter.bRecursiveClasses = true; | ||
}; | ||
|
||
static void FilterAddNativeParentClassPath(FARFilter& InFilter, const UClass* Class) | ||
{ | ||
if (Class == nullptr) | ||
{ | ||
return; | ||
} | ||
|
||
const FString Value = FString::Printf( | ||
TEXT("%s'%s'"), | ||
*UClass::StaticClass()->GetName(), | ||
*Class->GetPathName() | ||
); | ||
InFilter.TagsAndValues.Add(FBlueprintTags::NativeParentClassPath, Value); | ||
}; | ||
}; |
48 changes: 48 additions & 0 deletions
48
...ounteaInventoryEquipmentEditor/Private/Factories/MounteaInventoryItemBlueprintFactory.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
|
||
#include "MounteaInventoryItemBlueprintFactory.h" | ||
|
||
#include "Definitions/MounteaInventoryItemBlueprint.h" | ||
#include "Kismet2/KismetEditorUtilities.h" | ||
#include "Utils/MounteaInventoryEquipmentEditorUtilities.h" | ||
|
||
UMounteaInventoryItemBlueprintFactory::UMounteaInventoryItemBlueprintFactory() | ||
{ | ||
bCreateNew = true; | ||
bEditAfterNew = true; | ||
|
||
SupportedClass = UMounteaInventoryItemBlueprint::StaticClass(); | ||
} | ||
|
||
UObject* UMounteaInventoryItemBlueprintFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) | ||
{ | ||
if (ParentClass == nullptr) | ||
{ | ||
ParentClass = UMounteaInventoryItemBlueprint::StaticClass(); | ||
} | ||
|
||
// Something is not right! | ||
if (ParentClass == nullptr || !FKismetEditorUtilities::CanCreateBlueprintOfClass(ParentClass)) | ||
{ | ||
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(NSLOCTEXT("UnrealEd", "CannotCreateBlueprintFromClass", "Cannot create a blueprint based on the class '{0}'."), FText::FromString(ParentClass->GetName()))); | ||
return nullptr; | ||
} | ||
|
||
return NewObject<UMounteaInventoryItemBlueprint>(InParent, ParentClass, Name, Flags, Context); | ||
} | ||
|
||
bool UMounteaInventoryItemBlueprintFactory::ConfigureProperties() | ||
{ | ||
static const FText TitleText = FText::FromString(TEXT("Pick Parent Class for new Mountea Inventory Component")); | ||
ParentClass = nullptr; | ||
|
||
UClass* ChosenClass = nullptr; | ||
const bool bPressedOk = FMounteaInventoryEquipmentEditorUtilities::PickChildrenOfClass(TitleText, ChosenClass, SupportedClass); | ||
if (bPressedOk) | ||
{ | ||
ParentClass = ChosenClass; | ||
} | ||
|
||
return bPressedOk; | ||
} |
31 changes: 31 additions & 0 deletions
31
.../MounteaInventoryEquipmentEditor/Private/Factories/MounteaInventoryItemBlueprintFactory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// All rights reserved Dominik Morse (Pavlicek) 2024 | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Factories/Factory.h" | ||
#include "MounteaInventoryItemBlueprintFactory.generated.h" | ||
|
||
class UMounteaInventoryItemBlueprint; | ||
|
||
/** | ||
* | ||
*/ | ||
UCLASS() | ||
class MOUNTEAINVENTORYEQUIPMENTEDITOR_API UMounteaInventoryItemBlueprintFactory : public UFactory | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
|
||
UMounteaInventoryItemBlueprintFactory(); | ||
|
||
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override; | ||
virtual bool ConfigureProperties() override; | ||
|
||
private: | ||
// Holds the template of the class we are building | ||
UPROPERTY() | ||
TSubclassOf<UMounteaInventoryItemBlueprint> ParentClass; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters