2019-12-26 15:33:43 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2014-05-29 17:43:04 -04:00
|
|
|
|
2014-10-15 05:21:18 -04:00
|
|
|
#include "DesignerExtension.h"
|
|
|
|
|
#include "ScopedTransaction.h"
|
2020-08-11 01:36:57 -04:00
|
|
|
#include "WidgetBlueprint.h"
|
2014-06-06 09:38:31 -04:00
|
|
|
|
2014-05-29 17:43:04 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "UMG"
|
|
|
|
|
|
2014-06-06 09:38:31 -04:00
|
|
|
// Designer Extension
|
|
|
|
|
|
2014-06-16 11:45:50 -04:00
|
|
|
FDesignerExtension::FDesignerExtension()
|
2020-08-11 01:36:57 -04:00
|
|
|
: ScopedTransaction(nullptr)
|
2014-06-16 11:45:50 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 01:36:57 -04:00
|
|
|
FDesignerExtension::~FDesignerExtension()
|
|
|
|
|
{
|
|
|
|
|
ensure(Designer == nullptr);
|
|
|
|
|
ensure(ScopedTransaction == nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-19 17:33:03 -04:00
|
|
|
void FDesignerExtension::Initialize(IUMGDesigner* InDesigner, UWidgetBlueprint* InBlueprint)
|
2014-05-29 17:43:04 -04:00
|
|
|
{
|
2014-08-19 17:33:03 -04:00
|
|
|
Designer = InDesigner;
|
2014-05-29 17:43:04 -04:00
|
|
|
Blueprint = InBlueprint;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 01:36:57 -04:00
|
|
|
void FDesignerExtension::Uninitialize()
|
|
|
|
|
{
|
|
|
|
|
Designer = nullptr;
|
|
|
|
|
Blueprint.Reset();
|
|
|
|
|
ensure(ScopedTransaction == nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 17:43:04 -04:00
|
|
|
FName FDesignerExtension::GetExtensionId() const
|
|
|
|
|
{
|
|
|
|
|
return ExtensionId;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-16 11:45:50 -04:00
|
|
|
void FDesignerExtension::BeginTransaction(const FText& SessionName)
|
|
|
|
|
{
|
2020-08-11 01:36:57 -04:00
|
|
|
if ( ensure(ScopedTransaction == nullptr) )
|
2014-06-16 11:45:50 -04:00
|
|
|
{
|
|
|
|
|
ScopedTransaction = new FScopedTransaction(SessionName);
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-17 12:40:49 -04:00
|
|
|
for ( FWidgetReference& Selection : SelectionCache )
|
2014-06-16 11:45:50 -04:00
|
|
|
{
|
2014-06-24 17:13:13 -04:00
|
|
|
if ( Selection.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
Selection.GetPreview()->Modify();
|
|
|
|
|
Selection.GetTemplate()->Modify();
|
|
|
|
|
}
|
2014-06-16 11:45:50 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FDesignerExtension::EndTransaction()
|
|
|
|
|
{
|
2020-08-11 01:36:57 -04:00
|
|
|
if ( ensure(ScopedTransaction != nullptr) )
|
2014-06-16 11:45:50 -04:00
|
|
|
{
|
|
|
|
|
delete ScopedTransaction;
|
2020-08-11 01:36:57 -04:00
|
|
|
ScopedTransaction = nullptr;
|
2014-06-16 11:45:50 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 17:43:04 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE
|