├── Config ├── DefaultEditor.ini ├── DefaultGame.ini └── DefaultEngine.ini ├── AwesomeShaders └── CustomFunction.ush ├── Plugins └── ShaderDirectory │ ├── Shaders │ └── CustomFunction.ush │ ├── Resources │ └── Icon128.png │ ├── Content │ └── M_CustomUSHTest.uasset │ ├── Source │ └── ShaderDirectory │ │ ├── Public │ │ └── ShaderDirectory.h │ │ ├── Private │ │ └── ShaderDirectory.cpp │ │ └── ShaderDirectory.Build.cs │ └── ShaderDirectory.uplugin ├── Content └── M_CustomUSHTest.uasset ├── Source ├── ShaderMacro │ ├── ShaderMacro.h │ ├── ShaderMacroGameModeBase.cpp │ ├── ShaderMacro.cpp │ ├── ShaderMacroGameModeBase.h │ └── ShaderMacro.Build.cs ├── ShaderMacro.Target.cs └── ShaderMacroEditor.Target.cs ├── ShaderMacro.uproject └── .gitignore /Config/DefaultEditor.ini: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AwesomeShaders/CustomFunction.ush: -------------------------------------------------------------------------------- 1 | float3 col = mul(A, B); 2 | return col; -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Shaders/CustomFunction.ush: -------------------------------------------------------------------------------- 1 | float3 col = mul(A, B); 2 | return col; -------------------------------------------------------------------------------- /Config/DefaultGame.ini: -------------------------------------------------------------------------------- 1 | 2 | [/Script/EngineSettings.GeneralProjectSettings] 3 | ProjectID=A516639F49D1BB34C40C6DA83F17E937 4 | -------------------------------------------------------------------------------- /Content/M_CustomUSHTest.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaderwitch/CustomShaderDirectoryExample/HEAD/Content/M_CustomUSHTest.uasset -------------------------------------------------------------------------------- /Source/ShaderMacro/ShaderMacro.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaderwitch/CustomShaderDirectoryExample/HEAD/Plugins/ShaderDirectory/Resources/Icon128.png -------------------------------------------------------------------------------- /Source/ShaderMacro/ShaderMacroGameModeBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | 4 | #include "ShaderMacroGameModeBase.h" 5 | 6 | -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Content/M_CustomUSHTest.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaderwitch/CustomShaderDirectoryExample/HEAD/Plugins/ShaderDirectory/Content/M_CustomUSHTest.uasset -------------------------------------------------------------------------------- /Source/ShaderMacro/ShaderMacro.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "ShaderMacro.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, ShaderMacro, "ShaderMacro" ); 7 | -------------------------------------------------------------------------------- /ShaderMacro.uproject: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "EngineAssociation": "4.24", 4 | "Category": "", 5 | "Description": "", 6 | "Modules": [ 7 | { 8 | "Name": "ShaderMacro", 9 | "Type": "Runtime", 10 | "LoadingPhase": "Default" 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /Source/ShaderMacro/ShaderMacroGameModeBase.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "ShaderMacroGameModeBase.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class SHADERMACRO_API AShaderMacroGameModeBase : public AGameModeBase 14 | { 15 | GENERATED_BODY() 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Source/ShaderDirectory/Public/ShaderDirectory.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | class FShaderDirectoryModule : public IModuleInterface 9 | { 10 | public: 11 | 12 | /** IModuleInterface implementation */ 13 | virtual void StartupModule() override; 14 | virtual void ShutdownModule() override; 15 | }; 16 | -------------------------------------------------------------------------------- /Source/ShaderMacro.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class ShaderMacroTarget : TargetRules 7 | { 8 | public ShaderMacroTarget( TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Game; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | ExtraModuleNames.AddRange( new string[] { "ShaderMacro" } ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Source/ShaderMacroEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class ShaderMacroEditorTarget : TargetRules 7 | { 8 | public ShaderMacroEditorTarget( TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Editor; 11 | DefaultBuildSettings = BuildSettingsVersion.V2; 12 | ExtraModuleNames.AddRange( new string[] { "ShaderMacro" } ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Config/DefaultEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/Engine.Engine] 2 | +ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/ShaderMacro") 3 | +ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/ShaderMacro") 4 | +ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="ShaderMacroGameModeBase") 5 | 6 | [/Script/HardwareTargeting.HardwareTargetingSettings] 7 | TargetedHardwareClass=Desktop 8 | AppliedTargetedHardwareClass=Desktop 9 | DefaultGraphicsPerformance=Maximum 10 | AppliedDefaultGraphicsPerformance=Maximum 11 | 12 | 13 | -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/ShaderDirectory.uplugin: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "Version": 1, 4 | "VersionName": "1.0", 5 | "FriendlyName": "ShaderDirectory", 6 | "Description": "", 7 | "Category": "Other", 8 | "CreatedBy": "", 9 | "CreatedByURL": "", 10 | "DocsURL": "", 11 | "MarketplaceURL": "", 12 | "SupportURL": "", 13 | "CanContainContent": true, 14 | "IsBetaVersion": false, 15 | "IsExperimentalVersion": false, 16 | "Installed": false, 17 | "Modules": [ 18 | { 19 | "Name": "ShaderDirectory", 20 | "Type": "Runtime", 21 | "LoadingPhase": "Default" 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /Source/ShaderMacro/ShaderMacro.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class ShaderMacro : ModuleRules 6 | { 7 | public ShaderMacro(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); 12 | 13 | PrivateDependencyModuleNames.AddRange(new string[] { }); 14 | 15 | // Uncomment if you are using Slate UI 16 | // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); 17 | 18 | // Uncomment if you are using online features 19 | // PrivateDependencyModuleNames.Add("OnlineSubsystem"); 20 | 21 | // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Source/ShaderDirectory/Private/ShaderDirectory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "ShaderDirectory.h" 4 | #include 5 | #include 6 | 7 | #define LOCTEXT_NAMESPACE "FShaderDirectoryModule" 8 | 9 | void FShaderDirectoryModule::StartupModule() 10 | { 11 | // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module 12 | FString ShaderDir = FPaths::Combine(FPaths::ProjectPluginsDir(), TEXT("ShaderDirectory/Shaders")); 13 | AddShaderSourceDirectoryMapping("/Plugin/ShaderDirectory", ShaderDir); 14 | 15 | FString ProjectShaderDir = FPaths::Combine(FPaths::ProjectDir(), TEXT("/AwesomeShaders")); 16 | AddShaderSourceDirectoryMapping("/Project/AwesomeShaders", ProjectShaderDir); 17 | } 18 | 19 | void FShaderDirectoryModule::ShutdownModule() 20 | { 21 | // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, 22 | // we call this function before unloading the module. 23 | } 24 | 25 | #undef LOCTEXT_NAMESPACE 26 | 27 | IMPLEMENT_MODULE(FShaderDirectoryModule, ShaderDirectory) -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Visual Studio 2015 user specific files 2 | .vs/ 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | 22 | # Compiled Static libraries 23 | *.lai 24 | *.la 25 | *.a 26 | *.lib 27 | 28 | # Executables 29 | *.exe 30 | *.out 31 | *.app 32 | *.ipa 33 | 34 | # These project files can be generated by the engine 35 | *.xcodeproj 36 | *.xcworkspace 37 | *.sln 38 | *.suo 39 | *.opensdf 40 | *.sdf 41 | *.VC.db 42 | *.VC.opendb 43 | 44 | # Precompiled Assets 45 | SourceArt/**/*.png 46 | SourceArt/**/*.tga 47 | 48 | # Binary Files 49 | Binaries/* 50 | Plugins/*/Binaries/* 51 | 52 | # Builds 53 | Build/* 54 | 55 | # Whitelist PakBlacklist-.txt files 56 | !Build/*/ 57 | Build/*/** 58 | !Build/*/PakBlacklist*.txt 59 | 60 | # Don't ignore icon files in Build 61 | !Build/**/*.ico 62 | 63 | # Built data for maps 64 | *_BuiltData.uasset 65 | 66 | # Configuration files generated by the Editor 67 | Saved/* 68 | 69 | # Compiled source files for the engine to use 70 | Intermediate/* 71 | Plugins/*/Intermediate/* 72 | 73 | # Cache files for the editor to use 74 | DerivedDataCache/* -------------------------------------------------------------------------------- /Plugins/ShaderDirectory/Source/ShaderDirectory/ShaderDirectory.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class ShaderDirectory : ModuleRules 6 | { 7 | public ShaderDirectory(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicIncludePaths.AddRange( 12 | new string[] { 13 | // ... add public include paths required here ... 14 | } 15 | ); 16 | 17 | 18 | PrivateIncludePaths.AddRange( 19 | new string[] { 20 | // ... add other private include paths required here ... 21 | } 22 | ); 23 | 24 | 25 | PublicDependencyModuleNames.AddRange( 26 | new string[] 27 | { 28 | "Core", 29 | // ... add other public dependencies that you statically link with here ... 30 | } 31 | ); 32 | 33 | 34 | PrivateDependencyModuleNames.AddRange( 35 | new string[] 36 | { 37 | "CoreUObject", 38 | "Engine", 39 | "Slate", 40 | "SlateCore", 41 | "RenderCore" 42 | // ... add private dependencies that you statically link with here ... 43 | } 44 | ); 45 | 46 | 47 | DynamicallyLoadedModuleNames.AddRange( 48 | new string[] 49 | { 50 | // ... add any modules that your module loads dynamically here ... 51 | } 52 | ); 53 | } 54 | } 55 | --------------------------------------------------------------------------------