Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Binaries/Win64/UnrealEditor-CustomShapeButton.dll
Binary file not shown.
Binary file modified Binaries/Win64/UnrealEditor-CustomShapeButton.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion Binaries/Win64/UnrealEditor.modules
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"BuildId": "37670630",
"BuildId": "43139311",
"Modules":
{
"CustomShapeButton": "UnrealEditor-CustomShapeButton.dll"
Expand Down
2 changes: 1 addition & 1 deletion CustomShapeButton.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "mailto:janseliw@gmail.com",
"EngineVersion": "5.5.0",
"EngineVersion": "5.6.0",
"EnabledByDefault": true,
"CanContainContent": false,
"IsBetaVersion": false,
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a href="https://github.com/JanSeliv/CustomShapeButton/blob/main/LICENSE">![License](https://img.shields.io/badge/license-MIT-brightgreen.svg)</a>
<a href="https://www.unrealengine.com/">![Unreal Engine](https://img.shields.io/badge/Unreal-5.5-dea309?style=flat&logo=unrealengine)</a>
<a href="https://www.unrealengine.com/">![Unreal Engine](https://img.shields.io/badge/Unreal-5.6-dea309?style=flat&logo=unrealengine)</a>

<br/>
<p align="center">
Expand Down Expand Up @@ -35,6 +35,8 @@ Detailed documentation about the Custom Shape Button can be found [here](https:/
Check out our [Release](https://github.com/JanSeliv/CustomShapeButton/releases) page for a sample project showcasing the Custom Shape Button plugin.

## 📅 Changelog
#### 2025-11-17
- Updated to **Unreal Engine 5.6**
#### 2025-06-27
- Updated to **Unreal Engine 5.5**
- [Bug] Fixed overlapping don't work on covered areas when stacked on top of each other: added `Overlap Order` setting for proper handing underlying buttons
Expand Down
2 changes: 1 addition & 1 deletion Source/CustomShapeButton/CustomShapeButton.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public CustomShapeButton(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
CppStandard = CppStandardVersion.Latest;
bEnableNonInlinedGenCppWarnings = true;
CppCompileWarningSettings.NonInlinedGenCppWarningLevel = WarningLevel.Error;

PublicDependencyModuleNames.AddRange(new[]
{
Expand Down
29 changes: 19 additions & 10 deletions Source/CustomShapeButton/Private/SCustomShapeButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,34 @@ void SCustomShapeButton::UpdateRawColors_Texture(const UTexture2D& Texture)

// Get Raw Colors data on Render thread
TWeakPtr<SCustomShapeButton> WeakThisPtr = StaticCastWeakPtr<SCustomShapeButton>(AsWeak());
checkf(WeakThisPtr.IsValid(), TEXT("ERROR: [%i] %hs:\n'WeakThis' is not valid!"), __LINE__, __FUNCTION__);
const TWeakObjectPtr<const UTexture2D> WeakTexture = &Texture;
const TWeakObjectPtr WeakTexture(&Texture);
const FIntRect TextureSize(0, 0, TextureRes.X, TextureRes.Y);
ENQUEUE_RENDER_COMMAND(TryUpdateRawColorsOnce)([WeakThisPtr, WeakTexture, TextureSize](FRHICommandListImmediate& RHICmdList)
{
SCustomShapeButton* This = WeakThisPtr.Pin().Get();
if (!ensureMsgf(This, TEXT("ASSERT: [%i] %hs:\n'This' is not valid!"), __LINE__, __FUNCTION__))
const UTexture2D* Texture2D = WeakTexture.Get();
const FTextureResource* TextureResource = Texture2D ? Texture2D->GetResource() : nullptr;
FRHITexture* RHITexture = TextureResource ? TextureResource->GetTexture2DRHI() : nullptr;
if (!ensureMsgf(RHITexture, TEXT("%hs: 'RHITexture' is not valid"), __FUNCTION__))
{
return;
}

const UTexture2D* Texture2D = WeakTexture.Get();
const FTextureResource* TextureResource = Texture2D ? Texture2D->GetResource() : nullptr;
FRHITexture* RHITexture = TextureResource ? TextureResource->GetTexture2DRHI() : nullptr;
if (ensureMsgf(RHITexture, TEXT("%hs: 'RHITexture' is not valid"), __FUNCTION__))
// Obtain data
TArray<FColor> OutColors;
RHICmdList.ReadSurfaceData(RHITexture, TextureSize, OutColors, FReadSurfaceDataFlags());
if (!ensureMsgf(!OutColors.IsEmpty(), TEXT("ASSERT: [%i] %hs:\n'OutColors' is empty, failed to read texture data!"), __LINE__, __FUNCTION__))
{
// Copy data to cache
RHICmdList.ReadSurfaceData(RHITexture, TextureSize, /*out*/This->RawColors, FReadSurfaceDataFlags());
return;
}

// Set the data on Game thread
AsyncTask(ENamedThreads::GameThread, [WeakThisPtr, TempColors = MoveTemp(OutColors)]() mutable -> void
{
if (SCustomShapeButton* This = WeakThisPtr.Pin().Get())
{
This->RawColors = MoveTemp(TempColors);
}
});
});
}

Expand Down