TSharedRef<FUICommandDragDropOp> FUICommandDragDropOp::New( TSharedRef<const FUICommandInfo> InCommandInfo, FName InOriginMultiBox, TSharedPtr<SWidget> CustomDectorator, FVector2D DecoratorOffset )
{
	TSharedRef<FUICommandDragDropOp> Operation = MakeShareable(new FUICommandDragDropOp(InCommandInfo, InOriginMultiBox, CustomDectorator, DecoratorOffset));
	Operation->Construct();

	return Operation;
}
	static TSharedRef<FSampleDragDropOp> New()
	{
		TSharedRef<FSampleDragDropOp> Operation = MakeShareable(new FSampleDragDropOp);
		FSlateApplication::GetDragDropReflector().RegisterOperation<FSampleDragDropOp>(Operation);
		Operation->Construct();
		return Operation;
	}
TSharedRef<FDragConnection> FDragConnection::New(const TSharedRef<SGraphPanel>& InGraphPanel, const TArray< TSharedRef<SGraphPin> >& InStartingPins, bool bInShiftOperation)
{
	TSharedRef<FDragConnection> Operation = MakeShareable(new FDragConnection(InGraphPanel, InStartingPins, bInShiftOperation));
	Operation->Construct();

	return Operation;
}
	static TSharedRef<FAmbivalentDirectionDragConnection> New(UK2Node_Knot* InKnot, const TSharedRef<SGraphPanel>& InGraphPanel, const TArray< TSharedRef<SGraphPin> >& InStartingPins, bool bInShiftOperation)
	{
		TSharedRef<FAmbivalentDirectionDragConnection> Operation = MakeShareable(new FAmbivalentDirectionDragConnection(InKnot, InGraphPanel, InStartingPins, bInShiftOperation));
		Operation->Construct();

		return Operation;
	}
TSharedRef<FAbilityDragDrop> FAbilityDragDrop::New(TSharedPtr<FActionSlotInfo> PickedItemIn, TSharedPtr<SARActionItemWidget> LastAbilitySlotIn)
{
	TSharedRef<FAbilityDragDrop> Operation = MakeShareable(new FAbilityDragDrop);
	Operation->ActionData = nullptr;
	Operation->PickedAbility = PickedItemIn;
	Operation->LastAbilitySlot = LastAbilitySlotIn;
	Operation->Construct();
	return Operation;
}
TSharedRef<FWidgetTemplateDragDropOp> FWidgetTemplateDragDropOp::New(const TSharedPtr<FWidgetTemplate>& InTemplate)
{
    TSharedRef<FWidgetTemplateDragDropOp> Operation = MakeShareable(new FWidgetTemplateDragDropOp());
    Operation->Template = InTemplate;
    Operation->DefaultHoverText = InTemplate->Name;
    Operation->CurrentHoverText = InTemplate->Name;
    Operation->Construct();

    return Operation;
}
Example #7
0
TSharedRef<FTrackNodeDragDropOp> FTrackNodeDragDropOp::New(TSharedRef<STrackNode> TrackNode, const FVector2D &CursorPosition, const FVector2D &ScreenPositionOfNode)
{
	TSharedRef<FTrackNodeDragDropOp> Operation = MakeShareable(new FTrackNodeDragDropOp);
	Operation->OriginalTrackNode = TrackNode;

	Operation->Offset = ScreenPositionOfNode - CursorPosition;
	Operation->StartingScreenPos = ScreenPositionOfNode;

	Operation->Construct();

	return Operation;
}
Example #8
0
TSharedRef<FTrackNodeDragDropOp> FTrackNodeDragDropOp::New(TSharedRef<STrackNode> TrackNode, const FVector2D &CursorPosition, const FVector2D &ScreenPositionOfNode)
{
	TSharedRef<FTrackNodeDragDropOp> Operation = MakeShareable(new FTrackNodeDragDropOp);
	FSlateApplication::GetDragDropReflector().RegisterOperation<FTrackNodeDragDropOp>(Operation);
	Operation->OriginalTrackNode = TrackNode;

	Operation->Offset = ScreenPositionOfNode - CursorPosition;
	Operation->StartingScreenPos = ScreenPositionOfNode;

	Operation->Construct();

	return Operation;
}
TSharedPtr<IMeshPaintGeometryAdapter> FMeshPaintSpriteAdapterFactory::Construct(class UMeshComponent* InComponent, int32 InPaintingMeshLODIndex, int32 InUVChannelIndex) const
{
	if (UPaperSpriteComponent* SpriteComponent = Cast<UPaperSpriteComponent>(InComponent))
	{
		if (SpriteComponent->GetSprite() != nullptr)
		{
			TSharedRef<FMeshPaintSpriteAdapter> Result = MakeShareable(new FMeshPaintSpriteAdapter());
			if (Result->Construct(InComponent, InPaintingMeshLODIndex, InUVChannelIndex))
			{
				return Result;
			}
		}
	}

	return nullptr;
}
Example #10
0
TSharedRef<FAssetDragDropOp> FAssetDragDropOp::New(const TArray<FAssetData>& InAssetData, UActorFactory* ActorFactory /*= NULL*/)
{
	TSharedRef<FAssetDragDropOp> Operation = MakeShareable(new FAssetDragDropOp);

	Operation->MouseCursor = EMouseCursor::GrabHandClosed;

	Operation->ThumbnailSize = 64;

	Operation->AssetData = InAssetData;
	Operation->ActorFactory = ActorFactory;

	Operation->Init();

	Operation->Construct();
	return Operation;
}
TSharedRef<FWwiseEventDragDropOp> FWwiseEventDragDropOp::New(const TArray<TSharedPtr<FWwiseTreeItem>>& InAssets)
{
	FWwiseEventDragDropOp* RawPointer = new FWwiseEventDragDropOp();
	TSharedRef<FWwiseEventDragDropOp> Operation = MakeShareable(RawPointer);
	
	Operation->MouseCursor = EMouseCursor::GrabHandClosed;
	Operation->Assets = InAssets;
	Operation->SetCanDrop(false);

	EWwiseTreeItemType::Type ItemType = InAssets[0]->ItemType;
	int32 i = 1;
	for (; i < InAssets.Num(); i++)
	{
		if (InAssets[i]->ItemType != ItemType)
		{
			break;
		}
	}

	if (i == InAssets.Num())
	{
		switch (ItemType)
		{
		case EWwiseTreeItemType::Event:
			Operation->Icon = SWwisePicker::EventIcon;
			break;
		case EWwiseTreeItemType::AuxBus:
			Operation->Icon = SWwisePicker::AuxBusIcon;
			break;
		}
	}

	Operation->Construct();

	
	FAssetViewDragAndDropExtender::FOnDropDelegate DropDelegate = FAssetViewDragAndDropExtender::FOnDropDelegate::CreateRaw(RawPointer, &FWwiseEventDragDropOp::OnAssetViewDrop);
	FAssetViewDragAndDropExtender::FOnDragOverDelegate DragOverDelegate = FAssetViewDragAndDropExtender::FOnDragOverDelegate::CreateRaw(RawPointer, &FWwiseEventDragDropOp::OnAssetViewDragOver);
	FAssetViewDragAndDropExtender::FOnDragLeaveDelegate DragLeaveDelegate = FAssetViewDragAndDropExtender::FOnDragLeaveDelegate::CreateRaw(RawPointer, &FWwiseEventDragDropOp::OnAssetViewDragLeave);
	Operation->pExtender = new FAssetViewDragAndDropExtender(DropDelegate, DragOverDelegate, DragLeaveDelegate);

	FContentBrowserModule& ContentBrowserModule = FModuleManager::GetModuleChecked<FContentBrowserModule>("ContentBrowser");
	TArray<FAssetViewDragAndDropExtender>& AssetViewDragAndDropExtenders = ContentBrowserModule.GetAssetViewDragAndDropExtenders();
	AssetViewDragAndDropExtenders.Add(*(Operation->pExtender));
	
	return Operation;
}
TSharedRef<FInventoryDragDrop> FInventoryDragDrop::New(TSharedPtr<FARDragDropInfo> PickedItemIn, TSharedPtr<SARInventoryItemWidget> LastItemSlotIn)
{
	TSharedRef<FInventoryDragDrop> Operation = MakeShareable(new FInventoryDragDrop);
	Operation->ItemInThisSlot = nullptr;
	Operation->PickedItem = PickedItemIn;
	Operation->LastItemSlot = LastItemSlotIn;
	if (TestItems && TestItems->EditEntries.Num() > 0 && PickedItemIn->ItemIndex >= 0)
	{
		if (PickedItemIn->ItemSlot == EItemSlot::Item_Chest)
		{
			Operation->ItemInThisSlot = ChestItems->GetItemDataFromArrayPtr(PickedItemIn->ItemIndex);
		}
		else
			Operation->ItemInThisSlot = TestItems->GetItemDataFromArrayPtr(PickedItemIn->ItemIndex);
	}

	Operation->Construct();
	return Operation;
}
Example #13
0
TSharedRef<FFlipbookKeyFrameDragDropOp> FFlipbookKeyFrameDragDropOp::New(int32 InWidth, UPaperFlipbook* InFlipbook, int32 InFrameIndex)
{
	// Create the drag-drop op containing the key
	TSharedRef<FFlipbookKeyFrameDragDropOp> Operation = MakeShareable(new FFlipbookKeyFrameDragDropOp);
	Operation->KeyFrameData = InFlipbook->GetKeyFrameChecked(InFrameIndex);
	Operation->SourceFrameIndex = InFrameIndex;
	Operation->SourceFlipbook = InFlipbook;
	Operation->WidgetWidth = InWidth;
	Operation->Construct();

	// Remove the key from the flipbook
	{
		InFlipbook->Modify();
		FScopedFlipbookMutator EditLock(InFlipbook);
		EditLock.KeyFrames.RemoveAt(InFrameIndex);
	}

	return Operation;
}
//------------------------------------------------------------------------------
TSharedRef<FKismetMacroDragDropAction> FKismetMacroDragDropAction::New(
	FName                 InMacroName, 
	UBlueprint*           InBlueprint, 
	UEdGraph*             InMacro, 
	FNodeCreationAnalytic AnalyticCallback)
{
	TSharedRef<FKismetMacroDragDropAction> Operation = MakeShareable(new FKismetMacroDragDropAction);
	Operation->MacroName = InMacroName;
	Operation->Macro = InMacro;
	Operation->Blueprint = InBlueprint;
	Operation->AnalyticCallback = AnalyticCallback;

	// Check to see if the macro has any latent functions in it, some graph types do not allow for latent functions
	bool bIsLatentMacro = FBlueprintEditorUtils::CheckIfGraphHasLatentFunctions(Operation->Macro);

	Operation->CanBeDroppedDelegate = FCanBeDroppedDelegate::CreateStatic(&CanMacroBeDropped, InMacro, bIsLatentMacro);

	Operation->Construct();
	return Operation;
}
//------------------------------------------------------------------------------
TSharedRef<FKismetFunctionDragDropAction> FKismetFunctionDragDropAction::New(
	TSharedPtr<FEdGraphSchemaAction>	InActionNode,
	FName								InFunctionName, 
	UClass*								InOwningClass, 
	FMemberReference const&				InCallOnMember, 
	FNodeCreationAnalytic				AnalyticCallback, 
	FCanBeDroppedDelegate				CanBeDroppedDelegate /* = FCanBeDroppedDelegate() */)
{
	TSharedRef<FKismetFunctionDragDropAction> Operation = MakeShareable(new FKismetFunctionDragDropAction);
	Operation->FunctionName     = InFunctionName;
	Operation->OwningClass      = InOwningClass;
	Operation->CallOnMember     = InCallOnMember;
	Operation->AnalyticCallback = AnalyticCallback;
	Operation->CanBeDroppedDelegate = CanBeDroppedDelegate;
	Operation->ActionNode = InActionNode;

	if (!CanBeDroppedDelegate.IsBound())
	{
		Operation->CanBeDroppedDelegate = FCanBeDroppedDelegate::CreateStatic(&CanFunctionBeDropped, Operation->GetFunctionProperty());
	}

	Operation->Construct();
	return Operation;
}
TSharedRef<FUMGDragDropOp> FUMGDragDropOp::New(UDragDropOperation* InOperation, const FVector2D &CursorPosition, const FVector2D &ScreenPositionOfDragee, float DPIScale, TSharedPtr<SObjectWidget> SourceUserWidget)
{
	check(InOperation);

	TSharedRef<FUMGDragDropOp> Operation = MakeShareable(new FUMGDragDropOp());
	Operation->MouseDownOffset = ScreenPositionOfDragee - CursorPosition;
	Operation->StartingScreenPos = ScreenPositionOfDragee;
	Operation->SourceUserWidget = SourceUserWidget;
	Operation->GameViewport = SourceUserWidget->GetWidgetObject()->GetWorld()->GetGameViewport();
	Operation->DragOperation = InOperation;

	TSharedPtr<SWidget> DragVisual;
	if ( InOperation->DefaultDragVisual == nullptr )
	{
		DragVisual = SNew(STextBlock)
			.Text(FText::FromString(InOperation->Tag));
	}
	else
	{
		//TODO Make sure users are not trying to add a widget that already exists elsewhere.
		DragVisual = InOperation->DefaultDragVisual->TakeWidget();
	}

	Operation->DecoratorWidget =
		SNew(SDPIScaler)
		.DPIScale(DPIScale)
		[
			DragVisual.ToSharedRef()
		];

	Operation->DecoratorWidget->SlatePrepass();

	Operation->Construct();

	return Operation;
}
	static TSharedRef<FSampleDragDropOp> New()
	{
		TSharedRef<FSampleDragDropOp> Operation = MakeShareable(new FSampleDragDropOp);
		Operation->Construct();
		return Operation;
	}