mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
Support SL_INTERPOLATOR and local function
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
// Copyright FlecsProj. All Rights Reserved.
|
||||
// Copyright UShaderLab. All Rights Reserved.
|
||||
|
||||
#include "DirectoryWatcherModule.h"
|
||||
#include "Editor.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "HAL/FileManager.h"
|
||||
#include "IDirectoryWatcher.h"
|
||||
#include "Interfaces/IPluginManager.h"
|
||||
#include "MaterialEditingLibrary.h"
|
||||
@@ -16,6 +17,7 @@
|
||||
#include "ShaderLabMaterialRegistry.h"
|
||||
#include "ShaderLabModel.h"
|
||||
#include "ShaderLabSubsystem.h"
|
||||
#include "ShaderLabVSCodeButton.h"
|
||||
#include "UObject/Package.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY_STATIC(LogShaderLabEditor, Log, All);
|
||||
@@ -108,17 +110,37 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Map the plugin's Intermediate/ShaderLabGen directory (a build-time artifact dir) so the graph
|
||||
// builder can #include per-shader generated local-code headers (`/UShaderLabGen/<Name>.gen.ush`).
|
||||
// AddShaderSourceDirectoryMapping requires the real dir to already exist, so create it first.
|
||||
{
|
||||
const FString GenDir = FShaderLabGraphBuilder::GetGeneratedShaderDir();
|
||||
const TCHAR* GenRoot = FShaderLabGraphBuilder::GetGeneratedVirtualRoot();
|
||||
if (!GenDir.IsEmpty())
|
||||
{
|
||||
IFileManager::Get().MakeDirectory(*GenDir, /*Tree*/ true);
|
||||
if (FPaths::DirectoryExists(GenDir) && !AllShaderSourceDirectoryMappings().Contains(GenRoot))
|
||||
{
|
||||
AddShaderSourceDirectoryMapping(GenRoot, GenDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in / recompile base materials whenever the registry asks (startup + hot reload).
|
||||
BuildHandle = FShaderLabMaterialRegistry::Get().OnBuildMaterial().AddStatic(&BuildAndCompile);
|
||||
|
||||
StartWatchingSources();
|
||||
|
||||
// "Open .usl in VSCode" toolbar button on the Material Instance Editor for ShaderLab MICs.
|
||||
ShaderLabVSCodeButton::Register();
|
||||
|
||||
UE_LOG(LogShaderLabEditor, Log, TEXT("ShaderLabEditor module started."));
|
||||
}
|
||||
|
||||
virtual void ShutdownModule() override
|
||||
{
|
||||
StopWatchingSources();
|
||||
ShaderLabVSCodeButton::Unregister();
|
||||
if (BuildHandle.IsValid())
|
||||
{
|
||||
FShaderLabMaterialRegistry::Get().OnBuildMaterial().Remove(BuildHandle);
|
||||
|
||||
Reference in New Issue
Block a user