Support UMaterial all property settings, enhance VSCode code-snippets

This commit is contained in:
Eragon-Brisingr
2026-07-07 11:33:35 +08:00
parent 3dbdf02f27
commit 2bf500bd98
8 changed files with 446 additions and 106 deletions

View File

@@ -5,10 +5,12 @@
#include "Interfaces/IPluginManager.h"
#include "MaterialShared.h"
#include "Materials/Material.h"
#include "Misc/CoreDelegates.h"
#include "Misc/Paths.h"
#include "Modules/ModuleManager.h"
#include "ShaderCore.h"
#include "ShaderLabGraphBuilder.h"
#include "ShaderLabIDEPrepare.h"
#include "ShaderLabMaterialInstanceConstant.h"
#include "ShaderLabMaterialRegistry.h"
#include "ShaderLabModel.h"
@@ -148,6 +150,12 @@ public:
// module loaded for all uncooked runs) is the fix for invisible materials under `-game`.
BuildHandle = FShaderLabMaterialRegistry::Get().OnBuildMaterial().AddStatic(&BuildAndCompile);
// First-launch convenience: auto-generate the .usl IDE authoring assets if the project is missing them
// (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);
UE_LOG(LogShaderLabBuilder, Log, TEXT("ShaderLabBuilder module started."));
}
@@ -158,10 +166,16 @@ public:
FShaderLabMaterialRegistry::Get().OnBuildMaterial().Remove(BuildHandle);
BuildHandle.Reset();
}
if (PostEngineInitHandle.IsValid())
{
FCoreDelegates::GetOnPostEngineInit().Remove(PostEngineInitHandle);
PostEngineInitHandle.Reset();
}
}
private:
FDelegateHandle BuildHandle;
FDelegateHandle PostEngineInitHandle;
};
IMPLEMENT_MODULE(FShaderLabBuilderModule, UShaderLabBuilder)