Files
UnrealEngineUWP/Engine/Source/Editor/ViewportInteraction/ViewportDragOperation.cpp
Lauren Ridge f361d5ae54 Merging //UE4/Private-Geometry to Dev-VREditor (//UE4/Dev-VREditor) 3339870
#rb Mike.Fricker

[CL 3340396 by Lauren Ridge in Dev-VREditor branch]
2017-03-09 16:53:09 -05:00

52 lines
1.2 KiB
C++

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#include "ViewportDragOperation.h"
UViewportDragOperationComponent::UViewportDragOperationComponent( const class FObjectInitializer& Initializer ) :
Super( Initializer ),
DragOperation( nullptr )
{
}
UViewportDragOperationComponent::~UViewportDragOperationComponent()
{
DragOperation = nullptr;
}
UViewportDragOperation* UViewportDragOperationComponent::GetDragOperation()
{
return DragOperation;
}
void UViewportDragOperationComponent::SetDragOperationClass( const TSubclassOf<UViewportDragOperation> InDragOperation )
{
DragOperationSubclass = InDragOperation;
}
void UViewportDragOperationComponent::StartDragOperation()
{
if ( DragOperationSubclass )
{
// Reset the drag operation to make sure we start a new one
ClearDragOperation();
// Create the drag object with the latest class
DragOperation = NewObject<UViewportDragOperation>( ( UObject* ) GetTransientPackage(), DragOperationSubclass );
}
}
void UViewportDragOperationComponent::ClearDragOperation()
{
if ( DragOperation )
{
DragOperation->MarkPendingKill();
}
DragOperation = nullptr;
}
bool UViewportDragOperationComponent::IsDragging() const
{
return DragOperation != nullptr;
}