Skip to content

Commit

Permalink
Merge pull request #82 from PlasticSCM/1003408-fix-small-icons-ue52
Browse files Browse the repository at this point in the history
Fix small status icons showing a checkboard in UE5.2
  • Loading branch information
juliomaqueda committed Jun 12, 2023
2 parents e0874ce + 801afbc commit 1cb8940
Showing 1 changed file with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "ISourceControlModule.h"
#if ENGINE_MAJOR_VERSION == 5
#include "Styling/AppStyle.h"
#if ENGINE_MINOR_VERSION >= 2
#include "RevisionControlStyle/RevisionControlStyle.h"
#endif
#endif

#define LOCTEXT_NAMESPACE "PlasticSourceControl.State"
Expand Down Expand Up @@ -211,6 +214,26 @@ FName FPlasticSourceControlState::GetSmallIconName() const

FSlateIcon FPlasticSourceControlState::GetIcon() const
{
#if ENGINE_MINOR_VERSION >= 2

if (!IsCurrent())
{
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.NotAtHeadRevision");
}
else if (WorkspaceState != EWorkspaceState::CheckedOutChanged && WorkspaceState != EWorkspaceState::CheckedOutUnchanged && WorkspaceState != EWorkspaceState::Conflicted)
{
if (IsCheckedOutOther())
{
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.CheckedOutByOtherUser", NAME_None, "RevisionControl.CheckedOutByOtherUserBadge");
}
else if (IsModifiedInOtherBranch())
{
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.ModifiedOtherBranch", NAME_None, "RevisionControl.ModifiedBadge");
}
}

#else

if (!IsCurrent())
{
return FSlateIcon(FAppStyle::GetAppStyleSetName(), "Perforce.NotAtHeadRevision");
Expand All @@ -227,7 +250,37 @@ FSlateIcon FPlasticSourceControlState::GetIcon() const
}
}

#if ENGINE_MINOR_VERSION >= 1 // UE5.1+
#endif

#if ENGINE_MINOR_VERSION >= 2 // UE5.2+

switch (WorkspaceState)
{
case EWorkspaceState::CheckedOutChanged:
case EWorkspaceState::CheckedOutUnchanged:
case EWorkspaceState::Replaced: // Merged (waiting for check-in)
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.CheckedOut");
case EWorkspaceState::Added:
case EWorkspaceState::Copied:
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.OpenForAdd");
case EWorkspaceState::Moved:
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.Branched");
case EWorkspaceState::Deleted:
case EWorkspaceState::LocallyDeleted:
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.MarkedForDelete");
case EWorkspaceState::Conflicted:
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.Conflicted");
case EWorkspaceState::Private: // Not controlled
case EWorkspaceState::Changed: // Changed but unchecked-out is in a certain way not controlled
return FSlateIcon(FRevisionControlStyleManager::GetStyleSetName(), "RevisionControl.NotInDepot");
case EWorkspaceState::Ignored:
case EWorkspaceState::Unknown:
case EWorkspaceState::Controlled: // Unchanged (not checked out) ie no icon
default:
return FSlateIcon();
}

#elif ENGINE_MINOR_VERSION >= 1 // UE5.1+

switch (WorkspaceState)
{
Expand Down

0 comments on commit 1cb8940

Please sign in to comment.