mirror of
https://github.com/Eragon-Brisingr/UShaderLab.git
synced 2026-09-15 14:54:36 +00:00
Fix -Game no matieral error
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "MaterialEditorModule.h"
|
||||
#include "Misc/Paths.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "ShaderCore.h"
|
||||
#include "ShaderLabGraphBuilder.h"
|
||||
#include "ShaderLabMaterialInstanceConstant.h"
|
||||
#include "Styling/AppStyle.h"
|
||||
#include "Textures/SlateIcon.h"
|
||||
@@ -22,21 +22,16 @@ namespace ShaderLabVSCodeButton
|
||||
{
|
||||
static FDelegateHandle GExtenderDelegateHandle;
|
||||
|
||||
/** Reverse the ShaderLabPath virtual path (e.g. "/Project/Examples/Basic.usl") to a disk path via the
|
||||
* registered shader mappings (generic — /Project, /Plugin/<any>, /Engine). Empty if unresolved. */
|
||||
/** Reverse the ShaderLabPath virtual path (e.g. "/Project/Examples/Basic.usl") to an absolute disk path
|
||||
* via the shared shader-mapping resolver (generic — /Project, /Plugin/<any>, /Engine). Empty if unresolved. */
|
||||
static FString ResolveVirtualToDisk(const FString& VirtualPath)
|
||||
{
|
||||
int32 BestKeyLen = -1;
|
||||
FString BestDisk;
|
||||
for (const TPair<FString, FString>& Mapping : AllShaderSourceDirectoryMappings())
|
||||
FString Disk;
|
||||
if (!FShaderLabGraphBuilder::ResolveVirtualShaderFile(VirtualPath, Disk))
|
||||
{
|
||||
if (VirtualPath.StartsWith(Mapping.Key + TEXT("/"), ESearchCase::IgnoreCase) && Mapping.Key.Len() > BestKeyLen)
|
||||
{
|
||||
BestKeyLen = Mapping.Key.Len();
|
||||
BestDisk = Mapping.Value / VirtualPath.RightChop(Mapping.Key.Len() + 1);
|
||||
}
|
||||
return FString();
|
||||
}
|
||||
return (BestKeyLen >= 0) ? FPaths::ConvertRelativePathToFull(BestDisk) : FString();
|
||||
return FPaths::ConvertRelativePathToFull(Disk);
|
||||
}
|
||||
|
||||
static void OpenInVSCode(TWeakObjectPtr<UShaderLabMaterialInstanceConstant> MICWeak)
|
||||
|
||||
Reference in New Issue
Block a user