本文整理汇总了C++中UEdGraph类的典型用法代码示例。如果您正苦于以下问题:C++ UEdGraph类的具体用法?C++ UEdGraph怎么用?C++ UEdGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UEdGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetClassToSpawn
void UK2Node_LatentAbilityCall::PinDefaultValueChanged(UEdGraphPin* ChangedPin)
{
if (ChangedPin->PinName == FK2Node_LatentAbilityCallHelper::ClassPinName)
{
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
// Because the archetype has changed, we break the output link as the output pin type will change
//UEdGraphPin* ResultPin = GetResultPin();
//ResultPin->BreakAllPinLinks();
// Remove all pins related to archetype variables
for (auto OldPin : SpawnParmPins)
{
OldPin->BreakAllPinLinks();
Pins.Remove(OldPin);
}
SpawnParmPins.Empty();
UClass* UseSpawnClass = GetClassToSpawn();
if (UseSpawnClass != NULL)
{
CreatePinsForClass(UseSpawnClass);
}
// Refresh the UI for the graph so the pin changes show up
UEdGraph* Graph = GetGraph();
Graph->NotifyGraphChanged();
// Mark dirty
FBlueprintEditorUtils::MarkBlueprintAsModified(GetBlueprint());
}
}
示例2: MergeChildrenGraphsIn
// Moves the contents of all of the children graphs (recursively) into the target graph. This does not clone, it's destructive to the source
void FEdGraphUtilities::MergeChildrenGraphsIn(UEdGraph* MergeTarget, UEdGraph* ParentGraph, bool bRequireSchemaMatch, bool bInIsCompiling/* = false*/)
{
// Determine if we are regenerating a blueprint on load
UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(MergeTarget);
const bool bIsLoading = Blueprint ? Blueprint->bIsRegeneratingOnLoad : false;
// Merge all children nodes in too
for (int32 Index = 0; Index < ParentGraph->SubGraphs.Num(); ++Index)
{
UEdGraph* ChildGraph = ParentGraph->SubGraphs[Index];
auto NodeOwner = Cast<const UEdGraphNode>(ChildGraph ? ChildGraph->GetOuter() : nullptr);
const bool bNonVirtualGraph = NodeOwner ? NodeOwner->ShouldMergeChildGraphs() : true;
// Only merge children in with the same schema as the parent
auto ChildSchema = ChildGraph ? ChildGraph->GetSchema() : nullptr;
auto TargetSchema = MergeTarget ? MergeTarget->GetSchema() : nullptr;
const bool bSchemaMatches = ChildSchema && TargetSchema && ChildSchema->GetClass()->IsChildOf(TargetSchema->GetClass());
const bool bDoMerge = bNonVirtualGraph && (!bRequireSchemaMatch || bSchemaMatches);
if (bDoMerge)
{
// Even if we don't require a match to recurse, we do to actually copy the nodes
if (bSchemaMatches)
{
ChildGraph->MoveNodesToAnotherGraph(MergeTarget, IsAsyncLoading() || bIsLoading, bInIsCompiling);
}
MergeChildrenGraphsIn(MergeTarget, ChildGraph, bRequireSchemaMatch, bInIsCompiling);
}
}
}
示例3: GetClassToSpawn
void UK2Node_LiveEditObject::PinDefaultValueChanged(UEdGraphPin* Pin)
{
if(Pin->PinName == UK2Node_LiveEditObjectStatics::BaseClassPinName)
{
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
// Remove all pins related to archetype variables
TArray<UEdGraphPin*> OldPins = Pins;
for(int32 i=0; i<OldPins.Num(); i++)
{
UEdGraphPin* OldPin = OldPins[i];
if( IsSpawnVarPin(OldPin) )
{
Pin->BreakAllPinLinks();
Pins.Remove(OldPin);
}
}
UClass* UseSpawnClass = GetClassToSpawn();
if(UseSpawnClass != NULL)
{
CreatePinsForClass(UseSpawnClass);
}
// Refresh the UI for the graph so the pin changes show up
UEdGraph* Graph = GetGraph();
Graph->NotifyGraphChanged();
// Mark dirty
FBlueprintEditorUtils::MarkBlueprintAsModified(GetBlueprint());
}
}
示例4: check
void UAnimGraphNode_StateMachineBase::PostPlacedNewNode()
{
// Create a new animation graph
check(EditorStateMachineGraph == NULL);
EditorStateMachineGraph = CastChecked<UAnimationStateMachineGraph>(FBlueprintEditorUtils::CreateNewGraph(this, NAME_None, UAnimationStateMachineGraph::StaticClass(), UAnimationStateMachineSchema::StaticClass()));
check(EditorStateMachineGraph);
EditorStateMachineGraph->OwnerAnimGraphNode = this;
// Find an interesting name
TSharedPtr<INameValidatorInterface> NameValidator = FNameValidatorFactory::MakeValidator(this);
FBlueprintEditorUtils::RenameGraphWithSuggestion(EditorStateMachineGraph, NameValidator, TEXT("New State Machine"));
// Initialize the anim graph
const UEdGraphSchema* Schema = EditorStateMachineGraph->GetSchema();
Schema->CreateDefaultNodesForGraph(*EditorStateMachineGraph);
// Add the new graph as a child of our parent graph
UEdGraph* ParentGraph = GetGraph();
if(ParentGraph->SubGraphs.Find(EditorStateMachineGraph) == INDEX_NONE)
{
ParentGraph->Modify();
ParentGraph->SubGraphs.Add(EditorStateMachineGraph);
}
}
示例5: LOCTEXT
FText UK2Node_MacroInstance::GetCompactNodeTitle() const
{
// Special case handling for standard macros
// @TODO Change this to use metadata by allowing macros to specify CompactNodeTitle metadata
UEdGraph* MacroGraph = MacroGraphReference.GetGraph();
if(MacroGraph != nullptr && MacroGraph->GetOuter()->GetName() == TEXT("StandardMacros"))
{
FName MacroName = FName(*MacroGraph->GetName());
if( MacroName == TEXT("IncrementFloat" ) ||
MacroName == TEXT("IncrementInt"))
{
return LOCTEXT("IncrementCompactNodeTitle", "++");
}
else if( MacroName == TEXT("DecrementFloat") ||
MacroName == TEXT("DecrementInt"))
{
return LOCTEXT("DecrementCompactNodeTitle", "--");
}
else if( MacroName == TEXT("NegateFloat") ||
MacroName == TEXT("NegateInt") )
{
return LOCTEXT("DecrementCompactNodeTitle", "-");
}
}
return Super::GetCompactNodeTitle();
}
示例6: OnNewBlueprintCreated
void FPersonaModule::OnNewBlueprintCreated(UBlueprint* InBlueprint)
{
if (ensure(InBlueprint->UbergraphPages.Num() > 0))
{
UEdGraph* EventGraph = InBlueprint->UbergraphPages[0];
int32 SafeXPosition = 0;
int32 SafeYPosition = 0;
if (EventGraph->Nodes.Num() != 0)
{
SafeXPosition = EventGraph->Nodes[0]->NodePosX;
SafeYPosition = EventGraph->Nodes[EventGraph->Nodes.Num() - 1]->NodePosY + EventGraph->Nodes[EventGraph->Nodes.Num() - 1]->NodeHeight + 100;
}
// add try get owner node
UK2Node_CallFunction* GetOwnerNode = NewObject<UK2Node_CallFunction>(EventGraph);
UFunction* MakeNodeFunction = UAnimInstance::StaticClass()->FindFunctionByName(GET_FUNCTION_NAME_CHECKED(UAnimInstance, TryGetPawnOwner));
GetOwnerNode->CreateNewGuid();
GetOwnerNode->PostPlacedNewNode();
GetOwnerNode->SetFromFunction(MakeNodeFunction);
GetOwnerNode->SetFlags(RF_Transactional);
GetOwnerNode->AllocateDefaultPins();
GetOwnerNode->NodePosX = SafeXPosition;
GetOwnerNode->NodePosY = SafeYPosition;
UEdGraphSchema_K2::SetNodeMetaData(GetOwnerNode, FNodeMetadata::DefaultGraphNode);
GetOwnerNode->bIsNodeEnabled = false;
EventGraph->AddNode(GetOwnerNode);
}
}
示例7: check
UK2Node_PlayMovieScene* FSequencerActorBindingManager::CreateNewPlayMovieSceneNode( UMovieScene* MovieScene ) const
{
// Grab the world object for this editor
check( MovieScene != NULL );
ULevel* Level = ActorWorld->GetCurrentLevel();
check( Level != NULL );
// Here, we'll create a level script if one does not yet exist.
const bool bDontCreate = false;
ULevelScriptBlueprint* LSB = Level->GetLevelScriptBlueprint( bDontCreate );
if( LSB != NULL )
{
UEdGraph* TargetGraph = NULL;
if( LSB->UbergraphPages.Num() > 0 )
{
TargetGraph = LSB->UbergraphPages[0]; // Just use the first graph
}
if( ensure( TargetGraph != NULL ) )
{
// Figure out a decent place to stick the node
const FVector2D NewNodePos = TargetGraph->GetGoodPlaceForNewNode();
// Create a new node
UK2Node_PlayMovieScene* TemplateNode = NewObject<UK2Node_PlayMovieScene>();
TemplateNode->SetMovieScene( MovieScene );
return FEdGraphSchemaAction_K2NewNode::SpawnNodeFromTemplate<UK2Node_PlayMovieScene>(TargetGraph, TemplateNode, NewNodePos);;
}
}
return NULL;
}
示例8: GetPinObj
bool SGraphPin::TryHandlePinConnection(SGraphPin& OtherSPin)
{
UEdGraphPin* PinA = GetPinObj();
UEdGraphPin* PinB = OtherSPin.GetPinObj();
UEdGraph* MyGraphObj = PinA->GetOwningNode()->GetGraph();
return MyGraphObj->GetSchema()->TryCreateConnection(PinA, PinB);
}
示例9: GetGraph
FText UK2Node_FunctionEntry::GetNodeTitle(ENodeTitleType::Type TitleType) const
{
UEdGraph* Graph = GetGraph();
FGraphDisplayInfo DisplayInfo;
Graph->GetSchema()->GetGraphDisplayInformation(*Graph, DisplayInfo);
return DisplayInfo.DisplayName;
}
示例10: GetGraph
void UEdGraphNode::DestroyNode()
{
UEdGraph* ParentGraph = GetGraph();
check(ParentGraph);
// Remove the node - this will break all links. Will be GC'd after this.
ParentGraph->RemoveNode(this);
}
示例11: GetDocumentationExcerptName
FString UK2Node_MacroInstance::GetDocumentationExcerptName() const
{
UEdGraph* MacroGraph = MacroGraphReference.GetGraph();
if (MacroGraph != NULL)
{
return MacroGraph->GetName();
}
return Super::GetDocumentationExcerptName();
}
示例12: GetGraphDisplayInformation
void UAnimationConduitGraphSchema::GetGraphDisplayInformation(const UEdGraph& Graph, /*out*/ FGraphDisplayInfo& DisplayInfo) const
{
DisplayInfo.DisplayName = FText::FromString( Graph.GetName() );
if (const UAnimStateConduitNode* ConduitNode = Cast<const UAnimStateConduitNode>(Graph.GetOuter()))
{
DisplayInfo.DisplayName = FText::Format( NSLOCTEXT("Animation", "ConduitRuleGraphTitle", "{0} (conduit rule)"), FText::FromString( ConduitNode->GetNodeTitle(ENodeTitleType::FullTitle) ) );
}
}
示例13: new
void FBlueprintStatsModule::DumpBlueprintStats()
{
TArray<FBlueprintStatRecord> Records;
for (TObjectIterator<UBlueprint> BlueprintIt; BlueprintIt; ++BlueprintIt)
{
UBlueprint* Blueprint = *BlueprintIt;
new (Records) FBlueprintStatRecord(Blueprint);
}
// Now merge them
FBlueprintStatRecord Aggregate(NULL);
for (const FBlueprintStatRecord& SourceRecord : Records)
{
Aggregate.MergeAnotherRecordIn(SourceRecord);
}
// Sort the lists
Aggregate.NodeCount.ValueSort(TGreater<int32>());
Aggregate.FunctionCount.ValueSort(TGreater<int32>());
Aggregate.FunctionOwnerCount.ValueSort(TGreater<int32>());
Aggregate.RemoteMacroCount.ValueSort(TGreater<int32>());
// Print out the merged record
UE_LOG(LogBlueprintStats, Log, TEXT("Blueprint stats for %d blueprints in %s"), Records.Num(), GGameName);
UE_LOG(LogBlueprintStats, Log, TEXT("%s"), *Aggregate.ToString(true));
UE_LOG(LogBlueprintStats, Log, TEXT("%s"), *Aggregate.ToString(false));
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the node list
UE_LOG(LogBlueprintStats, Log, TEXT("NodeClass,NumInstances"));
for (const auto& NodePair : Aggregate.NodeCount)
{
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%d"), *(NodePair.Key->GetName()), NodePair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the function list
UE_LOG(LogBlueprintStats, Log, TEXT("FunctionPath,ClassName,FunctionName,NumInstances"));
for (const auto& FunctionPair : Aggregate.FunctionCount)
{
UFunction* Function = FunctionPair.Key;
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%s,%s,%d"), *(Function->GetPathName()), *(Function->GetOuterUClass()->GetName()), *(Function->GetName()), FunctionPair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
// Print out the macro list
UE_LOG(LogBlueprintStats, Log, TEXT("MacroPath,MacroName,NumInstances"));
for (const auto& MacroPair : Aggregate.RemoteMacroCount)
{
UEdGraph* MacroGraph = MacroPair.Key;
UE_LOG(LogBlueprintStats, Log, TEXT("%s,%s,%d"), *(MacroGraph->GetPathName()), *(MacroGraph->GetName()), MacroPair.Value);
}
UE_LOG(LogBlueprintStats, Log, TEXT("\n"));
}
示例14: GetClassToSpawn
void UK2Node_SpawnActorFromClass::OnClassPinChanged()
{
const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>();
// Remove all pins related to archetype variables
TArray<UEdGraphPin*> OldPins = Pins;
TArray<UEdGraphPin*> OldClassPins;
for (int32 i = 0; i < OldPins.Num(); i++)
{
UEdGraphPin* OldPin = OldPins[i];
if (IsSpawnVarPin(OldPin))
{
Pins.Remove(OldPin);
OldClassPins.Add(OldPin);
}
}
CachedNodeTitle.MarkDirty();
UClass* UseSpawnClass = GetClassToSpawn();
TArray<UEdGraphPin*> NewClassPins;
if (UseSpawnClass != NULL)
{
CreatePinsForClass(UseSpawnClass, NewClassPins);
}
UEdGraphPin* ResultPin = GetResultPin();
// Cache all the pin connections to the ResultPin, we will attempt to recreate them
TArray<UEdGraphPin*> ResultPinConnectionList = ResultPin->LinkedTo;
// Because the archetype has changed, we break the output link as the output pin type will change
ResultPin->BreakAllPinLinks();
// Recreate any pin links to the Result pin that are still valid
for (UEdGraphPin* Connections : ResultPinConnectionList)
{
K2Schema->TryCreateConnection(ResultPin, Connections);
}
K2Schema->ConstructBasicPinTooltip(*ResultPin, LOCTEXT("ResultPinDescription", "The spawned Actor"), ResultPin->PinToolTip);
// Rewire the old pins to the new pins so connections are maintained if possible
RewireOldPinsToNewPins(OldClassPins, NewClassPins);
// Destroy the old pins
DestroyPinList(OldClassPins);
// Refresh the UI for the graph so the pin changes show up
UEdGraph* Graph = GetGraph();
Graph->NotifyGraphChanged();
// Mark dirty
FBlueprintEditorUtils::MarkBlueprintAsModified(GetBlueprint());
}
示例15: NSLOCTEXT
FText UK2Node_MacroInstance::GetNodeTitle(ENodeTitleType::Type TitleType) const
{
UEdGraph* MacroGraph = MacroGraphReference.GetGraph();
FText Result = NSLOCTEXT("K2Node", "MacroInstance", "Macro instance");
if (MacroGraph)
{
Result = FText::FromString(MacroGraph->GetName());
}
return Result;
}