2014-03-14 14:13:41 -04:00
|
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#include "EnvironmentQueryEditorPrivatePCH.h"
|
|
|
|
|
|
|
|
|
|
#include "DetailCustomizations/EnvDirectionCustomization.h"
|
|
|
|
|
#include "DetailCustomizations/EnvTraceDataCustomization.h"
|
|
|
|
|
#include "DetailCustomizations/EnvQueryParamSetupCustomization.h"
|
|
|
|
|
#include "DetailCustomizations/EnvQueryTestDetails.h"
|
|
|
|
|
|
|
|
|
|
#include "ModuleManager.h"
|
|
|
|
|
#include "Toolkits/ToolkitManager.h"
|
|
|
|
|
#include "SGraphNode_EnvironmentQuery.h"
|
|
|
|
|
#include "EdGraphUtilities.h"
|
2014-04-23 20:18:55 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE( FEnvironmentQueryEditorModule, EnvironmentQueryEditor );
|
|
|
|
|
DEFINE_LOG_CATEGORY(LogEnvironmentQueryEditor);
|
|
|
|
|
|
|
|
|
|
const FName FEnvironmentQueryEditorModule::EnvironmentQueryEditorAppIdentifier( TEXT( "EnvironmentQueryEditorApp" ) );
|
|
|
|
|
|
|
|
|
|
class FGraphPanelNodeFactory_EnvironmentQuery : public FGraphPanelNodeFactory
|
|
|
|
|
{
|
|
|
|
|
virtual TSharedPtr<class SGraphNode> CreateNode(UEdGraphNode* Node) const OVERRIDE
|
|
|
|
|
{
|
|
|
|
|
if (UEnvironmentQueryGraphNode* EnvQueryNode = Cast<UEnvironmentQueryGraphNode>(Node))
|
|
|
|
|
{
|
|
|
|
|
return SNew(SGraphNode_EnvironmentQuery, EnvQueryNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TSharedPtr<FGraphPanelNodeFactory> GraphPanelNodeFactory_EnvironmentQuery;
|
|
|
|
|
|
|
|
|
|
void FEnvironmentQueryEditorModule::StartupModule()
|
|
|
|
|
{
|
|
|
|
|
MenuExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
|
|
|
ToolBarExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
|
|
|
|
|
|
|
|
GraphPanelNodeFactory_EnvironmentQuery = MakeShareable( new FGraphPanelNodeFactory_EnvironmentQuery() );
|
|
|
|
|
FEdGraphUtilities::RegisterVisualNodeFactory(GraphPanelNodeFactory_EnvironmentQuery);
|
|
|
|
|
|
|
|
|
|
ItemDataAssetTypeActions = MakeShareable(new FAssetTypeActions_EnvironmentQuery);
|
|
|
|
|
FModuleManager::LoadModuleChecked<FAssetToolsModule>("AssetTools").Get().RegisterAssetTypeActions(ItemDataAssetTypeActions.ToSharedRef());
|
|
|
|
|
|
|
|
|
|
// Register the details customizer
|
|
|
|
|
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
2014-06-04 10:16:14 -04:00
|
|
|
PropertyModule.RegisterCustomPropertyTypeLayout( "EnvFloatParam", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FEnvQueryParamSetupCustomization::MakeInstance ) );
|
|
|
|
|
PropertyModule.RegisterCustomPropertyTypeLayout( "EnvIntParam", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FEnvQueryParamSetupCustomization::MakeInstance ) );
|
|
|
|
|
PropertyModule.RegisterCustomPropertyTypeLayout( "EnvBoolParam", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FEnvQueryParamSetupCustomization::MakeInstance ) );
|
|
|
|
|
PropertyModule.RegisterCustomPropertyTypeLayout( "EnvDirection", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FEnvDirectionCustomization::MakeInstance ) );
|
|
|
|
|
PropertyModule.RegisterCustomPropertyTypeLayout( "EnvTraceData", FOnGetPropertyTypeCustomizationInstance::CreateStatic( &FEnvTraceDataCustomization::MakeInstance ) );
|
2014-06-04 12:11:33 -04:00
|
|
|
PropertyModule.RegisterCustomClassLayout( "EnvQueryTest", FOnGetDetailCustomizationInstance::CreateStatic( &FEnvQueryTestDetails::MakeInstance ) );
|
2014-03-14 14:13:41 -04:00
|
|
|
PropertyModule.NotifyCustomizationModuleChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FEnvironmentQueryEditorModule::ShutdownModule()
|
|
|
|
|
{
|
|
|
|
|
if (!UObjectInitialized())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MenuExtensibilityManager.Reset();
|
|
|
|
|
ToolBarExtensibilityManager.Reset();
|
|
|
|
|
|
|
|
|
|
if ( GraphPanelNodeFactory_EnvironmentQuery.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
FEdGraphUtilities::UnregisterVisualNodeFactory(GraphPanelNodeFactory_EnvironmentQuery);
|
|
|
|
|
GraphPanelNodeFactory_EnvironmentQuery.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Unregister the EnvironmentQuery item data asset type actions
|
|
|
|
|
if (ItemDataAssetTypeActions.IsValid())
|
|
|
|
|
{
|
|
|
|
|
if (FModuleManager::Get().IsModuleLoaded("AssetTools"))
|
|
|
|
|
{
|
|
|
|
|
FModuleManager::GetModuleChecked<FAssetToolsModule>("AssetTools").Get().UnregisterAssetTypeActions(ItemDataAssetTypeActions.ToSharedRef());
|
|
|
|
|
}
|
|
|
|
|
ItemDataAssetTypeActions.Reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Unregister the details customization
|
|
|
|
|
if (FModuleManager::Get().IsModuleLoaded("PropertyEditor"))
|
|
|
|
|
{
|
|
|
|
|
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
|
2014-06-04 10:46:20 -04:00
|
|
|
PropertyModule.UnregisterCustomPropertyTypeLayout( "EnvFloatParam" );
|
|
|
|
|
PropertyModule.UnregisterCustomPropertyTypeLayout( "EnvIntParam" );
|
|
|
|
|
PropertyModule.UnregisterCustomPropertyTypeLayout( "EnvBoolParam" );
|
|
|
|
|
PropertyModule.UnregisterCustomPropertyTypeLayout( "EnvDirection" );
|
|
|
|
|
PropertyModule.UnregisterCustomPropertyTypeLayout( "EnvTraceData" );
|
|
|
|
|
|
2014-06-04 12:11:33 -04:00
|
|
|
PropertyModule.UnregisterCustomClassLayout( "EnvQueryTest" );
|
2014-03-14 14:13:41 -04:00
|
|
|
PropertyModule.NotifyCustomizationModuleChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TSharedRef<IEnvironmentQueryEditor> FEnvironmentQueryEditorModule::CreateEnvironmentQueryEditor( const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UEnvQuery* Script )
|
|
|
|
|
{
|
|
|
|
|
TSharedRef< FEnvironmentQueryEditor > NewEnvironmentQueryEditor( new FEnvironmentQueryEditor() );
|
|
|
|
|
NewEnvironmentQueryEditor->InitEnvironmentQueryEditor( Mode, InitToolkitHost, Script );
|
|
|
|
|
return NewEnvironmentQueryEditor;
|
|
|
|
|
}
|
|
|
|
|
|