FUIStylePanel migra de TMap<EUIPanelTexture, FSlateBrush> (enum legacy) para TMap<FName, FSlateBrush>. Permite adicionar/remover categorias diretamente no DT_UI_Styles via dropdown (meta=GetOptions) sem mexer no enum em C++. PanelBackground, PanelOutline e PanelOutlineEffect viraram *_DEPRECATED. Versoes novas: PanelBackgroundByName, PanelOutlineByName, PanelOutlineEffectByName. PostSerialize migra os legacy -> ByName no PostLoad de cada FUIStyleRow. Apos o primeiro re-save no editor os deprecated ficam vazios e o codigo vira no-op. PropertyRedirects em DefaultEngine.ini preservam a leitura do asset antigo (3 entries: PanelBackground, PanelOutline, PanelOutlineEffect). Atualiza UIPanel_Base pra ler ByName + DT_UI_Styles, UI_Panel_Master e UI_PlayerStatus_Window resalvos. Inclui nova textura T_Panel_Outline_Effect_Square_02. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
108 lines
3.6 KiB
C++
108 lines
3.6 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "CommonUserWidget.h"
|
|
#include "UI/UIStyleTypes.h"
|
|
#include "UI/UIStyleTokens.h"
|
|
#include "UIPanel_Base.generated.h"
|
|
|
|
class UBorder;
|
|
|
|
/**
|
|
* Painel base do ZMMO — mesmo padrão do UUIButton_Base, mas container.
|
|
* Fundação CommonUI (UCommonUserWidget). Camada Abstract; o WBP concreto
|
|
* (UI_Panel_Master) herda DIRETO desta classe C++ (UMG não encadeia árvores
|
|
* de WBP — ver ARQUITETURA.md §3.3).
|
|
*
|
|
* Visual data-driven por FUIStyle.Panel (UZMMOThemeSubsystem). Designers
|
|
* injetam o conteúdo no NamedSlot "Content".
|
|
*/
|
|
UCLASS(Abstract, Blueprintable)
|
|
class ZMMO_API UUIPanel_Base : public UCommonUserWidget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
/**
|
|
* true = lê brushes da DT_UI_Styles (FUIStylePanel) — tema centralizado.
|
|
* false = ignora a DT e usa apenas `Panels` (brushes manuais no Details).
|
|
*/
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel")
|
|
bool bUseTheme = true;
|
|
|
|
// ---- Modo TEMA: chave FName do TMap FUIStylePanel pra cada Border. ----
|
|
//
|
|
// GetOptions popula dropdown lendo DT_UI_Styles row "Default" — adicione
|
|
// uma entry em FUIStylePanel.PanelBackgroundByName no DT e a categoria
|
|
// aparece aqui sem recompilar C++. Vazio = sem brush (NoDrawType).
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel",
|
|
meta = (EditCondition = "bUseTheme", EditConditionHides,
|
|
GetOptions = "GetPanelBackgroundOptions"))
|
|
FName BackgroundKey;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel",
|
|
meta = (EditCondition = "bUseTheme", EditConditionHides,
|
|
GetOptions = "GetPanelOutlineOptions"))
|
|
FName OutlineKey;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel",
|
|
meta = (EditCondition = "bUseTheme", EditConditionHides,
|
|
GetOptions = "GetPanelOutlineEffectOptions"))
|
|
FName OutlineEffectKey;
|
|
|
|
// ---- Modo MANUAL: 3 brushes editáveis direto no Details. ----
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Panel",
|
|
meta = (EditCondition = "!bUseTheme", EditConditionHides))
|
|
FUIPanelBrushSet Panels;
|
|
|
|
/** Re-resolve os tokens do tema ativo e reaplica no Background. */
|
|
UFUNCTION(BlueprintCallable, Category = "UI Style")
|
|
void RefreshUIStyle();
|
|
|
|
/**
|
|
* Populadores do dropdown (meta=GetOptions) das chaves de textura.
|
|
* Lêem DT_UI_Styles row "Default" e retornam as FName de cada sub-mapa
|
|
* do FUIStylePanel. Editar o DT no editor reflete aqui sem recompilar.
|
|
* São métodos de instância porque o UE precisa de UFUNCTION reflexável;
|
|
* o conteúdo não usa estado da instância (poderia ser estático).
|
|
*/
|
|
UFUNCTION()
|
|
TArray<FString> GetPanelBackgroundOptions() const;
|
|
|
|
UFUNCTION()
|
|
TArray<FString> GetPanelOutlineOptions() const;
|
|
|
|
UFUNCTION()
|
|
TArray<FString> GetPanelOutlineEffectOptions() const;
|
|
|
|
protected:
|
|
virtual void NativePreConstruct() override;
|
|
virtual void NativeConstruct() override;
|
|
virtual void NativeDestruct() override;
|
|
|
|
/** Hook opcional: o WBP pode estender/sobrescrever a aplicação visual. */
|
|
UFUNCTION(BlueprintImplementableEvent, Category = "UI Style",
|
|
meta = (DisplayName = "Apply Panel Style"))
|
|
void BP_ApplyPanelStyle(const FUIStylePanel& Panel);
|
|
|
|
/** Widgets visuais opcionais. */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UBorder> Background;
|
|
|
|
/** Contorno texturizado por cima do fundo (modo textura, padrão Hyper). */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UBorder> Outline;
|
|
|
|
/** Efeito sobre o contorno (glow/embossing/etc.) — pintado acima do Outline. */
|
|
UPROPERTY(meta = (BindWidgetOptional))
|
|
TObjectPtr<UBorder> OutlineEffect;
|
|
|
|
private:
|
|
UFUNCTION()
|
|
void HandleThemeChanged(FName NewThemeId);
|
|
|
|
bool bThemeBound = false;
|
|
};
|