More work on graph editing
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
#include "MCPUtils.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
#include "MaterialGraph/MaterialGraphNode.h"
|
||||
#include "Materials/Material.h"
|
||||
#include "IMaterialEditor.h"
|
||||
#include "GraphNode_Delete.generated.h"
|
||||
|
||||
|
||||
@@ -47,8 +50,21 @@ public:
|
||||
}
|
||||
|
||||
F.PreEdit();
|
||||
FoundNode->BreakAllNodeLinks();
|
||||
Graph->RemoveNode(FoundNode);
|
||||
|
||||
if (Cast<UMaterialGraphNode>(FoundNode))
|
||||
{
|
||||
// Use the material editor's DeleteNodes to properly remove
|
||||
// both the graph node and the underlying material expression.
|
||||
IMaterialEditor* MatEditor = F.CastEditor<UMaterial, IMaterialEditor>();
|
||||
if (!MatEditor) return;
|
||||
MatEditor->DeleteNodes({FoundNode});
|
||||
}
|
||||
else
|
||||
{
|
||||
FoundNode->BreakAllNodeLinks();
|
||||
Graph->RemoveNode(FoundNode);
|
||||
}
|
||||
|
||||
F.PostEdit();
|
||||
|
||||
Result.Appendf(TEXT("Deleted node '%s' from graph '%s'.\n"), *NodeTitle, *GraphName);
|
||||
|
||||
Reference in New Issue
Block a user