mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 23:04:37 +00:00
Support UE 5.7
This commit is contained in:
@@ -27,7 +27,10 @@
|
||||
#include "Materials/MaterialExpressionSceneTexture.h"
|
||||
#include "Engine/SubsurfaceProfile.h"
|
||||
#include "Engine/SpecularProfile.h"
|
||||
#include "Engine/ToonProfile.h"
|
||||
#include "Misc/EngineVersionComparison.h"
|
||||
#if !UE_VERSION_OLDER_THAN(5, 8, 0)
|
||||
#include "Engine/ToonProfile.h" // Substrate Toon BSDF/profile is 5.8+; the whole Toon path is version-guarded out on 5.7
|
||||
#endif
|
||||
#include "Materials/MaterialExpressionTextureObjectParameter.h"
|
||||
#include "Materials/MaterialExpressionTextureSampleParameter2D.h"
|
||||
#include "Materials/MaterialExpressionTextureCoordinate.h"
|
||||
@@ -505,7 +508,8 @@ namespace ShaderLabGraph
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// --- Toon (experimental) ---
|
||||
// --- Toon (experimental; Substrate 5.8+ only — UMaterialExpressionSubstrateToonBSDF does not exist in 5.7) ---
|
||||
#if !UE_VERSION_OLDER_THAN(5, 8, 0)
|
||||
static const FSlabFieldDef GToonFields[] = {
|
||||
{ TEXT("BaseColor"), CMOT_Float3 }, { TEXT("Metallic"), CMOT_Float1 }, { TEXT("Specular"), CMOT_Float1 },
|
||||
{ TEXT("Roughness"), CMOT_Float1 }, { TEXT("Normal"), CMOT_Float3 }, { TEXT("EmissiveColor"), CMOT_Float3 },
|
||||
@@ -526,6 +530,7 @@ namespace ShaderLabGraph
|
||||
if (F == TEXT("Tangent")) return &B->Tangent;
|
||||
return nullptr;
|
||||
}
|
||||
#endif // !UE_VERSION_OLDER_THAN(5, 8, 0) — Toon
|
||||
|
||||
// --- Light Function ---
|
||||
static const FSlabFieldDef GLightFunctionFields[] = {
|
||||
@@ -554,8 +559,10 @@ namespace ShaderLabGraph
|
||||
GVolumeFields, UE_ARRAY_COUNT(GVolumeFields), &MakeVolumeNode, &GetVolumePin },
|
||||
{ EShaderLabBsdfType::ClearCoat, TEXT("ShaderLab ClearCoat"), TEXT("FShaderLabClearCoat"), TEXT("ShaderLabDefaultClearCoat"),
|
||||
GClearCoatFields, UE_ARRAY_COUNT(GClearCoatFields), &MakeClearCoatNode, &GetClearCoatPin },
|
||||
#if !UE_VERSION_OLDER_THAN(5, 8, 0)
|
||||
{ EShaderLabBsdfType::Toon, TEXT("ShaderLab Toon"), TEXT("FShaderLabToon"), TEXT("ShaderLabDefaultToon"),
|
||||
GToonFields, UE_ARRAY_COUNT(GToonFields), &MakeToonNode, &GetToonPin },
|
||||
#endif
|
||||
{ EShaderLabBsdfType::LightFunction, TEXT("ShaderLab LightFunction"), TEXT("FShaderLabLightFunction"), TEXT("ShaderLabDefaultLightFunction"),
|
||||
GLightFunctionFields, UE_ARRAY_COUNT(GLightFunctionFields), &MakeLightFunctionNode, &GetLightFunctionPin },
|
||||
};
|
||||
@@ -1825,10 +1832,12 @@ namespace ShaderLabGraph
|
||||
{
|
||||
if (!LoadProfileAsset(M.SubsurfaceProfilePath, TEXT("SubsurfaceProfile"), Eye->SubsurfaceProfile, OutErrors)) { return false; }
|
||||
}
|
||||
#if !UE_VERSION_OLDER_THAN(5, 8, 0)
|
||||
else if (UMaterialExpressionSubstrateToonBSDF* Toon = Cast<UMaterialExpressionSubstrateToonBSDF>(Bsdf))
|
||||
{
|
||||
if (!LoadProfileAsset(M.ToonProfilePath, TEXT("ToonProfile"), Toon->ToonProfile, OutErrors)) { return false; }
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user