You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 2899855 on 2016/03/08 by Marc.Audy Merging //UE4/Dev-Main to Dev-Framework (//UE4/Dev-Framework) @ 2899785 Change2926689on 2016/03/29 by Jeff.Farris AAIController::SetFocus() will now implicitly clear any location focus at the same priority. UE-27975 #rb john.abercrombie Change 2926690 on 2016/03/29 by Jeff.Farris Using wildcard operator with the "KismetEvent" or "ke" console commands will now only trigger the event on objects in the world in which it was triggered. Prevents badness with running events on things like CDOs and editor actors. (UE-23106) Change 2926691 on 2016/03/29 by mason.seay Content for testing collision on scaled components Change 2926692 on 2016/03/29 by Jeff.Farris - FixupDeltaSeconds now considers time dilation when clamping. - Acceptable range for time dilation values is now a config parameter on WorldSettings - Acceptable range for undilated frame times is now a config parameter on WorldSettings (UE-27815) #rb marc.audy Change 2926711 on 2016/03/29 by Ori.Cohen Fix constraint rendering when scaling a cosntraint actor #JIRA UE-28691, UE-28700 #rb Lina.Halper Change 2926745 on 2016/03/29 by Lukasz.Furman navigation filters can now be instantiated per querier - usually AI agent required for FORT-21372 Change 2926789 on 2016/03/29 by Ori.Cohen Downgrade check to ensure for 2d physics during a hard shutdown #rb Michael.Noland Change 2926859 on 2016/03/29 by Ori.Cohen Fix red herring warnings of not locking physx scenes during hard shutdown. #JIRA UE-28747 #rb Michael.Noland Change 2927444 on 2016/03/30 by Thomas.Sarkanen Fixed Blueprint compiler errors when resetting timer handles Added basic support for 64-bit int/uint terms to Blueprint. This allows the use of opaque 64-bit integer types inside of BlueprintType structs, it in no way means that 64-bit ints are fully supported in Blueprint. Corrected a left-over formatting oversight when converting a FTimerHandle to a string. Added new by-ref "Clear and Invalidate Timer by Handle" function to Blueprint system library & deprecated old version. #rb Maciej.Mroz (and a few others!) #jira UE-28833 - Unresolved compiler error for B_Pickups blueprint in Fortnite Change 2927520 on 2016/03/30 by Jurre.deBaare Should not allow skeletal mesh components mobility to be set to static, but detach instead #fix Added CanHaveStaticMobility to SceneComponent class, and check this when trying to propogate Static mobility to parent component #jira UE-26364 Change 2927533 on 2016/03/30 by Jurre.deBaare Static Mesh Merge tool: when merging from multiple blueprints, fails to combine same materials #fix Material index remapping was part of if-clause where it shouldn't be #jira UE-23827 Static Mesh Merge tool, failed to combine physics data if using complex #fix Required copying the SectionInfoMap from source static meshes HLOD/MergeActor - Vertex Colours are not correctly propagated to negatively scaled meshes #fix had to re-order function calls #jira UE-28316 #rb James.Golding Change 2927535 on 2016/03/30 by Ori.Cohen Make sub-stepping run on game thread #JIRA UE-24011 #rb Gil.Gribb Change 2927537 on 2016/03/30 by Jurre.deBaare Warning message when HLOD mesh > 65536 vertices #jira UE-22365 #fix added messages when building proxy mesh Change 2927691 on 2016/03/30 by Jeff.Farris Fixed potential PlayerState leak (UE-22700) Change2927692on 2016/03/30 by Lina.Halper Allow it to select any name they want other than just restrict to what we have. - I think it may not be the best solution but with current widget built, you can't even clear name, which is problem. - Other solution is to add "Clear" as a name, and when that gets entered, we just clear it, but then the X button is odd and no purpose being there. - I think we should just allow them to choose if they don't like it but with suggestions. #rb: Ori.Cohen #jira UE-27786 #code review: Benn.Gallagher Change 2927853 on 2016/03/30 by Lina.Halper [CL 2944273 by Marc Audy in Main branch]
303 lines
9.8 KiB
C++
303 lines
9.8 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "EnvironmentQueryEditorPrivatePCH.h"
|
|
#include "GraphEditorActions.h"
|
|
#include "ScopedTransaction.h"
|
|
#include "EdGraphUtilities.h"
|
|
|
|
#include "EnvironmentQuery/EnvQuery.h"
|
|
#include "EnvironmentQuery/EnvQueryOption.h"
|
|
#include "EnvironmentQuery/EnvQueryGenerator.h"
|
|
|
|
#include "Toolkits/IToolkitHost.h"
|
|
#include "Editor/WorkspaceMenuStructure/Public/WorkspaceMenuStructureModule.h"
|
|
#include "Editor/PropertyEditor/Public/PropertyEditorModule.h"
|
|
#include "Editor/PropertyEditor/Public/IDetailsView.h"
|
|
#include "SDockTab.h"
|
|
#include "GenericCommands.h"
|
|
|
|
#define LOCTEXT_NAMESPACE "EnvironmentQueryEditor"
|
|
|
|
const FName FEnvironmentQueryEditor::EQSUpdateGraphTabId( TEXT( "EnvironmentQueryEditor_UpdateGraph" ) );
|
|
const FName FEnvironmentQueryEditor::EQSPropertiesTabId( TEXT( "EnvironmentQueryEditor_Properties" ) );
|
|
|
|
void FEnvironmentQueryEditor::RegisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
{
|
|
WorkspaceMenuCategory = InTabManager->AddLocalWorkspaceMenuCategory(LOCTEXT("WorkspaceMenu_EnvironmentQueryEditor", "Environment Query Editor"));
|
|
auto WorkspaceMenuCategoryRef = WorkspaceMenuCategory.ToSharedRef();
|
|
|
|
FAssetEditorToolkit::RegisterTabSpawners(InTabManager);
|
|
|
|
InTabManager->RegisterTabSpawner( EQSUpdateGraphTabId, FOnSpawnTab::CreateSP(this, &FEnvironmentQueryEditor::SpawnTab_UpdateGraph) )
|
|
.SetDisplayName( NSLOCTEXT("EnvironmentQueryEditor", "Graph", "Graph") )
|
|
.SetGroup(WorkspaceMenuCategoryRef)
|
|
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "GraphEditor.EventGraph_16x"));
|
|
|
|
InTabManager->RegisterTabSpawner( EQSPropertiesTabId, FOnSpawnTab::CreateSP(this, &FEnvironmentQueryEditor::SpawnTab_Properties) )
|
|
.SetDisplayName( NSLOCTEXT("EnvironmentQueryEditor", "PropertiesTab", "Details" ) )
|
|
.SetGroup(WorkspaceMenuCategoryRef)
|
|
.SetIcon(FSlateIcon(FEditorStyle::GetStyleSetName(), "LevelEditor.Tabs.Details"));
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::UnregisterTabSpawners(const TSharedRef<class FTabManager>& InTabManager)
|
|
{
|
|
FAssetEditorToolkit::UnregisterTabSpawners(InTabManager);
|
|
|
|
InTabManager->UnregisterTabSpawner( EQSPropertiesTabId );
|
|
InTabManager->UnregisterTabSpawner( EQSUpdateGraphTabId );
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::InitEnvironmentQueryEditor( const EToolkitMode::Type Mode, const TSharedPtr< class IToolkitHost >& InitToolkitHost, UEnvQuery* InScript )
|
|
{
|
|
SelectedNodesCount = 0;
|
|
Query = InScript;
|
|
check(Query != NULL);
|
|
|
|
TSharedRef<FTabManager::FLayout> StandaloneDefaultLayout = FTabManager::NewLayout( "Standalone_EnvironmentQuery_Layout" )
|
|
->AddArea
|
|
(
|
|
FTabManager::NewPrimaryArea() ->SetOrientation(Orient_Vertical)
|
|
->Split
|
|
(
|
|
FTabManager::NewStack()
|
|
->SetSizeCoefficient(0.1f)
|
|
->AddTab(GetToolbarTabId(), ETabState::OpenedTab)
|
|
->SetHideTabWell( true )
|
|
)
|
|
->Split
|
|
(
|
|
FTabManager::NewSplitter() ->SetOrientation(Orient_Horizontal)
|
|
->Split
|
|
(
|
|
FTabManager::NewStack()
|
|
->SetSizeCoefficient(0.7f)
|
|
->AddTab( EQSUpdateGraphTabId, ETabState::OpenedTab )
|
|
)
|
|
->Split
|
|
(
|
|
FTabManager::NewStack()
|
|
->SetSizeCoefficient(0.3f)
|
|
->AddTab( EQSPropertiesTabId, ETabState::OpenedTab )
|
|
)
|
|
)
|
|
);
|
|
|
|
const bool bCreateDefaultStandaloneMenu = true;
|
|
const bool bCreateDefaultToolbar = true;
|
|
FAssetEditorToolkit::InitAssetEditor( Mode, InitToolkitHost, FEnvironmentQueryEditorModule::EnvironmentQueryEditorAppIdentifier, StandaloneDefaultLayout, bCreateDefaultStandaloneMenu, bCreateDefaultToolbar, Query );
|
|
|
|
FEnvironmentQueryEditorModule& EnvironmentQueryEditorModule = FModuleManager::LoadModuleChecked<FEnvironmentQueryEditorModule>( "EnvironmentQueryEditor" );
|
|
AddMenuExtender(EnvironmentQueryEditorModule.GetMenuExtensibilityManager()->GetAllExtenders(GetToolkitCommands(), GetEditingObjects()));
|
|
|
|
RegenerateMenusAndToolbars();
|
|
|
|
// Update BT asset data based on saved graph to have correct data in editor
|
|
TSharedPtr<SGraphEditor> UpdateGraphEditor = UpdateGraphEdPtr.Pin();
|
|
if (UpdateGraphEditor.IsValid() && UpdateGraphEditor->GetCurrentGraph() != NULL)
|
|
{
|
|
//let's find root node
|
|
UEnvironmentQueryGraph* EQSGraph = Cast<UEnvironmentQueryGraph>(UpdateGraphEditor->GetCurrentGraph());
|
|
EQSGraph->UpdateAsset();
|
|
}
|
|
}
|
|
|
|
FName FEnvironmentQueryEditor::GetToolkitFName() const
|
|
{
|
|
return FName("Environment Query");
|
|
}
|
|
|
|
FText FEnvironmentQueryEditor::GetBaseToolkitName() const
|
|
{
|
|
return NSLOCTEXT("EnvironmentQueryEditor", "AppLabel", "EnvironmentQuery");
|
|
}
|
|
|
|
FString FEnvironmentQueryEditor::GetWorldCentricTabPrefix() const
|
|
{
|
|
return NSLOCTEXT("EnvironmentQueryEditor", "WorldCentricTabPrefix", "EnvironmentQuery ").ToString();
|
|
}
|
|
|
|
|
|
FLinearColor FEnvironmentQueryEditor::GetWorldCentricTabColorScale() const
|
|
{
|
|
return FLinearColor( 0.0f, 0.0f, 0.2f, 0.5f );
|
|
}
|
|
|
|
|
|
/** Create new tab for the supplied graph - don't call this directly, call SExplorer->FindTabForGraph.*/
|
|
TSharedRef<SGraphEditor> FEnvironmentQueryEditor::CreateGraphEditorWidget(UEdGraph* InGraph)
|
|
{
|
|
check(InGraph != NULL);
|
|
|
|
// Create the appearance info
|
|
FGraphAppearanceInfo AppearanceInfo;
|
|
AppearanceInfo.CornerText = NSLOCTEXT("EnvironmentQueryEditor", "AppearanceCornerText", "ENVIRONMENT QUERY");
|
|
|
|
SGraphEditor::FGraphEditorEvents InEvents;
|
|
InEvents.OnSelectionChanged = SGraphEditor::FOnSelectionChanged::CreateSP(this, &FEnvironmentQueryEditor::OnSelectedNodesChanged);
|
|
|
|
CreateCommandList();
|
|
|
|
// Make title bar
|
|
TSharedRef<SWidget> TitleBarWidget =
|
|
SNew(SBorder)
|
|
.BorderImage( FEditorStyle::GetBrush( TEXT("Graph.TitleBackground") ) )
|
|
.HAlign(HAlign_Fill)
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+SHorizontalBox::Slot()
|
|
.HAlign(HAlign_Center)
|
|
.FillWidth(1.f)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(NSLOCTEXT("EnvironmentQueryEditor", "TheQueryGraphLabel", "Query Graph"))
|
|
.TextStyle( FEditorStyle::Get(), TEXT("GraphBreadcrumbButtonText") )
|
|
]
|
|
];
|
|
|
|
// Make full graph editor
|
|
return SNew(SGraphEditor)
|
|
.AdditionalCommands(GraphEditorCommands)
|
|
.Appearance(AppearanceInfo)
|
|
.TitleBar(TitleBarWidget)
|
|
.GraphToEdit(InGraph)
|
|
.GraphEvents(InEvents);
|
|
}
|
|
|
|
|
|
TSharedRef<SDockTab> FEnvironmentQueryEditor::SpawnTab_UpdateGraph( const FSpawnTabArgs& Args )
|
|
{
|
|
check( Args.GetTabId().TabType == EQSUpdateGraphTabId );
|
|
UEnvironmentQueryGraph* MyGraph = Cast<UEnvironmentQueryGraph>(Query->EdGraph);
|
|
if (Query->EdGraph == NULL)
|
|
{
|
|
MyGraph = NewObject<UEnvironmentQueryGraph>(Query, NAME_None, RF_Transactional);
|
|
Query->EdGraph = MyGraph;
|
|
|
|
// let's read data from BT script and generate nodes
|
|
const UEdGraphSchema* Schema = Query->EdGraph->GetSchema();
|
|
Schema->CreateDefaultNodesForGraph(*Query->EdGraph);
|
|
|
|
MyGraph->OnCreated();
|
|
}
|
|
else
|
|
{
|
|
MyGraph->OnLoaded();
|
|
}
|
|
|
|
MyGraph->Initialize();
|
|
|
|
TSharedRef<SGraphEditor> UpdateGraphEditor = CreateGraphEditorWidget(Query->EdGraph);
|
|
UpdateGraphEdPtr = UpdateGraphEditor; // Keep pointer to editor
|
|
|
|
return SNew(SDockTab)
|
|
.Label( NSLOCTEXT("EnvironmentQueryEditor", "UpdateGraph", "Update Graph") )
|
|
.TabColorScale( GetTabColorScale() )
|
|
[
|
|
UpdateGraphEditor
|
|
];
|
|
}
|
|
|
|
TSharedRef<SDockTab> FEnvironmentQueryEditor::SpawnTab_Properties(const FSpawnTabArgs& Args)
|
|
{
|
|
check( Args.GetTabId() == EQSPropertiesTabId );
|
|
|
|
CreateInternalWidgets();
|
|
|
|
TSharedRef<SDockTab> SpawnedTab = SNew(SDockTab)
|
|
.Icon( FEditorStyle::GetBrush("SoundClassEditor.Tabs.Properties") )
|
|
.Label( NSLOCTEXT("EnvironmentQueryEditor", "SoundClassPropertiesTitle", "Details" ) )
|
|
[
|
|
DetailsView.ToSharedRef()
|
|
];
|
|
|
|
return SpawnedTab;
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::OnSelectedNodesChanged(const TSet<class UObject*>& NewSelection)
|
|
{
|
|
TArray<UObject*> Selection;
|
|
|
|
SelectedNodesCount = NewSelection.Num();
|
|
if (NewSelection.Num())
|
|
{
|
|
for(TSet<class UObject*>::TConstIterator SetIt(NewSelection);SetIt;++SetIt)
|
|
{
|
|
UEnvironmentQueryGraphNode* GraphNode = CastChecked<UEnvironmentQueryGraphNode>(*SetIt);
|
|
if (GraphNode)
|
|
{
|
|
if (GraphNode->IsA(UEnvironmentQueryGraphNode_Root::StaticClass()))
|
|
{
|
|
Selection.Add(GraphNode);
|
|
}
|
|
else if (GraphNode->IsA(UEnvironmentQueryGraphNode_Option::StaticClass()))
|
|
{
|
|
UEnvQueryOption* QueryOption = Cast<UEnvQueryOption>(GraphNode->NodeInstance);
|
|
if (QueryOption)
|
|
{
|
|
Selection.Add(QueryOption->Generator);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Selection.Add(GraphNode->NodeInstance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (Selection.Num() == 1)
|
|
{
|
|
DetailsView->SetObjects(Selection);
|
|
}
|
|
else
|
|
{
|
|
DetailsView->SetObject(NULL);
|
|
}
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::CreateInternalWidgets()
|
|
{
|
|
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>( "PropertyEditor" );
|
|
const FDetailsViewArgs DetailsViewArgs( false, false, true, FDetailsViewArgs::ObjectsUseNameArea, false );
|
|
DetailsView = PropertyEditorModule.CreateDetailView( DetailsViewArgs );
|
|
DetailsView->SetObject( NULL );
|
|
DetailsView->OnFinishedChangingProperties().AddSP(this, &FEnvironmentQueryEditor::OnFinishedChangingProperties);
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::SaveAsset_Execute()
|
|
{
|
|
// modify BT asset
|
|
TSharedPtr<SGraphEditor> UpdateGraphEditor = UpdateGraphEdPtr.Pin();
|
|
if (UpdateGraphEditor.IsValid() && UpdateGraphEditor->GetCurrentGraph() != NULL)
|
|
{
|
|
//let's find root node
|
|
UEnvironmentQueryGraph* EdGraph = Cast<UEnvironmentQueryGraph>(UpdateGraphEditor->GetCurrentGraph());
|
|
EdGraph->UpdateAsset();
|
|
}
|
|
// save it
|
|
IEnvironmentQueryEditor::SaveAsset_Execute();
|
|
}
|
|
|
|
void FEnvironmentQueryEditor::OnFinishedChangingProperties(const FPropertyChangedEvent& PropertyChangedEvent)
|
|
{
|
|
if (PropertyChangedEvent.Property)
|
|
{
|
|
FGraphPanelSelectionSet CurrentSelection = GetSelectedNodes();
|
|
if (CurrentSelection.Num() == 1)
|
|
{
|
|
for (FGraphPanelSelectionSet::TConstIterator It(CurrentSelection); It; ++It)
|
|
{
|
|
UEnvironmentQueryGraphNode_Test* TestNode = Cast<UEnvironmentQueryGraphNode_Test>(*It);
|
|
UEnvironmentQueryGraphNode_Option* ParentNode = TestNode ? Cast<UEnvironmentQueryGraphNode_Option>(TestNode->ParentNode) : nullptr;
|
|
|
|
if (ParentNode)
|
|
{
|
|
ParentNode->CalculateWeights();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#undef LOCTEXT_NAMESPACE |