You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ============================ MAJOR FEATURES & CHANGES ============================ Change 3441680 by Uriel.Doyon Added units to point light intensity, to allow the user to specify the value in candelas or lumens. New point light actors now configure the intensity in candelas by default. Replaced viewport exposure settings by an EV100 slider. Hidding the tone mapper in the show flag now still applies the exposure. Added a new AutoExposure method called EV100 which allows to specify : - MinEV100, MaxEV100 - Calibration Constnat - Exposure Compensation #jira UE-42783 Change 3454934 by Chris.Bunner Backing out changelists 3441680, 3454636 and 3454844 for the sake of integration stability. Change 3629223 by Rolando.Caloca DR - Rollback //UE4/Dev-Rendering/Engine/Source/Runtime/VulkanRHI to changelist 3627847 Change 3629708 by Rolando.Caloca DR - vk - Redo some changes from DevMobile 3601439 3604186 3606672 3617383 3617474 3617483 Change 3636145 by Chris.Bunner Linux compile fix. Change 3636198 by Chris.Bunner Include fix. Change 3636225 by Daniel.Wright Removed spammy draw event Change 3636397 by Daniel.Wright Visualize volumetric lightmaps uses 18% grey in lit mode Change 3636398 by Daniel.Wright Translucency lighting modes work with Volumetric Lightmaps * The old Indirect Lighting Cache always interpolated one sample per object, while Volumetric lightmaps operate at the frequency of the Translucency Lighting Mode (per-vertex or per-pixel) so the lighting accuracy is much higher. * The old ILC always applied the single lighting sample with a per-pixel normal, even in per-vertex lighting modes * Volumetric PerVertex NonDirectional (cheapest lit translucency) went from 74 instructions down to 42 * Volumetric Directional went from 104 up to 122 Change 3636604 by Chris.Bunner Added a material translation error on identically named/associated but differently valued parameters as this will cause one of them to be lost during parameter evaluation, the result being "random". Change 3637668 by Rolando.Caloca DR - hlslcc - Skip preprocessor when not required which reduces peak mem consumption by ~500 MB - Fix missing indexing on intrinsic return type Change 3638541 by Chris.Bunner Fixed editor materials - Skip hardcoded parameter names that we rely on being overridden when checking for non-matching duplicate parameters. Change 3638798 by Mark.Satterthwaite Rebuilt hlslcc for Mac for Rolando's 3637668 changes. Change 3638861 by Mark.Satterthwaite Missed making a log verbose in the Metal ring-buffer. Change 3639482 by Rolando.Caloca DR - vk - Minor fixes Change 3639909 by Michael.Lentine Add special case for struct needed to compile. Workaround issues in parser such that (x)[0] is replaced with x[0] and (x).a is replaced with x.a. Change 3639916 by Michael.Lentine Spelling fix. Change 3640053 by Mark.Satterthwaite Fix Desktop Forward rendering on Nvidia Metal rendering on macOS by modifying the shader and runtime to treat ForwardLocalLightBuffer data as uint rather than float and invert the use of as*() casts. Tthis is *necessary* to avoid a bug/limitation of Nvidia's current Metal shader compiler that flushes all denorm values to zero on load from any resource. AMD & iOS Metal only flush-to-zero when sampling from textures and that's what Apple regard as the expected behaviour. I have however asked them to standardise on the D3D behaviour of preserving denorms on all load, move (incl. min/max/as*()-casts) & store operations. This won't happen in the current or imminent OS/Xcode releases. Now only Intel Metal is broken and their problems run deeper. #jira UE-48881 Change 3640983 by Olaf.Piesche Cache the depth buffer collision shader for GPU particles even when simple forward is enabled, as that can be turned off at runtime. #jira UE-48799 Change 3641480 by Michael.Lentine Add min16float to FP16Math Change 3642442 by Mark.Satterthwaite Fix the native shader libraries again & undo the increase in cook time from changes to the way FShaderCodeLibrary was compiling & deduplicating the shaders. - Remvoe the single linear array for accumulated shader code: reallocating this is tremendously expensive and will double the time taken to iteratively cook large projects. - Uncompress the shader data for the native library system so that it actually works again. - Fix some errant change to the Metal compiler that was trying to wedge the fully compiled library into the single Metal library which is 100% bogus. #jira UE-49192 Change3642919by Chris.Bunner Reverted unintended changes to material static parameter set serialization. Bumped material version to force re-serialization. Fixed a few typos. Change 3642923 by Richard.Wallis Fix for "Pixel Inspector On" message not disappearing when closing pixel inspector window while on. Handle tab closed events to cancel the pixel inspector if window closed while running. #jira UE-46504 Change 3643296 by Michael.Lentine Convert all structures that aren't use globally to halfs. Change 3643381 by Ryan.Brucks New Plugin allowing Blueprint Texture and RT reads as well as MIC creation and modification. Change 3643929 by Ben.Salem Added better precision on thread values in Perf Monitor. Also added global thread values to go with per-world ones to help track down the most accurate numbers possible. #tests Ran locally, changes validated by benj Change 3644203 by Mark.Satterthwaite Refactor mtlpp a little bit to make the compiler do more of the work & update for all the latest publicly exposed APIs. Change 3644336 by Mark.Satterthwaite Ref-count the mtlpp Device object so that it can be the repository for IMP caching - now just have to go through the types created from a specific device and have them keep a reference.... Change 3644431 by Uriel.Doyon Added a intensity units property, for point lights and spot lights, that can be set to Candelas, Lumens or Unitless (legacy). The default units value for newly placed point lights and spot lights is configured in the project settings. Spot lights configured in lumens have their whole luminous energy redirected toward the cone. This means that changing the outer cone angle, changes the spot light brightness. New exposure menu that uses an EV100 slider. New post process settings "camera" tab regrouping : ShutterSpeed, ISO, Aperture and ExposureCompensation. Post process settings "auto exposure" tab renamed "exposure". The calibration constant for "Auto Exposure Basic" is now configurable in the advanced tab. The auto exposure method is renamed "Metering Mode" New pre-exposure feature that allows the engine to apply the previous frame exposure before writing to the scene color. This allows the engine to render the scene with similar range than the final color (after exposure), and avoid arithmetic overflow for low precision RT formats. The amount of exposure applied directly is called pre-exposure, and is compensated by a smaller post-exposure value. Change 3645098 by Marcus.Wassmer Don't add meshes twice when in simpleforward Change 3645551 by Daniel.Wright VolumetricScatteringIntensity is greyed out based on Mobility Change 3645707 by Chris.Bunner Skip empty parameters when identifying invalid duplicates during material translation. Change 3646225 by Uriel.Doyon Texture streaming support for particle sub-uv Change 3646323 by Rolando.Caloca DR - vk - Fix bad update texture 2/3d parameters Change 3646463 by Mark.Satterthwaite Metal shader files that can serve as extensions to the metal_stdlib rather than trying to wedge even more into the shader compiler. Might as well leverage Metal's C++'ness. Currently just a skeleton of a buffer type that would better emulate HLSL Buffer<>/RWBuffer<> objects. Change 3646727 by Marcus.Wassmer fix linux and nonunity compiles Change 3647777 by Rolando.Caloca DR - Mobile Vulkan optimization Change 3647822 by Lauren.Ridge Layers are now renameable (except Layer 0 is always "Background") in Material Layers Functions Change 3647918 by Chris.Bunner Static analysis fixes - Monolithic include, forward delcared enums, locally shadowed variable. Change 3648010 by Michael.Lentine Don't use min16float by default. Change 3648015 by Michael.Lentine Add special case fixes for min16float as well as half on console. Change 3648024 by Lauren.Ridge Moving MaterialLayersFunctions Layer naming to EditorOnly wrappers Change 3648127 by Lauren.Ridge Moving name getter functionality to FMaterialLayersFunctions Change 3648265 by Lauren.Ridge Fixing loctext key Change 3648293 by Rolando.Caloca DR - D3D12 fix Change 3648326 by Rolando.Caloca DR - vk - Added subrectangle support when updating Texture2D and Texture3D Change 3648522 by Rolando.Caloca DR - vk - Do not try to create a BufferView of a StructuredBuffer (no valid pixelformat) Change 3648612 by Rolando.Caloca DR - vk - Implement RHIMapStagingSurface Change 3648673 by Rolando.Caloca DR - vk - Reduce Vulkan pipeline cache disk size by filtering duplicated shader ucodes Change 3648913 by Arne.Schober DR - Performance optimization during HLod traversal. using vector load and avoiding array copy by passing it through reference instead through value. Change 3649443 by Daniel.Wright Exposed EmissiveBoost, since Lightmass supports Emissive areas on meshes Change 3650436 by Mark.Satterthwaite Implemented the necessary extensions for Metal shading language to move lots of complexity out of MetalBackend and into actual shader code to make life *vastly* simpler. - Full ue4::typed_buffer<T> wrapper type & associated ue4::buffer<>/ue4::buffer_atomic<> API - totally untested but should be functionally equivalent to HLSL Buffer<T>/RWBuffer<T>. - All the sensible casts I can think of are now defined in ue4_format - any additional ones can just be added. The enurm of formats needs to be exposed to MetalRHI so we upload the correct values, but this should be trivial. - Added a full series of wrappers around texturecube_array and depthcube_array to insulate code from whether it is backed by a real cube_array or a texture2d_array so we don't have to maintain complicated variants for new/old iOS devices. - Added implementations for a bunch of annoying HLSL & GLSL intrinsics that were being matched by name + reverse_bits which needs a custom implementation on old shader standards. Change 3650861 by Rolando.Caloca DR - vk - Fix warnings Change 3651116 by Rolando.Caloca DR - vk - Support for compressed saved PSO cache Change 3651321 by Rolando.Caloca DR - vk - Prep for load multiple PSO files Change 3651337 by Chris.Bunner Editor-only default material fallback (hardcoded material). #jira UE-48404 Change 3651839 by Rolando.Caloca DR - vk - Integrate minor pipeline changes Change 3652042 by Mark.Satterthwaite More work on mtlpp: - Selector class that caches IMP from SEL & Class. - Fixes to ns::Error. - Added test case application for testing denorm & float reinterpret-cast behaviour on Metal. Change 3652370 by Uriel.Doyon New "stat StreamingOverview" giving high level metrics of texture usage. New function ResetAverageRequiredTexturePoolSize() and GetAverageRequiredTexturePoolSize() giving the average ideal value for "r.streaming.poolsize". Change 3653658 by Chris.Bunner Material vertex interpolator for sprite and gpu sprite particles. Change 3653676 by Rolando.Caloca DR - vk - Integrate changes: Multiple PSO caches, shared ucode & compression, size reduction up to 80% Change 3653940 by Daniel.Wright Moved Volumetric Lightmap textures out of FScene and into FPrecomputedVolumetricLightmapData so their lifetime can match the MapBuildData. This allows tossing the source BulkData in game after RHI texture creation even though switching lighting scenarios does Release/InitializeRenderingResources multiple times. Change 3653956 by Daniel.Wright Fixed leak of BatchVisibilityId's Change 3653991 by Daniel.Wright Fixed missing include Change 3654013 by Daniel.Wright Refactored reflection capture composite SM4 handling, now forces fully rough even if !REFLECTION_COMPOSITE_USE_BLENDED_REFLECTION_CAPTURES (forward shading default) Change 3654018 by Daniel.Wright Remove unused SM4 reflection capture cubemap Change 3654118 by Rolando.Caloca DR - vk - Fix for queries; support for r.Vulkan.ProfileCmdBuffers to only time cmd buffers w/o gpu bubbles Change 3654339 by Chris.Bunner Temporarily disabed a material error whilst working with content teams to fix the introduced bugs. Change 3654534 by Daniel.Wright Editor is only supported on Feature Level 5 platforms. Added a message box and exit when SM4 is detected (d3d10, OpenGL 3). Change 3654751 by Rolando.Caloca DR - vk - Add readback for RGB10A2; minor optimization Change 3654940 by Rolando.Caloca DR - vk - Warning fix Change 3655104 by Mark.Satterthwaite Add a bunch of code to mtlpp to wrap the Xcode command-line Metal tools and use them to provide a convenient command-line tool that can compile two Metal shaders & diff the resulting AIR to make debugging easier. Obviously this only works on macOS. Change 3655173 by Jian.Ru Render dithered material as masked if a stencil prepass is not used #jira UE-50064, UE-49537 Change 3655479 by Daniel.Wright Fixed HandleLegacyMapBuildData not getting called on P maps loaded in the editor, which apparently was dropped in an integration error, causing all legacy maps (before the BuildData change) to lose their built lighting. Change 3656341 by Richard.Wallis Metal validation checks to test for drawing of the end of a vertex stream as seen in UE-48172 (Landscape Mesh Flickers Rapidly When Using Sculpting Landscape). This is not a fix for that but just a error log to catch the bad draw calls. #jira UE-48172 Change 3656844 by Rolando.Caloca DR - vk - Avoid microcode copy - Fix link error Change 3656894 by Rolando.Caloca DR - vk - Enable api dump without needing validation enabled Change 3656915 by Marcus.Wassmer Fix DX12 buffer lock for read Change 3657166 by Rolando.Caloca DR - vk - Proper fix for api dump layer Change 3657401 by Rolando.Caloca DR - vk - Linux compile fix Change 3657607 by Rolando.Caloca DR - vk - Prep for changes Change 3658722 by Chris.Bunner Refresh shared texture samplers when changing max ansiotropy level (e.g. scalability settings). #jira UE-30086 Change 3659499 by Daniel.Wright Moved bEnableAutoLODGeneration to LOD category so it's not the only one in HLOD category Change 3659644 by Mark.Satterthwaite D3D11 equivalent to 3656341 (only enabled when -d3ddebug is) to validate DrawIndexedPrimitives isn't trying to draw off the end of the instanced vertex streams which has inconsistent (and potentially undefined) behaviour across the various APIs we support. This fires when painting the landscape because the code attempts to render with a FirstInstance value that is as large as the number of elements in the instance-data streams which D3D11 drivers silently fails to render, but which Metal (& probably Vulkan too) will renders as garbage. This pattern is wrong & will be even more dangerous in a Draw*Indirect world. #jira UE-48172 Change 3659831 by Rolando.Caloca DR - vk - Copy 3657927 (fixes for Mali) Change 3661921 by Rolando.Caloca DR - vk - Minor log/info changes Change 3661985 by Mark.Satterthwaite Change the Metal sampler filter translation to better match D3D. Change 3662050 by Richard.Wallis Compile fix for Metal enums. Change 3662062 by Rolando.Caloca DR - Copy from 3662060 - OpenGL cloth fix Change 3662100 by Mark.Satterthwaite Use a temporary file and an atomic move to put the Metal PCH into the right place and reduce the number of false PCH compile failures on the build farm. Change 3662253 by Daniel.Wright Reflection Captures support Lighting Scenarios without recapturing * Reflection Captures are now part of the Map Build * Modifying a capture in editor will display a preview, but game can only display built captures (black for unbuilt with screen message) * Reflection Capture build data moved to the BuildData package * Building lighting / reflection captures no longer dirties ULevels * Sky lights which capture the scene now work correctly with Lighting Scenarios * Lighting Scenarios must now be loaded for each time they are made visible (no switching back and forth while keeping both loaded) Change 3663215 by Mark.Satterthwaite Initial, incomplete, tool added to mtlpp to help debug macOS Internal Compiler Errors - the mtlpp command-line tool can be fed the debug output from UE4 along with compiler settings to automatically compile shaders and construct the render pipeline that crashes the runtime compiler. So far only macOS render-pipeline-states are supported currently. Change 3663293 by Mark.Satterthwaite Added Metal device selection to the mtlpp command-line tool so I can quickly test compile on dual-GPU Macbook Pro's. Change 3663471 by Daniel.Wright Reflection Capture Builds no longer use UEditorLevelUtils::SetLevelVisibility to control level visibility, which streams out sublevels, modifying nav mesh Fixed status updates during Reflection Capture Build Captures overflowing GMaxNumReflectionCaptures now log a warning instead of pretending that they built successfully Change3664056by Rolando.Caloca DR - Linux compile fix Change 3664460 by Daniel.Wright Restored unused LoadTimesObjectVersion, packages saved with it will issue a warning on load Change 3664802 by Uriel.Doyon Fixed flash created by pre-exposure when the value changed dramatically between frames Change 3664890 by Daniel.Wright Created 'Stat MapBuildData' to track the memory size of lighting and reflection capture build outputs Change 3665163 by Rolando.Caloca DR - Copy from 3665156 - Gracefully fail when there are mem leaks exiting Vulkan Change 3665629 by Daniel.Wright Only Surface domain materials cast shadows in Lightmass Change 3665855 by Marcus.Wassmer PR #4032: Fix comparison of SceneColorFormat (Contributed by Hybrid0) Change 3666707 by Guillaume.Abadie Replaces some custom material node to get View.BufferSizeAndInvSize with ViewProperty material expression in some engine material functions. Change 3667239 by Rolando.Caloca DR - Use hlslcc define for common issues Change 3668108 by Brian.Karis Disabled to Catmull-Rom filter. Too many flickering issues. Disabled antiflicker as well. Change 3668157 by Mark.Satterthwaite In the prototype Metal stdlib extension library add inline versions of the D3D SM6 "wave" intrinsics that can be expressed in terms of Metal 2.0 simd/quad group operations (macOS=simd, iOS=quad). These are unlikely to be as efficient as direct intrinsics but they should be functionally equivalent. These functions are not available *yet* as I still need to hook the ue4_stdlib into MetalShaderFormat & MetalRHI. The following HLSL 6 functions are implemented: WaveAllBitAnd WaveAllMax WaveAllMin WaveAllBitOr WaveAllBitXor WaveAllEqual WaveAllProduct WaveAllSum WaveAllTrue WaveAnyTrue WaveBallot WaveGetLaneCount WaveGetLaneIndex WaveOnce WavePrefixProduct WavePrefixSum WaveReadFirstLane WaveReadLaneAt The following can't be implemented in Metal as of Metal 2.0 AFAIK: WaveGetOrderedIndex WaveIsHelperLane GlobalOrderedCountIncrement QuadReadLaneAt QuadSwapX QuadSwapY Change 3668260 by Olaf.Piesche Cache particle collision shaders regardless of simple forward state Missed this checkin #jira FORT-51307 Change 3669243 by Daniel.Wright Bumped shader version to propagate FReflectionCaptureData rename Change 3669369 by Mark.Satterthwaite Duplicating Metal changes from //UE4/Release-4.18 to Dev-Rendering (//UE4/Dev-Rendering) 3662503 Collapse system-variables to one declaration in MetalUtils to avoid later shader compiler errors when they are specified more than once, which is seemingly permissable. Fixes volumetric fog. #jira UE-50293 3665210 - Invalidate all Metal shaders again to force a recompile to workaround another driver bug. - On macOS compact the clip-distance value into a single output to avoid bugs in the runtime pipeline compilers. - In SCW's direct-compile mode MetalShaderForamt should always dump the resulting Metal shader and print any errors we encounter to the log. - Change FGenerateMetalVisitor to take a FMetalCodeBackend& not a FMetalCodeBackend* to avoid a lot of pointless pointer validation. #jira UE-50244 3665429 Fix a crash on shutdown due to MetalRHI caching vertex-declarations beyond the lifetime of the RHI by moving the cache into the FMetalDynamicRHI itself. #jira UE-50356 3665613 Fix DistanceField rendering on Metal & the associated validation layer error when it is enabled - MetalRHI can't use the same approach as Vulkan without a bit more work. #jira UE-50364 3667584 Fix black flickering on some materials that use World Position Offset - the Metal sincos intrinsic comes into two flavours for single precision floats and we want the precise version not the fast version. The "cross" implementation needed a few more fma's too and this change has to invalidate Metal shaders again to take effect. #jira UE-50399 3667805 Changing sincos in Metal fragment shaders had undesirable side-effects - the compiler is now re-associating another floating point operation - so limit the use of precise::sincos to vertex-shaders for now. This fixes the WPO materials without causing any other obvious problems. #jira UE-50399 Change 3669912 by Mark.Satterthwaite Fix Metal compilation for PCSS shadows - the HLSL that is compiled uses both SampleCmp and Sample which GLSL disallows (shadowSampler types in GLSL only allow SampleCmp) but is perfectly valid in Metal where only the texture type declaration changes. Duplicate MetalBackend.cpp changes from Joe.Graf's: 3667781 Fixed an extra ) being emitted during HLSL->Metal translation Added depthcube_array support per Mark's instructions Change 3670308 by Mark.Satterthwaite Missing autorelease pool blocks in MetalTexture functions. Change 3670989 by Mark.Satterthwaite Stop trying to be so clever with Metal clip-distances: AMD have a bug in 10.13.0 that means we can only emit one clip-distance value, so simply emit the value with the lowest index (we have handily ordered them by importance!) and let the others become user-interpolators until this bug is resolved in a macOS SU (according to Max@AMD the fix is in, just not in time for 4.18). This means planar reflections will work, VR no-multi-view-fallback will work & layered rendering will work either individually or together - the difference being that on macOS *only* the VR no-multi-view-fallback & layered rendering paths may be slower when combined with the global clip plane. Hit & run fix to MetalCaptureManager and availability of tile-shader functions while I'm here. #jira UE-50518 Change 3671014 by Mark.Satterthwaite Correct handling of RowLinearPVRTC blits for iOS Metal desired for Ocean. Change 3671575 by Rolando.Caloca DR - Copy 3668036 Stop syncing CPU with GPU on Vulkan Change 3671637 by Rolando.Caloca DR - Copy3670937Fixes Vulkan editor outline Change 3672309 by Mark.Satterthwaite Submitted on behalf of Richard Wallis: Only disable V-Sync on Metal in macOS 10.13 when running in "true" fullscreen mode (where we switch display modes & forbid switching spaces or tabbing out) so that you won't see the rainbow artefact caused by being out-of-sync with WindowServer, only the tearing you'd expect when V-Sync is disabled. We'll chat with Apple about whether there is a way to avoid the rainbow artefact when switching spaces in Windowed Fullscreen with displaySync disabled. #jira UE-50134 Change 3672314 by Daniel.Wright User friendly message dialog for when a required key is missing from BaseLightmass.ini Change 3672315 by Daniel.Wright Assert on load when a uniform buffer struct goes missing, instead of a crash on save Change 3672476 by Chris.Bunner Removed duplicate material instance editor command binding that appeared in a task stream merge. Change 3672626 by Mark.Satterthwaite Move the ue4_stdlib.metal extensions to MetalRHI's Public header directory as it'll need to be available to both modules and that's easier to accomplish from here. Change 3672643 by Mark.Satterthwaite iOS compilation fixes. Change 3672728 by Daniel.Wright Fixed encoded HDR reflection captures Change 3672753 by Jian.Ru Fix texture swimming #jira UE-49369 Change 3672815 by Daniel.Wright Tooltip for build button explaining why it might be disabled Change 3673350 by Rolando.Caloca DR - vk - Do not reallocate memory every draw call Change 3673501 by Rolando.Caloca DR - vk - Remove more reallocations Change 3673505 by Rolando.Caloca DR - Remove global variable with semantic Change 3673514 by Rolando.Caloca DR - vk - compile fix Change 3675899 by Chris.Bunner Fixed support for editor-time transient parameter overrides. This happens when a compiled material's scalar or vector parameter is changed in value only, the active material resources should also update and be reverted when the material graph is closed. The code was incorrectly pulling base parameters from expressions instead of the actual uniform. Change 3676843 by Arne.Schober DR - UE-49473 - Fix Stateleak caused by custom drawer in the long for loop, where the depth stencil state might not be reset in a subsequent itteration of the loop. Change 3678269 by Daniel.Wright Fixed Encoded HDR reflection capture data getting the wrong Brightness applied when cooking Change 3678543 by Daniel.Wright MapBuildData now tosses the unneeded reflection capture format on load. Affects target platforms that require multiple formats at cook time. Change 3679602 by Jian.Ru Fix up mesh decal shader complexity view mode #jira UE-50272 Change 3679959 by Chris.Bunner Fixed logic on overriden vector parameter retrieval for material instances checking a function owned parameter. #jira UE-50712 Change 3679998 by Daniel.Wright Fixed crash when precomputing static visibility only [CL3680175by Marcus Wassmer in Main branch]
118 lines
4.7 KiB
C++
118 lines
4.7 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MaterialEditorModule.h"
|
|
#include "Modules/ModuleManager.h"
|
|
#include "IMaterialEditor.h"
|
|
#include "MaterialEditor.h"
|
|
#include "MaterialEditorUtilities.h"
|
|
#include "MaterialInstanceEditor.h"
|
|
#include "Materials/MaterialInstance.h"
|
|
#include "Materials/MaterialFunctionInstance.h"
|
|
|
|
const FName MaterialEditorAppIdentifier = FName(TEXT("MaterialEditorApp"));
|
|
const FName MaterialInstanceEditorAppIdentifier = FName(TEXT("MaterialInstanceEditorApp"));
|
|
|
|
/**
|
|
* Material editor module
|
|
*/
|
|
class FMaterialEditorModule : public IMaterialEditorModule
|
|
{
|
|
public:
|
|
/** Constructor, set up console commands and variables **/
|
|
FMaterialEditorModule()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Called right after the module DLL has been loaded and the module object has been created
|
|
*/
|
|
virtual void StartupModule() override
|
|
{
|
|
MenuExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
ToolBarExtensibilityManager = MakeShareable(new FExtensibilityManager);
|
|
}
|
|
|
|
/**
|
|
* Called before the module is unloaded, right before the module object is destroyed.
|
|
*/
|
|
virtual void ShutdownModule() override
|
|
{
|
|
MenuExtensibilityManager.Reset();
|
|
ToolBarExtensibilityManager.Reset();
|
|
}
|
|
|
|
/**
|
|
* Creates a new material editor, either for a material or a material function
|
|
*/
|
|
virtual TSharedRef<IMaterialEditor> CreateMaterialEditor(const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UMaterial* Material) override
|
|
{
|
|
TSharedRef<FMaterialEditor> NewMaterialEditor(new FMaterialEditor());
|
|
NewMaterialEditor->InitEditorForMaterial(Material);
|
|
OnMaterialEditorOpened().Broadcast(NewMaterialEditor);
|
|
NewMaterialEditor->InitMaterialEditor(Mode, InitToolkitHost, Material);
|
|
return NewMaterialEditor;
|
|
}
|
|
|
|
virtual TSharedRef<IMaterialEditor> CreateMaterialEditor(const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UMaterialFunction* MaterialFunction) override
|
|
{
|
|
TSharedRef<FMaterialEditor> NewMaterialEditor(new FMaterialEditor());
|
|
NewMaterialEditor->InitEditorForMaterialFunction(MaterialFunction);
|
|
OnMaterialFunctionEditorOpened().Broadcast(NewMaterialEditor);
|
|
NewMaterialEditor->InitMaterialEditor(Mode, InitToolkitHost, MaterialFunction);
|
|
return NewMaterialEditor;
|
|
}
|
|
|
|
virtual TSharedRef<IMaterialEditor> CreateMaterialInstanceEditor(const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UMaterialInstance* MaterialInstance) override
|
|
{
|
|
TSharedRef<FMaterialInstanceEditor> NewMaterialInstanceEditor(new FMaterialInstanceEditor());
|
|
NewMaterialInstanceEditor->InitEditorForMaterial(MaterialInstance);
|
|
OnMaterialInstanceEditorOpened().Broadcast(NewMaterialInstanceEditor);
|
|
NewMaterialInstanceEditor->InitMaterialInstanceEditor(Mode, InitToolkitHost, MaterialInstance);
|
|
return NewMaterialInstanceEditor;
|
|
}
|
|
|
|
virtual TSharedRef<IMaterialEditor> CreateMaterialInstanceEditor(const EToolkitMode::Type Mode, const TSharedPtr< IToolkitHost >& InitToolkitHost, UMaterialFunctionInstance* MaterialFunction) override
|
|
{
|
|
TSharedRef<FMaterialInstanceEditor> NewMaterialInstanceEditor(new FMaterialInstanceEditor());
|
|
NewMaterialInstanceEditor->InitEditorForMaterialFunction(MaterialFunction);
|
|
OnMaterialInstanceEditorOpened().Broadcast(NewMaterialInstanceEditor);
|
|
NewMaterialInstanceEditor->InitMaterialInstanceEditor(Mode, InitToolkitHost, MaterialFunction);
|
|
return NewMaterialInstanceEditor;
|
|
}
|
|
|
|
virtual void GetVisibleMaterialParameters(const class UMaterial* Material, class UMaterialInstance* MaterialInstance, TArray<FMaterialParameterInfo>& VisibleExpressions) override
|
|
{
|
|
FMaterialEditorUtilities::GetVisibleMaterialParameters(Material, MaterialInstance, VisibleExpressions);
|
|
}
|
|
|
|
virtual bool MaterialLayersEnabled()
|
|
{
|
|
return FMaterialEditorModule::bMaterialLayersEnabled;
|
|
};
|
|
|
|
/** Gets the extensibility managers for outside entities to extend material editor's menus and toolbars */
|
|
virtual TSharedPtr<FExtensibilityManager> GetMenuExtensibilityManager() override { return MenuExtensibilityManager; }
|
|
virtual TSharedPtr<FExtensibilityManager> GetToolBarExtensibilityManager() override { return ToolBarExtensibilityManager; }
|
|
|
|
static void ToggleLayers()
|
|
{
|
|
FMaterialEditorModule::bMaterialLayersEnabled = !FMaterialEditorModule::bMaterialLayersEnabled;
|
|
}
|
|
|
|
|
|
static bool bMaterialLayersEnabled;
|
|
|
|
private:
|
|
TSharedPtr<FExtensibilityManager> MenuExtensibilityManager;
|
|
TSharedPtr<FExtensibilityManager> ToolBarExtensibilityManager;
|
|
|
|
};
|
|
|
|
IMPLEMENT_MODULE( FMaterialEditorModule, MaterialEditor );
|
|
|
|
bool FMaterialEditorModule::bMaterialLayersEnabled = false;
|
|
|
|
namespace MatEd
|
|
{
|
|
static FAutoConsoleCommand ToggleLayers(TEXT("MatEd.ToggleLayers"), TEXT("Toggles experimental Material Layers feature"), FConsoleCommandDelegate::CreateStatic(&FMaterialEditorModule::ToggleLayers));
|
|
} |