// Clones the content from SourceGraph and merges it into MergeTarget; including merging/flattening all of the children from the SourceGraph into MergeTarget
void FEdGraphUtilities::CloneAndMergeGraphIn(UEdGraph* MergeTarget, UEdGraph* SourceGraph, FCompilerResultsLog& MessageLog, bool bRequireSchemaMatch, bool bInIsCompiling/* = false*/, TArray<UEdGraphNode*>* OutClonedNodes)
{
	// Clone the graph, then move all of it's children
	UEdGraph* ClonedGraph = CloneGraph(SourceGraph, NULL, &MessageLog, true);
	MergeChildrenGraphsIn(ClonedGraph, ClonedGraph, bRequireSchemaMatch);

	// Duplicate the list of cloned nodes
	if (OutClonedNodes != NULL)
	{
		OutClonedNodes->Append(ClonedGraph->Nodes);
	}

	// Determine if we are regenerating a blueprint on load
	UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(MergeTarget);
	const bool bIsLoading = Blueprint ? Blueprint->bIsRegeneratingOnLoad : false;

	// Move them all to the destination
	ClonedGraph->MoveNodesToAnotherGraph(MergeTarget, IsAsyncLoading() || bIsLoading, bInIsCompiling);
}
Beispiel #2
0
int main()
{
	int i;
	graphnode* copygraph;
	graphnode *examplegraph = (graphnode*)malloc(sizeof(graphnode));
	examplegraph->label = 0;
	examplegraph->neighbor = (graphnode**)malloc(sizeof(graphnode*) *3);
	for(i = 0; i < 2; i++) {
		examplegraph->neighbor[i] = (graphnode*)malloc(sizeof(graphnode));
		examplegraph->neighbor[i]->label = i + 1; 
	}
	examplegraph->neighbor[i] = NULL;

	examplegraph->neighbor[0]->neighbor = (graphnode**)malloc(sizeof(graphnode*) *2);
	examplegraph->neighbor[0]->neighbor[0] = examplegraph;
	examplegraph->neighbor[0]->neighbor[1] = NULL;
	
	examplegraph->neighbor[1]->neighbor = (graphnode**)malloc(sizeof(graphnode*) *2);
	examplegraph->neighbor[1]->neighbor[0] = examplegraph;
	examplegraph->neighbor[1]->neighbor[1] = NULL;
	
	copygraph = CloneGraph(examplegraph ,3);
	printf("%d", copygraph->neighbor[0]->neighbor[0]->label);
}