2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "NiagaraEditorPrivatePCH.h"
|
2015-04-13 15:25:14 -04:00
|
|
|
#include "NiagaraScript.h"
|
|
|
|
|
#include "NiagaraComponent.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "CompilerResultsLog.h"
|
|
|
|
|
#include "EdGraphUtilities.h"
|
|
|
|
|
#include "VectorVM.h"
|
2014-06-18 07:25:31 -04:00
|
|
|
#include "ComponentReregisterContext.h"
|
2014-10-16 03:41:17 -04:00
|
|
|
#include "NiagaraCompiler_VectorVM.h"
|
|
|
|
|
#include "NiagaraEditorCommon.h"
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3045398)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3028958 on 2016/06/27 by Ben.Woodhouse
Fix for perf issue with GetSingleFinalDataConst
This was caused by the LPV integration/switch to blendables. Now we cache the flag for the directionalocclusion in the LPV class. This reduces calls to GetSingleFinalDataConst on the blendable data (potentially slow), and makes things a bit cleaner and consistent.
Tested in QAGame editor (with LPV enabled in ConsoleSettings.ini)
#jira UE-26179
Change 3029401 on 2016/06/27 by Rolando.Caloca
DR - More vk logging
Change 3029549 on 2016/06/27 by Uriel.Doyon
Refactored "r.OnlyStreamInTextures" into "r.Streaming.FullyLoadUsedTextures", making it fully load every used textures, as an alternative to disabling texture streaming.
New options "r.Streaming.UsePerTextureBias" that assign a bias between 0 and MipBias to each texture in order to fit in budget.
Fixed crash when disabling texture streaming.
Fixed issue when disabling texture streaming that would make current loaded texture low res.
New logic to prevent retrying to cancel a streaming request more than once.
Pending load request of one extra mip will not be cancelled anymore.
Changed UTexture2D from float to double. Also using FApp::GetCurrentTime() instead of FPlatformTime::Seconds().
#jira UE-32197
#jira UE-31102
Change 3029837 on 2016/06/27 by David.Hill
Fixed Shutter SM4 not working when using compute shader eye-adaptation
#jira UE-32443
The default eye adaptation value was missing.
Change 3030039 on 2016/06/27 by Uriel.Doyon
Fix for crash when landscape materials are used in the Texture Streaming Build.
#jira UE-32196
Change 3030081 on 2016/06/27 by Uriel.Doyon
Updated MaterialTexCoordScalesPixelShader to use PackedEyeIndex, preventing crash when building the map with stereo rendering enabled.
Change 3030401 on 2016/06/28 by Ben.Woodhouse
Perf Monitor: Fix for perf warning due to cvar FindConsoleVariable being called too frequently. Tested in QAGame editor (DX11)
#jira UE-31238
Change 3030607 on 2016/06/28 by Marc.Olano
Random Number generators: fixed bug in TEA, added integer and float Blum-Blum-Shub. BBS is way cheaper for similar quality, suggest it for future use.
Change 3030627 on 2016/06/28 by Ben.Woodhouse
Fix for warning. CVar naming scope clash (doesn't appear to happen in vs2015).
Change 3030809 on 2016/06/28 by Marc.Olano
Noise shader function rename & perf improvement.
Due to incorrect terminology in internet soruces, previous "Perlin" noise was not, in fact, Perlin noise. Now more accurately called "Value" noise. 6x perf improvement for value noise by changing random number function to BBS. Also updated instruction counts in UI tooltips.
Change 3030850 on 2016/06/28 by Marc.Olano
Rename & redirect noise material enums. At some point these got switched around and no longer accurately described the noise options the selected. Redirect, so all existing content will continue to work as-is. Updated UDN docs to match.
Change 3030981 on 2016/06/28 by Rolando.Caloca
DR - vk - More logging
Change 3031056 on 2016/06/28 by Marc.Olano
Introduce new pure-ALU gradient shader noise. Add noise samples to RenderTest map
Change 3031398 on 2016/06/28 by Benjamin.Hyder
updating TM-Shadermodels (correcting Mt Rushmore)
Change 3031441 on 2016/06/28 by Marc.Olano
Use only float version of BBS shader rand function for ES2
Change 3031463 on 2016/06/28 by John.Billon
Fixed F4 changing the viewmode in Fortnite editor. The detailed lighting viewmode (detaillighting) named in DefaultInput.ini differed from the one in BaseInput.ini(lit_detaillighting).
#Jira UE-32020
Change 3031512 on 2016/06/28 by Zabir.Hoque
Relax clear flags for DX12 RHIs.
Properly flush pending commands before residency is updated.
Change 3031517 on 2016/06/28 by Rolando.Caloca
DR - vk logging using r.Vulkan.DumpLayer
Change 3032359 on 2016/06/29 by Allan.Bentham
Fix mobile shadows crash.
Change 3032431 on 2016/06/29 by Gil.Gribb
Merging //UE4/Dev-Main@3032394 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3032757 on 2016/06/29 by Uriel.Doyon
Fixed global mip bias being applied twice following integration with main.
Change 3033121 on 2016/06/29 by Rolando.Caloca
DR - vk - Logging
Change 3033529 on 2016/06/29 by Daniel.Wright
Null world guard on UReflectionCaptureComponent::ReadbackFromGPU
Change 3033668 on 2016/06/29 by Uriel.Doyon
Grouped texture streaming settings to simplify logic.
New options "r.Streaming.UseAllMips" to ignores the different lod and cinematic bias
#jira UE-32118
Change 3034403 on 2016/06/30 by Rolando.Caloca
DR - Shorten dumped shader debug strings
Change 3034475 on 2016/06/30 by Rolando.Caloca
DR - Missing logging
Change 3034722 on 2016/06/30 by Uriel.Doyon
Improved StreamingAccuracy viewmodes with alpha test and translucent materials
#jira UE-32656
Change 3034797 on 2016/06/30 by Rolando.Caloca
DR - vk - 'fix' RHIClear but causes a CPU hang on AMD, so disabled again
Change 3034799 on 2016/06/30 by Rolando.Caloca
DR - vk - missed file
Change 3034905 on 2016/06/30 by Rolando.Caloca
DR - vk - Fix for render passes being reused with wrong dimensions
Change 3035503 on 2016/07/01 by Simon.Tovey
Async compute version of translucency lighting volume clear.
Change 3035577 on 2016/07/01 by Marc.Olano
Tiling noise. Adds tiling option for gradient, gradient texture, and value noise in the noise material node. Tiling is more expensive, but allows noise functions to be baked into a seamless repeating texture.
Change 3035587 on 2016/07/01 by Ben.Woodhouse
Fix for async SSAO bug (SSAO Async Compute results are used before the async job wait)
#jira UE-32709
Change 3035618 on 2016/07/01 by Olaf.Piesche
Asset fixes
Change 3035692 on 2016/07/01 by Rolando.Caloca
DR - vk - Deferred deletion queue
Change 3035808 on 2016/07/01 by Rolando.Caloca
DR - vk - Stat for deletion time, fixed some logging
Change 3036012 on 2016/07/01 by John.Billon
Alpha Coverage Preservation
-Textures have a Alpha Preservation Vec4 property which dictates about much of that channel to preserve down the mip chain during mip generation.
#Jira UE-31986
Change 3036041 on 2016/07/01 by Rolando.Caloca
DR - vk - Fix for 32bit
Change 3036433 on 2016/07/01 by Rolando.Caloca
DR - More vk logging
Change 3036935 on 2016/07/04 by Simon.Tovey
Removing Data Objects
Change 3036942 on 2016/07/04 by Ben.Woodhouse
Fix for decal rendering resource leak
The cause was that FD3D11BoundRenderTargets doesn't support setting RTs sparsely. So if one element is NULL, it won't release the ones after it.
The sparse RT layout happened as a result of a change back in October, which meant that GBuffers for decals could be set sparsely, dependent on whether the decal wrote to the normalbuffer
This change adds support for sparsely bound rendertargets in FD3D11BoundRenderTargets.
#jira UE-32602
Change 3037563 on 2016/07/05 by Chris.Bunner
HLOD self-shadowing in baked lighting fix.
Change 3037640 on 2016/07/05 by Marcus.Wassmer
Fix bug in USE_GPU_OVERWRITE_CHECKING
Change 3037927 on 2016/07/05 by Rolando.Caloca
DR - Fix touch pads not showing on Vulkan
#jira UE-32062
Change 3038085 on 2016/07/05 by Chris.Bunner
HLOD dynamic shadowing support.
#jira UE-22627
Change 3038209 on 2016/07/05 by Rolando.Caloca
DR - vk - Android compile fix
Change 3038644 on 2016/07/05 by Uriel.Doyon
Added LerpRange that allows to lerp between two rotators without taking the sortest path.
Change 3038820 on 2016/07/05 by Uriel.Doyon
Selecting streaming accuracy view modes will not automatically generate missing visualization data.
Change 3039332 on 2016/07/06 by John.Billon
-Made MaxGPUSkinBonesCvar a FAutoConsoleVariableRef and moved it to mesh utilitles from console manager to fix a thread initialization problem.
#Jira UE-31710
Change 3039454 on 2016/07/06 by Simon.Tovey
Moved all Niagara files from Engine and UnrealEd to remove dependancies and increase compile times.
Niagara is now 99.999% decoupled from engine and editor so development should be much streamlined.
Plus a few other edits to remove Curves/DataObjects that I missed in last CL.
Change 3039517 on 2016/07/06 by Gil.Gribb
Merging //UE4/Dev-Main@3039013 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3039587 on 2016/07/06 by Rolando.Caloca
DR - vk logging, submit counter
Change 3039603 on 2016/07/06 by Rolando.Caloca
DR - Allow more samplers on GL4
#jira UE-32628
#jira UE-32744
Change 3039661 on 2016/07/06 by Daniel.Wright
Fixed non-directional DFAO occlusion on specular 'r.AOSpecularOcclusionMode 0'
Skylight occlusion tint now applies to specular
Skylight occlusion tint on diffuse is now correctly affected by DiffuseColor
Change 3039960 on 2016/07/06 by Daniel.Wright
Forward renderer initial implementation
* Point and spot lights are culled to a frustum space grid, base pass loops over culled lights.
* Light culling uses a reverse linked list to avoid a per-cell limit, and the linked list is compacted to an array before the base pass.
* New cvars to control light culling: r.Forward.MaxCulledLightsPerCell, r.Forward.LightGridSizeZ, r.Forward.LightGridPixelSize
* A full Z Prepass is forced with forward shading. This allows deferred rendering before the base pass of shadow projection methods that only rely on depth.
* Dynamic shadows are packed based on the assigned stationary light ShadowMapChannel, since stationary lights are already restricted to 4 overlapping.
* GBuffer render targets are still allocated
* Fixed several issues in parallax corrected base pass reflections - not blending out box shape, discontinuity in reflection vector, not blending with stationary skylight properly
* Forward shading is now used for TLM_SurfacePerPixelLighting translucency in the deferred path
* Notable missing features: shadowing of translucency, support for various translucency lighting modes, multiple blended reflection captures
Change 3040050 on 2016/07/06 by Daniel.Wright
Added r.Shadow.WholeSceneShadowCacheMb, which defaults to 150, to limit how much memory can be spent caching whole scene shadowmaps
Change 3040160 on 2016/07/06 by Daniel.Wright
Fixed tile artifacts in indirect capsule shadows from doing the scaled sphere vs tile bounding sphere intersection in the wrong space
Change 3040163 on 2016/07/06 by Rolando.Caloca
DR - vk - More logging
Change 3040257 on 2016/07/06 by Daniel.Wright
Skylights aren't captured until their level is made visible- fixes the case where skylights capture too early
Change 3040316 on 2016/07/06 by Daniel.Wright
PerObject shadows from point / spot lights do the light source pull back based on subject box size, not subject radius, since the box is used to find a valid < 90 degree projection. Fix from licensee
Change 3040361 on 2016/07/06 by Daniel.Wright
Fixed TexCreate_UAV being used on translucency volume textures in SM4
Change 3040402 on 2016/07/06 by Rolando.Caloca
DR - vk - Make host mem accesses coherent
Change 3040486 on 2016/07/06 by Daniel.Wright
CIS fixes
Change 3041028 on 2016/07/07 by Gil.Gribb
Merging //UE4/Dev-Main@3040917 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3041235 on 2016/07/07 by Simon.Tovey
Compile fix for FName conflict on UProperty (hopefully).
Change 3041666 on 2016/07/07 by Daniel.Wright
Fixed TLM_SurfacePerPixelLighting in SM4, falls back to lighting volume
Change 3041731 on 2016/07/07 by Olaf.Piesche
Adding Niagara to dynamically loaded module list; should fix UE-32915
Change 3042181 on 2016/07/07 by Daniel.Wright
CIS fix
[CL 3045471 by Gil Gribb in Main branch]
2016-07-11 18:51:20 -04:00
|
|
|
#include "NiagaraNodeFunctionCall.h"
|
|
|
|
|
#include "NiagaraNodeInput.h"
|
|
|
|
|
#include "NiagaraNodeOutput.h"
|
|
|
|
|
|
|
|
|
|
#include "EdGraphSchema_Niagara.h"
|
2014-10-16 03:41:17 -04:00
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "NiagaraCompiler"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
DEFINE_LOG_CATEGORY_STATIC(LogNiagaraCompiler, All, All);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
void FNiagaraEditorModule::CompileScript(UNiagaraScript* ScriptToCompile)
|
|
|
|
|
{
|
|
|
|
|
check(ScriptToCompile != NULL);
|
|
|
|
|
if (ScriptToCompile->Source == NULL)
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogNiagaraCompiler, Error, TEXT("No source for Niagara script: %s"), *ScriptToCompile->GetPathName());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TComponentReregisterContext<UNiagaraComponent> ComponentReregisterContext;
|
|
|
|
|
|
2014-10-16 03:41:17 -04:00
|
|
|
FNiagaraCompiler_VectorVM Compiler;
|
|
|
|
|
Compiler.CompileScript(ScriptToCompile);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-10-16 03:41:17 -04:00
|
|
|
//Compile for compute here too?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/** Expression that gets an input attribute. */
|
|
|
|
|
class FNiagaraExpression_GetAttribute : public FNiagaraExpression
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
FNiagaraExpression_GetAttribute(class FNiagaraCompiler* InCompiler, const FNiagaraVariableInfo& InAttribute)
|
|
|
|
|
: FNiagaraExpression(InCompiler, InAttribute)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
ResultLocation = ENiagaraExpressionResultLocation::InputData;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
virtual bool Process()override
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
check(ResultLocation == ENiagaraExpressionResultLocation::InputData);
|
2015-01-14 15:48:20 -05:00
|
|
|
ResultIndex = Compiler->GetAttributeIndex(Result);
|
2015-08-20 08:49:28 -04:00
|
|
|
return true;
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Expression that gets a constant. */
|
|
|
|
|
class FNiagaraExpression_GetConstant : public FNiagaraExpression
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
FNiagaraExpression_GetConstant(class FNiagaraCompiler* InCompiler, const FNiagaraVariableInfo& InConstant, bool bIsInternal)
|
|
|
|
|
: FNiagaraExpression(InCompiler, InConstant)
|
2014-10-16 03:41:17 -04:00
|
|
|
, bInternal(bIsInternal)
|
|
|
|
|
{
|
|
|
|
|
ResultLocation = ENiagaraExpressionResultLocation::Constants;
|
|
|
|
|
//For matrix constants we must add 4 input expressions that will be filled in as the constant is processed.
|
|
|
|
|
//They must at least exist now so that other expressions can reference them.
|
2015-01-14 15:48:20 -05:00
|
|
|
if (Result.Type == ENiagaraDataType::Matrix)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
static const FName ResultName(TEXT("MatrixComponent"));
|
|
|
|
|
SourceExpressions.Add(MakeShareable(new FNiagaraExpression(InCompiler, FNiagaraVariableInfo(ResultName, ENiagaraDataType::Vector))));
|
|
|
|
|
SourceExpressions.Add(MakeShareable(new FNiagaraExpression(InCompiler, FNiagaraVariableInfo(ResultName, ENiagaraDataType::Vector))));
|
|
|
|
|
SourceExpressions.Add(MakeShareable(new FNiagaraExpression(InCompiler, FNiagaraVariableInfo(ResultName, ENiagaraDataType::Vector))));
|
|
|
|
|
SourceExpressions.Add(MakeShareable(new FNiagaraExpression(InCompiler, FNiagaraVariableInfo(ResultName, ENiagaraDataType::Vector))));
|
2015-01-08 11:49:58 -05:00
|
|
|
}
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
virtual bool Process()override
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
check(ResultLocation == ENiagaraExpressionResultLocation::Constants);
|
|
|
|
|
//Get the index of the constant. Also gets a component index if this is for a packed scalar constant.
|
2015-08-20 08:49:28 -04:00
|
|
|
Compiler->GetConstantResultIndex(Result, bInternal, ResultIndex);
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
if (Result.Type == ENiagaraDataType::Matrix)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
check(SourceExpressions.Num() == 4);
|
|
|
|
|
TNiagaraExprPtr Src0 = GetSourceExpression(0);
|
|
|
|
|
TNiagaraExprPtr Src1 = GetSourceExpression(1);
|
|
|
|
|
TNiagaraExprPtr Src2 = GetSourceExpression(2);
|
|
|
|
|
TNiagaraExprPtr Src3 = GetSourceExpression(3);
|
|
|
|
|
Src0->ResultLocation = ENiagaraExpressionResultLocation::Constants;
|
|
|
|
|
Src0->ResultIndex = ResultIndex;
|
|
|
|
|
Src1->ResultLocation = ENiagaraExpressionResultLocation::Constants;
|
|
|
|
|
Src1->ResultIndex = ResultIndex + 1;
|
|
|
|
|
Src2->ResultLocation = ENiagaraExpressionResultLocation::Constants;
|
|
|
|
|
Src2->ResultIndex = ResultIndex + 2;
|
|
|
|
|
Src3->ResultLocation = ENiagaraExpressionResultLocation::Constants;
|
|
|
|
|
Src3->ResultIndex = ResultIndex + 3;
|
|
|
|
|
}
|
2015-08-20 08:49:28 -04:00
|
|
|
|
|
|
|
|
return true;
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bInternal;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Expression that just collects some other expressions together. E.g for a matrix. */
|
|
|
|
|
class FNiagaraExpression_Collection : public FNiagaraExpression
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
FNiagaraExpression_Collection(class FNiagaraCompiler* InCompiler, const FNiagaraVariableInfo& Result, TArray<TNiagaraExprPtr>& InSourceExpressions)
|
|
|
|
|
: FNiagaraExpression(InCompiler, Result)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
SourceExpressions = InSourceExpressions;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2015-05-15 07:50:13 -04:00
|
|
|
bool FNiagaraCompiler::CheckInputs(FName OpName, TArray<TNiagaraExprPtr>& Inputs)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
//check the types of the input expressions.
|
|
|
|
|
const FNiagaraOpInfo* OpInfo = FNiagaraOpInfo::GetOpInfo(OpName);
|
|
|
|
|
check(OpInfo);
|
|
|
|
|
int32 NumInputs = Inputs.Num();
|
|
|
|
|
check(OpInfo->Inputs.Num() == NumInputs);
|
2015-05-15 07:50:13 -04:00
|
|
|
bool bError = false;
|
2014-10-16 03:41:17 -04:00
|
|
|
for (int32 i = 0; i < NumInputs ; ++i)
|
|
|
|
|
{
|
2015-05-15 07:50:13 -04:00
|
|
|
check(Inputs[i].IsValid());
|
2015-01-14 15:48:20 -05:00
|
|
|
if (OpInfo->Inputs[i].DataType != Inputs[i]->Result.Type)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-05-15 07:50:13 -04:00
|
|
|
bError = true;
|
|
|
|
|
FText ErrorText = FText::Format(LOCTEXT("Expression {0} has incorrect inputs!\nExpected: {1} - Actual: {2}", ""),
|
|
|
|
|
FText::FromString(OpName.ToString()),
|
|
|
|
|
FText::AsNumber((int32)OpInfo->Inputs[i].DataType),
|
|
|
|
|
FText::AsNumber((int32)((TNiagaraExprPtr)Inputs[i])->Result.Type.GetValue()));
|
|
|
|
|
MessageLog.Error(*ErrorText.ToString());
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-05-15 07:50:13 -04:00
|
|
|
return bError;
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-05-15 07:50:13 -04:00
|
|
|
bool FNiagaraCompiler::CheckOutputs(FName OpName, TArray<TNiagaraExprPtr>& Outputs)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
//check the types of the input expressions.
|
|
|
|
|
const FNiagaraOpInfo* OpInfo = FNiagaraOpInfo::GetOpInfo(OpName);
|
|
|
|
|
check(OpInfo);
|
|
|
|
|
int32 NumOutputs = Outputs.Num();
|
2015-05-15 07:50:13 -04:00
|
|
|
bool bError = false;
|
2014-10-16 03:41:17 -04:00
|
|
|
check(OpInfo->Outputs.Num() == NumOutputs);
|
|
|
|
|
for (int32 i = 0; i < NumOutputs; ++i)
|
|
|
|
|
{
|
2015-05-15 07:50:13 -04:00
|
|
|
check(Outputs[i].IsValid());
|
2015-01-14 15:48:20 -05:00
|
|
|
if (OpInfo->Outputs[i].DataType != Outputs[i]->Result.Type)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-05-15 07:50:13 -04:00
|
|
|
bError = true;
|
|
|
|
|
FText ErrorText = FText::Format(LOCTEXT("Expression {0} has incorrect inputs!\nExpected: {1} - Actual: {2}", ""),
|
|
|
|
|
FText::FromString(OpName.ToString()),
|
|
|
|
|
FText::AsNumber((int32)OpInfo->Outputs[i].DataType),
|
|
|
|
|
FText::AsNumber((int32)((TNiagaraExprPtr)Outputs[i])->Result.Type.GetValue()));
|
|
|
|
|
MessageLog.Error(*ErrorText.ToString());
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-05-15 07:50:13 -04:00
|
|
|
return bError;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FNiagaraCompiler::Error(FText ErrorText, UNiagaraNode* Node, UEdGraphPin* Pin)
|
|
|
|
|
{
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3054480)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3045482 on 2016/07/11 by Zabir.Hoque
DX12 Quries need to individually track their syncpoints. Only when resolving a query on the same frame should be stall.
Change 3045929 on 2016/07/12 by Simon.Tovey
Removing some deprecated node types from Niagara
Change 3045951 on 2016/07/12 by Ben.Woodhouse
D3D11 Log detailed live device info on shutdown if the debug layer is enabled (including resource types)
Change 3046019 on 2016/07/12 by Chris.Bunner
Fixed typo in material input name.
#jira UE-5575
Change 3046053 on 2016/07/12 by Rolando.Caloca
DR - Fix GL4 shutdown
#jira UE-32799
Change 3046055 on 2016/07/12 by Rolando.Caloca
DR - vk - Fix NumInstances=0
Change 3046063 on 2016/07/12 by Rolando.Caloca
DR - vk - Added flat to uint layouts per glslang
- Fix bad extension on dumped shaders
Change 3046067 on 2016/07/12 by Rolando.Caloca
DR - vk - Fix check when not using color RT
- Added queue submit & present counters
Change 3046088 on 2016/07/12 by Ben.Woodhouse
Live GPU stats
A non-hierarchical realtime high level GPU profiler with support for cumulative stat recording.
Stats are added with SCOPED_GPU_STAT macros, e.g. SCOPED_GPU_STAT(RHICmdList, Stat_GPU_Distortion)
The bulk of the files in this change are simply instrumentation for the renderer. The core changes are in SceneUtils.cpp/h and D3D11Query.cpp (this is the XB1/DX11X implementation of timestamp RHI queries, which was missing)
Note: this is currently disabled by default. Enable with the cvar r.gpustatsenabled
Tested on PC, XB1, PS4
Change 3046128 on 2016/07/12 by Olaf.Piesche
Max draw distance and fade range for lights, requested by JonL
Change 3046183 on 2016/07/12 by Ben.Woodhouse
PR #2532: Fix SSAO being applied in unlit viewmode (Contributed by nick-penwarden)
Change 3046223 on 2016/07/12 by Luke.Thatcher
Fix Scene Cube Captures. SceneCaptureSource flag on the ViewFamily was not set for cube components.
#jira UE-32345
Change 3046228 on 2016/07/12 by Marc.Olano
Add Voronoi noise to Noise material node.
Four versions with differing speed/quality levels accessed through the Quality value in the material node. Tooltips give estimates of the cost of each.
Also includes spiffy new Rand3DPCG16 and Rand3DPCG32 int3 to int3 hash functions, and a 20% improvement on the computed gradient noise.
Change 3046269 on 2016/07/12 by Rolando.Caloca
DR - Skip flush on RHIDiscardRenderTargets and only use it on platforms that need it (ie OpenGL)
Change 3046294 on 2016/07/12 by Rolando.Caloca
DR - Fix static analyisis
warning C6326: Potential comparison of a constant with another constant.
Change 3046295 on 2016/07/12 by Rolando.Caloca
DR - Fix the previous fix
Change 3046731 on 2016/07/12 by Marc.Olano
Fix typo in shader random number constant: repeated extra digit made it too big.
Change 3046796 on 2016/07/12 by Uriel.Doyon
The texture streaming manager now keeps a set of all valid textures.
This is used to prevent from indirecting deleted memory upon SetTexturesRemovedTimestamp.
#jira UE-33048
Change 3046800 on 2016/07/12 by Rolando.Caloca
DR - vk - Added create image & renderpass dump
Change 3046845 on 2016/07/12 by John.Billon
Forgot to apply MaxGPUSkinBones Cvar access changes in a few locations.
Change 3047023 on 2016/07/12 by Olaf.Piesche
Niagara:
-a bit of cleanup
-now store and double buffer attributes individually, eliminating unnecessary copy of unused attributes
-removed FNiagaraConstantMap, replaced with an instance of FNiagaraConstants
-some code simplification
-removed some deprecated structs and code used only by old content
Change 3047052 on 2016/07/12 by Zabir.Hoque
Unshelved from pending changelist '3044062':
PR #2588: Adding blend mode BLEND_AlphaComposite (4.12) (Contributed by moritz-wundke)
Change 3047727 on 2016/07/13 by Luke.Thatcher
Fix Scene Capture Components only updating every other frame.
#jira UE-32581
Change 3047919 on 2016/07/13 by Olaf.Piesche
CMask decode, use in deferred decals, for PS4
Change 3047921 on 2016/07/13 by Uriel.Doyon
"Build Texture Streaming" will now remove duplicate error msg when computing texcoord scales.
Also, several texture messages are packed on the same line if they relate to the same material.
Change 3047952 on 2016/07/13 by Rolando.Caloca
DR - vk - Initial prep pass for separating combined images & samplers
Change 3048648 on 2016/07/13 by Marcus.Wassmer
Fix rare GPU hang when asynctexture reallocs would overlap with EndFrame
Change 3049058 on 2016/07/13 by Rolando.Caloca
DR - vk - timestamps
Change 3049725 on 2016/07/14 by Marcus.Wassmer
Fix autosdk bug where not having a platform directory sync'd at all would break manual SDK detection
Change 3049742 on 2016/07/14 by Rolando.Caloca
DR - Fix warning
Change 3049902 on 2016/07/14 by Rolando.Caloca
DR - Fix typo
Change 3050345 on 2016/07/14 by Olaf.Piesche
UE-23925
Clamping noise tessellation for beams at a high but sensible value; also making sure during beam index buffer building that we never get over 2^16 indices; this is a bit hokey, but there are so many variables that can influence triangle/index count, that this is the only way to be sure (short of nuking the entire site from orbit).
Change 3050409 on 2016/07/14 by Olaf.Piesche
Replicating 3049049; missing break and check for active particles when resolving a source point to avoid a potential crash
Change 3050809 on 2016/07/14 by Rolando.Caloca
DR - vk - Remove redundant validation layers
Change 3051319 on 2016/07/15 by Ben.Woodhouse
Fix for world space camera position not being exposed in decal pixel shaders; also fixes decal lighting missing spec and reflection
The fix was to calculate ResolvedView at the top of the shader. Previously this was not initialized
#jira UE-31976
Change 3051692 on 2016/07/15 by Rolando.Caloca
DR - vk - Enable RHI thread by default
Change 3052103 on 2016/07/15 by Uriel.Doyon
Disabled depth offset in depth only pixel shaders when using debug view shaders (to prevent Z fighting).
#jira UE-32765
Change 3052140 on 2016/07/15 by Rolando.Caloca
DR - vk - Fix shader snafu
Change 3052495 on 2016/07/15 by Rolando.Caloca
DR - Fix for Win32 compile
#jira UE-33349
Change 3052536 on 2016/07/15 by Uriel.Doyon
Fixed texture streaming overbudget warning when using per texture bias.
[CL 3054554 by Gil Gribb in Main branch]
2016-07-18 17:17:08 -04:00
|
|
|
if (Pin)
|
|
|
|
|
{
|
|
|
|
|
FString ErrorString = FString::Printf(TEXT("Node: @@ - Pin: @@ - %s"), *ErrorText.ToString());
|
|
|
|
|
MessageLog.Error(*ErrorString, Node, Pin);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FString ErrorString = FString::Printf(TEXT("Node: @@ - %s"), *ErrorText.ToString());
|
|
|
|
|
MessageLog.Error(*ErrorString, Node);
|
|
|
|
|
}
|
2015-05-15 07:50:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FNiagaraCompiler::Warning(FText WarningText, UNiagaraNode* Node, UEdGraphPin* Pin)
|
|
|
|
|
{
|
|
|
|
|
FString WarnString = FString::Printf(TEXT("Node: @@ - Pin: @@ - %s"), *WarningText.ToString());
|
|
|
|
|
MessageLog.Warning(*WarnString, Node, Pin);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
int32 FNiagaraCompiler::GetAttributeIndex(const FNiagaraVariableInfo& Attr)const
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
return SourceGraph->GetAttributeIndex(Attr);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
FNiagaraDataSetProperties* FNiagaraCompiler::GetSharedDataIndex(FNiagaraDataSetID DataSet, bool bForRead, int32& OutIndex)
|
|
|
|
|
{
|
|
|
|
|
//Shared data is laid out:
|
|
|
|
|
//EventReceivers
|
|
|
|
|
//EventGenerators
|
|
|
|
|
|
|
|
|
|
int32 SetIndex = 0;
|
|
|
|
|
FNiagaraDataSetProperties* Ret = NULL;
|
|
|
|
|
auto SearchSharedArea = [&](TArray<FNiagaraDataSetProperties>& SharedSetGroup) -> FNiagaraDataSetProperties*
|
|
|
|
|
{
|
|
|
|
|
for (FNiagaraDataSetProperties& Props : SharedSetGroup)
|
|
|
|
|
{
|
|
|
|
|
if (DataSet == Props.ID)
|
|
|
|
|
{
|
|
|
|
|
OutIndex = SetIndex;
|
|
|
|
|
return &Props;
|
|
|
|
|
}
|
|
|
|
|
++SetIndex;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (bForRead)
|
|
|
|
|
{
|
|
|
|
|
Ret = SearchSharedArea(EventReceivers);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetIndex = EventReceivers.Num();
|
|
|
|
|
Ret = SearchSharedArea(EventGenerators);
|
|
|
|
|
}
|
|
|
|
|
check(Ret);
|
|
|
|
|
return Ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int32 FNiagaraCompiler::GetSharedDataVariableIndex(FNiagaraDataSetProperties* SharedDataSet, const FNiagaraVariableInfo& Variable)
|
|
|
|
|
{
|
|
|
|
|
check(SharedDataSet);
|
|
|
|
|
|
|
|
|
|
for (int32 i = 0; i < SharedDataSet->Variables.Num(); ++i)
|
|
|
|
|
{
|
|
|
|
|
if (SharedDataSet->Variables[i] == Variable)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return INDEX_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-16 03:41:17 -04:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::CompileOutputPin(UEdGraphPin* Pin)
|
|
|
|
|
{
|
|
|
|
|
check(Pin->Direction == EGPD_Output);
|
|
|
|
|
|
|
|
|
|
TNiagaraExprPtr Ret;
|
|
|
|
|
|
|
|
|
|
TNiagaraExprPtr* Expr = PinToExpression.Find(Pin);
|
|
|
|
|
if (Expr)
|
|
|
|
|
{
|
|
|
|
|
Ret = *Expr; //We've compiled this pin before. Return it's expression.
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//Otherwise we need to compile the node to get its output pins.
|
|
|
|
|
UNiagaraNode* Node = Cast<UNiagaraNode>(Pin->GetOwningNode());
|
|
|
|
|
TArray<FNiagaraNodeResult> Outputs;
|
|
|
|
|
Node->Compile(this, Outputs);
|
2015-08-20 08:49:28 -04:00
|
|
|
for (int32 i = 0; i < Outputs.Num(); ++i)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
PinToExpression.Add(Outputs[i].OutputPin, Outputs[i].Expression);
|
|
|
|
|
//We also grab the expression for the pin we're currently interested in. Otherwise we'd have to search the map for it.
|
|
|
|
|
Ret = Outputs[i].OutputPin == Pin ? Outputs[i].Expression : Ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::CompilePin(UEdGraphPin* Pin)
|
|
|
|
|
{
|
|
|
|
|
check(Pin);
|
|
|
|
|
TNiagaraExprPtr Ret;
|
|
|
|
|
if (Pin->Direction == EGPD_Input)
|
|
|
|
|
{
|
|
|
|
|
if (Pin->LinkedTo.Num() > 0)
|
|
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
//If we link to a function call, merge it's graph in.
|
|
|
|
|
TArray<UNiagaraScript*> Stack;
|
|
|
|
|
UNiagaraNodeFunctionCall* Function = Cast<UNiagaraNodeFunctionCall>(Pin->LinkedTo[0]->GetOwningNode());
|
|
|
|
|
while(Function)
|
|
|
|
|
{
|
|
|
|
|
if (!MergeFunctionIntoMainGraph(Function, Stack))
|
|
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Function = Cast<UNiagaraNodeFunctionCall>(Pin->LinkedTo[0]->GetOwningNode());
|
|
|
|
|
}
|
|
|
|
|
//Any functon calls linked to this pin are now merged into the main graph, compile it.
|
2014-10-16 03:41:17 -04:00
|
|
|
Ret = CompileOutputPin(Pin->LinkedTo[0]);
|
|
|
|
|
}
|
|
|
|
|
else if (!Pin->bDefaultValueIsIgnored)
|
|
|
|
|
{
|
|
|
|
|
//No connections to this input so add the default as a const expression.
|
|
|
|
|
const UEdGraphSchema_Niagara* Schema = Cast<const UEdGraphSchema_Niagara>(Pin->GetSchema());
|
Copying //UE4/Dev-Rendering to //UE4/Dev-Main (Source: //UE4/Dev-Rendering @ 3045398)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3028958 on 2016/06/27 by Ben.Woodhouse
Fix for perf issue with GetSingleFinalDataConst
This was caused by the LPV integration/switch to blendables. Now we cache the flag for the directionalocclusion in the LPV class. This reduces calls to GetSingleFinalDataConst on the blendable data (potentially slow), and makes things a bit cleaner and consistent.
Tested in QAGame editor (with LPV enabled in ConsoleSettings.ini)
#jira UE-26179
Change 3029401 on 2016/06/27 by Rolando.Caloca
DR - More vk logging
Change 3029549 on 2016/06/27 by Uriel.Doyon
Refactored "r.OnlyStreamInTextures" into "r.Streaming.FullyLoadUsedTextures", making it fully load every used textures, as an alternative to disabling texture streaming.
New options "r.Streaming.UsePerTextureBias" that assign a bias between 0 and MipBias to each texture in order to fit in budget.
Fixed crash when disabling texture streaming.
Fixed issue when disabling texture streaming that would make current loaded texture low res.
New logic to prevent retrying to cancel a streaming request more than once.
Pending load request of one extra mip will not be cancelled anymore.
Changed UTexture2D from float to double. Also using FApp::GetCurrentTime() instead of FPlatformTime::Seconds().
#jira UE-32197
#jira UE-31102
Change 3029837 on 2016/06/27 by David.Hill
Fixed Shutter SM4 not working when using compute shader eye-adaptation
#jira UE-32443
The default eye adaptation value was missing.
Change 3030039 on 2016/06/27 by Uriel.Doyon
Fix for crash when landscape materials are used in the Texture Streaming Build.
#jira UE-32196
Change 3030081 on 2016/06/27 by Uriel.Doyon
Updated MaterialTexCoordScalesPixelShader to use PackedEyeIndex, preventing crash when building the map with stereo rendering enabled.
Change 3030401 on 2016/06/28 by Ben.Woodhouse
Perf Monitor: Fix for perf warning due to cvar FindConsoleVariable being called too frequently. Tested in QAGame editor (DX11)
#jira UE-31238
Change 3030607 on 2016/06/28 by Marc.Olano
Random Number generators: fixed bug in TEA, added integer and float Blum-Blum-Shub. BBS is way cheaper for similar quality, suggest it for future use.
Change 3030627 on 2016/06/28 by Ben.Woodhouse
Fix for warning. CVar naming scope clash (doesn't appear to happen in vs2015).
Change 3030809 on 2016/06/28 by Marc.Olano
Noise shader function rename & perf improvement.
Due to incorrect terminology in internet soruces, previous "Perlin" noise was not, in fact, Perlin noise. Now more accurately called "Value" noise. 6x perf improvement for value noise by changing random number function to BBS. Also updated instruction counts in UI tooltips.
Change 3030850 on 2016/06/28 by Marc.Olano
Rename & redirect noise material enums. At some point these got switched around and no longer accurately described the noise options the selected. Redirect, so all existing content will continue to work as-is. Updated UDN docs to match.
Change 3030981 on 2016/06/28 by Rolando.Caloca
DR - vk - More logging
Change 3031056 on 2016/06/28 by Marc.Olano
Introduce new pure-ALU gradient shader noise. Add noise samples to RenderTest map
Change 3031398 on 2016/06/28 by Benjamin.Hyder
updating TM-Shadermodels (correcting Mt Rushmore)
Change 3031441 on 2016/06/28 by Marc.Olano
Use only float version of BBS shader rand function for ES2
Change 3031463 on 2016/06/28 by John.Billon
Fixed F4 changing the viewmode in Fortnite editor. The detailed lighting viewmode (detaillighting) named in DefaultInput.ini differed from the one in BaseInput.ini(lit_detaillighting).
#Jira UE-32020
Change 3031512 on 2016/06/28 by Zabir.Hoque
Relax clear flags for DX12 RHIs.
Properly flush pending commands before residency is updated.
Change 3031517 on 2016/06/28 by Rolando.Caloca
DR - vk logging using r.Vulkan.DumpLayer
Change 3032359 on 2016/06/29 by Allan.Bentham
Fix mobile shadows crash.
Change 3032431 on 2016/06/29 by Gil.Gribb
Merging //UE4/Dev-Main@3032394 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3032757 on 2016/06/29 by Uriel.Doyon
Fixed global mip bias being applied twice following integration with main.
Change 3033121 on 2016/06/29 by Rolando.Caloca
DR - vk - Logging
Change 3033529 on 2016/06/29 by Daniel.Wright
Null world guard on UReflectionCaptureComponent::ReadbackFromGPU
Change 3033668 on 2016/06/29 by Uriel.Doyon
Grouped texture streaming settings to simplify logic.
New options "r.Streaming.UseAllMips" to ignores the different lod and cinematic bias
#jira UE-32118
Change 3034403 on 2016/06/30 by Rolando.Caloca
DR - Shorten dumped shader debug strings
Change 3034475 on 2016/06/30 by Rolando.Caloca
DR - Missing logging
Change 3034722 on 2016/06/30 by Uriel.Doyon
Improved StreamingAccuracy viewmodes with alpha test and translucent materials
#jira UE-32656
Change 3034797 on 2016/06/30 by Rolando.Caloca
DR - vk - 'fix' RHIClear but causes a CPU hang on AMD, so disabled again
Change 3034799 on 2016/06/30 by Rolando.Caloca
DR - vk - missed file
Change 3034905 on 2016/06/30 by Rolando.Caloca
DR - vk - Fix for render passes being reused with wrong dimensions
Change 3035503 on 2016/07/01 by Simon.Tovey
Async compute version of translucency lighting volume clear.
Change 3035577 on 2016/07/01 by Marc.Olano
Tiling noise. Adds tiling option for gradient, gradient texture, and value noise in the noise material node. Tiling is more expensive, but allows noise functions to be baked into a seamless repeating texture.
Change 3035587 on 2016/07/01 by Ben.Woodhouse
Fix for async SSAO bug (SSAO Async Compute results are used before the async job wait)
#jira UE-32709
Change 3035618 on 2016/07/01 by Olaf.Piesche
Asset fixes
Change 3035692 on 2016/07/01 by Rolando.Caloca
DR - vk - Deferred deletion queue
Change 3035808 on 2016/07/01 by Rolando.Caloca
DR - vk - Stat for deletion time, fixed some logging
Change 3036012 on 2016/07/01 by John.Billon
Alpha Coverage Preservation
-Textures have a Alpha Preservation Vec4 property which dictates about much of that channel to preserve down the mip chain during mip generation.
#Jira UE-31986
Change 3036041 on 2016/07/01 by Rolando.Caloca
DR - vk - Fix for 32bit
Change 3036433 on 2016/07/01 by Rolando.Caloca
DR - More vk logging
Change 3036935 on 2016/07/04 by Simon.Tovey
Removing Data Objects
Change 3036942 on 2016/07/04 by Ben.Woodhouse
Fix for decal rendering resource leak
The cause was that FD3D11BoundRenderTargets doesn't support setting RTs sparsely. So if one element is NULL, it won't release the ones after it.
The sparse RT layout happened as a result of a change back in October, which meant that GBuffers for decals could be set sparsely, dependent on whether the decal wrote to the normalbuffer
This change adds support for sparsely bound rendertargets in FD3D11BoundRenderTargets.
#jira UE-32602
Change 3037563 on 2016/07/05 by Chris.Bunner
HLOD self-shadowing in baked lighting fix.
Change 3037640 on 2016/07/05 by Marcus.Wassmer
Fix bug in USE_GPU_OVERWRITE_CHECKING
Change 3037927 on 2016/07/05 by Rolando.Caloca
DR - Fix touch pads not showing on Vulkan
#jira UE-32062
Change 3038085 on 2016/07/05 by Chris.Bunner
HLOD dynamic shadowing support.
#jira UE-22627
Change 3038209 on 2016/07/05 by Rolando.Caloca
DR - vk - Android compile fix
Change 3038644 on 2016/07/05 by Uriel.Doyon
Added LerpRange that allows to lerp between two rotators without taking the sortest path.
Change 3038820 on 2016/07/05 by Uriel.Doyon
Selecting streaming accuracy view modes will not automatically generate missing visualization data.
Change 3039332 on 2016/07/06 by John.Billon
-Made MaxGPUSkinBonesCvar a FAutoConsoleVariableRef and moved it to mesh utilitles from console manager to fix a thread initialization problem.
#Jira UE-31710
Change 3039454 on 2016/07/06 by Simon.Tovey
Moved all Niagara files from Engine and UnrealEd to remove dependancies and increase compile times.
Niagara is now 99.999% decoupled from engine and editor so development should be much streamlined.
Plus a few other edits to remove Curves/DataObjects that I missed in last CL.
Change 3039517 on 2016/07/06 by Gil.Gribb
Merging //UE4/Dev-Main@3039013 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3039587 on 2016/07/06 by Rolando.Caloca
DR - vk logging, submit counter
Change 3039603 on 2016/07/06 by Rolando.Caloca
DR - Allow more samplers on GL4
#jira UE-32628
#jira UE-32744
Change 3039661 on 2016/07/06 by Daniel.Wright
Fixed non-directional DFAO occlusion on specular 'r.AOSpecularOcclusionMode 0'
Skylight occlusion tint now applies to specular
Skylight occlusion tint on diffuse is now correctly affected by DiffuseColor
Change 3039960 on 2016/07/06 by Daniel.Wright
Forward renderer initial implementation
* Point and spot lights are culled to a frustum space grid, base pass loops over culled lights.
* Light culling uses a reverse linked list to avoid a per-cell limit, and the linked list is compacted to an array before the base pass.
* New cvars to control light culling: r.Forward.MaxCulledLightsPerCell, r.Forward.LightGridSizeZ, r.Forward.LightGridPixelSize
* A full Z Prepass is forced with forward shading. This allows deferred rendering before the base pass of shadow projection methods that only rely on depth.
* Dynamic shadows are packed based on the assigned stationary light ShadowMapChannel, since stationary lights are already restricted to 4 overlapping.
* GBuffer render targets are still allocated
* Fixed several issues in parallax corrected base pass reflections - not blending out box shape, discontinuity in reflection vector, not blending with stationary skylight properly
* Forward shading is now used for TLM_SurfacePerPixelLighting translucency in the deferred path
* Notable missing features: shadowing of translucency, support for various translucency lighting modes, multiple blended reflection captures
Change 3040050 on 2016/07/06 by Daniel.Wright
Added r.Shadow.WholeSceneShadowCacheMb, which defaults to 150, to limit how much memory can be spent caching whole scene shadowmaps
Change 3040160 on 2016/07/06 by Daniel.Wright
Fixed tile artifacts in indirect capsule shadows from doing the scaled sphere vs tile bounding sphere intersection in the wrong space
Change 3040163 on 2016/07/06 by Rolando.Caloca
DR - vk - More logging
Change 3040257 on 2016/07/06 by Daniel.Wright
Skylights aren't captured until their level is made visible- fixes the case where skylights capture too early
Change 3040316 on 2016/07/06 by Daniel.Wright
PerObject shadows from point / spot lights do the light source pull back based on subject box size, not subject radius, since the box is used to find a valid < 90 degree projection. Fix from licensee
Change 3040361 on 2016/07/06 by Daniel.Wright
Fixed TexCreate_UAV being used on translucency volume textures in SM4
Change 3040402 on 2016/07/06 by Rolando.Caloca
DR - vk - Make host mem accesses coherent
Change 3040486 on 2016/07/06 by Daniel.Wright
CIS fixes
Change 3041028 on 2016/07/07 by Gil.Gribb
Merging //UE4/Dev-Main@3040917 to Dev-Rendering (//UE4/Dev-Rendering)
Change 3041235 on 2016/07/07 by Simon.Tovey
Compile fix for FName conflict on UProperty (hopefully).
Change 3041666 on 2016/07/07 by Daniel.Wright
Fixed TLM_SurfacePerPixelLighting in SM4, falls back to lighting volume
Change 3041731 on 2016/07/07 by Olaf.Piesche
Adding Niagara to dynamically loaded module list; should fix UE-32915
Change 3042181 on 2016/07/07 by Daniel.Wright
CIS fix
[CL 3045471 by Gil Gribb in Main branch]
2016-07-11 18:51:20 -04:00
|
|
|
ENiagaraDataType PinType = Schema->GetPinDataType(Pin);
|
2014-10-16 03:41:17 -04:00
|
|
|
|
|
|
|
|
FString ConstString = Pin->GetDefaultAsString();
|
|
|
|
|
FName ConstName(*ConstString);
|
2015-01-14 15:48:20 -05:00
|
|
|
|
|
|
|
|
FNiagaraVariableInfo Var(ConstName, PinType);
|
|
|
|
|
|
|
|
|
|
switch (PinType)
|
|
|
|
|
{
|
|
|
|
|
case ENiagaraDataType::Scalar:
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
float Default;
|
|
|
|
|
Schema->GetPinDefaultValue(Pin, Default);
|
2015-01-14 15:48:20 -05:00
|
|
|
ConstantData.SetOrAddInternal(Var, Default);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
2015-01-14 15:48:20 -05:00
|
|
|
break;
|
|
|
|
|
case ENiagaraDataType::Vector:
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
FVector4 Default;
|
|
|
|
|
Schema->GetPinDefaultValue(Pin, Default);
|
2015-01-14 15:48:20 -05:00
|
|
|
ConstantData.SetOrAddInternal(Var, Default);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
2015-01-14 15:48:20 -05:00
|
|
|
break;
|
|
|
|
|
case ENiagaraDataType::Matrix:
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
|
|
|
|
FMatrix Default;
|
|
|
|
|
Schema->GetPinDefaultValue(Pin, Default);
|
2015-01-14 15:48:20 -05:00
|
|
|
ConstantData.SetOrAddInternal(Var, Default);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
2015-01-14 15:48:20 -05:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Ret = Expression_GetInternalConstant(Var);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Ret = CompileOutputPin(Pin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Ret;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
void FNiagaraCompiler::GetParticleAttributes(TArray<FNiagaraVariableInfo>& OutAttributes)const
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
check(SourceGraph);
|
|
|
|
|
SourceGraph->GetAttributes(OutAttributes);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::Expression_GetAttribute(const FNiagaraVariableInfo& Attribute)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
Usage.bReadsAttriubteData = true;
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
int32 Index = Expressions.Add(MakeShareable(new FNiagaraExpression_GetAttribute(this, Attribute)));
|
2014-10-16 03:41:17 -04:00
|
|
|
return Expressions[Index];
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::Expression_GetExternalConstant(const FNiagaraVariableInfo& Constant)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
int32 Index = Expressions.Add(MakeShareable(new FNiagaraExpression_GetConstant(this, Constant, false)));
|
2014-10-16 03:41:17 -04:00
|
|
|
return Expressions[Index];
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::Expression_GetInternalConstant(const FNiagaraVariableInfo& Constant)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
int32 Index = Expressions.Add(MakeShareable(new FNiagaraExpression_GetConstant(this, Constant, true)));
|
2014-10-16 03:41:17 -04:00
|
|
|
return Expressions[Index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::Expression_Collection(TArray<TNiagaraExprPtr>& SourceExpressions)
|
|
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
//Todo - Collection expressions are just to collect parts of a matrix currently. Its a crappy way to do things that should be replaced.
|
|
|
|
|
//Definitely don't start using it for collections of other things.
|
|
|
|
|
int32 Index = Expressions.Add(MakeShareable(new FNiagaraExpression_Collection(this, FNiagaraVariableInfo(NAME_None, ENiagaraDataType::Vector), SourceExpressions)));
|
2014-10-16 03:41:17 -04:00
|
|
|
return Expressions[Index];
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetAttribute(const FNiagaraVariableInfo& Attribute)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
return Expression_GetAttribute(Attribute);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
|
|
|
|
|
2015-01-14 15:48:20 -05:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetExternalConstant(const FNiagaraVariableInfo& Constant, float Default)
|
2014-10-16 03:41:17 -04:00
|
|
|
{
|
2015-01-14 15:48:20 -05:00
|
|
|
SetOrAddConstant(false, Constant, Default);
|
|
|
|
|
return Expression_GetExternalConstant(Constant);
|
|
|
|
|
}
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetExternalConstant(const FNiagaraVariableInfo& Constant, const FVector4& Default)
|
|
|
|
|
{
|
|
|
|
|
SetOrAddConstant(false, Constant, Default);
|
|
|
|
|
return Expression_GetExternalConstant(Constant);
|
|
|
|
|
}
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetExternalConstant(const FNiagaraVariableInfo& Constant, const FMatrix& Default)
|
|
|
|
|
{
|
|
|
|
|
SetOrAddConstant(false, Constant, Default);
|
|
|
|
|
return Expression_GetExternalConstant(Constant);
|
2014-10-16 03:41:17 -04:00
|
|
|
}
|
2015-04-09 11:27:52 -04:00
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetInternalConstant(const FNiagaraVariableInfo& Constant, float Default)
|
|
|
|
|
{
|
|
|
|
|
SetOrAddConstant(true, Constant, Default);
|
|
|
|
|
return Expression_GetInternalConstant(Constant);
|
|
|
|
|
}
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetInternalConstant(const FNiagaraVariableInfo& Constant, const FVector4& Default)
|
|
|
|
|
{
|
|
|
|
|
SetOrAddConstant(true, Constant, Default);
|
|
|
|
|
return Expression_GetInternalConstant(Constant);
|
|
|
|
|
}
|
|
|
|
|
TNiagaraExprPtr FNiagaraCompiler::GetInternalConstant(const FNiagaraVariableInfo& Constant, const FMatrix& Default)
|
|
|
|
|
{
|
|
|
|
|
SetOrAddConstant(true, Constant, Default);
|
|
|
|
|
return Expression_GetInternalConstant(Constant);
|
|
|
|
|
}
|
2015-01-08 11:49:58 -05:00
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
bool FNiagaraCompiler::MergeFunctionIntoMainGraph(UNiagaraNodeFunctionCall* FunctionNode, TArray<UNiagaraScript*>& FunctionStack)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
|
|
|
|
struct FReconnectionInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
UEdGraphPin* From;
|
|
|
|
|
TArray<UEdGraphPin*> To;
|
|
|
|
|
|
|
|
|
|
//Fallback default value if an input connection is not connected.
|
|
|
|
|
FString FallbackDefault;
|
|
|
|
|
|
|
|
|
|
FReconnectionInfo()
|
|
|
|
|
: From(NULL)
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
if (UNiagaraScript* FuncScript = FunctionNode->FunctionScript)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
//Check for reentrance.
|
|
|
|
|
if (FunctionStack.Find(FuncScript) != INDEX_NONE)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
FString Callstack;
|
|
|
|
|
Callstack.Append(FuncScript->GetPathName()); Callstack.Append(TEXT("\n"));
|
|
|
|
|
for (UNiagaraScript* StackScript : FunctionStack)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
Callstack.Append(StackScript->GetPathName()); Callstack.Append(TEXT("\n"));
|
2015-04-09 11:27:52 -04:00
|
|
|
}
|
Copying //UE4/Dev-Blueprints to //UE4/Dev-Main (Source: //UE4/Dev-Blueprints @ 3025888)
#rb none
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2927746 on 2016/03/30 by Michael.Schoell
Local variables in function graphs will now store a hard reference to their UObject value.
Fixes a crash when a Blueprint is saved before compiling with the local variable's value set. Ensures that the UObject is loaded with the Blueprint.
#jira UE-27738 - Local variables in a function that is in a blueprint will somehow become invalid when calling a native
Change 2927751 on 2016/03/30 by Michael.Schoell
Back out changelist 2927746
Change 2986483 on 2016/05/23 by Maciej.Mroz
#jira UE-30976 Editable enum values set on an instance are lost during nativization
Added overriden names of Enum keys.
Change 2986712 on 2016/05/23 by Phillip.Kavan
[UE-21010] Apply updated transform to component template instances when changing the scene root in a Blueprint class.
change summary:
- modified SSCS_RowWidget::OnMakeNewRootDropAction() to propagate the location/rotation reset to instances of the component template that's becoming the new scene root.
Change 2987406 on 2016/05/23 by Ryan.Rauschkolb
Fixed Functions filter in Find-In-Blueprints will show components from the SCS
#jira UE-30140
Change 2988925 on 2016/05/24 by Ryan.Rauschkolb
Fixed Issue where certain primitives would not automatically type cast to Text in Blueprint graph.
#jira UE-20232
Change 2989001 on 2016/05/24 by Dan.Oconnor
PR #2418: Fixed a typo in Blueprint.h (Contributed by PistonMiner)
#jira UE-31142
Change 2989447 on 2016/05/25 by Phillip.Kavan
[UE-30807] Propagate edit condition property value changes to instances of template objects.
change summary:
- modified FPropertyEditor::SetEditConditionState() to propagate an EditConditionProperty value change to all instances if the outer owning object is a template (e.g. CDO)
Change 2989804 on 2016/05/25 by Phillip.Kavan
[UE-30289] Preserve relative scale on the root scene component when converting an Actor instance to a Blueprint Class.
change summary:
- modified FKismetEditorUtilities::CreateBlueprintFromActor() to post-copy the relative scale value from the Actor's root component to the new Blueprint CDO's root component
Change 2990234 on 2016/05/25 by Ryan.Rauschkolb
Fixed issue where including a period ina Blueprint function causes double-click to fail to open its graph
#jira UE-4426
Change 2990566 on 2016/05/25 by Mike.Beach
Better warn logging to help locate variable nodes that emit a "variable not found" message.
Change 2991083 on 2016/05/26 by Maciej.Mroz
Blueprint nativization: converted classes have "config" specified.
Change 2991363 on 2016/05/26 by Phillip.Kavan
[UE-19599] Copy-and-paste of Actor instances from level to Blueprint/IWCE component tree views now adds properly-initialized components.
change summary:
- modified FCustomizableTextObjectFactory::CanCreateObjectsFromText() to handle "Begin Actor/End Actor" blocks in T3D text
- modified FCustomizableTextObjectFactory::ProcessBuffer() to handle "Begin Actor/End Actor" blocks in T3D text (so that Actor-type objects can be processed)
- modified FComponentObjectTextFactory::CanCreateClass() to allow Actor-type objects to pass
- modified FComponentObjectTextFactory::ProcessConstructedObject() to handle Actor-type objects and pull out owned component instances as constructed objects
Change 2992990 on 2016/05/27 by Ryan.Rauschkolb
Fixed issue where Connecting Self Reference Pin to a String pin does not fully connect the generated GetDisplayName node
#jira UE-21973
Change 2992995 on 2016/05/27 by Ryan.Rauschkolb
Fixed issue where GetClass node is not listed in the Context Menu when pulling from a self node and Context Sensitive is checked.
#jira UE-30990
Change 2993449 on 2016/05/27 by Phillip.Kavan
[UE-31379] Don't instrument "preview" Actor instances during Blueprint profiler script event processing.
change summary:
- modified FBlueprintProfiler::InstrumentEvent() to check for and bypass Actor instances belonging to a preview or inactive world type.
Change 2993531 on 2016/05/27 by Mike.Beach
PR #2433: Interface functions inherited from a native base class now appear in . (Contributed by MichaelSchoell)
Change 2993969 on 2016/05/30 by Maciej.Mroz
UE-30729 Crash in Native Orion when selecting Sword or Tomahawk
Clear AsyncLoading in subobjects.
Change 2993990 on 2016/05/30 by Phillip.Kavan
[UE-30984] Exclude reroute nodes from Blueprint profiler node mapping.
change summary:
- modified FBlueprintFunctionContext::MapInputPins() to pass through non-relevant nodes when iterating through non-exec input pin links.
- modified FBlueprintFunctionContext::MapExecPins() to pass through non-relevant nodes when iterating through output exec pin links.
- modified FBlueprintFunctionContext::MapTunnelEntry() to pass through non-relevant nodes when iterating through tunnel node exit points.
- modified FBlueprintFunctionContext::MapTunnelInstance() to pass through non-relevant nodes when iterating through tunnel graph entry points.
Change 2994591 on 2016/05/31 by Ryan.Rauschkolb
Fixed issue where inherited Blueprint variable would not show parent's replications settings
#jira UE-18912
Change 2994613 on 2016/05/31 by Ben.Cosh
Minor refactor and Various fixes to the blueprint profiler moving towards MVP goal.
#Jira UE-27039 - Blueprint Profiler does not lists stats when calling an Event Dispatcher
#Jira UE-31396 - Blueprint profiler crashes inside the profiler connection drawing policy
#Jira UE-30957 - "Pure Time" does not populate with data in the Blueprint Profiler
#Jira UE-30926 - Blueprint profiler - expose heatmap thresholds to user through the profiler tab
#Jira UE-30909 - Blueprint Profiler - "compile" icon should denote Blueprint's instrumented status
#Jira UE-30911 - Blueprint profiler tab/panel should display warning when Blueprint is uninstrumented
#Jira UE-31385 - BP Profiler - Inclusive time column should be entirely filled out
#Jira UE-31375 - BP Profiler - Default sample averaging to the "arithmetic mean"
#Jira UE-31377 - BP Profiler - Default tree view filtering to off
#Jira UE-31387 - BP Profiler - Remove the "view type" button for MVP
#Jira UE-31384 - BP Profiler - In the tree view, rename the first time column "Avg. Time (ms)"
Notes:-
- Sequence node inclusive time fixed
- Trace History tidy up
- Compile Icon and status messages for instrumentation
- Message in the profiler tab for instrumentation
- Profiler view tidy up and heat thresholds controls added
- fixed the summed execution branch stats
- fixed the connection drawing policy to use branch pin stats and fixed the crash from UE-31396
- added hottest path and hottest endpoint wire heatmaps
- switched off the graph filter by default
- added total time for the heatmaps
- fixed issue where initialising mapped functions caused an assert due to changes to the array/map in initialisation code
Change 2995058 on 2016/05/31 by Phillip.Kavan
[UE-30718] Native/const implementable events will no longer cause a crash at runtime when the Blueprint profiler is running.
change summary:
- modified UObject::ProcessEvent() to bypass instrumentation for native event functions that are not implemented (overridden) in a BP class.
- modified FScriptEventPlayback::Process() to first check for a standalone function match (UCS, implementable events declared as 'const') before settling on the ubergraph function for the target context.
Change 2995218 on 2016/05/31 by Phillip.Kavan
[UE-30778] Restored non-K2 compact graph nodes (e.g. Material Editor) to previous size.
change summary:
- modified SGraphNode::GetNodeIndicatorOverlayVisibility() default impl to return 'Collapsed' by default, so it doesn't affect layout.
Change 2996417 on 2016/06/01 by Phillip.Kavan
[UE-16073] Basic shape components (cube etc.) will now apply the correct override material to instances after being added through the component tree in the Blueprint editor.
change summary:
- modified the 'OnBasicShapeCreated' lambda in FComponentTypeRegistryData::AddBasicShapeComponents() to propagate the material override to all instances when the given component is an archetype (template) object.
Change 2997001 on 2016/06/01 by Ryan.Rauschkolb
Fixed Double Clicking a component in the results of Find-In-Blueprints does not select the component
#jira UE-30143
Change 2997521 on 2016/06/02 by Maciej.Mroz
[Blueprint Nativization]
- Added FilesToIncludeInModuleHeader config variable in BlueprintNativizationSettings. So some headers can be included in NativizedAssets.h
- Guids of nodes are no longer recreated when Blueprint is duplicated for "C++ compilation". Previously child bp used variable names based on original parent class, but nativized parent class had guids recreated.
Change 2997522 on 2016/06/02 by Maciej.Mroz
Native implementation of NOEXPORT FInterpCurvePoint structures. (It's necessary for Blueprint nativization)
Change 2997638 on 2016/06/02 by Maciej.Mroz
Improvements for Blueprint Nativization:
- Overridden names in nativized code have proper escape characters (in generated code).
- OnlyDefaultConstructorDeclared metadata is replaced by ObjectInitializerConstructorDeclared
- Arrays of nativized anum have the following form: TArray<Enum> (previously it was TArray<TEnumAsByte<Enum>>)
- warning C4883 is disabled in .generated.cpp files for nativized module
Change 2997639 on 2016/06/02 by Maciej.Mroz
Minor improvements in Ocean gameplay code. Required for Blueprint Nativization.
#jira UE-28945 Failure packaging Nativized Ocean
Change 2997656 on 2016/06/02 by Maciej.Mroz
Various improvements in BlueprintCompilerCppBackend:
- Fixed interface cast
- Fixed TSwitchValue issue (when used with literals)
- Fixed improper name for NativeBlueprintEvent (when calling parent's implementation)
- Fixed bitfield getter code.
- Reduce code size (less UsedAssets, less ReferencedConvertedFields, cached UEnums)
- operator == is generated for nativized structs
- Fixed AssedId (AssetPtr) constructor in nativized code.
- Fixed arrays of noexport struct
- Fixed missing headers for native single cast delegate signature.
- Fixed issue when default constructor (in native) is missing (constructor with FObjectInitialized, wont be used automatically). See "ObjectInitializerConstructorDeclared" metadata.
Change 2997691 on 2016/06/02 by Maciej.Mroz
operator == in FText. It is required for some functions in TArray<FText>
Change 2997793 on 2016/06/02 by Ben.Cosh
Added support for BaseAsyncTask nodes, fixed a problem with instance mapping and turned off the debug instance filter
#Jira UE-30703 - Crash using blueprint profiler on AI pawn using nav mesh
#Proj BlueprintProfiler, Kismet
Change 2997901 on 2016/06/02 by Maciej.Mroz
Back out changelist 2997691
Change 2998038 on 2016/06/02 by Mike.Beach
Merging //UE4/Dev-Main to Dev-Blueprints (//UE4/Dev-Blueprints)
Change 2998052 on 2016/06/02 by Ryan.Rauschkolb
Fixed Comment bubbles not remembering changes after losing focus
#jira UE-20012
Change 2998450 on 2016/06/02 by Phillip.Kavan
[UE-31550] Fix crash on load of a Blueprint class containing a bitmask variable with missing enum type metadata.
change summary:
- modified FBlueprintEditorUtils::ValidateBlueprintVariableMetadata() to check for presence of bitmask enum type metadata on a variable before trying to validate it.
Change 2999763 on 2016/06/03 by Mike.Beach
Guarding against a crash with an ensure - attempting to catch why this is happening by logging more info, as we're unable to repro it. Guarding against nodes which reference malformed (TRASH) classes.
#jira UE-26761
Change 2999768 on 2016/06/03 by Maciej.Mroz
#jira UE-31592, UE-31593
This is just workaound. FReferenceFinder::FindReferences doesn;t find Enum variable in UByteProperty.
Change 2999770 on 2016/06/03 by Maciej.Mroz
[Blueprint Nativization]
Workaround for missing ==operator in native structures. The generated code uses special version of array funtions.
Change 2999798 on 2016/06/03 by Mike.Beach
Guarding against malformed Blueprints (ones without valid "authoratative" class) used as context for the node menu. Baffling how we'd get into this scenario, but this adds ensures to hopefully give us clues and stabalize the editor.
#jira UE-31522
Change 2999941 on 2016/06/03 by Mike.Beach
Correcting mistake in previously attempted fix (CL 2781229). Now using weak ptr IsValid checks to guard against destroyed nodes in deferred graph actions (TWeakObjectPtr::Get() does not check IsValid before returning).
#jira UE-23371
Change 3001731 on 2016/06/06 by Phillip.Kavan
[UE-30638] BP profiler will no longer crash at runtime while profiling events that call functions on an external target.
change summary:
- modified FBlueprintProfiler::ProcessEventProfilingData() to only remove 'Class' and 'Instance' signals on new events.
- modified FScriptEventPlayback::NodeSignalHelper struct to include a new 'BlueprintContext' field.
- modified FScriptEventPlayback::Process() to handle midstream context switches by updating the Blueprint/Function context on 'Class' and/or 'Instance' signals.
- modified FScriptEventPlayback::Process() to cache and reference the current Blueprint context within the cached NodeSignalHelper while handling processed events.
Change 3002075 on 2016/06/06 by Maciej.Mroz
Improved FScriptBuilderBase::EmitTermExpr in KismetCompilerVMBackend.
Literal expression can be emitted without known desitination property.
#jira UE-28443 Set Boolean (by ref) crashes the editor on compile
Change 3002096 on 2016/06/06 by Ben.Cosh
This change expands the way that the blueprint profiler detects event nodes during mapping to include other non function graphs.
#Jira UE-30716 - Blueprint Profiler crashes if function in another graph is called
#Proj BlueprintProfiler
Change 3002108 on 2016/06/06 by Ben.Cosh
Adds a new default option to average the blueprint level stats in the profiler.
#Jira UE-31386 - BP Profiler - Timings reported with "Show Instances" off (in the tree view) are not averaged
#Proj Kismet, BlueprintProfiler
- The controls were also getting a bit messy so I tidied them all up into a re-usable toolbar for convenience going forward.
Change 3002782 on 2016/06/06 by samuel.proctor
Test assets for Interface testing
Change 3003826 on 2016/06/07 by Ben.Cosh
A few minor visual improvements for the blueprint profiler.
#Proj Kismet, BlueprintProfiler, EditorStyle
- Updated the actor icon to match the world outliner and added some functionality to draw attention to stale/deleted actors.
- Updated the pure node icon.
Change 3004067 on 2016/06/07 by samuel.proctor
New test asset for blueprint interfaces
Change 3004069 on 2016/06/07 by samuel.proctor
Updating asset for Interface testing
Change 3004275 on 2016/06/07 by Ryan.Rauschkolb
Fixed issue where Toggle Comment Bubble button for Reroute nodes would not rever tthe comment bubble to constant visibility
#jira UE-23733
Change 3004329 on 2016/06/07 by Dan.Oconnor
EdGraphPin is no longer a UObject, this will improve load times significantly on projects with large number of blueprints, but content does need to be resaved in order to see the improvement in load time. UObject counts are also greatly reduced.
Change 3004418 on 2016/06/07 by Maciej.Mroz
KismetCompilerVMBackend: Fixed issue, when a byte property has no enum specified (for examle parameter from EqualEqual_ByteByte) but the enum is needed to parse a literal value.
Change 3004496 on 2016/06/07 by Dan.Oconnor
Disabling expensive pin allocation tracking
Change 3004649 on 2016/06/07 by Mike.Beach
Preventing a new warning from being generated on trace point exceptions (trace point exceptions are used to hook into the debugger, and don't represent errors).
#jira UE-31236
Change 3004667 on 2016/06/07 by Dan.Oconnor
Removed my debugging logic
Change 3004848 on 2016/06/07 by Dan.Oconnor
Fix spammy ensure
Change 3004871 on 2016/06/07 by Phillip.Kavan
[UE-24950] No longer including components instanced as default subobjects of and attached to components instanced by construction script in the IWCE component tree view.
change summary:
- modified SSCSEditor::UpdateTree() to exclude child components instanced in native code as "nested" DSOs and parented to non-natively-constructed (e.g. Blueprint) components; these instances are no longer being shown in IWCE in order to avoid confusion, as they're not currently mutable at the instance level, will always be parented to something that is visible in the tree, and they're also not currently shown in the Blueprint editor's component tree view (because they're not stored in the CDO).
- modified FSceneComponentData's ctor to exclude child components instanced in native code as nested DSOs from the AttachedInstancedComponents array; this allows child components instanced as nested DSOs to be disposed of along with the constructed parent instance when re-running construction scripts.
Change 3005203 on 2016/06/07 by Dan.Oconnor
Fix for undo/redo/serialization issues with ed graph pin change. When serialization logic was applied incrementally our attempts to keep LinkedTo symetrical and aggressively clear destroyed nodes caused problems
#jira UE-31750
Change 3005441 on 2016/06/08 by Maciej.Mroz
#jira UE-31625 Crash in nativized Orion
AssembleReferenceTokenStream is called for Dynamic Classes:
- in ConstructDynamicType() (when class is explicitly loaded)
- in __CustomDynamicClassInitialization() (when CDO is created)
Change 3005540 on 2016/06/08 by Ben.Cosh
This adds the ability to track profiler instances between editor and PIE instances and displays the current status through the icon coloring.
#Jira UE-30705 - Blueprint profiler stats lost if instance destroyed during PIE
#Proj BlueprintProfiler, Kismet
- The jira was already fixed but I think this change improves the instance status clarity
Change 3006196 on 2016/06/08 by Dan.Oconnor
Copy/paste logic for pin connections got lost in the shuffle
#jira UE-31747
Change 3006416 on 2016/06/08 by Phillip.Kavan
[UE-31735] Fix potential loss of GetClassDefaults node output pin links on load (due to dependency load order).
change summary:
- modified UK2Node_GetClassDefaults::GetInputClass() to redirect to the generated skeleton class only if it's valid. this ensures that output pins will be reallocated during node reconstruction even if the dependent Blueprint's skeleton class has not yet been generated on load.
Change 3006522 on 2016/06/08 by Dan.Oconnor
Under rare circumstances a deprecated pin comes in that is outered to the transient package
#jira UE-31779
Change 3006576 on 2016/06/08 by Dan.Oconnor
Fix for non-editor builds
#jira UE-31796
Change 3006610 on 2016/06/08 by Phillip.Kavan
[UE-31743] Fix data loss issue when loading a serialized non-native component class instance that's owned by an Actor-based Blueprint class instance.
change summary:
- modified FObjectInitializer::InitProperties() to disable fast path initialization for non-native class types when the default data does not equate to the non-native CDO (as is also done within the native path). this is necessary because the optimized property list that we generate at load time to support fast path initialization of Blueprint class instances is only applicable to the generated CDO.
Change 3006824 on 2016/06/08 by Dan.Oconnor
More undo/redo fixes, this time fixes for when transaction buffer changes # of pins, thus destabalizing the LinkedTo arrays
#jira UE-31794
Change 3006828 on 2016/06/08 by Dan.Oconnor
Fix for non-editor builds
Change 3006857 on 2016/06/08 by Dan.Oconnor
Investigating shutdown ensure, traced back to a static UEdGraphPin
Change 3006907 on 2016/06/08 by Dan.Oconnor
Noneditor build fix
Change 3006929 on 2016/06/08 by Dan.Oconnor
Deferring DeprecatedPins destruction until after UBlueprint has had a chance to fix up its watched pins, this is a better fix for #jira UE-31779
Change 3007133 on 2016/06/09 by Ben.Cosh
Fix for issue in the profiler asserting creating pins that don't have unique names.
#Jira UE-31752 - Crash compiling various Orion assets for blueprints profiling, ScriptExecNode.IsValid() failed
#Proj BlueprintProfiler
- I believe this was recently introduced with the changes to UEdGraphPin's
Change 3007964 on 2016/06/09 by Dan.Oconnor
Fix for PinHelpers::UnresolvedPins being left with stale entries by undo/redo
#jira UE-31829
Change 3007996 on 2016/06/09 by Ryan.Rauschkolb
Added 'empty' keyword to Array Clear Node.
#jira UE-12356
Change 3008007 on 2016/06/09 by Ryan.Rauschkolb
Added 'negate' keyword to boolean NOT node
#jira UE-12490
Change 3008011 on 2016/06/09 by Ryan.Rauschkolb
Added Vector2D * Vector2D multiplication node
#jira UE-31503
Change 3008014 on 2016/06/09 by Ryan.Rauschkolb
Fixed Cannot connect Make Array node output to MakeArray input with split pins
#jira UE-28530
Change 3008243 on 2016/06/09 by Dan.Oconnor
Fix for creation of FWeakGraphPinPtr from a pin that had been destroyed, client logic is still a bit broken in the case of the ClassDefaults node, but we're back to 'safe'
#jira UE-31841
Change 3008289 on 2016/06/09 by Dan.Oconnor
Editor transaction saves all state before applying undo/redo buffers when using 'bFlip' flow. This prevents messing with the object graph in the middle of saving state that will be restored later
#jira UE-31794
Change 3008422 on 2016/06/09 by Dan.Oconnor
Correct usage of GIsTransacting, replaced with Ar.IsTransacting() to correctly handle the case where we serialize after transacting but during the transaction (for instance, recompile blueprint in post undo, which we do quite a bit it turns out)
#jira UE-31857
Change 3009164 on 2016/06/10 by Ryan.Rauschkolb
Making changes to default values in the structure editor will now make changes to the structure without rebuilding the default values panel.
#jira UE-21141,UE-23723
Change 3009165 on 2016/06/10 by Ryan.Rauschkolb
Fixed Structure Default value editor collapses after undoing an alteration of a default value
#jira UE-31741
Change 3009181 on 2016/06/10 by Ryan.Rauschkolb
Fixed issue where modifying a default value in a Widget Blueprint would cause the Details Panel to refresh
#jira UE-30014
Change 3009313 on 2016/06/10 by Mike.Beach
Addressing issues with function return nodes in multiple ways:
- Preventing users from deleting return nodes for overriden/inherited functions.
- Also making sure that we create terminals for out params when the return node is disconnected (and pruned).
- Lastly, ensuring that new return nodes adhere to the function's signature (for cases, like where you copy/paste a return node from a different function).
#jira UE-31418
Change 3009595 on 2016/06/10 by Dan.Oconnor
EdGraphPinReference using PinId to resolve itself again, may create issues resolving pins created in compile
#jira UE-31879
Change 3009774 on 2016/06/10 by Dan.Oconnor
Fix for bad logic in RemovePin introduced in 3004329, just a bad reading of the logic, missed an early return
#jira UE-31906
Change 3009988 on 2016/06/10 by Dan.Oconnor
Prefer to use existing pins (based on PinId) when undoing/redoing pin serialization
#jira UE-31888
Change 3010050 on 2016/06/10 by Dan.Oconnor
Fixed missing call to ssuper class's PostEditUndo, fixed UBehaviorTreeGraph::PostEditUndo accessing Pins before they have been resolved
#jira UE-31892
Change 3010071 on 2016/06/10 by Dan.Oconnor
Fix for pasting when owning node has whitespace in result of GetPathName
#jira UE-31898
#coderview Bob.Tellez
Change 3010244 on 2016/06/11 by Dan.Oconnor
Fix for trivial copy/paste error, causes crash when copying/pasting nodes with text default values, part of UE-31870
Change 3010630 on 2016/06/13 by Dan.Oconnor
No longer relying on path name for pin resolution, path is unstable across graphs
#jira UE-31870
Change 3010647 on 2016/06/13 by Dan.Oconnor
PR #2496: Updated KismetMathLibrary comparison descriptions for FDateTime and FTimespan. (Contributed by CelPlays)
#jira UE-31928
Change 3011175 on 2016/06/13 by Ben.Cosh
Updates the Blueprint Profiler so that it can correctly map entry/exit from tunnels based on instance.
#Jira UE-30106 - Compiling QA_PhysVelocitySettleTest with the blueprint profiler results in a crash/assert
#Proj Kismet, BlueprintProfiler
- Ensured that the trace paths contain the macro instance exec nodes
- Selectively update stats in the tunnel exit site nodes based on valid exit sites to prevent cyclic updates.
- Updated the comments in map tunnel entry to spare peoples sanity when trying to understand what that function does.
Change 3011271 on 2016/06/13 by Ben.Cosh
This adds support for inherited blueprint classes to the blueprint profiler.
#Jira UE-31833 - The Blueprint profiler asserts when using a FlipFlop macro.
#Jira UE-31752 - Crash compiling various Orion assets for blueprints profiling, ScriptExecNode.IsValid() failed
#Proj BlueprintProfiler
Change 3011556 on 2016/06/13 by Ryan.Rauschkolb
Fixed Crash when breaking link to a split pin in MakeArray that is an array type
#jira UE-31919
Change 3011624 on 2016/06/13 by Dan.Oconnor
Fix for missing entries in MessageLog's source pin identification map. Bob T had originally populated this correctly, but somehow i lost it while iterating.
#jira UE-31955
Change 3011984 on 2016/06/13 by Dan.Oconnor
Sanitizing parentpin's subpins when destroying a pin
#jira UE-21392
Change 3012894 on 2016/06/14 by Phillip.Kavan
[UE-30922] Ensure that customized defaults are propagated to new instances at construction time during non-Actor-based Blueprint class reinstancing.
change summary:
- modified FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner() to use the reinstanced archetype object as the template object during construction of the new instance for non-Actor-based Blueprint class types.
#jira UE-30922
Change 3013037 on 2016/06/14 by Ryan.Rauschkolb
Fixed Crash when connecting to a split pin in a MakeArray node that has no connections
#jira UE-31917
Change 3014846 on 2016/06/15 by Dan.Oconnor
No longer using FText::IsLetter to parse math expression nodes, that function is very slow. $x is now a valid math expression variable name (genereated a compile error prior to this change)
#jira FORT-23753
Change 3015014 on 2016/06/15 by Dan.Oconnor
Removing poorly implement IsLetter function
Change 3015142 on 2016/06/15 by Dan.Oconnor
More intentional about removing subpins, prevents stale iterator on split pin collapse
#jira UE-32072
Change 3016326 on 2016/06/16 by Ryan.Rauschkolb
Fixed MakeArray node does not reset to wildcard when breaking links with split struct pins that have default values
#jira UE-32016
Change 3016494 on 2016/06/16 by Ryan.Rauschkolb
Fixed Crash when dragging a component into the Event Graph that's inherited from a C++ class
#jira UE-31876
Change 3016557 on 2016/06/16 by Dan.Oconnor
Explicit copy/move of string data for FText, removes some redundant copying and object construction/destruction [which could be optimzed away], saves 2-3 seconds in my 80s load asset benchmark
#jira FORT-23753
Change 3016577 on 2016/06/16 by Ryan.Rauschkolb
Fixed compiler warning for hidden member variable in FBlueprintVarActionDetails::GetVariableReplicationType
Change 3016906 on 2016/06/16 by Dan.Oconnor
Back out changelist 3016557
This will be done by Jamie.Dale in Dev-Editor
Change 3018081 on 2016/06/17 by Phillip.Kavan
[UE-31832] PR #2486: Expose UInheritableComponentHandler::GetAllTemplates() outside of editor (Contributed by Bogustus)
#jira UE-31832
Change 3018402 on 2016/06/17 by Dan.Oconnor
Missing include
Change 3018426 on 2016/06/17 by Ryan.Rauschkolb
Fixed MakeArray node with split pins and no connections does not paste correctly
#jira UE-32148
Change 3018452 on 2016/06/17 by Mike.Beach
Moving the patching of instanced sub-objects out of CPFUO (where you can't rely on the target to be a replacement for the source) to FBlueprintEditorUtils::PatchCDOSubobjectsIntoExport(), and making it so PatchCDOSubobjectsIntoExport() is called regularly for Blueprint regeneration (on load).
#jira UE-32158
Change 3018456 on 2016/06/17 by Dan.Oconnor
Fix for static analysis warning, this null check does nothing
Change 3018595 on 2016/06/17 by Mike.Beach
Fix for shadowed variable warning in CIS.
Change 3018699 on 2016/06/17 by Mike.Beach
Making MinimumAreaRectangle callable in Blueprints without world context (which is only needed for debug drawing).
Change 3019734 on 2016/06/20 by Phillip.Kavan
[UE-32064] Clone associated component template(s) when duplicating Blueprint function graphs containing one or more Add Component nodes.
change summary:
- added a UK2Node_AddComponent::PostDuplicate() override
- moved UK2Node_AddComponent::PostPasteNode() logic into a helper method that's now called from both PostDuplicate() and PostPasteNode() overrides.
notes:
- will prevent getting into the scenario described in UE-31831
#jira UE-32064
Change 3020635 on 2016/06/20 by Dan.Oconnor
Fix for bad cast in FCompilerResultsLog::Append, could cause crashes in clients of this function (math expressions nodes occasionally do when they fail to compile)
Change 3020894 on 2016/06/21 by Maciej.Mroz
#2522: Interface UProperties can ExposeOnSpawn (in Blueprints) (Contributed by MichaelSchoell)
Change 3020958 on 2016/06/21 by Ben.Cosh
This improves the way key events are detected in the blueprint profiler, preventing duplicate event entries when pressed and released are both wired. It also catches a bug with the compiler instrumentation flag when compiling.
#Jira UE-32270 - Input key events generate extra instrumentation data per key press
#Jira UE-32266 - Recompiling blueprints with instrumentation can fail to add instrumentation.
#Proj BlueprintProfiler, UnrealEd
Change 3021316 on 2016/06/21 by Ryan.Rauschkolb
Fixed issue where Copy/Paste of event nodes would not retain link information
Change 3021826 on 2016/06/21 by Phillip.Kavan
[UE-31831] Fix up AddComponent nodes on load if they are not associated with a unique template object.
change summary:
- added external linkage to UK2Node_AddComponent::MakeNewComponentTemplate(), and switched it to be a public API
- modified FBlueprintEditorUtils::UpdateComponentTemplates() (as this is already called on Blueprint load) to detect/warn and correct non-unique templates
#jira UE-31831
Change 3022047 on 2016/06/21 by Ryan.Rauschkolb
Fixed issue where copy/paste of return nodes would not preserve value or link data
#jira UE-26937
Change 3022619 on 2016/06/22 by Maciej.Mroz
#jira UE-30858 Nativized Orion - Some particle effects are not rendering
A static/persistent information (the mechanism is similar to AssetRegistrySearchable) about DynamicClass is added.
It's necessary since DynamicClasses are not handled as regular assets by AssetRegistry.
Fixed GameplayCueManager. Nativized cues can be found.
This is an early version of the feature. Amount of stored persistent data can be extended (but it would increase memory-usage).
Change 3022654 on 2016/06/22 by Maciej.Mroz
FBackendHelperStaticSearchableValues -fixed too strict ensure
Change 3023067 on 2016/06/22 by Maciej.Mroz
#jira UE-32083 Nativize Blueprints removes blueprint functionality in packaged project
Config settings from super class are not applied (at runtime) to nativized Blueprints . So all "config" properties are filled in constructor.
Change 3023222 on 2016/06/22 by Ryan.Rauschkolb
Fixed MakeArray node elements break when editing struct elements
#jira UE-21392
Change 3023405 on 2016/06/22 by Mike.Beach
Making sure sub-objects get instanced for Blueprint CDOs that had their FObjectInitializer deferred (happens when the super CDO hasn't been fully serialized). By the time the deferred FObjectInitializer is ran, the sub-objects have been assigned a RF_NeedLoad flag (where they normally wouldn't have one right after construction, when the initialization is usually ran).
#jira UE-31897
Change 3023992 on 2016/06/22 by Mike.Beach
Fixed an issue where hovering on/off a reroute node (toggling the comment bubble visibility) would create extraneous undo transactions.
#jira UE-31859
[CL 3025946 by Mike Beach in Main branch]
2016-06-23 19:35:24 -04:00
|
|
|
MessageLog.Error(*FString::Printf(TEXT("Reentrant function call!\n%s"), *Callstack));
|
2015-04-09 11:27:52 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
2015-08-20 08:49:28 -04:00
|
|
|
FunctionStack.Add(FuncScript);
|
2015-04-09 11:27:52 -04:00
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
// Clone the source graph so we can modify it as needed; merging in the child graphs
|
|
|
|
|
UNiagaraScriptSource* FuncSource = CastChecked<UNiagaraScriptSource>(FuncScript->Source);
|
|
|
|
|
UNiagaraGraph* FuncGraph = CastChecked<UNiagaraGraph>(FEdGraphUtilities::CloneGraph(FuncSource->NodeGraph, NULL, &MessageLog));
|
|
|
|
|
FEdGraphUtilities::MergeChildrenGraphsIn(FuncGraph, FuncGraph, /*bRequireSchemaMatch=*/ true);
|
|
|
|
|
|
|
|
|
|
//Copies the function graph into the main graph.
|
|
|
|
|
//Removes the Function call in the main graph and the input and output nodes in the function graph, reconnecting their pins appropriately.
|
|
|
|
|
//auto MergeFunctionIntoMainGraph = [&](UNiagaraNodeFunctionCall* InFunc, UNiagaraGraph* FuncGraph)
|
|
|
|
|
|
|
|
|
|
TMap<FName, FReconnectionInfo> InputConnections;
|
|
|
|
|
TMap<FName, FReconnectionInfo> OutputConnections;
|
|
|
|
|
TArray<class UEdGraphPin*> FuncCallInputPins;
|
|
|
|
|
TArray<class UEdGraphPin*> FuncCallOutputPins;
|
|
|
|
|
|
|
|
|
|
//Get all the pins that are connected to the inputs of the function call node in the main graph.
|
|
|
|
|
FunctionNode->GetInputPins(FuncCallInputPins);
|
|
|
|
|
for (UEdGraphPin* FuncCallInputPin : FuncCallInputPins)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
FName InputName(*FuncCallInputPin->PinName);
|
|
|
|
|
FReconnectionInfo& InputConnection = InputConnections.FindOrAdd(InputName);
|
|
|
|
|
if (FuncCallInputPin->LinkedTo.Num() > 0)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
check(FuncCallInputPin->LinkedTo.Num() == 1);
|
|
|
|
|
UEdGraphPin* LinkFrom = FuncCallInputPin->LinkedTo[0];
|
|
|
|
|
check(LinkFrom->Direction == EGPD_Output);
|
|
|
|
|
InputConnection.From = LinkFrom;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//This input has no link so we need the default value from the pin.
|
|
|
|
|
InputConnection.FallbackDefault = FuncCallInputPin->GetDefaultAsString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Get all the pins that are connected to the outputs of the function call node in the main graph.
|
|
|
|
|
FunctionNode->GetOutputPins(FuncCallOutputPins);
|
|
|
|
|
for (UEdGraphPin* FuncCallOutputPin : FuncCallOutputPins)
|
|
|
|
|
{
|
|
|
|
|
FName OutputName(*FuncCallOutputPin->PinName);
|
|
|
|
|
for (UEdGraphPin* LinkTo : FuncCallOutputPin->LinkedTo)
|
|
|
|
|
{
|
|
|
|
|
if (LinkTo)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
check(LinkTo->Direction == EGPD_Input);
|
|
|
|
|
FReconnectionInfo& OutputConnection = OutputConnections.FindOrAdd(OutputName);
|
|
|
|
|
OutputConnection.To.Add(LinkTo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Remove the function call node from the graph now that we have everything we need from it.
|
|
|
|
|
SourceGraph->RemoveNode(FunctionNode);
|
|
|
|
|
UNiagaraNodeOutput* SourceGraphOuputNode = SourceGraph->FindOutputNode();
|
|
|
|
|
check(SourceGraphOuputNode);
|
|
|
|
|
|
|
|
|
|
//Keep a list of the Input and Output nodes we see in the function graph so that we can remove (most of) them later.
|
|
|
|
|
TArray<UEdGraphNode*, TInlineAllocator<64>> ToRemove;
|
|
|
|
|
|
|
|
|
|
//For each input node in the function graph, get all the LinkTo connections for reconnecting to the main graph later.
|
|
|
|
|
TArray <UNiagaraNodeInput*> FuncGraphInputNodes;
|
|
|
|
|
FuncGraph->FindInputNodes(FuncGraphInputNodes);
|
|
|
|
|
for (UNiagaraNodeInput* FuncGraphInputNode : FuncGraphInputNodes)
|
|
|
|
|
{
|
|
|
|
|
check(FuncGraphInputNode && FuncGraphInputNode->Pins.Num() == 1);
|
|
|
|
|
//Get an array of "To" pins from one or more input nodes referencing each named input.
|
|
|
|
|
FReconnectionInfo& InputConnection = InputConnections.FindOrAdd(FuncGraphInputNode->Input.Name);
|
|
|
|
|
if (InputConnection.From)
|
|
|
|
|
{
|
|
|
|
|
//We have a connection from the function call so remove the input node and connect to that.
|
|
|
|
|
ToRemove.Add(FuncGraphInputNode);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//This input has no connection from the function call so what do we do here?
|
|
|
|
|
//For now we just leave the input node and connect back to it.
|
|
|
|
|
//This will mean unconnected pins from the function call will look for constants or attributes.
|
|
|
|
|
//In some cases we may want to just take the default value from the function call pin instead?
|
|
|
|
|
//Maybe have some properties on the function call defining that.
|
|
|
|
|
InputConnection.From = FuncGraphInputNode->Pins[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TArray<UEdGraphPin*>& LinkToPins = FuncGraphInputNode->Pins[0]->LinkedTo;
|
|
|
|
|
for (UEdGraphPin* ToPin : LinkToPins)
|
|
|
|
|
{
|
|
|
|
|
check(ToPin->Direction == EGPD_Input);
|
|
|
|
|
UEdGraphNode* OwningNode = ToPin->GetOwningNode();
|
|
|
|
|
if (!OwningNode->IsA(UNiagaraNodeOutput::StaticClass()))
|
|
|
|
|
{
|
|
|
|
|
//As long as the owning node will survive into the source graph, connect directly to it.
|
|
|
|
|
//Otherwise, we handle the connection in the OutputConnections.
|
|
|
|
|
InputConnection.To.Add(ToPin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//For each output of the output node in the function graph, get the "From" pin to be reconnected later.
|
|
|
|
|
{
|
|
|
|
|
UNiagaraNodeOutput* FuncGraphOutputNode = FuncGraph->FindOutputNode();
|
|
|
|
|
check(FuncGraphOutputNode);
|
|
|
|
|
|
|
|
|
|
//Unlike the input nodes, we don't have the option of keeping these if there is no "From" pin. The default values from the node pins should be used.
|
|
|
|
|
ToRemove.Add(FuncGraphOutputNode);
|
|
|
|
|
|
|
|
|
|
for (int32 OutputIdx = 0; OutputIdx < FuncGraphOutputNode->Outputs.Num(); ++OutputIdx)
|
|
|
|
|
{
|
|
|
|
|
FName OutputName = FuncGraphOutputNode->Outputs[OutputIdx].Name;
|
|
|
|
|
|
|
|
|
|
UEdGraphPin* OutputNodePin = FuncGraphOutputNode->Pins[OutputIdx];
|
|
|
|
|
check(OutputNodePin->LinkedTo.Num() <= 1);
|
|
|
|
|
FReconnectionInfo& OutputConnection = OutputConnections.FindOrAdd(OutputName);
|
|
|
|
|
UEdGraphPin* LinkFromPin = OutputNodePin->LinkedTo.Num() == 1 ? OutputNodePin->LinkedTo[0] : NULL;
|
|
|
|
|
|
|
|
|
|
if (LinkFromPin)
|
|
|
|
|
{
|
|
|
|
|
UEdGraphNode* OwningNode = LinkFromPin->GetOwningNode();
|
|
|
|
|
if (UNiagaraNodeInput* InputNode = Cast<UNiagaraNodeInput>(OwningNode))
|
|
|
|
|
{
|
|
|
|
|
//We are connected directly to an input node so we must find the corresponding input connection and connect to that.
|
|
|
|
|
if (FReconnectionInfo* InputConnection = InputConnections.Find(InputNode->Input.Name))
|
|
|
|
|
{
|
|
|
|
|
LinkFromPin = InputConnection->From;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (LinkFromPin)
|
|
|
|
|
{
|
|
|
|
|
check(LinkFromPin->Direction == EGPD_Output);
|
|
|
|
|
OutputConnection.From = LinkFromPin;
|
2015-04-09 11:27:52 -04:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
//This output is not connected so links to it in the main graph must use it's default value.
|
|
|
|
|
OutputConnection.FallbackDefault = OutputNodePin->GetDefaultAsString();
|
2015-04-09 11:27:52 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
//Remove all the In and Out nodes from the function graph.
|
|
|
|
|
for (UEdGraphNode* Remove : ToRemove)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
FuncGraph->RemoveNode(Remove);
|
|
|
|
|
}
|
2015-04-09 11:27:52 -04:00
|
|
|
|
2015-08-20 08:49:28 -04:00
|
|
|
TArray<UEdGraphNode*> FuncNodes = FuncGraph->Nodes;
|
|
|
|
|
TArray<UEdGraphNode*> ExistingNodes = SourceGraph->Nodes;
|
|
|
|
|
//Copy the nodes from the function graph over into the main graph.
|
|
|
|
|
FuncGraph->MoveNodesToAnotherGraph(SourceGraph, false);
|
|
|
|
|
|
|
|
|
|
FIntPoint FuncNodePos(FunctionNode->NodePosX, FunctionNode->NodePosY);
|
|
|
|
|
FIntRect Bounds = FEdGraphUtilities::CalculateApproximateNodeBoundaries(FuncNodes);
|
|
|
|
|
FIntPoint Center;
|
|
|
|
|
FIntPoint Extents;
|
|
|
|
|
Bounds.GetCenterAndExtents(Center, Extents);
|
|
|
|
|
|
|
|
|
|
FIntPoint Offset = FuncNodePos - Center;
|
|
|
|
|
for (UEdGraphNode* FuncNode : FuncNodes)
|
|
|
|
|
{
|
|
|
|
|
FuncNode->NodePosX += Offset.X;
|
|
|
|
|
FuncNode->NodePosY += Offset.Y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (UEdGraphNode* Node : ExistingNodes)
|
|
|
|
|
{
|
|
|
|
|
if (Node->NodePosX < FuncNodePos.X)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
Node->NodePosX -= Extents.X;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Node->NodePosX += Extents.X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Node->NodePosY < FuncNodePos.Y)
|
|
|
|
|
{
|
|
|
|
|
Node->NodePosY -= Extents.Y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Node->NodePosY += Extents.Y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Finally, do all the reconnection.
|
|
|
|
|
auto MakeConnection = [&](FReconnectionInfo& Info)
|
|
|
|
|
{
|
|
|
|
|
for (UEdGraphPin* LinkTo : Info.To)
|
|
|
|
|
{
|
|
|
|
|
if (Info.From)
|
2015-04-09 11:27:52 -04:00
|
|
|
{
|
2015-08-20 08:49:28 -04:00
|
|
|
Info.From->MakeLinkTo(LinkTo);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LinkTo->DefaultValue = Info.FallbackDefault;
|
2015-04-09 11:27:52 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-08-20 08:49:28 -04:00
|
|
|
};
|
|
|
|
|
for (TPair<FName, FReconnectionInfo>& ReconnectInfo : InputConnections){ MakeConnection(ReconnectInfo.Value); }
|
|
|
|
|
for (TPair<FName, FReconnectionInfo>& ReconnectInfo : OutputConnections){ MakeConnection(ReconnectInfo.Value); }
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Error(LOCTEXT("MergeNullFunction", "Function call node must reference a valid script."), FunctionNode, NULL);
|
|
|
|
|
return false;
|
2015-04-09 11:27:52 -04:00
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-16 08:22:18 -04:00
|
|
|
#undef LOCTEXT_NAMESPACE
|