More work on graph editing

This commit is contained in:
2026-03-13 00:48:19 -04:00
parent 8715cd25b0
commit 7202ef9bf6
8 changed files with 223 additions and 120 deletions

View File

@@ -11,6 +11,7 @@
#include "MaterialGraph/MaterialGraph.h"
#include "MaterialGraph/MaterialGraphNode.h"
#include "Engine/LevelScriptBlueprint.h"
#include "Subsystems/AssetEditorSubsystem.h"
MCPFetcher& MCPFetcher::SetError(const FString& Msg)
{
@@ -86,7 +87,18 @@ MCPFetcher& MCPFetcher::Asset(const FString& PackagePath)
{
SetObj(LoadObject<UObject>(nullptr, *PackagePath));
if (!Obj)
SetError(FString::Printf(TEXT("Could not load asset '%s'"), *PackagePath));
return SetError(FString::Printf(TEXT("Could not load asset '%s'"), *PackagePath));
OriginalAsset = Obj;
// Open the editor for this asset (or bring it to front if already open).
UAssetEditorSubsystem* Sub = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
if (!Sub || !Sub->OpenEditorForAsset(Obj))
return SetError(FString::Printf(TEXT("Could not open editor for '%s'"), *PackagePath));
Editor = Sub->FindEditorForAsset(OriginalAsset, false);
if (!Editor)
return SetError(FString::Printf(TEXT("Could not find editor instance for '%s'"), *PackagePath));
// If this is a material open in the editor, use the editor's transient copy.
if (UMaterial* Mat = ::Cast<UMaterial>(Obj))