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 Change 3358916 on 2017/03/22 by Andrew.Grant Merging //Orion/Main to Dev-General (//Orion/Dev-General) #!tests #!rb na Change 3357395 on 2017/03/21 by Daniel.Lamb Added some more custom stats to the cooker. Only cook the english cook culture when we are running local builds. #!rb Trivial #!test Iterative shared cooked builds paragon Change 3357377 on 2017/03/21 by Daniel.Lamb Added support for packages which fail to load to the package dependency info module #!rb Trivial #!test Cook paragon Change 3356838 on 2017/03/21 by Andrew.Grant Merging //Orion/Main to Dev-General (//Orion/Dev-General) #!3rb #!tests na Change 3355306 on 2017/03/20 by Daniel.Lamb Switched PackageDependencyInfo to using Guid instead of entire package hash when generating dependency info. Stopped cooker from collecting garbage while in the editor. Iterative cooks don't resolve string asset references for startup packages. #!rb Trivial #!test Shared precooked build paragon Change 3354527 on 2017/03/20 by Wes.Hunt AnalyticsProvider::SetUserID will now flush any pending events before changing the ID. #!jira AN-1660 #!fyi josh.markiewicz,david.nikdel #!rb josh.markiewicz #!tests ran client connected to Solo vs. AI server Change 3353852 on 2017/03/20 by Benn.Gallagher Speculative fix for clothing crashes using Mambo. It was possible that the skeletal mesh component could have triggered deletion or creation of simulation state objects while the simulation was in flight on another thread, added tracking and waiting for outstanding tasks. #!jira OR-36843, UE-42975 #!rb Martin.Wilson #!tests Editor PIE, -game hero gallery Change 3353048 on 2017/03/18 by Jeff.Williams #!ORION_DG - Merge MAIN @CL 3353033 Change 3352845 on 2017/03/17 by Daniel.Lamb Renamed the ConvertRenderTargetToTexture2D function so that it's obvious it's a editor only feature. #!rb Daniel.Wright #!test Editor paragon Change 3352544 on 2017/03/17 by Daniel.Lamb ADded support for ignoring ini settings incompatbilities when using shared cooked builds. #!rb Trivial #!test Shared cooked build paragon Change 3352285 on 2017/03/17 by Daniel.Lamb Fix client side compilation error to do with render texture conversion function #!rb Trivial #!test Compile Paragon Change 3352141 on 2017/03/17 by Daniel.Lamb Added support for blueprint function to convert a rendertexture to a texture. #!rb Daniel.Wright #!test Run in the editor Change 3351612 on 2017/03/17 by Andrew.Grant Expand EngineDir and ProjectDir variables during AppLocal deployment #!tests Jamie verified packaging Orion via the editor works now #!rb Jamie.Dale Change 3350470 on 2017/03/16 by Laurent.Delayen Fix for PS4 compile. #!rb none #!tests PS4 + non unity Change 3350237 on 2017/03/16 by Andrew.Grant Pak-mounting fix from Dev-Core for OR-36896 #!tests na #!rb GIl.Gribb Change 3350079 on 2017/03/16 by Laurent.Delayen Added 'AnimNotify_PlayMontageNotify' and 'AnimNotify_PlayMontageNotifyWindow' to forward notifies Begin/End to 'PlayMontage' AsyncTask. #!rb lina.halper #!tests Yin's BP Change3349694on 2017/03/16 by robomerge #!ROBOMERGE-AUTHOR: dan.hertzka Exposing copy/paste actions for properties embedded within IDetailGroup header rows #!rb Matt.Kuhlenschmidt #!tests Copy/paste on skin variant primary override rows #!ROBOMERGE-SOURCE: CL 3349513 in //Orion/Dev-REGS/... via CL 3349675 #!ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3349560 on 2017/03/16 by David.Ratti Update GameplayTagReferenceHelper to pass in raw data for owner struct (Rather than having caller pass raw 'this' to delegate). Fixes crashes with resizing lists while making calling code less crappy (avoid having to implement copy cstor and operator to fixup delegate). Added GameplayTagReferenceHelper to gameplay cue classes. #!rb none #!tests editor Change 3349305 on 2017/03/16 by Andrew.Grant Merging //Orion/Main to Dev-General (//Orion/Dev-General) #!tests compiled #!rb na Change 3349189 on 2017/03/16 by Benn.Gallagher Fixed clothing not running in PS4 packaged builds #!rb Martin.Wilson #!jira OR-36680 #!tests PS4 cooked OrionEntry with Shinbi Change 3348659 on 2017/03/15 by Daniel.Lamb Fix compilation errors. #!rb None Change 3348646 on 2017/03/15 by Andrew.Grant Unshelved from pending changelist '3347778': <description: restricted, no permission to view> Change 3348636 on 2017/03/15 by Daniel.Lamb Fixed issue with rebuildlighting commandlet not checking out separate lighting files. #!rb None #!test ResavePackages commandlet Change 3348559 on 2017/03/15 by Daniel.Lamb Fixed up some iterative ini settings blacklist configs. #!rb Trivial #!test Iterative Cook paragon Change 3348379 on 2017/03/15 by Laurent.Delayen Added simple Async Node 'Play Montage' to use outside of gameplay abilities. #!rb none #!tests none Change 3348035 on 2017/03/15 by Ben.Salem Switch automationcheckpoint to being a .log file. Unblocks running on packaged builds in paragon. #!rb none #!tests ran oh so very many tests with the changes. Change 3345982 on 2017/03/14 by Zak.Middleton #!orion - OR-36422: Clamp client net send rate for character movement to 60Hz (down from 90). Integrates CL 3345771 from Dev-Framework which adds engine support for specifying the rate parameters, and sets them in Orion DefaultGame.ini to 1/60 second. #!jira OR-36422 #!tests multi-PIE dedicated server, various framerates, net lag, etc. #!rb Laurent.Delayen #!codereview Laurent.Delayen Change 3345134 on 2017/03/14 by Jordan.Walker mono work Change 3344857 on 2017/03/14 by Martin.Wilson Missing includes for transactor header #!rb none Change 3341860 on 2017/03/10 by Chris.Bunner Partial revert of CL 3339904. Fixed material translation error with multiple connections from custom interpolator nodes. #!rb None #!tests Editor, Known trouble materials with interpolator nodes, With/without material functions Change 3341759 on 2017/03/10 by Daniel.Lamb Fixed up NetworkCompatible version so that it works with UGS. #!rb Trivial #!test Cook ps4 paragon. Change 3341616 on 2017/03/10 by Josh.Markiewicz #!UE4 - added define for OGS feature #!rb none #!codereview sam.zamani #!tests compiles Change 3341612 on 2017/03/10 by Josh.Markiewicz #!UE4 - removed old define #!tests compiles Change 3340180 on 2017/03/09 by Daniel.Lamb Integrate fix for sync loading from main to Dev General. #!rb Ben.Zeigler Change 3339904 on 2017/03/09 by Chris.Bunner Fixed material translation error when custom interpolator node hooked to multiple function outputs. #!rb None #!tests Editor Change 3339280 on 2017/03/09 by Josh.Markiewicz #!UE4 - removed WebBrowser moduel dependency on OnlineSubsystem - added 2 functions to online engine interface #!codereview sam.zamani, ben.marsh Change 3338654 on 2017/03/08 by Daniel.Lamb Fixed up some issues with iterative ini settings. Added support for target platforms exposing which audio formats they use so they can match up supported formats with different machines. #!rb None #!test Cook paragon iteratively Change 3336989 on 2017/03/08 by Ben.Marsh Merging CL 3336693 from Dev-Core: Use shared PCHs for game plugins by default, to reduce time spent generating individual PCHs. #!rb none Change 3336135 on 2017/03/07 by Michael.Trepka Hide GameLayerManager's title bar on exiting PIE #!rb Dan.Hertzka #!tests Tested in the editor on Windows Change 3335324 on 2017/03/07 by Aaron.Eady Chat; Adding AddedItem, CompletedItem, and DiscardedItem to the chat message type enum so we can control the color for each. Set the colors in the Social asset. Creating client record settings for turning on/off the added item, completed item, and discarded item in chat. Put these in the gameplay settings menu. Added horizontal boxes to the gameplay settings menu because we are running out of space. Added a vertical scroll bar to the gameplay settings menu but it doesn't seem to show. Also fixed the horizontal scroll bar at the bottom to be horizontal instead of vertical. #!rb Matt.Schembari #!tests MCP, PIE #!lockdown Nicholas.Davies #!RN Change 3333541 on 2017/03/06 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3333512 #!RB:none #!Tests:none #!codeReview: cameron.winston Change 3332578 on 2017/03/04 by Andrew.Grant Temp Disabled wrong-looking warning #!tests #!rb na #!ROBOMERGE: Main Change 3332555 on 2017/03/04 by Andrew.Grant Proper fix for Tencent DLL issue #!tests #!rb na #!ROBOMERGE: Main Change 3332552 on 2017/03/04 by Andrew.Grant Fix for Tencent DLL issue while staging #!tests none #!rb none #!ROBOMERGE: Main Change 3332216 on 2017/03/03 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3332168 #!RB:none #!Tests:none Change 3332060 on 2017/03/03 by Daniel.Lamb Fixed issue with AsyncLoading code eventually flushing async loading while in async loading... This causes all kinds of cool stuff like objects on the stack corruption and also deleted memory accesses. #!rb Gil.Gribb. #!test Editor and -game Change 3331680 on 2017/03/03 by Jason.Bestimt #!ORION_MAIN - Merge MAIN @ CL 3331636 #!RB:none #!Tests:none #!codeReview: andrew.grant Change 3331412 on 2017/03/03 by James.Hopkin #!orion Rebuilt OpenSSL libs for PS4 to fix process termination due to SIGPIPE on closing websockets Source change committed in CL#!3331380 #!jira OR-36274 #!fyi Paul.Moore Change 3331375 on 2017/03/03 by Sam.Zamani fix dll path for tenproxy #!rb none #!tests none Change 3330953 on 2017/03/02 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3330924 [STOMPED ChestOpeningScreen.uasset] #!RB:none #!Tests:none #!codeReview: bryan.rathman, phil.buuck, matt.schembari, andrew.grant Change 3330646 on 2017/03/02 by Andrew.Grant Warning and non-unity fix #!tests compiled #!rb none Change 3330388 on 2017/03/02 by Andrew.Grant Merging //Orion/Main to Dev-General (//Orion/Dev-General) #!tests #!rb na Change 3329982 on 2017/03/02 by Sam.Zamani fixed updated module rules #!rb none #!tests regen projects Change 3329964 on 2017/03/02 by Sam.Zamani Copying //Tasks/Orion/Dev-Online-Tencent to Dev-General (//Orion/Dev-General) 3245325 Adding new OSS for Tencent online platform 3245448 tencent third party SDK TCLS proxy functionality #!rb none 3245474 missing include #!rb none 3249585 TCLS tenproxy.dll in thirdparty bin folder #!rb none 3249726 Load TenProxy.dll for TCLS integration New OSS Tencent #!rb none 3255571 tencent configs #!rb none 3255826 Tencent TCLS paragon launcher #!rb none 3256168 TCLS launch batch update cmd line options #!rb none 3256170 Added "TencentLive,TencentDev" MCP config entries #!rb none3256504xmpp config update #!rb none 3273168 skip login steps for tencent config update #!rb none 3279427 #!xmpp add option to use plain text auth 3279428 disable ssl and use plain text auth for XMPP connection temporary until we have a valid cert setup on Tigase deployment 3281566 enabled OSS tencent this will also be the toggle for detecting when to enable tencent functionality at runtime 3283103 differentiate between tencent dev/live environments disable QoS region selection for tencentdev 3283106 lower http verbosity 3283734 config updates 3285066 disable replays and mtx for tencent build 3291005 #!online,mcp service config bEnabled flag to toggle individual services as needed 3291006 explicitly mark unneeded Mcp services as disabled 3291108 allow replay tab to be disabled via UOrionRuntimeOptions.bEnableReplays=false 3291492 disable recording of replays for tencent mode 3292750 disable replay tab based on bEnableReplays=false 3292753 new orion runtime option bDisallowCoinPurchases if true, prevents coins from being available for purchase 3292755 diable mtx coin offers if bDisallowCoinPurchases=true 3292759 missing header 3293246 disable query for available friend codes if bEnableFriendCodes=false 3293250 temp usage of NULL analytics provider 3298025 Adding optional RegionTencent plugin for overriding config files 3298027 ability to override config cache values via plugin config files 3311016 default to TencentDev backend when running in tencent mode 3311017 CMS tencent config 3311022 Rename RegionTencent to RegionCN 3312470 disable links for tencent build 3313014 move tenproxy.dll to \OrionGame\Binaries\ThirdParty\Tencent 3314861 tenproxy 2.0.2.7 update 3314878 default RegionCN plugin to disabled this will only be enabled once the RegionCN.pak is loaded 3314879 TCLS launcher pointing at UE4Editor.exe for development 3315257 missing file 3323573 remove TCLS launcher 3326006 Tencent TLOG SDK 3326277 wrapper singleton class for tenproxy connection 3329180 Tencent support for login flow 3329181 WIP tenproxy connection usage in identity 3329624 wip tcls proxy #!rb none #!tests none Change 3329651 on 2017/03/02 by Andrew.Grant Merging from //UE4/Main @ 3322856 through Orion-Staging #!tests QA #!rb na Change 3329411 on 2017/03/02 by robomerge #!ROBOMERGE-AUTHOR: dan.hertzka Duplicating CL 3303733 from Dev-Editor (simple fix for a massive issue) - This will prevent any TAssetPtr property from getting stomped by undo/redo (you know those ridiculous store and card art issues? Fixed!) #!lockdown Jason.Bestimt #!rb none #!tests Undo on an item definition asset #!ROBOMERGE-SOURCE: CL 3329404 in //Orion/Release-38.3/... via CL 3329405 #!ROBOMERGE-BOT: ORION (Main -> Dev-General) Change 3328858 on 2017/03/01 by Lina.Halper Fixed crash on importing animation that was edited before #!rb: none #!tests: reimport Change 3328459 on 2017/03/01 by Daniel.Lamb When adding new ddc back ends to the hierarchcial ddc make sure to update the async backends lists. #!codereview Gil.Gribb #!test None #!rb Trivial Change 3328182 on 2017/03/01 by Daniel.Lamb Unshelved from pending changelist '3318009': Adding support for shared cooked builds to be downloaded from the network. Included CookedAssetRegistry in the p:\ published builds. #!rb Ben.Marsh Change 3327856 on 2017/03/01 by Frank.Gigliotti Added velocity overrides to FRK4SpringInterpolator; #!RB None #!codeReview Laurent.Delayen #!Tests PIE Change 3327096 on 2017/03/01 by David.Ratti Added generic reference viewer details customization for gameplay tags. Added it to GameplayStatsMetaData. #!rb none #!tests editor Change 3326177 on 2017/02/28 by Daniel.Lamb Added some more debugging information to help track down live issue. #!rb Chris.Bunner #!test Ran editor. Change 3324951 on 2017/02/28 by David.Ratti UDataTable: added AddRow/RemoveRow native functions. #!rb JB #!tests na Change 3323852 on 2017/02/27 by David.Ratti Fix ::RequestAllGameplayTags OnlyIncludeDictionaryTags option #!codereview Ben.Zeigler #!rb #!tests na Change 3323706 on 2017/02/27 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3323694 #!RB:none #!Tests:none Change 3321945 on 2017/02/24 by Jon.Lietz OR-36258 - fixing an issue where gameplay effects that are set to not refresh the period should not allow the execution of a period effect on application. #!RB David.Ratti #!tests golden path #!codeReview: Billy.Bramer, Fred.Kimberley #!RNX Change 3321876 on 2017/02/24 by Daniel.Lamb Fixed erroronEngineContentUse flag not being set properly. #!rb Trivial #!test Cook Paragon. Change 3321591 on 2017/02/24 by Jason.Bestimt #!ORION_DG - MAIN @ CL 3321563 #!RB:none #!Tests:none Change 3321260 on 2017/02/24 by Andrew.Grant Fixed issue that was causing missing string references to not show their referencer #!rb none Change 3321040 on 2017/02/24 by Robert.Manuszewski Merging changes 3316253 and 3319134 from Dev-Core: fixes to file log hangs and crashes. #!rb none #!tests Cooked Win64 server and client, played cooked Win64 build Change 3319413 on 2017/02/23 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3319394 #!RB:none #!Tests:none Change 3317905 on 2017/02/22 by Daniel.Lamb Integrate CL 3238291 from Odin Add Plugin content to the asset registry Change the location of AssetRegistry.bin when cooking a plugin as DLC Include AssetRegistry.bin in the cooked plugin staging process Add function to PluginManager to keep list of any plugins that loaded a pak file Use list of plugins with pak files to merge their AssetRegistry.bin files into the main AssetRegistry when it's created #!rb Ben.Marsh #!codereview Chance.Ivey, Daniel.Lamb Change 3317648 on 2017/02/22 by Cody.Haskell Instead of popping an external web browser, we use the SWebBrowser widget on GFN. #!rb DanH #!codereview Andrew.Grant, Dan.Hertzka, Matt.Schembari #!tests PIE Change 3317289 on 2017/02/22 by Jason.Bestimt #!ORION_DG - Merge MAIN @ CL 3317254 #!RB:none #!Tests:none Change 3317186 on 2017/02/22 by Mieszko.Zielinski Fixed items that have been force-scored by an EQS test as 'failed' getting discarted even if the test is being run in scoring-only mode #!UE4 #!test golden path #!rb Lukasz.Furman #!codereview Daniel.Broder, John.Abercrombie Change 3317005 on 2017/02/22 by Daniel.Lamb Submitted wrong version of my file. #!rb Trivial #!test Compile Change 3316958 on 2017/02/22 by Daniel.Lamb Added support in buildcookrun for shared cooked builds. #!rb Trivial #!test BuildCookRun iterative script Change 3316942 on 2017/02/22 by Daniel.Lamb DLC cooking optimization. Optimization to determining package dependency tree, now is async. Fixes for iterate shared cooked build. Added fallback when using shared cooked build to local build if local build is newer. Added DLC cooking warning if you are overriding output directories. Removed previous release packages names from DLC asset registry. Only generate manifest for additional assets instead of all assets. Minor optimization to worst case resolving of string asset references. Only resolve those that haven't been resolved before (only happens when GC thrashing happens). #!rb Andrew.Grant #!test Cook paragon [CL 3365166 by Andrew Grant in Main branch]
505 lines
20 KiB
C++
505 lines
20 KiB
C++
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "Misc/Guid.h"
|
|
#include "SceneTypes.h"
|
|
#include "Modules/ModuleInterface.h"
|
|
#include "Engine/TextureStreamingTypes.h"
|
|
#include "UObject/ErrorException.h"
|
|
#include "Engine/Texture.h"
|
|
|
|
class ALandscapeProxy;
|
|
class Error;
|
|
class FStaticLODModel;
|
|
class ULandscapeComponent;
|
|
class UMaterial;
|
|
class UMaterialInstanceConstant;
|
|
class UMaterialInterface;
|
|
class UTexture2D;
|
|
class UTextureRenderTarget2D;
|
|
struct FMaterialProxySettings;
|
|
struct FRawMesh;
|
|
|
|
/* TODO replace this with rendering property enum when extending the system */
|
|
UENUM()
|
|
enum class EFlattenMaterialProperties : uint8
|
|
{
|
|
Diffuse,
|
|
Normal,
|
|
Metallic,
|
|
Roughness,
|
|
Specular,
|
|
Opacity,
|
|
Emissive,
|
|
SubSurface,
|
|
OpacityMask,
|
|
NumFlattenMaterialProperties
|
|
};
|
|
|
|
/** Structure used for storing intermediate baked down material data/samples*/
|
|
struct FFlattenMaterial
|
|
{
|
|
FFlattenMaterial()
|
|
: RenderSize(0, 0)
|
|
, bTwoSided(false)
|
|
, bDitheredLODTransition(false)
|
|
, BlendMode(BLEND_Opaque)
|
|
, EmissiveScale(1.0f)
|
|
{
|
|
for (FIntPoint& Size : PropertySizes)
|
|
{
|
|
Size = FIntPoint(ForceInitToZero);
|
|
}
|
|
}
|
|
|
|
/** Release all the sample data */
|
|
void ReleaseData()
|
|
{
|
|
for (TArray<FColor>& Samples : PropertySamples)
|
|
{
|
|
Samples.Empty();
|
|
}
|
|
}
|
|
|
|
/** Set all alpha channel values with InAlphaValue */
|
|
void FillAlphaValues(const uint8 InAlphaValue)
|
|
{
|
|
for (TArray<FColor>& SampleArray : PropertySamples)
|
|
{
|
|
for (FColor& Sample : SampleArray)
|
|
{
|
|
Sample.A = InAlphaValue;
|
|
}
|
|
}
|
|
}
|
|
|
|
const bool DoesPropertyContainData(const EFlattenMaterialProperties Property) const { return PropertySamples[(int32)Property].Num() > 0; }
|
|
|
|
const bool IsPropertyConstant(const EFlattenMaterialProperties Property) const { return PropertySamples[(int32)Property].Num() == 1; }
|
|
|
|
const bool ShouldGenerateDataForProperty(const EFlattenMaterialProperties Property) const { return PropertySizes[(int32)Property].GetMin() > 0; }
|
|
|
|
const FIntPoint GetPropertySize(const EFlattenMaterialProperties Property) const{ return PropertySizes[(int32)Property]; }
|
|
void SetPropertySize(const EFlattenMaterialProperties Property, const FIntPoint& InSize) { PropertySizes[(int32)Property] = InSize; }
|
|
|
|
TArray<FColor>& GetPropertySamples(const EFlattenMaterialProperties Property) { return PropertySamples[(int32)Property]; }
|
|
const TArray<FColor>& GetPropertySamples(const EFlattenMaterialProperties Property) const { return PropertySamples[(int32)Property]; }
|
|
|
|
/** Material Guid */
|
|
FGuid MaterialId;
|
|
FIntPoint RenderSize;
|
|
|
|
/** Flag whether or not the material will have to be two-sided */
|
|
bool bTwoSided;
|
|
/** Flag whether or not the material will use dithered LOD transitions */
|
|
bool bDitheredLODTransition;
|
|
/** Blend mode for the new material */
|
|
EBlendMode BlendMode;
|
|
/** Scale (maximum baked down value) for the emissive property */
|
|
float EmissiveScale;
|
|
private:
|
|
|
|
/** Texture sizes for each individual property*/
|
|
FIntPoint PropertySizes[(uint32)EFlattenMaterialProperties::NumFlattenMaterialProperties];
|
|
/** Baked down texture samples for each individual property*/
|
|
TArray<FColor> PropertySamples[(uint32)EFlattenMaterialProperties::NumFlattenMaterialProperties];
|
|
};
|
|
|
|
/** Export material proxy cache*/
|
|
struct MATERIALUTILITIES_API FExportMaterialProxyCache
|
|
{
|
|
// Material proxies for each property. Note: we're not handling all properties here,
|
|
// so hold only up to MP_Normal inclusive.
|
|
class FMaterialRenderProxy* Proxies[MP_MAX];
|
|
|
|
FExportMaterialProxyCache();
|
|
~FExportMaterialProxyCache();
|
|
|
|
/** Releasing the cached render proxies */
|
|
void Release();
|
|
};
|
|
|
|
/** Intermediate material merging data */
|
|
struct FMaterialMergeData
|
|
{
|
|
/** Material proxy cache, eliminates shader compilations when a material is baked out multiple times for different meshes */
|
|
FExportMaterialProxyCache* ProxyCache;
|
|
|
|
/** Input data */
|
|
/** Material that is being baked out */
|
|
class UMaterialInterface* Material;
|
|
/** Raw mesh data used to bake out the material with, optional */
|
|
const struct FRawMesh* Mesh;
|
|
/** LODModel data used to bake out the material with, optional */
|
|
const class FStaticLODModel* LODModel;
|
|
/** Material index to use when the material is baked out using mesh data (face material indices) */
|
|
int32 MaterialIndex;
|
|
/** Optional tex coordinate bounds of original texture coordinates set */
|
|
FBox2D TexcoordBounds;
|
|
/** Optional new set of non-overlapping texture coordinates */
|
|
const TArray<FVector2D>& TexCoords;
|
|
|
|
/** Output emissive scale, maximum baked out emissive value (used to scale other samples, 1/EmissiveScale * Sample) */
|
|
float EmissiveScale;
|
|
|
|
FMaterialMergeData(
|
|
UMaterialInterface* InMaterial,
|
|
const FRawMesh* InMesh,
|
|
const FStaticLODModel* InLODModel,
|
|
int32 InMaterialIndex,
|
|
FBox2D InTexcoordBounds,
|
|
const TArray<FVector2D>& InTexCoords)
|
|
: ProxyCache(nullptr)
|
|
, Material(InMaterial)
|
|
, Mesh(InMesh)
|
|
, LODModel(InLODModel)
|
|
, MaterialIndex(InMaterialIndex)
|
|
, TexcoordBounds(InTexcoordBounds)
|
|
, TexCoords(InTexCoords)
|
|
, EmissiveScale(0.0f)
|
|
{
|
|
ProxyCache = new FExportMaterialProxyCache();
|
|
}
|
|
|
|
~FMaterialMergeData()
|
|
{
|
|
if (ProxyCache)
|
|
{
|
|
delete ProxyCache;
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
class UMaterialInterface;
|
|
class UMaterial;
|
|
class UTexture2D;
|
|
class UTextureRenderTarget2D;
|
|
class UWorld;
|
|
class ALandscapeProxy;
|
|
class ULandscapeComponent;
|
|
class FPrimitiveComponentId;
|
|
class UMaterialInstanceConstant;
|
|
struct FMaterialMergeData;
|
|
|
|
/**
|
|
* Material utilities
|
|
*/
|
|
class MATERIALUTILITIES_API FMaterialUtilities : public IModuleInterface
|
|
{
|
|
public:
|
|
/** Begin IModuleInterface implementation */
|
|
virtual void StartupModule() override;
|
|
virtual void ShutdownModule() override;
|
|
/** End IModuleInterface implementation */
|
|
|
|
/**
|
|
* Whether material utilities support exporting specified material blend mode and property
|
|
*/
|
|
static bool SupportsExport(EBlendMode InBlendMode, EMaterialProperty InMaterialProperty);
|
|
|
|
/**
|
|
* Renders specified material property into texture
|
|
*
|
|
* @param InWorld World object to use for material property rendering
|
|
* @param InMaterial Target material
|
|
* @param InMaterialProperty Material property to render
|
|
* @param InRenderTarget Render target to render to
|
|
* @param OutBMP Output array of rendered samples
|
|
* @return Whether operation was successful
|
|
*/
|
|
DEPRECATED(4.11, "Please use ExportMaterialProperty function with new signature")
|
|
static bool ExportMaterialProperty(UWorld* InWorld, UMaterialInterface* InMaterial, EMaterialProperty InMaterialProperty, UTextureRenderTarget2D* InRenderTarget, TArray<FColor>& OutBMP);
|
|
|
|
/**
|
|
* Renders specified material property into texture
|
|
*
|
|
* @param InMaterial Target material
|
|
* @param InMaterialProperty Material property to render
|
|
* @param OutBMP Output array of rendered samples
|
|
* @param OutSize Output size of the rendered samples
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterialProperty(UMaterialInterface* InMaterial, EMaterialProperty InMaterialProperty, TArray<FColor>& OutBMP, FIntPoint& OutSize );
|
|
|
|
/**
|
|
* Renders specified material property into texture
|
|
*
|
|
* @param InMaterial Target material
|
|
* @param InMaterialProperty Material property to render
|
|
* @param InSize Input size for the rendered samples
|
|
* @param OutBMP Output array of rendered samples
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterialProperty(UMaterialInterface* InMaterial, EMaterialProperty InMaterialProperty, FIntPoint InSize, TArray<FColor>& OutBMP );
|
|
|
|
/**
|
|
* Renders specified material property into texture
|
|
*
|
|
* @param InWorld World object to use for material property rendering
|
|
* @param InMaterial Target material
|
|
* @param InMaterialProperty Material property to render
|
|
* @param OutBMP Output array of rendered samples
|
|
* @return Whether operation was successful
|
|
*/
|
|
DEPRECATED(4.11, "Please use ExportMaterialProperty function with new signature")
|
|
static bool ExportMaterialProperty(UWorld* InWorld, UMaterialInterface* InMaterial, EMaterialProperty InMaterialProperty, FIntPoint& OutSize, TArray<FColor>& OutBMP);
|
|
|
|
/**
|
|
* Flattens specified material
|
|
*
|
|
* @param InWorld World object to use for material rendering
|
|
* @param InMaterial Target material
|
|
* @param OutFlattenMaterial Output flattened material
|
|
* @return Whether operation was successful
|
|
*/
|
|
DEPRECATED(4.11, "Please use ExportMaterial function with new signature")
|
|
static bool ExportMaterial(UWorld* InWorld, UMaterialInterface* InMaterial, FFlattenMaterial& OutFlattenMaterial);
|
|
|
|
/**
|
|
* Flattens specified material
|
|
*
|
|
* @param InMaterial Target material
|
|
* @param OutFlattenMaterial Output flattened material
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterial(UMaterialInterface* InMaterial, FFlattenMaterial& OutFlattenMaterial, struct FExportMaterialProxyCache* ProxyCache = NULL);
|
|
|
|
/**
|
|
* Flattens specified material using mesh data
|
|
*
|
|
* @param InMaterial Target material
|
|
* @param InMesh Mesh data to use for flattening
|
|
* @param InMaterialIndex Material index
|
|
* @param InTexcoordBounds Texture bounds
|
|
* @param InTexCoords Replacement non-overlapping texture coordinates
|
|
* @param OutFlattenMaterial Output flattened material
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterial(UMaterialInterface* InMaterial, const FRawMesh* InMesh, int32 InMaterialIndex, const FBox2D& InTexcoordBounds, const TArray<FVector2D>& InTexCoords, FFlattenMaterial& OutFlattenMaterial, struct FExportMaterialProxyCache* ProxyCache = NULL);
|
|
|
|
/**
|
|
* Flattens specified landscape material
|
|
*
|
|
* @param InLandscape Target landscape
|
|
* @param HiddenPrimitives Primitives to hide while rendering scene to texture
|
|
* @param OutFlattenMaterial Output flattened material
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportLandscapeMaterial(ALandscapeProxy* InLandscape, const TSet<FPrimitiveComponentId>& HiddenPrimitives, FFlattenMaterial& OutFlattenMaterial);
|
|
|
|
/**
|
|
* Generates a texture from an array of samples
|
|
*
|
|
* @param Outer Outer for the material and texture objects, if NULL new packages will be created for each asset
|
|
* @param AssetLongName Long asset path for the new texture
|
|
* @param Size Resolution of the texture to generate (must match the number of samples)
|
|
* @param Samples Color data for the texture
|
|
* @param CompressionSettings Compression settings for the new texture
|
|
* @param LODGroup LODGroup for the new texture
|
|
* @param Flags ObjectFlags for the new texture
|
|
* @param bSRGB Whether to set the bSRGB flag on the new texture
|
|
* @param SourceGuidHash (optional) Hash (stored as Guid) to use part of the texture source's DDC key.
|
|
* @return The new texture.
|
|
*/
|
|
static UTexture2D* CreateTexture(UPackage* Outer, const FString& AssetLongName, FIntPoint Size, const TArray<FColor>& Samples, TextureCompressionSettings CompressionSettings, TextureGroup LODGroup, EObjectFlags Flags, bool bSRGB, const FGuid& SourceGuidHash = FGuid());
|
|
|
|
/**
|
|
* Creates UMaterial object from a flatten material
|
|
*
|
|
* @param Outer Outer for the material and texture objects, if NULL new packages will be created for each asset
|
|
* @param BaseName BaseName for the material and texture objects, should be a long package name in case Outer is not specified
|
|
* @param Flags Object flags for the material and texture objects.
|
|
* @param OutGeneratedAssets List of generated assets - material, textures
|
|
* @return Returns a pointer to the constructed UMaterial object.
|
|
*/
|
|
static UMaterial* CreateMaterial(const FFlattenMaterial& InFlattenMaterial, UPackage* InOuter, const FString& BaseName, EObjectFlags Flags, const struct FMaterialProxySettings& MaterialProxySettings, TArray<UObject*>& OutGeneratedAssets, const TextureGroup& InTextureGroup = TEXTUREGROUP_World);
|
|
|
|
/**
|
|
* Creates an instanced material based of BaseMaterial
|
|
* @param Outer Outer for the material and texture objects, if NULL new packages will be created for each asset
|
|
* @param BaseName BaseName for the material and texture objects, should be a long package name in case Outer is not specified
|
|
* @param Flags Object flags for the material and texture objects.
|
|
* @return Returns a pointer to the constructed UMaterialInstanceConstant object.
|
|
*/
|
|
|
|
static UMaterialInstanceConstant* CreateInstancedMaterial(UMaterial* BaseMaterial, UPackage* InOuter, const FString& BaseName, EObjectFlags Flags);
|
|
|
|
/**
|
|
* Creates bakes textures for a ULandscapeComponent
|
|
*
|
|
* @param LandscapeComponent The component to bake textures for
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportBaseColor(ULandscapeComponent* LandscapeComponent, int32 TextureSize, TArray<FColor>& OutSamples);
|
|
|
|
/**
|
|
* Creates a FFlattenMaterial instance with the given MaterialProxySettings data
|
|
*
|
|
* @param InMaterialLODSettings Settings containing how to material should be merged
|
|
* @return Set up FFlattenMaterial according to the given settings
|
|
*/
|
|
static FFlattenMaterial CreateFlattenMaterialWithSettings(const FMaterialProxySettings& InMaterialLODSettings);
|
|
|
|
/**
|
|
* Analyzes given material to determine how many texture coordinates and whether or not vertex colors are used within the material Graph
|
|
*
|
|
* @param InMaterial Material to analyze
|
|
* @param InMaterialSettings Settings containing how to material should be merged
|
|
* @param OutNumTexCoords Number of texture coordinates used across all properties flagged for merging
|
|
* @param OutRequiresVertexData Flag whether or not Vertex Data is used in the material graph for the properties flagged for merging
|
|
*/
|
|
static void AnalyzeMaterial(class UMaterialInterface* InMaterial, const struct FMaterialProxySettings& InMaterialSettings, int32& OutNumTexCoords, bool& OutRequiresVertexData);
|
|
|
|
/**
|
|
* Remaps material indices where possible to reduce the number of materials required for creating a proxy material
|
|
*
|
|
* @param InMaterials List of Material interfaces (non-unique)
|
|
* @param InMeshData Array of meshes who use the materials in InMaterials
|
|
* @param InMaterialMap Map of MeshIDAndLOD keys with a material index array as value mapping InMeshData to the InMaterials array
|
|
* @param InMaterialProxySettings Settings for creating the proxy material
|
|
* @param bBakeVertexData Flag whether or not Vertex Data should be baked down
|
|
* @param bMergeMaterials Flag whether or not materials with be merged for this mesh
|
|
* @param OutMeshShouldBakeVertexData Array with Flag for each mesh whether or not Vertex Data should be baked down or is required to
|
|
* @param OutMaterialMap Map of MeshIDAndLOD keys with a material index array as value mapping InMeshData to the OutMaterials array
|
|
* @param OutMaterials List of Material interfaces (unique)
|
|
*/
|
|
static void RemapUniqueMaterialIndices(const TArray<struct FSectionInfo>& InSections, const TArray<struct FRawMeshExt>& InMeshData, const TMap<FIntPoint, TArray<int32> >& InMaterialMap, const FMaterialProxySettings& InMaterialProxySettings, const bool bBakeVertexData, const bool bMergeMaterials, TArray<bool>& OutMeshShouldBakeVertexData, TMap<FIntPoint, TArray<int32> >& OutMaterialMap, TArray<struct FSectionInfo>& OutSections);
|
|
|
|
/**
|
|
* Tries to optimize the flatten material's data by picking out constant values for the various properties
|
|
*
|
|
* @param InFlattenMaterial Flatten material to optimize
|
|
*/
|
|
static void OptimizeFlattenMaterial(FFlattenMaterial& InFlattenMaterial);
|
|
|
|
/**
|
|
* Resizes flatten material's data if applicable by comparing it with the original settings
|
|
*
|
|
* @param InFlattenMaterial Flatten material to optimize
|
|
*/
|
|
static void ResizeFlattenMaterial(FFlattenMaterial& InFlattenMaterial, const struct FMeshProxySettings& InMeshProxySettings);
|
|
|
|
|
|
/**
|
|
* Contains errors generated when exporting material texcoord scales.
|
|
* Used to prevent displaying duplicates, as instances using the same shaders get the same issues.
|
|
*/
|
|
class MATERIALUTILITIES_API FExportErrorManager
|
|
{
|
|
public:
|
|
|
|
FExportErrorManager(ERHIFeatureLevel::Type InFeatureLevel) : FeatureLevel(InFeatureLevel) {}
|
|
|
|
enum EErrorType
|
|
{
|
|
EET_IncohorentValues,
|
|
EET_NoValues
|
|
};
|
|
|
|
/**
|
|
* Register a new error.
|
|
*
|
|
* @param Material The material having this error.
|
|
* @param TextureName The texture for which the scale could not be generated.
|
|
* @param RegisterIndex The register index bound to this texture.
|
|
* @param ErrorType The issue encountered.
|
|
*/
|
|
void Register(const UMaterialInterface* Material, FName TextureName, int32 RegisterIndex, EErrorType ErrorType);
|
|
|
|
/**
|
|
* Output all errors registered.
|
|
*/
|
|
void OutputToLog();
|
|
|
|
private:
|
|
|
|
struct FError
|
|
{
|
|
const FMaterial* Material;
|
|
int32 RegisterIndex;
|
|
EErrorType ErrorType;
|
|
|
|
bool operator==(const FError& Rhs) const;
|
|
};
|
|
|
|
struct FInstance
|
|
{
|
|
const UMaterialInterface* Material;
|
|
FName TextureName;
|
|
};
|
|
|
|
friend uint32 GetTypeHash(const FError& Error);
|
|
|
|
ERHIFeatureLevel::Type FeatureLevel;
|
|
TMap<FError, TArray<FInstance> > ErrorInstances;
|
|
};
|
|
|
|
/**
|
|
* Get the material texcoord scales applied on each textures
|
|
*
|
|
* @param InMaterial Target material
|
|
* @param QualityLevel Quality level used for the shader profiling.
|
|
* @param FeatureLevel Feature level used for the shader profiling.
|
|
* @param OutErrors Manager to log errors (removes duplicates and similar errors)
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterialUVDensities(UMaterialInterface* InMaterial, EMaterialQualityLevel::Type QualityLevel, ERHIFeatureLevel::Type FeatureLevel, FExportErrorManager& OutErrors);
|
|
|
|
// QQQ COMMENTS
|
|
static void DetermineMaterialImportance(const TArray<UMaterialInterface*>& InMaterials, TArray<float>& OutImportance);
|
|
static void GeneratedBinnedTextureSquares(const FVector2D DestinationSize, TArray<float>& InTexureWeights, TArray<FBox2D>& OutGeneratedBoxes);
|
|
private:
|
|
|
|
/**
|
|
* Private export material function to which unique signatures are mapped for unified code path
|
|
*
|
|
* @param InMaterialData Target material data
|
|
* @param OutFlattenMaterial Output flattened material
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool ExportMaterial(struct FMaterialMergeData& InMaterialData, FFlattenMaterial& OutFlattenMaterial, struct FExportMaterialProxyCache* ProxyCache = NULL);
|
|
|
|
/**
|
|
* Renders out the specified material property with the given material data to a texture
|
|
*
|
|
* @param InMaterialData Target material data
|
|
* @param InMaterialProperty Target material property
|
|
* @param bInForceLinearGamma Whether or not to force linear gamma (used for Normal property)
|
|
* @param InPixelFormat Pixel format of the target texture
|
|
* @param InTargetSize Dimensions of the target texture
|
|
* @param OutSampleSize Dimensions of the rendered texture
|
|
* @param OutSamples Array of FColor samples containing the rendered out texture pixel data
|
|
* @return Whether operation was successful
|
|
*/
|
|
static bool RenderMaterialPropertyToTexture(struct FMaterialMergeData& InMaterialData, EMaterialProperty InMaterialProperty, bool bInForceLinearGamma, EPixelFormat InPixelFormat, const FIntPoint InTargetSize, FIntPoint& OutSampleSize, TArray<FColor>& OutSamples);
|
|
|
|
/**
|
|
* Creates and add or reuses a RenderTarget from the pool
|
|
*
|
|
* @param bInForceLinearGamma Whether or not to force linear gamma
|
|
* @param InPixelFormat Pixel format of the render target
|
|
* @param InTargetSize Dimensions of the render target
|
|
* @return Created render target
|
|
*/
|
|
static UTextureRenderTarget2D* CreateRenderTarget(bool bInForceLinearGamma, bool bNormalMap, EPixelFormat InPixelFormat, FIntPoint& InTargetSize );
|
|
|
|
/** Clears the pool with available render targets */
|
|
static void ClearRenderTargetPool();
|
|
|
|
/** Call back for garbage collector, cleans up the RenderTargetPool if CurrentlyRendering is set to false */
|
|
void OnPreGarbageCollect();
|
|
|
|
/** Tries to optimize the sample array (will set to const value if all samples are equal) */
|
|
static void OptimizeSampleArray(TArray<FColor>& InSamples, FIntPoint& InSampleSize);
|
|
|
|
private:
|
|
/** Flag to indicate whether or not a texture is currently being rendered out */
|
|
static bool CurrentlyRendering;
|
|
/** Pool of available render targets, cached for re-using on consecutive property rendering */
|
|
static TArray<UTextureRenderTarget2D*> RenderTargetPool;
|
|
};
|