Skip to content

Commit

Permalink
Slot Content Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlicekdominik committed Oct 22, 2023
1 parent 9dd71e7 commit 6bc7c66
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Source/MounteaInventoryEquipment/Public/Settings/ContentTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,51 @@ class MOUNTEAINVENTORYEQUIPMENT_API UButtonTheme : public UContentTheme
FButtonStyle ButtonStyle;
};

/**
* USlotTheme
*
* This theme configuration is specifically crafted for inventory slots, enabling customization of various layers
* within each slot. A slot in inventory or UI systems often has multiple visual elements layered together to create
* a rich and interactive appearance. The USlotTheme offers a structured way to theme these layers, ensuring visual
* consistency across all slots in the application.
*
* The configuration covers the following layers:
* - Primary Slot Layer: This forms the base or background layer of the slot, often used for the main appearance.
* - Secondary Slot Layer: This sits atop the primary layer, possibly representing additional design elements or subtle details.
* - Tertiary Slot Layer: Another layer for decorative or functional purposes, such as hover effects or highlight states.
* - Quaternary Slot Layer: The top-most layer which can be used for special accents, borders, or additional overlays.
*
* Given its Blueprintable nature, designers can easily customize the look and feel of slots directly within the
* Blueprint Editor, facilitating quick iterations and real-time visual feedback. This level of customization ensures
* that slots in the application can be themed to match any desired aesthetic or design language.
*
* Usage:
* For any UI component or system that utilizes slots, apply an instance of this theme configuration to achieve the
* desired slot appearance. Combining multiple layers provides depth and richness to the slot design, enhancing
* user experience.
*
* @see UContentTheme
* @see UInventoryThemeConfig
*/
UCLASS( DisplayName="Slot Theme Config")
class MOUNTEAINVENTORYEQUIPMENT_API USlotTheme : public UContentTheme
{
GENERATED_BODY()

public:


UPROPERTY(EditAnywhere, Category="Slot Brush")
FSlateBrush PrimarySlotLayer;

UPROPERTY(EditAnywhere, Category="Slot Brush")
FSlateBrush SecondarySlotLayer;

UPROPERTY(EditAnywhere, Category="Slot Brush")
FSlateBrush TertiarySlotLayer;

UPROPERTY(EditAnywhere, Category="Slot Brush")
FSlateBrush QuaternarySlotLayer;
};

#undef LOCTEXT_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,33 @@ bool UCategoryThemeAssetFactory::ConfigureProperties()

return bPressedOk;
}

USlotThemeAssetFactory::USlotThemeAssetFactory()
{
bCreateNew = true;
bEditAfterNew = true;

SupportedClass = USlotTheme::StaticClass();
}

UObject* USlotThemeAssetFactory::FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn)
{
USlotTheme* NewTheme = NewObject<USlotTheme>(InParent, ParentClass, Name, Flags, Context);

return NewTheme;
}

bool USlotThemeAssetFactory::ConfigureProperties()
{
static const FText TitleText = FText::FromString(TEXT("Pick Parent Class for new Mountea Inventory Slot Theme"));

UClass* ChosenClass = nullptr;
const bool bPressedOk = FMounteaInventoryEquipmentEditorUtilities::PickChildrenOfClass(TitleText, ChosenClass, USlotTheme::StaticClass());

if ( bPressedOk )
{
ParentClass = ChosenClass;
}

return bPressedOk;
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ class MOUNTEAINVENTORYEQUIPMENTEDITOR_API UCategoryThemeAssetFactory : public UM

UCategoryThemeAssetFactory();

virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
virtual bool ConfigureProperties() override;
};

UCLASS()
class MOUNTEAINVENTORYEQUIPMENTEDITOR_API USlotThemeAssetFactory : public UMounteaContentThemeAssetFactory
{
GENERATED_BODY()

public:

USlotThemeAssetFactory();

virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
virtual bool ConfigureProperties() override;
};

0 comments on commit 6bc7c66

Please sign in to comment.