// 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(GraphNode->GetGraph()); const bool bPinDesiresToBeHidden = !MaterialGraph->IsInputVisible(PinIndex) || (bHideNoConnectionPins && !bPinHasConections); if (!bPinDesiresToBeHidden) { TSharedPtr 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(); }