Files
UnrealEngineUWP/Engine/Source/Editor/GraphEditor/Private/MaterialNodes/SGraphNodeMaterialResult.cpp
Ben Cosh e90a7467ff Added a movement filter to the node movement call, which now adds any successfully moved nodes. This prevents duplicate movement if two selected comments try to move the same node.
#TTP 314475 - k2: comment boxes within other comment boxes do not move if the outer most box is moved. Also, if two nested comment boxes are moved, the nodes within move 2x as much as they should (video)
#Branch UE4
#Proj GraphEditor, BehaviourTreeEditor

#Add SNodePanel::SNode::FNodeSet typedef for conveniance and clarity
#Change Changed SNodePanel::MoveTo to take an FNodeSet as an exclusion filter on the moved nodes, once moved nodes are appended into this set.

CodeReview Chris.Wood, Nick.Whiting

[CL 2064255 by Ben Cosh in Main branch]
2014-05-06 04:45:44 -04:00

61 lines
1.8 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "GraphEditorCommon.h"
#include "SGraphNodeMaterialResult.h"
/////////////////////////////////////////////////////
// SGraphNodeMaterialResult
void SGraphNodeMaterialResult::Construct(const FArguments& InArgs, UMaterialGraphNode_Root* InNode)
{
this->GraphNode = InNode;
this->RootNode = InNode;
this->SetCursor(EMouseCursor::CardinalCross);
this->UpdateGraphNode();
}
void SGraphNodeMaterialResult::CreatePinWidgets()
{
// Create Pin widgets for each of the pins.
for( int32 PinIndex=0; PinIndex < GraphNode->Pins.Num(); ++PinIndex )
{
UEdGraphPin* CurPin = GraphNode->Pins[PinIndex];
bool bHideNoConnectionPins = false;
if (OwnerGraphPanelPtr.IsValid())
{
bHideNoConnectionPins = OwnerGraphPanelPtr.Pin()->GetPinVisibility() == SGraphEditor::Pin_HideNoConnection;
}
const bool bPinHasConections = CurPin->LinkedTo.Num() > 0;
//const bool bPinDesiresToBeHidden = CurPin->bHidden || (bHideNoConnectionPins && !bPinHasConections);
UMaterialGraph* MaterialGraph = CastChecked<UMaterialGraph>(GraphNode->GetGraph());
const bool bPinDesiresToBeHidden = !MaterialGraph->IsInputVisible(PinIndex) || (bHideNoConnectionPins && !bPinHasConections);
if (!bPinDesiresToBeHidden)
{
TSharedPtr<SGraphPin> NewPin = CreatePinWidget(CurPin);
check(NewPin.IsValid());
NewPin->SetIsEditable(IsEditable);
this->AddPin(NewPin.ToSharedRef());
}
}
}
void SGraphNodeMaterialResult::MoveTo(const FVector2D& NewPosition, FNodeSet& NodeFilter)
{
SGraphNode::MoveTo(NewPosition, NodeFilter);
RootNode->Material->EditorX = RootNode->NodePosX;
RootNode->Material->EditorY = RootNode->NodePosY;
RootNode->Material->MarkPackageDirty();
RootNode->Material->MaterialGraph->MaterialDirtyDelegate.ExecuteIfBound();
}