From 36cbbda965cffc5435d58211a81e218fdf875f40 Mon Sep 17 00:00:00 2001 From: daren cheng Date: Mon, 20 Sep 2021 18:38:24 -0400 Subject: [PATCH] Fix checkbox style on editor utility widgets. #jira UE-117887 #rb Vincent.Gauthier #preflight 6148f759315f54000134958f [CL 17576768 by daren cheng in ue5-main branch] --- .../Editor/Blutility/Classes/EditorUtilityWidget.h | 2 ++ .../Runtime/SlateCore/Public/Styling/SlateTypes.h | 10 ++++++++++ .../Source/Runtime/UMG/Private/Components/Button.cpp | 3 +++ .../Source/Runtime/UMG/Private/Components/CheckBox.cpp | 3 +++ .../UMG/Private/Components/CircularThrobber.cpp | 3 +++ .../Runtime/UMG/Private/Components/ComboBoxKey.cpp | 6 ++++++ .../Runtime/UMG/Private/Components/ComboBoxString.cpp | 3 +++ .../Runtime/UMG/Private/Components/EditableText.cpp | 3 +++ .../Runtime/UMG/Private/Components/EditableTextBox.cpp | 3 +++ .../Runtime/UMG/Private/Components/ExpandableArea.cpp | 3 +++ .../UMG/Private/Components/InputKeySelector.cpp | 3 +++ .../UMG/Private/Components/MultiLineEditableText.cpp | 3 +++ .../Private/Components/MultiLineEditableTextBox.cpp | 3 +++ .../Runtime/UMG/Private/Components/ProgressBar.cpp | 3 +++ .../Runtime/UMG/Private/Components/ScrollBar.cpp | 3 +++ .../Runtime/UMG/Private/Components/ScrollBox.cpp | 3 +++ .../Source/Runtime/UMG/Private/Components/Slider.cpp | 3 +++ .../Source/Runtime/UMG/Private/Components/SpinBox.cpp | 3 +++ .../Source/Runtime/UMG/Private/Components/Throbber.cpp | 3 +++ .../Source/Runtime/UMG/Private/Components/Widget.cpp | 4 ++++ .../Source/Runtime/UMG/Public/Blueprint/UserWidget.h | 3 +++ 21 files changed, 73 insertions(+) diff --git a/Engine/Source/Editor/Blutility/Classes/EditorUtilityWidget.h b/Engine/Source/Editor/Blutility/Classes/EditorUtilityWidget.h index d1ba8259fd1f..4bdaf377569a 100644 --- a/Engine/Source/Editor/Blutility/Classes/EditorUtilityWidget.h +++ b/Engine/Source/Editor/Blutility/Classes/EditorUtilityWidget.h @@ -39,6 +39,8 @@ public: return bAutoRunDefaultAction; } + virtual bool IsEditorUtility() const override { return true; } + protected: UPROPERTY(Category = Config, EditDefaultsOnly, BlueprintReadWrite, AssetRegistrySearchable) FString HelpText; diff --git a/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h b/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h index 512e5798f2bb..3afd41da449a 100644 --- a/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h +++ b/Engine/Source/Runtime/SlateCore/Public/Styling/SlateTypes.h @@ -262,7 +262,17 @@ struct SLATECORE_API FCheckBoxStyle : public FSlateWidgetStyle UndeterminedImage.UnlinkColors(); UndeterminedHoveredImage.UnlinkColors(); UndeterminedPressedImage.UnlinkColors(); + BackgroundImage.UnlinkColors(); + BackgroundHoveredImage.UnlinkColors(); + BackgroundPressedImage.UnlinkColors(); + ForegroundColor.Unlink(); + HoveredForeground.Unlink(); + PressedForeground.Unlink(); + CheckedForeground.Unlink(); + CheckedHoveredForeground.Unlink(); + CheckedPressedForeground.Unlink(); + UndeterminedForeground.Unlink(); BorderBackgroundColor.Unlink(); } }; diff --git a/Engine/Source/Runtime/UMG/Private/Components/Button.cpp b/Engine/Source/Runtime/UMG/Private/Components/Button.cpp index dc03ce651d71..bc8670679dd6 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/Button.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/Button.cpp @@ -44,6 +44,9 @@ UButton::UButton(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorButtonStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/CheckBox.cpp b/Engine/Source/Runtime/UMG/Private/Components/CheckBox.cpp index c1f5ab8c8f43..105530ef318f 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/CheckBox.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/CheckBox.cpp @@ -43,6 +43,9 @@ UCheckBox::UCheckBox(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorCheckboxStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/CircularThrobber.cpp b/Engine/Source/Runtime/UMG/Private/Components/CircularThrobber.cpp index 90e3e750833c..616f1fa38fc5 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/CircularThrobber.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/CircularThrobber.cpp @@ -44,6 +44,9 @@ UCircularThrobber::UCircularThrobber(const FObjectInitializer& ObjectInitializer if (IsEditorWidget()) { Image = *EditorCircularThrobberBrushStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxKey.cpp b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxKey.cpp index a1f0e9ad7f6b..b29c99f995f8 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxKey.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxKey.cpp @@ -22,6 +22,12 @@ UComboBoxKey::UComboBoxKey() const ISlateStyle& SlateStyle = IsEditorWidget() ? FCoreStyle::Get() : FUMGCoreStyle::Get(); WidgetStyle = SlateStyle.GetWidgetStyle("ComboBox"); ItemStyle = SlateStyle.GetWidgetStyle("TableView.Row"); + + if (IsEditorWidget()) + { + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); + } #else WidgetStyle = FUMGCoreStyle::Get().GetWidgetStyle("ComboBox"); ItemStyle = FUMGCoreStyle::Get().GetWidgetStyle("TableView.Row"); diff --git a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp index 9eab3ab88ba1..edf41e5bf730 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ComboBoxString.cpp @@ -63,6 +63,9 @@ UComboBoxString::UComboBoxString(const FObjectInitializer& ObjectInitializer) { WidgetStyle = *EditorComboBoxStyle; ItemStyle = *EditorComboBoxRowStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/EditableText.cpp b/Engine/Source/Runtime/UMG/Private/Components/EditableText.cpp index 5f1da01d1bf4..121d0b8055be 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/EditableText.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/EditableText.cpp @@ -44,6 +44,9 @@ UEditableText::UEditableText(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorEditableTextStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/EditableTextBox.cpp b/Engine/Source/Runtime/UMG/Private/Components/EditableTextBox.cpp index e6e45e50b2b1..ab66c0bd6e9b 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/EditableTextBox.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/EditableTextBox.cpp @@ -66,6 +66,9 @@ UEditableTextBox::UEditableTextBox(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorEditableTextBoxStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/ExpandableArea.cpp b/Engine/Source/Runtime/UMG/Private/Components/ExpandableArea.cpp index 838872158df5..1d17f64aa9d5 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ExpandableArea.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ExpandableArea.cpp @@ -69,6 +69,9 @@ UExpandableArea::UExpandableArea(const FObjectInitializer& ObjectInitializer) { Style = *EditorExpandableAreaStyle; BorderBrush = *EditorExpandableAreaBorderBrush; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/InputKeySelector.cpp b/Engine/Source/Runtime/UMG/Private/Components/InputKeySelector.cpp index f8e86289f1fd..fb4e03afb1ad 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/InputKeySelector.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/InputKeySelector.cpp @@ -62,6 +62,9 @@ UInputKeySelector::UInputKeySelector( const FObjectInitializer& ObjectInitialize { WidgetStyle = *EditorInputKeySelectorButtonStyle; TextStyle = *EditorInputKeySelectorTextStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableText.cpp b/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableText.cpp index d9fc84c8e8ac..0069953b9c72 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableText.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableText.cpp @@ -43,6 +43,9 @@ UMultiLineEditableText::UMultiLineEditableText(const FObjectInitializer& ObjectI if (IsEditorWidget()) { WidgetStyle = *EditorMultiLineEditableTextStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableTextBox.cpp b/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableTextBox.cpp index 8fae64e57336..f1b5b6021b74 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableTextBox.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/MultiLineEditableTextBox.cpp @@ -67,6 +67,9 @@ UMultiLineEditableTextBox::UMultiLineEditableTextBox(const FObjectInitializer& O { WidgetStyle = *EditorMultiLineEditableTextBoxStyle; TextStyle = *EditorMultiLineEditableTextBoxTextStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/ProgressBar.cpp b/Engine/Source/Runtime/UMG/Private/Components/ProgressBar.cpp index 6e6075f0374c..b936eedc3bdd 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ProgressBar.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ProgressBar.cpp @@ -40,6 +40,9 @@ UProgressBar::UProgressBar(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorProgressBarStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/ScrollBar.cpp b/Engine/Source/Runtime/UMG/Private/Components/ScrollBar.cpp index dda1e876ed97..c48d293a7775 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ScrollBar.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ScrollBar.cpp @@ -48,6 +48,9 @@ UScrollBar::UScrollBar(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorScrollBarStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR } diff --git a/Engine/Source/Runtime/UMG/Private/Components/ScrollBox.cpp b/Engine/Source/Runtime/UMG/Private/Components/ScrollBox.cpp index a06ef5a12e39..5ee2c0ab9cd4 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/ScrollBox.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/ScrollBox.cpp @@ -80,6 +80,9 @@ UScrollBox::UScrollBox(const FObjectInitializer& ObjectInitializer) { WidgetStyle = *EditorScrollBoxStyle; WidgetBarStyle = *EditorScrollBoxBarStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/Slider.cpp b/Engine/Source/Runtime/UMG/Private/Components/Slider.cpp index 347c0cabd83c..75135a8765d9 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/Slider.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/Slider.cpp @@ -52,6 +52,9 @@ USlider::USlider(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorSliderStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/SpinBox.cpp b/Engine/Source/Runtime/UMG/Private/Components/SpinBox.cpp index 5369e0e58873..97ede8060fc4 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/SpinBox.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/SpinBox.cpp @@ -61,6 +61,9 @@ USpinBox::USpinBox(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { WidgetStyle = *EditorSpinBoxStyle; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR diff --git a/Engine/Source/Runtime/UMG/Private/Components/Throbber.cpp b/Engine/Source/Runtime/UMG/Private/Components/Throbber.cpp index 559c32072a91..3302007bca97 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/Throbber.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/Throbber.cpp @@ -47,6 +47,9 @@ UThrobber::UThrobber(const FObjectInitializer& ObjectInitializer) if (IsEditorWidget()) { Image = *EditorThrobberBrush; + + // The CDO isn't an editor widget and thus won't use the editor style, call post edit change to mark difference from CDO + PostEditChange(); } #endif // WITH_EDITOR } diff --git a/Engine/Source/Runtime/UMG/Private/Components/Widget.cpp b/Engine/Source/Runtime/UMG/Private/Components/Widget.cpp index 9b3bb30c5464..77378b98d835 100644 --- a/Engine/Source/Runtime/UMG/Private/Components/Widget.cpp +++ b/Engine/Source/Runtime/UMG/Private/Components/Widget.cpp @@ -1089,6 +1089,10 @@ bool UWidget::IsEditorWidget() const { return WidgetBP->AllowEditorWidget(); } + else if (UUserWidget* UserWidget = Cast(WidgetBPObject)) + { + return UserWidget->IsEditorUtility(); + } } return false; diff --git a/Engine/Source/Runtime/UMG/Public/Blueprint/UserWidget.h b/Engine/Source/Runtime/UMG/Public/Blueprint/UserWidget.h index 250c7a532f08..bfdaf4ca81ba 100644 --- a/Engine/Source/Runtime/UMG/Public/Blueprint/UserWidget.h +++ b/Engine/Source/Runtime/UMG/Public/Blueprint/UserWidget.h @@ -846,6 +846,9 @@ public: UFUNCTION(BlueprintCallable, Category = Animation) void BindToAnimationEvent(UWidgetAnimation* Animation, FWidgetAnimationDynamicEvent Delegate, EWidgetAnimationEvent AnimationEvent, FName UserTag = NAME_None); + /** Is this widget an editor utility widget. */ + virtual bool IsEditorUtility() const { return false; } + protected: /**