From edfef387c33be4dfd2c07cd097bc93daaecf433f Mon Sep 17 00:00:00 2001 From: Nick Darnell Date: Tue, 17 Jun 2014 17:47:12 -0400 Subject: [PATCH] UMG - Open to the designer by default, add canvas if no other widgets have been added. [CL 2108579 by Nick Darnell in Main branch] --- .../Private/AssetTypeActions_WidgetBlueprint.cpp | 2 +- Engine/Source/Editor/UMGEditor/Private/SUMGEditorTree.cpp | 2 +- .../Editor/UMGEditor/Private/WidgetBlueprintEditor.cpp | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Engine/Source/Editor/UMGEditor/Private/AssetTypeActions_WidgetBlueprint.cpp b/Engine/Source/Editor/UMGEditor/Private/AssetTypeActions_WidgetBlueprint.cpp index 27371c010679..de83aa56c55c 100644 --- a/Engine/Source/Editor/UMGEditor/Private/AssetTypeActions_WidgetBlueprint.cpp +++ b/Engine/Source/Editor/UMGEditor/Private/AssetTypeActions_WidgetBlueprint.cpp @@ -29,7 +29,7 @@ void FAssetTypeActions_WidgetBlueprint::OpenAssetEditor( const TArray& TArray Blueprints; Blueprints.Add(Blueprint); - NewBlueprintEditor->InitWidgetBlueprintEditor(Mode, EditWithinLevelEditor, Blueprints, ShouldUseDataOnlyEditor(Blueprint)); + NewBlueprintEditor->InitWidgetBlueprintEditor(Mode, EditWithinLevelEditor, Blueprints, true); //FBlueprintEditorModule& BlueprintEditorModule = FModuleManager::LoadModuleChecked( "Kismet" ); //TSharedRef< IBlueprintEditor > NewKismetEditor = BlueprintEditorModule.CreateBlueprintEditor( Mode, EditWithinLevelEditor, Blueprint, ShouldUseDataOnlyEditor(Blueprint) ); diff --git a/Engine/Source/Editor/UMGEditor/Private/SUMGEditorTree.cpp b/Engine/Source/Editor/UMGEditor/Private/SUMGEditorTree.cpp index 241b95a5038e..db1ccca910e2 100644 --- a/Engine/Source/Editor/UMGEditor/Private/SUMGEditorTree.cpp +++ b/Engine/Source/Editor/UMGEditor/Private/SUMGEditorTree.cpp @@ -68,7 +68,7 @@ void SUMGEditorTree::Construct(const FArguments& InArgs, TSharedPtrOnSelectedWidgetsChanged.AddRaw(this, &SUMGEditorTree::OnEditorSelectionChanged); - RefreshTree(); + bRefreshRequested = true; } SUMGEditorTree::~SUMGEditorTree() diff --git a/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintEditor.cpp b/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintEditor.cpp index f4f3f2737d5e..a79d8bbc17ca 100644 --- a/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintEditor.cpp +++ b/Engine/Source/Editor/UMGEditor/Private/WidgetBlueprintEditor.cpp @@ -76,6 +76,14 @@ void FWidgetBlueprintEditor::InitWidgetBlueprintEditor(const EToolkitMode::Type { InitBlueprintEditor(Mode, InitToolkitHost, InBlueprints, bShouldOpenInDefaultsMode); + UWidgetBlueprint* Blueprint = GetWidgetBlueprintObj(); + + // If this blueprint is empty, add a canvas panel as the root widget. + if ( Blueprint->WidgetTree->WidgetTemplates.Num() == 0 ) + { + Blueprint->WidgetTree->ConstructWidget(UCanvasPanel::StaticClass()); + } + UpdatePreview(GetWidgetBlueprintObj(), true); }