mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
Support UE 5.7
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "MaterialShared.h"
|
||||
#include "Materials/Material.h"
|
||||
#include "Misc/CoreDelegates.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
#include "Misc/Paths.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "ShaderCore.h"
|
||||
@@ -16,6 +17,15 @@
|
||||
#include "ShaderLabModel.h"
|
||||
#include "UObject/UObjectIterator.h"
|
||||
|
||||
// FCoreDelegates::OnPostEngineInit became the accessor GetOnPostEngineInit() in UE 5.8; 5.7 exposes the
|
||||
// delegate member directly. Mirror the same bridge the runtime subsystem uses so the shared plugin builds
|
||||
// on both engines.
|
||||
#if UE_VERSION_OLDER_THAN(5, 8, 0)
|
||||
#define SHADERLAB_ON_POST_ENGINE_INIT FCoreDelegates::OnPostEngineInit
|
||||
#else
|
||||
#define SHADERLAB_ON_POST_ENGINE_INIT FCoreDelegates::GetOnPostEngineInit()
|
||||
#endif
|
||||
|
||||
DEFINE_LOG_CATEGORY_STATIC(LogShaderLabBuilder, Log, All);
|
||||
|
||||
namespace
|
||||
@@ -154,7 +164,7 @@ public:
|
||||
// (a fresh clone lacks .vscode — it is git-ignored). Deferred to post-engine-init so shader-source
|
||||
// mappings (added above) and UMaterial reflection are ready; the callback self-gates to an interactive
|
||||
// editor session (no cook / -game / commandlet / unattended).
|
||||
PostEngineInitHandle = FCoreDelegates::GetOnPostEngineInit().AddStatic(&ShaderLabIDE_EnsureGeneratedIfMissing);
|
||||
PostEngineInitHandle = SHADERLAB_ON_POST_ENGINE_INIT.AddStatic(&ShaderLabIDE_EnsureGeneratedIfMissing);
|
||||
|
||||
UE_LOG(LogShaderLabBuilder, Log, TEXT("ShaderLabBuilder module started."));
|
||||
}
|
||||
@@ -168,7 +178,7 @@ public:
|
||||
}
|
||||
if (PostEngineInitHandle.IsValid())
|
||||
{
|
||||
FCoreDelegates::GetOnPostEngineInit().Remove(PostEngineInitHandle);
|
||||
SHADERLAB_ON_POST_ENGINE_INIT.Remove(PostEngineInitHandle);
|
||||
PostEngineInitHandle.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user