// RadialSliceWidget.h // A single wedge of the radial menu. One of these exists per entry, each with // its own dynamic material instance. It knows its own angular span and whether // it is currently the hovered slice — nothing about its neighbours. #pragma once #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" #include "RadialSliceWidget.generated.h" class UImage; class UMaterialInstanceDynamic; UCLASS(Abstract) class URadialSliceWidget : public UUserWidget { GENERATED_BODY() public: // Called once when the slice is created. StartAngle/AngleSize are degrees, // clockwise from 12 o'clock; the material uses them to draw just this wedge. void Setup(UMaterialInterface* InSliceMaterial, float StartAngleDeg, float AngleSizeDeg, UTexture2D* Icon, bool bEnabled); // Smoothly animate this slice's highlight toward target (0 = off, 1 = on). // Called every tick by the container with the *undilated* delta. void UpdateHighlight(bool bIsHovered, float UndilatedDelta); protected: virtual void NativeConstruct() override; UPROPERTY(meta = (BindWidget)) TObjectPtr WedgeImage = nullptr; UPROPERTY(meta = (BindWidget)) TObjectPtr IconImage = nullptr; // Speed of the highlight ease. Higher = snappier. UPROPERTY(EditDefaultsOnly, Category = "Radial Menu") float HighlightInterpSpeed = 16.f; // Distance in px from the menu center to the icon, placing it on the slice's // centerline. Should sit between the material's InnerRadius and OuterRadius: // roughly (InnerRadius + OuterRadius) * 0.5 * MenuDiameter. UPROPERTY(EditDefaultsOnly, Category = "Radial Menu") float IconRadius = 164.f; private: UPROPERTY(Transient) TObjectPtr WedgeMID = nullptr; bool bSliceEnabled = true; float CurrentHighlight = 0.f; };