本文整理汇总了C++中UEdGraphNode::GetGraph方法的典型用法代码示例。如果您正苦于以下问题:C++ UEdGraphNode::GetGraph方法的具体用法?C++ UEdGraphNode::GetGraph怎么用?C++ UEdGraphNode::GetGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UEdGraphNode
的用法示例。
在下文中一共展示了UEdGraphNode::GetGraph方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PostProcessPastedNodes
// Reconcile other pin links:
// - Links between nodes within the copied set are fine
// - Links to nodes that were not copied need to be fixed up if the copy-paste was in the same graph or broken completely
// Call PostPasteNode on each node
void FEdGraphUtilities::PostProcessPastedNodes(TSet<UEdGraphNode*>& SpawnedNodes)
{
// Run thru and fix up the node's pin links; they may point to invalid pins if the paste was to another graph
for (TSet<UEdGraphNode*>::TIterator It(SpawnedNodes); It; ++It)
{
UEdGraphNode* Node = *It;
UEdGraph* CurrentGraph = Node->GetGraph();
for (int32 PinIndex = 0; PinIndex < Node->Pins.Num(); ++PinIndex)
{
UEdGraphPin* ThisPin = Node->Pins[PinIndex];
for (int32 LinkIndex = 0; LinkIndex < ThisPin->LinkedTo.Num(); )
{
UEdGraphPin* OtherPin = ThisPin->LinkedTo[LinkIndex];
if (OtherPin == NULL)
{
// Totally bogus link
ThisPin->LinkedTo.RemoveAtSwap(LinkIndex);
}
else if (!SpawnedNodes.Contains(OtherPin->GetOwningNode()))
{
// It's a link across the selection set, so it should be broken
OtherPin->LinkedTo.RemoveSwap(ThisPin);
ThisPin->LinkedTo.RemoveAtSwap(LinkIndex);
}
else if (!OtherPin->LinkedTo.Contains(ThisPin))
{
// The link needs to be reciprocal
check(OtherPin->GetOwningNode()->GetGraph() == CurrentGraph);
OtherPin->LinkedTo.Add(ThisPin);
++LinkIndex;
}
else
{
// Everything seems fine but sanity check the graph
check(OtherPin->GetOwningNode()->GetGraph() == CurrentGraph);
++LinkIndex;
}
}
}
}
// Give every node a chance to deep copy associated resources, etc...
for (TSet<UEdGraphNode*>::TIterator It(SpawnedNodes); It; ++It)
{
UEdGraphNode* Node = *It;
Node->PostPasteNode();
Node->ReconstructNode();
// Ensure we have RF_Transactional set on all pasted nodes, as its not copied in the T3D format
Node->SetFlags(RF_Transactional);
}
}
示例2: BreakNodeLinks
void UMaterialGraphSchema::BreakNodeLinks(UEdGraphNode& TargetNode) const
{
bool bHasLinksToBreak = false;
for (auto PinIt = TargetNode.Pins.CreateConstIterator(); PinIt; ++PinIt)
{
UEdGraphPin* Pin = *PinIt;
for (auto LinkIt = Pin->LinkedTo.CreateConstIterator(); LinkIt; ++LinkIt)
{
if (*LinkIt)
{
bHasLinksToBreak = true;
}
}
}
Super::BreakNodeLinks(TargetNode);
if (bHasLinksToBreak)
{
FMaterialEditorUtilities::UpdateMaterialAfterGraphChange(TargetNode.GetGraph());
}
}
示例3: HoverTargetChanged
void FKismetVariableDragDropAction::HoverTargetChanged()
{
UProperty* VariableProperty = GetVariableProperty();
if (VariableProperty == nullptr)
{
return;
}
FString VariableString = VariableName.ToString();
// Icon/text to draw on tooltip
FSlateColor IconColor = FLinearColor::White;
const FSlateBrush* StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));
FText Message = LOCTEXT("InvalidDropTarget", "Invalid drop target!");
UEdGraphPin* PinUnderCursor = GetHoveredPin();
bool bCanMakeSetter = true;
bool bBadSchema = false;
bool bBadGraph = false;
UEdGraph* HoveredGraph = GetHoveredGraph();
if (HoveredGraph)
{
if (Cast<const UEdGraphSchema_K2>(HoveredGraph->GetSchema()) == NULL)
{
bBadSchema = true;
}
else if(!CanVariableBeDropped(VariableProperty, *HoveredGraph))
{
bBadGraph = true;
}
UStruct* Outer = CastChecked<UStruct>(VariableProperty->GetOuter());
FNodeConstructionParams NewNodeParams;
NewNodeParams.VariableName = VariableName;
const UBlueprint* DropOnBlueprint = FBlueprintEditorUtils::FindBlueprintForGraph(HoveredGraph);
NewNodeParams.Graph = HoveredGraph;
NewNodeParams.VariableSource = Outer;
bCanMakeSetter = CanExecuteMakeSetter(NewNodeParams, VariableProperty);
}
UEdGraphNode* VarNodeUnderCursor = Cast<UK2Node_Variable>(GetHoveredNode());
if (bBadSchema)
{
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));
Message = LOCTEXT("CannotCreateInThisSchema", "Cannot access variables in this type of graph");
}
else if(bBadGraph)
{
FFormatNamedArguments Args;
Args.Add(TEXT("VariableName"), FText::FromString(VariableString));
Args.Add(TEXT("Scope"), FText::FromString(HoveredGraph->GetName()));
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.Error"));
if(IsFromBlueprint(FBlueprintEditorUtils::FindBlueprintForGraph(HoveredGraph)) && VariableProperty->GetOuter()->IsA(UFunction::StaticClass()))
{
Message = FText::Format( LOCTEXT("IncorrectGraphForLocalVariable_Error", "Cannot place local variable '{VariableName}' in external scope '{Scope}'"), Args);
}
else
{
Message = FText::Format( LOCTEXT("IncorrectGraphForVariable_Error", "Cannot place variable '{VariableName}' in external scope '{Scope}'"), Args);
}
}
else if (PinUnderCursor != NULL)
{
FFormatNamedArguments Args;
Args.Add(TEXT("PinUnderCursor"), FText::FromString(PinUnderCursor->PinName));
Args.Add(TEXT("VariableName"), FText::FromString(VariableString));
if(CanVariableBeDropped(VariableProperty, *PinUnderCursor->GetOwningNode()->GetGraph()))
{
const UEdGraphSchema_K2* Schema = CastChecked<const UEdGraphSchema_K2>(PinUnderCursor->GetSchema());
const bool bIsRead = PinUnderCursor->Direction == EGPD_Input;
const UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForNode(PinUnderCursor->GetOwningNode());
const bool bReadOnlyProperty = FBlueprintEditorUtils::IsPropertyReadOnlyInCurrentBlueprint(Blueprint, VariableProperty);
const bool bCanWriteIfNeeded = bIsRead || !bReadOnlyProperty;
FEdGraphPinType VariablePinType;
Schema->ConvertPropertyToPinType(VariableProperty, VariablePinType);
const bool bTypeMatch = Schema->ArePinTypesCompatible(VariablePinType, PinUnderCursor->PinType);
Args.Add(TEXT("PinUnderCursor"), FText::FromString(PinUnderCursor->PinName));
if (bTypeMatch && bCanWriteIfNeeded)
{
StatusSymbol = FEditorStyle::GetBrush(TEXT("Graph.ConnectorFeedback.OK"));
if (bIsRead)
{
Message = FText::Format(LOCTEXT("MakeThisEqualThat_PinEqualVariableName", "Make {PinUnderCursor} = {VariableName}"), Args);
}
else
{
Message = FText::Format(LOCTEXT("MakeThisEqualThat_VariableNameEqualPin", "Make {VariableName} = {PinUnderCursor}"), Args);
}
//.........这里部分代码省略.........
示例4: BuildExecutionRoadmap
void FKismetConnectionDrawingPolicy::BuildExecutionRoadmap()
{
LatestTimeDiscovered = 0.0;
// Only do highlighting in PIE or SIE
if (!CanBuildRoadmap())
{
return;
}
UBlueprint* TargetBP = FBlueprintEditorUtils::FindBlueprintForGraphChecked(GraphObj);
UObject* ActiveObject = TargetBP->GetObjectBeingDebugged();
check(ActiveObject); // Due to CanBuildRoadmap
// Redirect the target Blueprint when debugging with a macro graph visible
if (TargetBP->BlueprintType == BPTYPE_MacroLibrary)
{
TargetBP = Cast<UBlueprint>(ActiveObject->GetClass()->ClassGeneratedBy);
}
TArray<UEdGraphNode*> SequentialNodesInGraph;
TArray<double> SequentialNodeTimes;
{
const TSimpleRingBuffer<FKismetTraceSample>& TraceStack = FKismetDebugUtilities::GetTraceStack();
UBlueprintGeneratedClass* TargetClass = Cast<UBlueprintGeneratedClass>(TargetBP->GeneratedClass);
FBlueprintDebugData& DebugData = TargetClass->GetDebugData();
for (int32 i = 0; i < TraceStack.Num(); ++i)
{
const FKismetTraceSample& Sample = TraceStack(i);
if (UObject* TestObject = Sample.Context.Get())
{
if (TestObject == ActiveObject)
{
if (UEdGraphNode* Node = DebugData.FindSourceNodeFromCodeLocation(Sample.Function.Get(), Sample.Offset, /*bAllowImpreciseHit=*/ false))
{
if (GraphObj == Node->GetGraph())
{
SequentialNodesInGraph.Add(Node);
SequentialNodeTimes.Add(Sample.ObservationTime);
}
else
{
// If the top-level source node is a macro instance node
UK2Node_MacroInstance* MacroInstanceNode = Cast<UK2Node_MacroInstance>(Node);
if (MacroInstanceNode)
{
// Attempt to locate the macro source node through the code mapping
UEdGraphNode* MacroSourceNode = DebugData.FindMacroSourceNodeFromCodeLocation(Sample.Function.Get(), Sample.Offset);
if (MacroSourceNode)
{
// If the macro source node is located in the current graph context
if (GraphObj == MacroSourceNode->GetGraph())
{
// Add it to the sequential node list
SequentialNodesInGraph.Add(MacroSourceNode);
SequentialNodeTimes.Add(Sample.ObservationTime);
}
else
{
// The macro source node isn't in the current graph context, but we might have a macro instance node that is
// in the current graph context, so obtain the set of macro instance nodes that are mapped to the code here.
TArray<UEdGraphNode*> MacroInstanceNodes;
DebugData.FindMacroInstanceNodesFromCodeLocation(Sample.Function.Get(), Sample.Offset, MacroInstanceNodes);
// For each macro instance node in the set
for (auto MacroInstanceNodeIt = MacroInstanceNodes.CreateConstIterator(); MacroInstanceNodeIt; ++MacroInstanceNodeIt)
{
// If the macro instance node is located in the current graph context
MacroInstanceNode = Cast<UK2Node_MacroInstance>(*MacroInstanceNodeIt);
if (MacroInstanceNode && GraphObj == MacroInstanceNode->GetGraph())
{
// Add it to the sequential node list
SequentialNodesInGraph.Add(MacroInstanceNode);
SequentialNodeTimes.Add(Sample.ObservationTime);
// Exit the loop; we're done
break;
}
}
}
}
}
}
}
}
}
}
}
// Run thru and apply bonus time
const float InvNumNodes = 1.0f / (float)SequentialNodeTimes.Num();
for (int32 i = 0; i < SequentialNodesInGraph.Num(); ++i)
{
double& ObservationTime = SequentialNodeTimes[i];
const float PositionRatio = (SequentialNodeTimes.Num() - i) * InvNumNodes;
//.........这里部分代码省略.........
示例5: BuildExecutionRoadmap
void FKismetConnectionDrawingPolicy::BuildExecutionRoadmap()
{
LatestTimeDiscovered = 0.0;
// Only do highlighting in PIE or SIE
if (!CanBuildRoadmap())
{
return;
}
UBlueprint* TargetBP = FBlueprintEditorUtils::FindBlueprintForGraphChecked(GraphObj);
UObject* ActiveObject = TargetBP->GetObjectBeingDebugged();
check(ActiveObject); // Due to CanBuildRoadmap
// Redirect the target Blueprint when debugging with a macro graph visible
if (TargetBP->BlueprintType == BPTYPE_MacroLibrary)
{
TargetBP = Cast<UBlueprint>(ActiveObject->GetClass()->ClassGeneratedBy);
}
TArray<UEdGraphNode*> SequentialNodesInGraph;
TArray<double> SequentialNodeTimes;
TArray<UEdGraphPin*> SequentialExecPinsInGraph;
{
const TSimpleRingBuffer<FKismetTraceSample>& TraceStack = FKismetDebugUtilities::GetTraceStack();
UBlueprintGeneratedClass* TargetClass = Cast<UBlueprintGeneratedClass>(TargetBP->GeneratedClass);
FBlueprintDebugData& DebugData = TargetClass->GetDebugData();
for (int32 i = 0; i < TraceStack.Num(); ++i)
{
const FKismetTraceSample& Sample = TraceStack(i);
if (UObject* TestObject = Sample.Context.Get())
{
if (TestObject == ActiveObject)
{
UEdGraphPin* AssociatedPin = DebugData.FindExecPinFromCodeLocation(Sample.Function.Get(), Sample.Offset);
if (UEdGraphNode* Node = DebugData.FindSourceNodeFromCodeLocation(Sample.Function.Get(), Sample.Offset, /*bAllowImpreciseHit=*/ false))
{
if (GraphObj == Node->GetGraph())
{
SequentialNodesInGraph.Add(Node);
SequentialNodeTimes.Add(Sample.ObservationTime);
SequentialExecPinsInGraph.Add(AssociatedPin);
}
else
{
// If the top-level source node is a macro instance node
UK2Node_MacroInstance* MacroInstanceNode = Cast<UK2Node_MacroInstance>(Node);
if (MacroInstanceNode)
{
// Attempt to locate the macro source node through the code mapping
UEdGraphNode* MacroSourceNode = DebugData.FindMacroSourceNodeFromCodeLocation(Sample.Function.Get(), Sample.Offset);
if (MacroSourceNode)
{
// If the macro source node is located in the current graph context
if (GraphObj == MacroSourceNode->GetGraph())
{
// Add it to the sequential node list
SequentialNodesInGraph.Add(MacroSourceNode);
SequentialNodeTimes.Add(Sample.ObservationTime);
SequentialExecPinsInGraph.Add(AssociatedPin);
}
else
{
// The macro source node isn't in the current graph context, but we might have a macro instance node that is
// in the current graph context, so obtain the set of macro instance nodes that are mapped to the code here.
TArray<UEdGraphNode*> MacroInstanceNodes;
DebugData.FindMacroInstanceNodesFromCodeLocation(Sample.Function.Get(), Sample.Offset, MacroInstanceNodes);
// For each macro instance node in the set
for (auto MacroInstanceNodeIt = MacroInstanceNodes.CreateConstIterator(); MacroInstanceNodeIt; ++MacroInstanceNodeIt)
{
// If the macro instance node is located in the current graph context
MacroInstanceNode = Cast<UK2Node_MacroInstance>(*MacroInstanceNodeIt);
if (MacroInstanceNode && GraphObj == MacroInstanceNode->GetGraph())
{
// Add it to the sequential node list
SequentialNodesInGraph.Add(MacroInstanceNode);
SequentialNodeTimes.Add(Sample.ObservationTime);
SequentialExecPinsInGraph.Add(AssociatedPin);
// Exit the loop; we're done
break;
}
}
}
}
}
}
}
}
}
}
}
// Run thru and apply bonus time
//.........这里部分代码省略.........