Files
UnrealEngineUWP/Engine/Source/Developer/MeshBuilder/Private/StaticMeshBuilder.cpp

1016 lines
39 KiB
C++
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
#include "StaticMeshBuilder.h"
#include "BuildOptimizationHelper.h"
#include "Components.h"
#include "Engine/StaticMesh.h"
#include "IMeshReductionInterfaces.h"
#include "IMeshReductionManagerModule.h"
#include "MeshBuild.h"
#include "MeshDescriptionHelper.h"
#include "Misc/ScopedSlowTask.h"
#include "Modules/ModuleManager.h"
#include "PhysicsEngine/BodySetup.h"
#include "StaticMeshAttributes.h"
#include "StaticMeshOperations.h"
#include "StaticMeshResources.h"
#include "Math/Bounds.h"
#include "NaniteBuilder.h"
#include "Rendering/NaniteResources.h"
DEFINE_LOG_CATEGORY(LogStaticMeshBuilder);
void BuildAllBufferOptimizations(
struct FStaticMeshLODResources& StaticMeshLOD,
const struct FMeshBuildSettings& LODBuildSettings,
TArray< uint32 >& IndexBuffer,
bool bNeeds32BitIndices,
TArray< FStaticMeshBuildVertex >& StaticMeshBuildVertices
);
FStaticMeshBuilder::FStaticMeshBuilder()
{
}
static bool UseNativeQuadraticReduction()
{
// Are we using our tool, or simplygon? The tool is only changed during editor restarts
IMeshReduction* ReductionModule = FModuleManager::Get().LoadModuleChecked<IMeshReductionManagerModule>("MeshReductionInterface").GetStaticMeshReductionInterface();
FString VersionString = ReductionModule->GetVersionString();
TArray<FString> SplitVersionString;
VersionString.ParseIntoArray(SplitVersionString, TEXT("_"), true);
bool bUseQuadricSimplier = SplitVersionString[0].Equals("QuadricMeshReduction");
return bUseQuadricSimplier;
}
/**
* Compute bounding box and sphere from position buffer
*/
static void ComputeBoundsFromPositionBuffer(const FPositionVertexBuffer& UsePositionBuffer, FBoxSphereBounds& BoundsOut)
{
// Calculate the bounding box.
FBounds3f Bounds;
for (uint32 VertexIndex = 0; VertexIndex < UsePositionBuffer.GetNumVertices(); VertexIndex++)
{
Bounds += UsePositionBuffer.VertexPosition(VertexIndex);
}
// Calculate the bounding sphere, using the center of the bounding box as the origin.
FVector3f Center = Bounds.GetCenter();
float RadiusSqr = 0.0f;
for (uint32 VertexIndex = 0; VertexIndex < UsePositionBuffer.GetNumVertices(); VertexIndex++)
{
RadiusSqr = FMath::Max( RadiusSqr, ( UsePositionBuffer.VertexPosition(VertexIndex) - Center ).SizeSquared() );
}
BoundsOut.Origin = FVector(Center);
BoundsOut.BoxExtent = FVector(Bounds.GetExtent());
BoundsOut.SphereRadius = FMath::Sqrt( RadiusSqr );
}
/**
* Compute bounding box and sphere from vertices
*/
static void ComputeBoundsFromVertexList(const TArray<FStaticMeshBuildVertex>& Vertices, FBoxSphereBounds& BoundsOut)
{
// Calculate the bounding box.
FBounds3f Bounds;
for (int32 VertexIndex = 0; VertexIndex < Vertices.Num(); VertexIndex++)
{
Bounds += Vertices[VertexIndex].Position;
}
// Calculate the bounding sphere, using the center of the bounding box as the origin.
FVector3f Center = Bounds.GetCenter();
float RadiusSqr = 0.0f;
for (int32 VertexIndex = 0; VertexIndex < Vertices.Num(); VertexIndex++)
{
RadiusSqr = FMath::Max( RadiusSqr, ( Vertices[VertexIndex].Position - Center ).SizeSquared() );
}
BoundsOut.Origin = FVector(Center);
BoundsOut.BoxExtent = FVector(Bounds.GetExtent());
BoundsOut.SphereRadius = FMath::Sqrt( RadiusSqr );
}
static bool BuildNanite(
UStaticMesh* StaticMesh,
FStaticMeshSourceModel& SourceModel,
FStaticMeshLODResourcesArray& LODResources,
FStaticMeshVertexFactoriesArray& LODVertexFactories,
Nanite::FResources& NaniteResources,
const FMeshNaniteSettings& NaniteSettings,
TArrayView<float> PercentTriangles,
FBoxSphereBounds& BoundsOut
)
{
TRACE_CPUPROFILER_EVENT_SCOPE( FStaticMeshBuilder::BuildNanite );
if( !SourceModel.IsMeshDescriptionValid() )
{
return false;
}
FMeshDescription MeshDescription = *SourceModel.GetOrCacheMeshDescription();
FMeshBuildSettings& BuildSettings = SourceModel.BuildSettings;
FStaticMeshLODResources& StaticMeshLOD = LODResources[0];
// compute tangents, lightmap UVs, etc
FMeshDescriptionHelper MeshDescriptionHelper( &BuildSettings );
MeshDescriptionHelper.SetupRenderMeshDescription( StaticMesh, MeshDescription );
//Build new vertex buffers
TArray< FStaticMeshBuildVertex > StaticMeshBuildVertices;
//Because we will remove MeshVertex that are redundant, we need a remap
//Render data Wedge map is only set for LOD 0???
TArray<int32> RemapVerts;
TArray<int32>& WedgeMap = StaticMeshLOD.WedgeMap;
WedgeMap.Reset();
//Prepare the PerSectionIndices array so we can optimize the index buffer for the GPU
TArray<TArray<uint32> > PerSectionIndices;
PerSectionIndices.AddDefaulted( MeshDescription.PolygonGroups().Num() );
StaticMeshLOD.Sections.Empty( MeshDescription.PolygonGroups().Num() );
//Build the vertex and index buffer
UE::Private::StaticMeshBuilder::BuildVertexBuffer(
StaticMesh,
MeshDescription,
BuildSettings,
WedgeMap,
StaticMeshLOD.Sections,
PerSectionIndices,
StaticMeshBuildVertices,
MeshDescriptionHelper.GetOverlappingCorners(),
RemapVerts
);
const uint32 NumTextureCoord = MeshDescription.VertexInstanceAttributes().GetAttributesRef<FVector2f>( MeshAttribute::VertexInstance::TextureCoordinate ).GetNumChannels();
// Only the render data and vertex buffers will be used from now on unless we have more than one source models
// This will help with memory usage for Nanite Mesh by releasing memory before doing the build
MeshDescription.Empty();
// TODO get bounds from Nanite which computes them anyways!!!!
ComputeBoundsFromVertexList(StaticMeshBuildVertices, BoundsOut);
// Concatenate the per-section index buffers.
TArray<uint32> CombinedIndices;
bool bNeeds32BitIndices = false;
UE::Private::StaticMeshBuilder::BuildCombinedSectionIndices(PerSectionIndices, StaticMeshLOD.Sections, CombinedIndices, bNeeds32BitIndices);
// Nanite build requires the section material indices to have already been resolved from the SectionInfoMap
// as the indices are baked into the FMaterialTriangles.
for (int32 SectionIndex = 0; SectionIndex < StaticMeshLOD.Sections.Num(); SectionIndex++)
{
StaticMeshLOD.Sections[SectionIndex].MaterialIndex = StaticMesh->GetSectionInfoMap().Get(0, SectionIndex).MaterialIndex;
}
// Make sure to not keep the large WedgeMap from the input mesh around.
// No need to calculate a new one for the coarse mesh, because Nanite meshes don't need it yet.
WedgeMap.Empty();
Nanite::IBuilderModule& NaniteBuilderModule = Nanite::IBuilderModule::Get();
// Setup the input data
Nanite::IBuilderModule::FVertexMeshData InputMeshData;
Swap( InputMeshData.Vertices, StaticMeshBuildVertices );
Swap( InputMeshData.TriangleIndices, CombinedIndices );
InputMeshData.Sections = StaticMeshLOD.Sections;
// Request output LODs for each LOD resource
TArray< Nanite::IBuilderModule::FVertexMeshData, TInlineAllocator<4> > OutputLODMeshData;
OutputLODMeshData.SetNum( PercentTriangles.Num() );
for( int32 LodIndex = 0; LodIndex < OutputLODMeshData.Num(); LodIndex++ )
{
OutputLODMeshData[ LodIndex ].PercentTriangles = PercentTriangles[ LodIndex ];
}
if( !NaniteBuilderModule.Build( NaniteResources, InputMeshData, OutputLODMeshData, NumTextureCoord, NaniteSettings ) )
{
UE_LOG(LogStaticMesh, Error, TEXT("Failed to build Nanite for HiRes static mesh. See previous line(s) for details."));
return false;
}
// Copy over the output data to the static mesh LOD data
// Certain output LODs might be empty if the builder decided it wasn't needed (then remove these LODs again)
int ValidLODCount = 0;
for (int32 LodIndex = 0; LodIndex < OutputLODMeshData.Num(); ++LodIndex)
{
Nanite::IBuilderModule::FVertexMeshData& ProxyMeshData = OutputLODMeshData[LodIndex];
bool bHasValidSections = false;
for (FStaticMeshSection& Section : ProxyMeshData.Sections)
{
if (Section.NumTriangles > 0)
{
bHasValidSections = true;
break;
}
}
// Valid valid sections then copy over data to the LODResource
if (bHasValidSections)
{
// Add new LOD resource if not created yet
if (ValidLODCount >= LODResources.Num())
{
LODResources.Add(new FStaticMeshLODResources);
new (LODVertexFactories) FStaticMeshVertexFactories(GMaxRHIFeatureLevel);
}
FStaticMeshLODResources& ProxyLOD = LODResources[ValidLODCount];
ProxyLOD.Sections.Empty(ProxyMeshData.Sections.Num());
for (FStaticMeshSection& Section : ProxyMeshData.Sections)
{
ProxyLOD.Sections.Add(Section);
}
TRACE_CPUPROFILER_EVENT_SCOPE(FStaticMeshBuilder::Build::BufferInit);
ProxyLOD.VertexBuffers.StaticMeshVertexBuffer.SetUseHighPrecisionTangentBasis(BuildSettings.bUseHighPrecisionTangentBasis);
ProxyLOD.VertexBuffers.StaticMeshVertexBuffer.SetUseFullPrecisionUVs(BuildSettings.bUseFullPrecisionUVs);
FStaticMeshVertexBufferFlags StaticMeshVertexBufferFlags;
StaticMeshVertexBufferFlags.bNeedsCPUAccess = true;
StaticMeshVertexBufferFlags.bUseBackwardsCompatibleF16TruncUVs = BuildSettings.bUseBackwardsCompatibleF16TruncUVs;
ProxyLOD.VertexBuffers.StaticMeshVertexBuffer.Init(ProxyMeshData.Vertices, NumTextureCoord, StaticMeshVertexBufferFlags);
ProxyLOD.VertexBuffers.PositionVertexBuffer.Init(ProxyMeshData.Vertices);
ProxyLOD.VertexBuffers.ColorVertexBuffer.Init(ProxyMeshData.Vertices);
// Why is the 'bNeeds32BitIndices' used from the original index buffer? Is that needed?
const EIndexBufferStride::Type IndexBufferStride = bNeeds32BitIndices ? EIndexBufferStride::Force32Bit : EIndexBufferStride::Force16Bit;
ProxyLOD.IndexBuffer.SetIndices(ProxyMeshData.TriangleIndices, IndexBufferStride);
BuildAllBufferOptimizations(ProxyLOD, BuildSettings, ProxyMeshData.TriangleIndices, bNeeds32BitIndices, ProxyMeshData.Vertices);
ValidLODCount++;
}
}
return true;
}
bool FStaticMeshBuilder::Build(FStaticMeshRenderData& StaticMeshRenderData, UStaticMesh* StaticMesh, const FStaticMeshLODGroup& LODGroup, bool bGenerateCoarseMeshStreamingLODs)
{
const bool bNaniteBuildEnabled = StaticMesh->NaniteSettings.bEnabled;
const bool bHaveHiResSourceModel = StaticMesh->IsHiResMeshDescriptionValid();
int32 NumTasks = (bNaniteBuildEnabled && bHaveHiResSourceModel) ? (StaticMesh->GetNumSourceModels() + 1) : (StaticMesh->GetNumSourceModels());
FScopedSlowTask SlowTask(NumTasks, NSLOCTEXT("StaticMeshEditor", "StaticMeshBuilderBuild", "Building static mesh render data."));
SlowTask.MakeDialog();
// The tool can only been switch by restarting the editor
static bool bIsThirdPartyReductiontool = !UseNativeQuadraticReduction();
- Deprecated FRawMesh as source model serialization format for static meshes. - MeshDescription now held as compressed bulk data and unpacked on demand. This is managed by FMeshDescriptionBulkData. - Made RawMesh accessors in StaticMesh responsible for performing legacy conversion from MeshDescription if necessary. - Added FBulkDataReader/FBulkDataWriter for serializing bulk data to/from archives. - Added FUntypedBulkData::UnloadBulkData() for releasing the bulk data allocation without invalidating it (so it can be reloaded when necessary). Editor only. - Renamed StaticMesh MeshDescription methods (now GetMeshDescription(), CommitMeshDescription() etc). - Removed unnecessary mesh description attributes from StaticMesh: those which are used only by Editable Mesh, and transient attributes which are automatically generated when needed for building vertex tangent space. - Slight change to FAttributesSetBase::RegisterAttribute(): if the attribute specified already exists, it will be amended to adopt the type, passed flags and number of indices. If only the number of indices changes, any existing data will be preserved if possible. - Added TMeshAttributesRef::Copy() to copy an entire attributes array from one name/index to another. - Changed implementation of TMeshAttributesRef/TMeshAttributesView to provide a const ref/view if the template type parameter is const. Added TMeshAttributesConstRef/TMeshAttributesConstView as an alias for backwards compatibility. - Added FMeshDescription::IsEmpty() for determining whether a mesh description has any content or not. - Removed versioning GUID for mesh description: this should be handled by each mesh description client now. #rb Alexis.Matte [CL 4644791 by Richard TalbotWatkin in Dev-Editor branch]
2018-12-10 09:29:08 -05:00
if (!StaticMesh->IsMeshDescriptionValid(0))
{
//Warn the user that there is no mesh description data
UE_LOG(LogStaticMeshBuilder, Error, TEXT("Cannot find a valid mesh description to build the asset."));
return false;
}
if (StaticMeshRenderData.LODResources.Num() > 0)
{
//At this point the render data is suppose to be empty
UE_LOG(LogStaticMeshBuilder, Error, TEXT("Cannot build static mesh render data twice [%s]."), *StaticMesh->GetFullName());
//Crash in debug
checkSlow(StaticMeshRenderData.LODResources.Num() == 0);
return false;
}
TRACE_CPUPROFILER_EVENT_SCOPE(FStaticMeshBuilder::Build);
const int32 NumSourceModels = StaticMesh->GetNumSourceModels();
StaticMeshRenderData.AllocateLODResources(NumSourceModels);
TArray<FMeshDescription> MeshDescriptions;
MeshDescriptions.SetNum(NumSourceModels);
const FMeshSectionInfoMap BeforeBuildSectionInfoMap = StaticMesh->GetSectionInfoMap();
const FMeshSectionInfoMap BeforeBuildOriginalSectionInfoMap = StaticMesh->GetOriginalSectionInfoMap();
const FMeshNaniteSettings NaniteSettings = StaticMesh->NaniteSettings;
bool bNaniteDataBuilt = false; // true once we have finished building Nanite, which can happen in multiple places
int32 NaniteBuiltLevels = 0;
// Bounds of the pre-Nanite mesh
FBoxSphereBounds HiResBounds;
bool bHaveHiResBounds = false;
// Do nanite build for HiRes SourceModel if we have one. In that case we skip the inline nanite build
// below that would happen with LOD0 build
if (bHaveHiResSourceModel && bNaniteBuildEnabled)
{
SlowTask.EnterProgressFrame(1);
bool bBuildSuccess = BuildNanite(
StaticMesh,
StaticMesh->GetHiResSourceModel(),
StaticMeshRenderData.LODResources,
StaticMeshRenderData.LODVertexFactories,
StaticMeshRenderData.NaniteResources,
NaniteSettings,
TArrayView< float >(),
HiResBounds );
if( bBuildSuccess )
{
bHaveHiResBounds = true;
bNaniteDataBuilt = true;
}
}
// If we want Nanite built, and have not already done it, do it based on LOD0 built render data.
// This will replace the output VertexBuffers/etc with the fractional Nanite cut to be stored as LOD0 RenderData.
if (!bNaniteDataBuilt && bNaniteBuildEnabled)
{
TArray< float, TInlineAllocator<4> > PercentTriangles;
for (int32 LodIndex = 0; LodIndex < NumSourceModels; ++LodIndex)
{
FStaticMeshSourceModel& SrcModel = StaticMesh->GetSourceModel( LodIndex );
// As soon as we hit an artist provided LOD stop
if( LodIndex > 0 && SrcModel.IsMeshDescriptionValid() )
break;
FMeshReductionSettings ReductionSettings = LODGroup.GetSettings( SrcModel.ReductionSettings, LodIndex );
PercentTriangles.Add( ReductionSettings.PercentTriangles );
}
SlowTask.EnterProgressFrame( PercentTriangles.Num() );
bool bBuildSuccess = BuildNanite(
StaticMesh,
StaticMesh->GetSourceModel(0),
StaticMeshRenderData.LODResources,
StaticMeshRenderData.LODVertexFactories,
StaticMeshRenderData.NaniteResources,
NaniteSettings,
PercentTriangles,
HiResBounds );
check( bBuildSuccess );
bHaveHiResBounds = true;
bNaniteDataBuilt = true;
NaniteBuiltLevels = PercentTriangles.Num();
}
// Build render data for each LOD, starting from where Nanite left off.
for (int32 LodIndex = NaniteBuiltLevels; LodIndex < NumSourceModels; ++LodIndex)
{
TRACE_CPUPROFILER_EVENT_SCOPE_STR("FStaticMeshBuilder::Build LOD");
SlowTask.EnterProgressFrame(1);
FScopedSlowTask BuildLODSlowTask(3);
BuildLODSlowTask.EnterProgressFrame(1);
FStaticMeshSourceModel& SrcModel = StaticMesh->GetSourceModel(LodIndex);
float MaxDeviation = 0.0f;
FMeshBuildSettings& LODBuildSettings = SrcModel.BuildSettings;
bool bIsMeshDescriptionValid = StaticMesh->CloneMeshDescription(LodIndex, MeshDescriptions[LodIndex]);
FMeshDescriptionHelper MeshDescriptionHelper(&LODBuildSettings);
FMeshReductionSettings ReductionSettings = LODGroup.GetSettings(SrcModel.ReductionSettings, LodIndex);
// Make sure we do not reduce a non custom LOD by itself
const int32 BaseReduceLodIndex = FMath::Clamp<int32>(ReductionSettings.BaseLODModel, NaniteBuiltLevels, bIsMeshDescriptionValid ? LodIndex : LodIndex - 1);
// Use simplifier if a reduction in triangles or verts has been requested.
bool bUseReduction = StaticMesh->IsReductionActive(LodIndex);
if (bIsMeshDescriptionValid)
{
MeshDescriptionHelper.SetupRenderMeshDescription(StaticMesh, MeshDescriptions[LodIndex]);
}
else
{
if (bUseReduction)
{
// Initialize an empty mesh description that the reduce will fill
FStaticMeshAttributes(MeshDescriptions[LodIndex]).Register();
}
else
{
//Duplicate the lodindex 0 we have a 100% reduction which is like a duplicate
MeshDescriptions[LodIndex] = MeshDescriptions[BaseReduceLodIndex];
//Set the overlapping threshold
float ComparisonThreshold = StaticMesh->GetSourceModel(BaseReduceLodIndex).BuildSettings.bRemoveDegenerates ? THRESH_POINTS_ARE_SAME : 0.0f;
MeshDescriptionHelper.FindOverlappingCorners(MeshDescriptions[LodIndex], ComparisonThreshold);
if (LodIndex > 0)
{
//Make sure the SectionInfoMap is taken from the Base RawMesh
int32 SectionNumber = StaticMesh->GetOriginalSectionInfoMap().GetSectionNumber(BaseReduceLodIndex);
for (int32 SectionIndex = 0; SectionIndex < SectionNumber; ++SectionIndex)
{
//Keep the old data if its valid
bool bHasValidLODInfoMap = StaticMesh->GetSectionInfoMap().IsValidSection(LodIndex, SectionIndex);
//Section material index have to be remap with the ReductionSettings.BaseLODModel SectionInfoMap to create
//a valid new section info map for the reduced LOD.
if (!bHasValidLODInfoMap && StaticMesh->GetSectionInfoMap().IsValidSection(BaseReduceLodIndex, SectionIndex))
{
//Copy the BaseLODModel section info to the reduce LODIndex.
FMeshSectionInfo SectionInfo = StaticMesh->GetSectionInfoMap().Get(BaseReduceLodIndex, SectionIndex);
FMeshSectionInfo OriginalSectionInfo = StaticMesh->GetOriginalSectionInfoMap().Get(BaseReduceLodIndex, SectionIndex);
StaticMesh->GetSectionInfoMap().Set(LodIndex, SectionIndex, SectionInfo);
StaticMesh->GetOriginalSectionInfoMap().Set(LodIndex, SectionIndex, OriginalSectionInfo);
}
}
}
}
if (LodIndex > 0)
{
LODBuildSettings = StaticMesh->GetSourceModel(BaseReduceLodIndex).BuildSettings;
}
}
// Reduce LODs
if (bUseReduction)
{
TRACE_CPUPROFILER_EVENT_SCOPE_STR("FStaticMeshBuilder::Build - Reduce LOD");
float OverlappingThreshold = LODBuildSettings.bRemoveDegenerates ? THRESH_POINTS_ARE_SAME : 0.0f;
FOverlappingCorners OverlappingCorners;
FStaticMeshOperations::FindOverlappingCorners(OverlappingCorners, MeshDescriptions[BaseReduceLodIndex], OverlappingThreshold);
int32 OldSectionInfoMapCount = StaticMesh->GetSectionInfoMap().GetSectionNumber(LodIndex);
if (LodIndex == BaseReduceLodIndex)
{
//When using LOD 0, we use a copy of the mesh description since reduce do not support inline reducing
FMeshDescription BaseMeshDescription = MeshDescriptions[BaseReduceLodIndex];
MeshDescriptionHelper.ReduceLOD(BaseMeshDescription, MeshDescriptions[LodIndex], ReductionSettings, OverlappingCorners, MaxDeviation);
}
else
{
MeshDescriptionHelper.ReduceLOD(MeshDescriptions[BaseReduceLodIndex], MeshDescriptions[LodIndex], ReductionSettings, OverlappingCorners, MaxDeviation);
}
New attribute array API. Fixed some flaws in the original API, deprecated various methods, and introduced some new features. - Now attribute arrays are accessed via TAttributesRef or TAttributesView (and corresponding const versions). These value types hold references to attribute arrays, and individual elements can be accessed by their element ID and attribute index. Using a value type is safer than the previous method which required assignment to a const-ref (and not doing so would take a temporary copy of the attribute array). - The attribute set has been totally flattened, so all attributes of different types are added to the same container. This greatly improves compile times, prevents attributes from being created with the same name but different types, and permits the view feature. - The class hierarchy has changed to have generic base classes where possible with no particular ElementID type. This reduces the code footprint by no longer generating nearly identical copies of templated methods. - A TAttributesView allows the user to access an attribute array by the type of their choosing, regardless of its actual type. For example, the Normal attribute may be registered with type FPackedVector, but accessed as if it was an FVector. This allows us to move away from very strong typing, and instead transparently store attributes of a more efficient size, while the user is not affected. - A transient attribute flag has been added, to denote that a particular attribute should not be saved. #rb none [CL 4226081 by Richard TalbotWatkin in Dev-Editor branch]
2018-07-20 18:58:37 -04:00
const TPolygonGroupAttributesRef<FName> PolygonGroupImportedMaterialSlotNames = MeshDescriptions[LodIndex].PolygonGroupAttributes().GetAttributesRef<FName>(MeshAttribute::PolygonGroup::ImportedMaterialSlotName);
const TPolygonGroupAttributesRef<FName> BasePolygonGroupImportedMaterialSlotNames = MeshDescriptions[BaseReduceLodIndex].PolygonGroupAttributes().GetAttributesRef<FName>(MeshAttribute::PolygonGroup::ImportedMaterialSlotName);
// Recompute adjacency information. Since we change the vertices when we reduce
MeshDescriptionHelper.FindOverlappingCorners(MeshDescriptions[LodIndex], OverlappingThreshold);
//Make sure the static mesh SectionInfoMap is up to date with the new reduce LOD
//We have to remap the material index with the ReductionSettings.BaseLODModel sectionInfoMap
//Set the new SectionInfoMap for this reduced LOD base on the ReductionSettings.BaseLODModel SectionInfoMap
TArray<int32> BaseUniqueMaterialIndexes;
//Find all unique Material in used order
for (const FPolygonGroupID PolygonGroupID : MeshDescriptions[BaseReduceLodIndex].PolygonGroups().GetElementIDs())
{
int32 MaterialIndex = StaticMesh->GetMaterialIndexFromImportedMaterialSlotName(BasePolygonGroupImportedMaterialSlotNames[PolygonGroupID]);
if (MaterialIndex == INDEX_NONE)
{
MaterialIndex = PolygonGroupID.GetValue();
}
BaseUniqueMaterialIndexes.AddUnique(MaterialIndex);
}
TArray<int32> UniqueMaterialIndex;
//Find all unique Material in used order
for (const FPolygonGroupID PolygonGroupID : MeshDescriptions[LodIndex].PolygonGroups().GetElementIDs())
{
int32 MaterialIndex = StaticMesh->GetMaterialIndexFromImportedMaterialSlotName(PolygonGroupImportedMaterialSlotNames[PolygonGroupID]);
if (MaterialIndex == INDEX_NONE)
{
MaterialIndex = PolygonGroupID.GetValue();
}
UniqueMaterialIndex.AddUnique(MaterialIndex);
}
//If the reduce did not output the same number of section use the base LOD sectionInfoMap
bool bIsOldMappingInvalid = OldSectionInfoMapCount != MeshDescriptions[LodIndex].PolygonGroups().Num();
bool bValidBaseSectionInfoMap = BeforeBuildSectionInfoMap.GetSectionNumber(BaseReduceLodIndex) > 0;
//All used material represent a different section
for (int32 SectionIndex = 0; SectionIndex < UniqueMaterialIndex.Num(); ++SectionIndex)
{
//Keep the old data
bool bHasValidLODInfoMap = !bIsOldMappingInvalid && BeforeBuildSectionInfoMap.IsValidSection(LodIndex, SectionIndex);
//Section material index have to be remap with the ReductionSettings.BaseLODModel SectionInfoMap to create
//a valid new section info map for the reduced LOD.
//Find the base LOD section using this material
if (!bHasValidLODInfoMap)
{
bool bSectionInfoSet = false;
if (bValidBaseSectionInfoMap)
{
for (int32 BaseSectionIndex = 0; BaseSectionIndex < BaseUniqueMaterialIndexes.Num(); ++BaseSectionIndex)
{
if (UniqueMaterialIndex[SectionIndex] == BaseUniqueMaterialIndexes[BaseSectionIndex])
{
//Copy the base sectionInfoMap
FMeshSectionInfo SectionInfo = BeforeBuildSectionInfoMap.Get(BaseReduceLodIndex, BaseSectionIndex);
FMeshSectionInfo OriginalSectionInfo = BeforeBuildOriginalSectionInfoMap.Get(BaseReduceLodIndex, BaseSectionIndex);
StaticMesh->GetSectionInfoMap().Set(LodIndex, SectionIndex, SectionInfo);
StaticMesh->GetOriginalSectionInfoMap().Set(LodIndex, BaseSectionIndex, OriginalSectionInfo);
bSectionInfoSet = true;
break;
}
}
}
if (!bSectionInfoSet)
{
//Just set the default section info in case we did not found any match with the Base Lod
FMeshSectionInfo SectionInfo;
SectionInfo.MaterialIndex = SectionIndex;
StaticMesh->GetSectionInfoMap().Set(LodIndex, SectionIndex, SectionInfo);
StaticMesh->GetOriginalSectionInfoMap().Set(LodIndex, SectionIndex, SectionInfo);
}
}
}
}
BuildLODSlowTask.EnterProgressFrame(1);
const FPolygonGroupArray& PolygonGroups = MeshDescriptions[LodIndex].PolygonGroups();
FStaticMeshLODResources& StaticMeshLOD = StaticMeshRenderData.LODResources[LodIndex];
StaticMeshLOD.MaxDeviation = MaxDeviation;
//Build new vertex buffers
TArray< FStaticMeshBuildVertex > StaticMeshBuildVertices;
StaticMeshLOD.Sections.Empty(PolygonGroups.Num());
TArray<int32> RemapVerts; //Because we will remove MeshVertex that are redundant, we need a remap
//Render data Wedge map is only set for LOD 0???
TArray<int32>& WedgeMap = StaticMeshLOD.WedgeMap;
WedgeMap.Reset();
//Prepare the PerSectionIndices array so we can optimize the index buffer for the GPU
TArray<TArray<uint32> > PerSectionIndices;
PerSectionIndices.AddDefaulted(MeshDescriptions[LodIndex].PolygonGroups().Num());
//Build the vertex and index buffer
UE::Private::StaticMeshBuilder::BuildVertexBuffer(
StaticMesh,
MeshDescriptions[LodIndex],
LODBuildSettings,
WedgeMap,
StaticMeshLOD.Sections,
PerSectionIndices,
StaticMeshBuildVertices,
MeshDescriptionHelper.GetOverlappingCorners(),
RemapVerts
);
const uint32 NumTextureCoord = MeshDescriptions[LodIndex].VertexInstanceAttributes().GetAttributesRef<FVector2f>( MeshAttribute::VertexInstance::TextureCoordinate ).GetNumChannels();
// Only the render data and vertex buffers will be used from now on unless we have more than one source models
// This will help with memory usage for Nanite Mesh by releasing memory before doing the build
if (NumSourceModels == 1)
{
MeshDescriptions.Empty();
}
// Concatenate the per-section index buffers.
TArray<uint32> CombinedIndices;
bool bNeeds32BitIndices = false;
UE::Private::StaticMeshBuilder::BuildCombinedSectionIndices(PerSectionIndices, StaticMeshLOD.Sections, CombinedIndices, bNeeds32BitIndices);
{
TRACE_CPUPROFILER_EVENT_SCOPE(FStaticMeshBuilder::Build::BufferInit);
StaticMeshLOD.VertexBuffers.StaticMeshVertexBuffer.SetUseHighPrecisionTangentBasis(LODBuildSettings.bUseHighPrecisionTangentBasis);
StaticMeshLOD.VertexBuffers.StaticMeshVertexBuffer.SetUseFullPrecisionUVs(LODBuildSettings.bUseFullPrecisionUVs);
FStaticMeshVertexBufferFlags StaticMeshVertexBufferFlags;
StaticMeshVertexBufferFlags.bNeedsCPUAccess = true;
StaticMeshVertexBufferFlags.bUseBackwardsCompatibleF16TruncUVs = LODBuildSettings.bUseBackwardsCompatibleF16TruncUVs;
StaticMeshLOD.VertexBuffers.StaticMeshVertexBuffer.Init(StaticMeshBuildVertices, NumTextureCoord, StaticMeshVertexBufferFlags);
StaticMeshLOD.VertexBuffers.PositionVertexBuffer.Init(StaticMeshBuildVertices);
StaticMeshLOD.VertexBuffers.ColorVertexBuffer.Init(StaticMeshBuildVertices);
const EIndexBufferStride::Type IndexBufferStride = bNeeds32BitIndices ? EIndexBufferStride::Force32Bit : EIndexBufferStride::Force16Bit;
StaticMeshLOD.IndexBuffer.SetIndices(CombinedIndices, IndexBufferStride);
// post-process the index buffer
BuildLODSlowTask.EnterProgressFrame(1);
BuildAllBufferOptimizations(StaticMeshLOD, LODBuildSettings, CombinedIndices, bNeeds32BitIndices, StaticMeshBuildVertices);
}
} //End of LOD for loop
{
TRACE_CPUPROFILER_EVENT_SCOPE_STR("FStaticMeshBuilder::Build - Calculate Bounds");
// Calculate the bounding box of LOD0 buffer
FPositionVertexBuffer& BasePositionVertexBuffer = StaticMeshRenderData.LODResources[0].VertexBuffers.PositionVertexBuffer;
ComputeBoundsFromPositionBuffer(BasePositionVertexBuffer, StaticMeshRenderData.Bounds);
// combine with high-res bounds if it was computed
if (bHaveHiResBounds)
{
StaticMeshRenderData.Bounds = StaticMeshRenderData.Bounds + HiResBounds;
}
}
return true;
}
bool FStaticMeshBuilder::BuildMeshVertexPositions(
UStaticMesh* StaticMesh,
TArray<uint32>& BuiltIndices,
TArray<FVector3f>& BuiltVertices)
{
TRACE_CPUPROFILER_EVENT_SCOPE(FStaticMeshBuilder::BuildMeshVertexPositions);
if (!StaticMesh->IsMeshDescriptionValid(0))
{
//Warn the user that there is no mesh description data
UE_LOG(LogStaticMeshBuilder, Error, TEXT("Cannot find a valid mesh description to build the asset."));
return false;
}
const int32 NumSourceModels = StaticMesh->GetNumSourceModels();
if (NumSourceModels > 0)
{
FMeshDescription MeshDescription;
const bool bIsMeshDescriptionValid = StaticMesh->CloneMeshDescription(/*LodIndex*/ 0, MeshDescription);
if (bIsMeshDescriptionValid)
{
const FMeshBuildSettings& BuildSettings = StaticMesh->GetSourceModel(0).BuildSettings;
const FStaticMeshConstAttributes Attributes(MeshDescription);
TArrayView<const FVector3f> VertexPositions = Attributes.GetVertexPositions().GetRawArray();
TArrayView<const FVertexID> VertexIndices = Attributes.GetTriangleVertexIndices().GetRawArray();
const FVector3f BuildScale3D = (FVector3f)BuildSettings.BuildScale3D;
BuiltVertices.Reserve(VertexPositions.Num());
for (int32 VertexIndex = 0; VertexIndex < VertexPositions.Num(); ++VertexIndex)
{
BuiltVertices.Add(VertexPositions[VertexIndex] * BuildScale3D);
}
BuiltIndices.Reserve(VertexIndices.Num());
for (int32 TriangleIndex = 0; TriangleIndex < VertexIndices.Num() / 3; ++TriangleIndex)
{
const uint32 I0 = VertexIndices[TriangleIndex * 3 + 0];
const uint32 I1 = VertexIndices[TriangleIndex * 3 + 1];
const uint32 I2 = VertexIndices[TriangleIndex * 3 + 2];
if (!ensureMsgf(I0 != INDEX_NONE && I1 != INDEX_NONE && I2 != INDEX_NONE,
TEXT("Mesh '%s' has triangles with uninitialized vertex indices"), *StaticMesh->GetName()))
{
continue;
}
const FVector3f V0 = BuiltVertices[I0];
const FVector3f V1 = BuiltVertices[I1];
const FVector3f V2 = BuiltVertices[I2];
const FVector3f TriangleNormal = ((V1 - V2) ^ (V0 - V2));
const bool bDegenerateTriangle = TriangleNormal.SizeSquared() < SMALL_NUMBER;
if (!bDegenerateTriangle)
{
BuiltIndices.Add(I0);
BuiltIndices.Add(I1);
BuiltIndices.Add(I2);
}
}
}
}
return true;
}
bool AreVerticesEqual(FStaticMeshBuildVertex const& A, FStaticMeshBuildVertex const& B, float ComparisonThreshold)
{
if ( !A.Position.Equals(B.Position, ComparisonThreshold)
|| !NormalsEqual((FVector)A.TangentX, (FVector)B.TangentX)
|| !NormalsEqual((FVector)A.TangentY, (FVector)B.TangentY)
|| !NormalsEqual((FVector)A.TangentZ, (FVector)B.TangentZ)
|| A.Color != B.Color)
{
return false;
}
// UVs
for (int32 UVIndex = 0; UVIndex < MAX_STATIC_TEXCOORDS; UVIndex++)
{
if (!UVsEqual(A.UVs[UVIndex], B.UVs[UVIndex]))
{
return false;
}
}
return true;
}
namespace UE::Private::StaticMeshBuilder
{
void BuildVertexBuffer(
UStaticMesh* StaticMesh,
const FMeshDescription& MeshDescription,
const FMeshBuildSettings& BuildSettings,
TArray<int32>& OutWedgeMap,
FStaticMeshSectionArray& OutSections,
TArray<TArray<uint32>>& OutPerSectionIndices,
TArray< FStaticMeshBuildVertex>& StaticMeshBuildVertices,
const FOverlappingCorners& OverlappingCorners,
TArray<int32>& RemapVerts
)
{
TRACE_CPUPROFILER_EVENT_SCOPE(BuildVertexBuffer);
TArray<int32> RemapVertexInstanceID;
// set up vertex buffer elements
const int32 NumVertexInstances = MeshDescription.VertexInstances().GetArraySize();
StaticMeshBuildVertices.Reserve(NumVertexInstances);
FStaticMeshConstAttributes Attributes(MeshDescription);
Total revamp of mesh element attribute model. Attributes now have a number of possible types (FVector, FVector4, FVector2D, float, int, bool, FName, UObject*) and are exposed as individual flat arrays, indexed by element ID. For example, vertex positions are essentially exposed as an array of FVector which can be directly accessed and modified. This has a number of advantages: - It is completely extensible: new attributes can be created (even by a third party) and added to a mesh description without requiring a serialization version bump, or any change to the parent structures. - This is more efficient in batch operations which deal with a number of mesh elements in one go. - These attribute buffers can potentially be passed directly to third-party libraries without requiring any kind of transformation. - The distinct types allow for a better representation of the attribute being specified, without invalid values being possible (cf representing a bool value in an FVector4). Attributes also have default values, and a flags field which confers use-specific properties to them. Editable Mesh currently uses this to determine whether an attribute's value can be automatically initialized by lerping the values of its neighbours, as well as for identifying auto-generated attributes such as tangents/normals. This is desirable as it means that even unknown / third-party attributes can potentially be handled transparently by Editable Mesh, without requiring the code to be extended. Certain higher-level operations in EditableMesh have been optimized to make full use of vertex instances where possible. The welding/splitting of identical vertex instances has been removed from here, as the aim is to unify this with mesh utility code elsewhere. Various bug fixes. #rb Alexis.Matte [CL 3794563 by Richard TalbotWatkin in Dev-Geometry branch]
2017-12-07 13:02:12 -05:00
TPolygonGroupAttributesConstRef<FName> PolygonGroupImportedMaterialSlotNames = Attributes.GetPolygonGroupMaterialSlotNames();
TVertexAttributesConstRef<FVector3f> VertexPositions = Attributes.GetVertexPositions();
TVertexInstanceAttributesConstRef<FVector3f> VertexInstanceNormals = Attributes.GetVertexInstanceNormals();
TVertexInstanceAttributesConstRef<FVector3f> VertexInstanceTangents = Attributes.GetVertexInstanceTangents();
TVertexInstanceAttributesConstRef<float> VertexInstanceBinormalSigns = Attributes.GetVertexInstanceBinormalSigns();
TVertexInstanceAttributesConstRef<FVector4f> VertexInstanceColors = Attributes.GetVertexInstanceColors();
TVertexInstanceAttributesConstRef<FVector2f> VertexInstanceUVs = Attributes.GetVertexInstanceUVs();
const bool bHasColors = VertexInstanceColors.IsValid();
const bool bIgnoreTangents = StaticMesh->NaniteSettings.bEnabled;
First pass of MeshDescription API and format refactor. - Removed hardcoded element type arrays (Vertices, Edges, Triangles etc.). Mesh element types can now be arbitrarily added, with any number of channels. - Mesh element containers have a much leaner format; instead of sparse arrays, they are now represented by a simple bitarray, determining whether an index is used or not. Consequently, mesh topology is now entirely described with the attribute system, e.g. edge start and end vertices, triangle vertices, etc. - Support added for attributes of arbitrary dimensions, e.g. float[4] or int[2]. - Support added for attributes which index into another mesh element container. - Added FMeshElementIndexer: this is an efficient container for maintaining backward references from one element type to another; for example, edges have an attribute specifying which vertices are at each end (an attribute of type FVertexID[2]). With an indexer, it is possible to look up which edges contain a given vertex, even though this is not explicitly stored. Indexers are designed to do minimal allocations and update lazily and in batch when necessary. - Added support for preserving UV topology in static meshes. UVs are now a first-class element type which may be indexed directly from triangles. - Added the facility to access the underlying array in an attribute array directly. - Triangles now directly reference their vertex, edge and UV IDs. Vertex instances are to be deprecated. - Changed various systems to be triangle-centric rather than polygon-centric, as this is faster. Triangles are presumed to be the elementary face type in a MeshDescription, even if polygons are still supported. The concept of polygons will be somewhat shifted to mean a group of triangles which should be treated collectively for editing purposes. - Optimised normal/tangent generation and FBX import. - Deprecated EditableMesh, MeshEditor and StaticMeshEditorExtension plugins - these are to be removed, but they still have certain hooks in place which need removing. #rb [CL 13568702 by Richard TalbotWatkin in ue5-main branch]
2020-05-28 10:56:57 -04:00
const uint32 NumTextureCoord = VertexInstanceUVs.GetNumChannels();
const FMatrix ScaleMatrix = FScaleMatrix(BuildSettings.BuildScale3D).Inverse().GetTransposed();
TMap<FPolygonGroupID, int32> PolygonGroupToSectionIndex;
for (const FPolygonGroupID PolygonGroupID : MeshDescription.PolygonGroups().GetElementIDs())
{
int32& SectionIndex = PolygonGroupToSectionIndex.FindOrAdd(PolygonGroupID);
SectionIndex = OutSections.Add(FStaticMeshSection());
FStaticMeshSection& StaticMeshSection = OutSections[SectionIndex];
StaticMeshSection.MaterialIndex = StaticMesh->GetMaterialIndexFromImportedMaterialSlotName(PolygonGroupImportedMaterialSlotNames[PolygonGroupID]);
if (StaticMeshSection.MaterialIndex == INDEX_NONE)
{
StaticMeshSection.MaterialIndex = PolygonGroupID.GetValue();
}
}
int32 ReserveIndicesCount = MeshDescription.Triangles().Num() * 3;
Copying //UE4/Dev-Editor to //UE4/Dev-Main (Source: //UE4/Dev-Editor @ 4048875) #lockdown Nick.Penwarden #rb none ============================ MAJOR FEATURES & CHANGES ============================ Change 3808185 by Cody.Albert Added missing calls to FEditorViewportClient::AddReferencedObjects in overrides Change 3809824 by Michael.Trepka Improved the way we generate groups in Xcode project's source code navigator. They are now sorted alphabetically and have correct paths so Xcode no longer displays them in red. Also, added __INTELLISENSE__ to preprocessor definitions for indexing to improve indexing without game header files generated. Change 3810089 by Jamie.Dale Fixed PO files failing to import translations containing only whitespace Change 3811281 by Matt.Kuhlenschmidt PR #4331: Toggle SIE shortcut only in PIE (Contributed by projectgheist) Change 3813031 by Matt.Kuhlenschmidt Fix undocked tabs not dropping at users mouse location #jira UE-53427 Change 3813361 by Brandon.Schaefer Print what SDL video driver we are using Change 3818430 by Matt.Kuhlenschmidt PR #4365: Incorrect font name and forgotten undef (Contributed by projectgheist) Change 3818432 by Matt.Kuhlenschmidt PR #4366: Asset Color Strip updates correct on drag and drop (Contributed by projectgheist) Change 3818436 by Matt.Kuhlenschmidt PR #4367: Improved logging (Contributed by projectgheist) Change 3819886 by Matt.Kuhlenschmidt Add a way to optionally disable the warning about referenced actors being moved to other levels. Useful for bulk actor moves via script Change 3819888 by Matt.Kuhlenschmidt Avoid crashing when a window size becomes too large to render. Instead just ensure and clamp to the maximum allowed size. Avoids crashes where the screen dimensions are saved with super large numbers for unknown reasons Change 3821773 by Brandon.Schaefer Fix crash when importing to level #jira UE-31573 Change 3821892 by Jamie.Dale Improved the localized asset cooking so that it only cooks L10N variants if their source asset is cooked #jira UE-53010 Change 3823714 by Christina.TempelaarL #jira UE-52179 added support for grayscale PSD files Change 3826805 by Christina.TempelaarL #jira UE-49636 SceneCaptureComponent2D hidden actor and show only actors disabled in blueprints #jira UE-53445 SceneCaptureComponent2D hidden actors always disabled in details layout Change 3828444 by Anthony.Bills Add LXC container script for building third party libraries. The intention is that this should become the only way to rebuild the third party libraries that require system dependencies not included in the cross-compile toolchain and also to rebuild the toolchains. Other third party libraries without any system dependencies could be rebuilt via the cross-compile toolchains/UBT. This script has been tested running on CentOS 7 and Ubuntu 17.10. Buy default the x86 and x86_64 builds will be built against a CentOS 6 container (and targeting glibc 1.12) and the aarch64 and armhf builds will use an Ubuntu Ubuntu Trusty (14.04) but this is not yet complete. Change 3828754 by Brandon.Schaefer Linux: Fix gamepad thumbstick clicks not registering (github #4209 thanks J??rn M??ller) #jira UE-45722 #review-3828733 Arciel.Rekman Change 3830414 by Brandon.Schaefer Remove circular referencing to a parent window. Move to use AddSP vs AddRaw as well to be safe manually remove ourselves from the selection event delegate list due to Linux pending deletion of windows. Looks like this should fix UE-28322 as well which I've removed the work around placed in for that. #jira UE-53918 #review @michael.trepka, @matt.kuhlenschmidt, @arciel.rekman Change 3830916 by Brandon.Schaefer More verbose message about missing VK extensions (from Marcin Undak) #review-3830710 marcin.undak, arciel.rekman Change 3831339 by Brandon.Schaefer Default to as-needed for debug mode #jira none #review-3830658 Arciel.Rekman Change 3833102 by Jamie.Dale Re-added warning for duplicate package localization IDs when gathering asset localization Change 3834600 by Jamie.Dale Optimized asset registry filter intersection Change 3838024 by Brandon.Schaefer Remove tracking of CLion/CMake build files (from github #4346 thanks reapazor!) #jira UE-53551 #review-3835803 arciel.rekman Change 3839969 by Michael.Dupuis #jira UE-52289: When OnRegister is called on the component make sure our PerInstanceRenderData is up to date Prevent a possible crash if ClearInstanceSelection was called on a component with no PerInstanceRenderData existing Change 3840049 by Michael.Dupuis #jira UE-52975: Was always performing the equivalent of an Add, so now we use the Transform during the duplicate Change 3840071 by Matt.Kuhlenschmidt - Combine some shader params for slate in order to reduce overhead setting uniform buffers - Added better stats for slate draw call rendering - cleaned up huge lambda in Slate rendering main function so we can read the main slate rendering function again Change 3840291 by Michael.Dupuis #jira UE-53053: Was having a mismatch between the remove reorder and the actual remove Change 3840840 by Michael.Dupuis #jira UE-53944: Make sure the LOD generated is in the valid range to prevent the crash Change 3842072 by Michael.Dupuis #jira UE-50299: Include NumSubsection in calculation of component quad factor Change 3842487 by Christina.TempelaarL #jira UE-50573 HighResShot has wrong res in immersive mode Change 3845702 by Matt.Kuhlenschmidt PR #4381: DefaultASTCQualityBySpeed too high max value. (Contributed by kallehamalainen) Change 3845706 by Matt.Kuhlenschmidt PR #4388: Only restore window if minimized (Contributed by projectgheist) Change 3845993 by Christina.TempelaarL #jira UE-41558 crash when selecting PostProcessingVolumes in separate levels Change 3856395 by Brandon.Schaefer No longer using ALAudio on Linux #jira UE-53717 Change 3858324 by Michael.Trepka Preserve command line arguments in Xcode project when regenerating it Change 3858365 by Michael.Dupuis #jira UE-52049: There was a case where adding and removing multiple time would lead to reordering the instances and this would cause the regeneration of the random stream for all the reorded instances. Change 3858492 by Michael.Trepka Updated dependencies for Mac dSYM files so that only cross-referenced modules have their dSYMs recreated on subsequent builds instead of all modules. Change 3859470 by Michael.Trepka CIS fix. Make sure a scheme file exists before trying to read it when generating Xcode project. Change 3859900 by Joe.Conley Fix for "Check Out Assets" window not properly receiving focus. Change 3865218 by Michael.Dupuis #jira UE-45784: Exposed the possibility to edit LDMaxDrawDistance Change 3866957 by Michael.Dupuis #jira UE-42509: Added BodyInstance to ULandscapeSplineSegment and ULandscapeSplineControlPoint Deprecated bEnabledCollision and migrate data as it's replaced by BodyInstance Change 3867220 by Cody.Albert Fixed Project Launcher scrollbar to properly stay anchored at the bottom of the scroll area. Change 3869117 by Michael.Dupuis #jira UE-42509:Fixed compile error when not having editor data Change 3872478 by Arciel.Rekman Linux: disable PIE if compiler enables it by default. Change 3874786 by Michael.Dupuis #jira UE-46925: Remove the guessing functionality when importing a heightmap, and instead propose to the user valid size that can be used for the import through a combo button. Improved usability of the UI by disabling size field when no file was specified Change 3875859 by Jamie.Dale Implemented our own canonization for culture codes Change 3877604 by Cody.Albert We now validate actor names passed to SetActorLabel to ensure None isn't passed in, which can corrupt levels Change 3877777 by Nick.Shin PhysX build fix - this came from CL: 3809757 #jira UE-54924 Cannot rebuild Apex/PhysX/NvCloth .emscripten missing Change 3881693 by Alexis.Matte Fix local path search to not search in memory only #jira UE-55018 Change 3882512 by Michael.Dupuis #jira none : Fixed screen size calculation to take aspect ratio into account correctly Change 3886926 by Arciel.Rekman Linux: fixed checking clang settings during the cross-build (UE-55132). #jira UE-55132 Change 3887080 by Anthony.Bills Updated SDL2 build script. - Now allows compiling inside a CentOS 6 or Ubuntu 12.04 container with wayland support when using the ContainerBuildThirdParty.sh. - Added multiple build arch support to the BuildThirdParty script and pass this down to the SDL2 build script. Change 3887260 by Arciel.Rekman Linux: fix leaking process handles in the cross-toolchain. Change 3889072 by Brandon.Schaefer Fix RPath workaround, to better handle both cases #jira UE-55150 #review-3888119 @Arciel.Rekman, @Ben.Marsh Change 3892546 by Alexis.Matte Remove fbx exporter welded vertices options #jira UE-51575 Change 3893516 by Michael.Dupuis Remove static mesh instancing async buffer filling, as with all the changes made, it's no longer necessary, the cost of loading very large buffer is negligable Rebuild the occlusion tree when using foliage.DensityScale with something other than 1.0 Change 3894365 by Brandon.Schaefer Pass FileReference over a raw string to the LinkEnvironment #jira none #review-3894241 @Ben.Marsh, @Arciel.Rekman Change 3895251 by Brandon.Schaefer Use X11 pointer barriers to bound the cursor to a region over warping the pointers. Patch from Cengiz #jira UE-25615 #jira UE-30714 #review-3894886 @Arciel.Rekman Change 3897541 by Michael.Dupuis #jira UE-53787: Added guard if for some reason the material is null we should not try to draw using this material Change 3904143 by Rex.Hill #jira UE-55366: Fix crash when overwriting existing level during level save as #jira UE-42426: Map '_BuiltData' can now be deleted when selected at same time as map - Map '_BuiltData' package is now garbage collected when switching maps in the editor Change 3906373 by Brandon.Schaefer Fix splash image. Use alias format for big/little endian machines. #jira none Change 3906711 by Rex.Hill #jira UE-42426: BuiltData now deleted with maps Change 3907221 by Cody.Albert Add support for relative asset source paths in content plugins Change 3911670 by Alexis.Matte Fix assetimportdata creation owner #jira UE-55567 Change 3912382 by Anthony.Bills Linux: Add binaries for GoogleTest and add to BuildThirdParty script. Change 3914634 by Cody.Albert Added missing include that could cause compile errors if IWYU was disabled. Change 3916227 by Cody.Albert Fixing some cases where we check #ifdef WITH_EDITOR instead of #if WITH_EDITOR Change 3917245 by Michael.Dupuis #jira UE-35097: Fixed crash when creating a new landscape with 2x2 subsection and material containing grass spawning Change 3918331 by Anthony.Bills Linux: Bundled Mono - Explicilty pick libc.so.6 as libc.so is a linker script and store the config file directly. Change 3920191 by Rex.Hill #jira UE-44197 Fix saving sub-level level causing MapBuildData to be deleted Improved MapBuildData rename, move, duplicate, copy Change 3920333 by Matt.Kuhlenschmidt Render target clear color property now settable in editor #jira UE-55347 Change 3926094 by Michael.Dupuis #jira UE-51502: Added some min/max values to foliage and grass settings to prevent overflow/crash #coderevew jack.porter Change 3926243 by Michael.Dupuis #jira UE-54669: cleaned up invalid/duplicate shader and moved some shaders to appropriate list Change 3926760 by Jamie.Dale Added support for TTC/OTC fonts These can be used via a sub-face index on FFontData, which can be set via a new combo in the font editor. You can also see the cached list of sub-faces within a font file from the UFontFace asset. Change 3927793 by Anthony.Bills Mono: Remove SharpZipLib and references from bundled Mono. #review-3887212 @ben.marsh, @michael.trepka Change 3928029 by Anthony.Bills Linux: Add support for UnrealVersionSelector. - Supports using UVS to launch without a project file. This will then launch the selected engine's project wizard. - Linux UVS uses Slate for the version selection and error log dialogs. - Mime-types and desktop file support added to DesktopPlatformLinux to allow associating with UVS as per the Windows binary and git builds. - Icons added for Linux. #review-3882197 @arciel.rekman, @brandon.schaefer Change 3931293 by Alexis.Matte Add generic Levenshtein edit distance to core algo. This algorithm will help suggesting name matching when users have to resolve material name conflict when re-import fbx meshes. Add also plenty of automation tests for it. #jira none Change 3931436 by Arciel.Rekman Stop RHI thread before shutting down RHI. - Prevents crashes for some drivers that create TLS objects with destructors; those destructors will get called after the thread exited, but the library will already be unloaded on RHI shutdown. Change 3934287 by Alexis.Matte Fix crash when re-importing skeletal mesh. Skinned component render data resource is now release when re-importing. #jira none Change 3937585 by Lauren.Ridge Added labels to the colors stored in the theme bar. Change 3937738 by Alexis.Matte Make sure content browser do not show a preview asset created when we cancel an export animation preview #jira UE-49743 Change 3941345 by Michael.Dupuis #jira UE-26959: Prevent reusing multiple type the same grass type into the same material grass output node Change 3941453 by Michael.Dupuis #jira UE-47492: Added a guard to validate LayerIndex Change 3942065 by Jamie.Dale Fixed crash trying to use FSlateApplication when it wasn't available (eg, in a commandlet) Change 3942573 by Alexis.Matte Fix static analysis Change 3942623 by Michael.Dupuis #jira 0 Cast to ulong as TaskIndex * NumStripes could exceed an int limit and add an assert if the wraparound is negative Change 3942993 by Matt.Kuhlenschmidt PR #4547: Verify the return value of FT_New_Memory_Face (Contributed by jorgenpt) Change 3942998 by Matt.Kuhlenschmidt PR #4554: Cleanup log printing (Contributed by projectgheist) Change 3943003 by Matt.Kuhlenschmidt PR #4534: Prevent Fatal log when alt tabbing during a level save (Contributed by projectgheist) Change 3943011 by Matt.Kuhlenschmidt PR #4518: edit (Contributed by pdlogingithub) Change 3943027 by Matt.Kuhlenschmidt PR #4524: Notifications always render on the screen with the main viewport (Contributed by projectgheist) Change 3943074 by Matt.Kuhlenschmidt PR #4484: Add group actor to folder (Contributed by ggsharkmob) Change 3943079 by Matt.Kuhlenschmidt PR #4431: Git Plugin: replace usage of the 2 cli args "--work-tree" and "--git-dir" by "-C" (Contributed by SRombauts) Change 3943092 by Matt.Kuhlenschmidt PR #4434: Git plugin: configure the default remote URL 'origin' (Contributed by SRombauts) Change 3943132 by Matt.Kuhlenschmidt PR #4247: Add File picker to Git Path setting on GitSourceControl (Contributed by shiena) Change 3943141 by Matt.Kuhlenschmidt PR #4303: Fix ULevelExporterT3D so that it works in a commandlet (Contributed by DSDambuster) Change 3943349 by Jamie.Dale Cleaned up PR #4547 Made the assert non-fatal to avoid it being able to take down the editor if you load up a bad font. Fixed some code that was deleted during the merge. Change 3943976 by Michael.Trepka Copy of CL 3940687 Fixed long link times when building for Mac in Debug by passing -no_deduplicate flag to the linker, which is what Xcode does in Debug configs. #jira none Change 3944882 by Matt.Kuhlenschmidt Fix a few regressions with scene viewport activation locking can capturing the cursor in editor #jira UE-56080, UE-56081 Change 3947339 by Michael.Dupuis #jira UE-55664: Fixed undo/redo buffer handling so we remove from the beginning of the buffer during undo buffer where buffer is at max memory and from the end during redo operation. Fixed cancel also to re add removed transaction at the end or the start depending if we're doing a redo or undo operation Fixed the Undo History UI to listen to an event when the undo buffer changed instead of checking every frame, as when the buffer was full, no changes would occur, thus no UI update. Change 3948179 by Jamie.Dale Fixed monochromatic font rendering - All non-8bpp images are now converted to 8bpp images for processing in Slate. - We convert the gray color of any images not using 256 grays (eg, monochromatic images that use 2 grays). - Fixed a case where the temporary bitmap wasn't being deleted. - Fixed a case where the bitmap could be used after it was deleted. - Added a CVar (Slate.EnableFontAntiAliasing) to control whether you want anti-aliased (256 grayscale) rendering (default), or monochromatic (2 grayscale) rendering. Change 3949922 by Alexis.Matte Ensure fbx node name are not empty when loading a fbx file. I use the same naming convention as Maya #jira UE-56079 Change 3950202 by Rex.Hill Fix crash during editor asset automation tests. Now skips showing modal progress window when opening asset editor window. ActiveTopLevelWindow is not set when modal windows are open. #jira UE-56112 Change 3950484 by Michael.Dupuis #jira UE-52176: delete the Cluster tree when the builder is no longer needed Change 3954628 by Michael.Dupuis Bring back 4.19/4.19.1 Landscape changes Change 3957037 by Michael.Dupuis #jira UE-53343: Add foliage instances back when changing component size Changed the formulation for the Clip/Expand behavior to make it more explicit on what will happen Added SlowTask stuff to manage big landscape change Change 3959020 by Rex.Hill Rename/move file MallocLeakDetection.h Change 3960325 by Michael.Dupuis Fixed static analysis Change 3961416 by Michael.Dupuis #jira UE-46100: Exposed UseDynamicInstanceBuffer on Foliage type, so user can decide if they want to update them dynamically #jira UE-55092: Fixed the warning to appear when having resource array as empty but VB as set up Added data conssitency that when using Dynamic buffer, Keep CPU Access should also be true, even if implicitly it's already the case, now it's explicit Change 3962372 by Michael.Trepka Copy of CL 3884121 Fix for SProgressBar rendering incorreclty on Mac #jira UE-56241 Change 3964931 by Anthony.Bills Linux: Add cross-compiled binary of UVS Shipping. Change 3966719 by Matt.Kuhlenschmidt Fix parameters out of order here #jira UE-56399 Change 3966724 by Matt.Kuhlenschmidt PR #4585: Export symbols for the FDragTool (Contributed by Begounet) Change 3966734 by Matt.Kuhlenschmidt PR #4596: fix the slider issue of the HighResolutionScreenshot window (Contributed by mamoniem) Change 3966739 by Matt.Kuhlenschmidt Removed duplicated code #jira UE-56369 Change 3966744 by Matt.Kuhlenschmidt PR #4602: Fixes check for existing extensions when generating "All Extensions". (Contributed by PhilBax) Change 3966758 by Matt.Kuhlenschmidt PR #4604: Fixed an issue where the Modules and DebugTools tabs would be unrecognized after startup if docked in the level editor (Contributed by tstaples) Change 3966780 by Matt.Kuhlenschmidt Fix crash accessing graph node title widgets when objects have become stale. #jira UE-56442 Change 3966884 by Alexis.Matte Fix speedtree uninitialized values #jira none Change 3967568 by Alexis.Matte Do not override the screensize when importing a skeletal mesh, let the value set by the AddLodInfo function #jira UE-56493 Change 3968333 by Brandon.Schaefer Fix order of operation #jira UE-56400 Change 3969070 by Anthony.Bills Linux: Make sure to set the UE_ENGINE_DIRECTORY #jira UE-56503 #review-3966609 @arciel.rekman, @brandon.schaefer Change 3971431 by Michael.Dupuis #jira UE-56515: Fixed an issue where ForcedLOD > MaxLOD and make sure that LastLOD will at least contain current streamed in LOD. #jira UE-56517: When using ParallelInitView 1 there was a memory leak related to a reallocate that happen with the TArray of FMemstack Pass correctly LODDistanceFactor instead of View.LODScale as we do not want StaticMeshScale to affect us. Change 3971467 by Matt.Kuhlenschmidt Fixed crash deleting a texture with texture painting on it #jira UE-56994 Change 3971557 by Matt.Kuhlenschmidt Fix temporary exporter objects being potentially GC'd and causing crashes during export #jira UE-56981 Change 3971713 by Cody.Albert PR #4597: [FPS Template] Small null pointer check fix and cleanup (Contributed by TheCodez) Change 3971846 by Michael.Dupuis #jira UE-56517: Properly "round" the count so we have the right amount of memory reserved #jira UE-56515: Still had a edge case left, so when using forced lod i simply make sure the value is in valid range, and allocate all the required data for this range Change 3973035 by Nick.Atamas Line and Spline rendering changes: * Lines/Splines now use 1 UV channel to anti-alias (this channel can be used for texturing) * Anti-aliasing filter now adjusted based on resolution * Modified Line/Spline topology to accomodate new UV requirements * Disabled vertex snapping for anti-aliased lines/splines; previously vertexes were snapped, but vertex positions did not affect line rendering (behavior effectively unchanged) * Splines now adaptively subdivided to avoid certain edge-cases Change 3973345 by Nick.Atamas - Number tweaks to maintain previously perceived wire thickness in various editors. Change 3977764 by Rex.Hill MallocTBB no longer debug fills bytes in development configuration Change 3978713 by Arciel.Rekman UVS: Fix stale dependency. Change 3980520 by Matt.Kuhlenschmidt Fix typo #jira UE-57059 Change 3980557 by Matt.Kuhlenschmidt Fixed negative pie window sizes causing crashes #jira UE-57100 Change 3980565 by Matt.Kuhlenschmidt PR #4628: Fixed revert action, now correctly uses CanRevert() condition (Contributed by Kryofenix) Change 3980568 by Matt.Kuhlenschmidt PR #4626: UE-57111: Handle CaptureRegion for HighResShot in PIE (Contributed by projectgheist) Change 3980580 by Matt.Kuhlenschmidt PR #4567: [Editor UI] Pick Parent Class dialog: set keyboard focus and handle Escape & Enter (Contributed by SRombauts) Change 3980581 by Matt.Kuhlenschmidt PR #4565: [Editor UI] Add C++ Class dialog: set keyboard focus and handle Escape & Enter (Contributed by SRombauts) Change 3981341 by Jamie.Dale Re-added GIsEditor condition around package namespace access #jira UE-55816 Change 3981808 by Ryan.Brucks Added LandscapeProxy functions to push RenderTarget data to Heightmaps and Weightmaps Change 3983344 by Jack.Porter #include fixes for CL 3981808 #jira 0 Change 3983391 by Jack.Porter One for #include fix for CL 3981808 #jira 0 Change 3983562 by Michael.Dupuis #jira UE-53787: Make sure the material array is valid before trying to generate static mesh batch element #jira UE-56451: Instead of asserting, simply skip this element as it had invalid custom data anyway, so we can't render it Change 3983600 by Matt.Kuhlenschmidt PR #4289: Pragma Once/Include guard cleanup (Contributed by projectgheist) Change 3983637 by Matt.Kuhlenschmidt PR #4408: Add a template pregeneration hook (Contributed by mhutch) Change 3984392 by Michael.Dupuis #jira UE-56314: Correctly apply LODBias on calculated LOD Fixed some Landscape popping that could occur when we were forcing a LOD that didn't match the component screen size Change 3984950 by Rex.Hill Optimized texture import speed 2-3x depending on number of cpu cores and image size Change 3985033 by Rex.Hill File drag and drop is more quick to respond when editor is in background #jira UE-57192 Change 3986218 by Jack.Porter Missing template parameter fix for CL 3981808 #jira 0 Change 3986376 by Michael.Dupuis #jira UE-56453: Do not use the CreateDynamicMaterialInstance as it will change the parenting of the actor used material, instead simply use the function to generate the MID and parent it correctly. Change 3989391 by Matt.Kuhlenschmidt Fix constant FName lookup in level editor when checking various states of level editor tabs Change 3990182 by Rex.Hill Optimize editor startup time: GetCurrentProjectModules Change 3990365 by Alexis.Matte Fix crash with spline mesh when the attach SM get a new imported LOD #jira UE-57119 Change 3991151 by Rex.Hill VR Editor module now waits to load images until VR mode activated in editor. Saves 0.4 seconds of editor startup time. Change 3991164 by Rex.Hill Optimize editor startup time: FindModulePaths() - Invalidates cache when search paths added - Use cache during wildcard searches containing * and ? Change 3995366 by Anthony.Bills Update BuildCrossToolchain script to allow a Linux host targeting multiple Linux architectures (including the hosts arch). Added a patch to support a gcc 4.8.5 based toolchain on windows (potentially useful for users crosscompiling using GCC and libstdc++ and targeting CentOS 7). #review-3848487 @arciel.rekman, @brandon.schaefer Change 3996109 by Jamie.Dale Reworked BP error messages to be more localization friendly #jira UETOOL-1356 Change 3996123 by Michael.Dupuis #jira UE-57427: Update random color on load of the component #jira UE-56272: Change 3996279 by Merritt.Cely Removed hardware survey from editor #jira an-2243 #tests launched the editor Change 3996626 by Alexis.Matte Fix crash when SkeletalMesh tangent buffer is empty after the build and we serialize the tangent array. #jira UE-57227 Change 3996663 by Max.Chen Sequencer: Fix fbx animation export - rotation and scale channels were flipped. #jira UE-57509 #jira UE-57512 #jira UE-57514 Change 4000331 by Brandon.Schaefer Add a GFNameTableForDebuggerVisualizers_MT back only for Unix under the Core module #review-3999426 @Arciel.Rekman #jira UE-55298 Change 4000450 by Matt.Kuhlenschmidt Another guard against a factory being destroyed during import #jira UE-57674 Change 4000459 by Matt.Kuhlenschmidt Added check for valid game viewport to see if this is the problem in UE-57677 #jira UE-57677 Change 4000493 by Matt.Kuhlenschmidt Remove stale GC'd components when refreshing paint mode to prevent crashes #jira UE-52618 Change 4000683 by Jamie.Dale Fixed target being incorrect when added via the Localization Dashboard #jira UE-57588 Change 4000738 by Alexis.Matte Add a section settings to ignore the section when reducing #jira UE-52580 Change 4000920 by Alexis.Matte PR #4219: Fix for SColorGradingPicker preventing PIE (Contributed by projectgheist) author projectgheist projectgheist@gmail.com Change 4001432 by Alexis.Matte Add a fbx re-import resolve material windows, user can now help resolving the material in case the importer fail to found a match. Change 4001447 by Jamie.Dale Fixed property table not working with multi-line editable text Change 4001449 by Jamie.Dale PR #4531: Localization multiline fix (Contributed by Lallapallooza) Change 4001557 by Alexis.Matte Fix a check in fbx scene importer, in case the user import a fbx LOD group with no geometry under it #jira UE-57676 Change 4002539 by Alexis.Matte Make the fbx importer global transform options persist in the config file #jira UE-50897 Change 4002562 by Anthony.Bills Linux: Enable UVS registering for git builds only and remove old Mono and pre-UVS script code. Change 4003241 by Alexis.Matte Fix the staticmesh import socket logic, it was duplicating socket when re-importing #jira UE-53635 Change 4003368 by Michael.Dupuis #jira UE-57276: #jira UE-56239: #jira UE-54547: Make sure we can't go above MaxLOD even for texture streaming Change 4003534 by Alexis.Matte Fix re-import mesh name match #jira UE-56485 Change 4005069 by Michael.Dupuis #jira UE-57594: Add a guard to prevent crash if we have an invalid resource for the heightmap texture (happen when component is deleted, for example) Change 4005468 by Lauren.Ridge Widgets should not be removed from parent when they are pending GC #jira UE-52260 Change 4006075 by Michael.Dupuis Fixed foliage density scaling to be applied even in editor, except in Foliage edit mode. Change 4006332 by Arciel.Rekman UBT: Adding support for bundled toolchains on Linux. - Authored by Anthony Bills, with modifications. Change 4007528 by Matt.Kuhlenschmidt PR #4665: Source control History Window: enlarge column Description (Contributed by SRombauts) Change 4007531 by Matt.Kuhlenschmidt PR #4656: UE-57200: Ignore reference to actor if same actor (Contributed by projectgheist) Change 4007548 by Matt.Kuhlenschmidt PR #4664: Set Password on EditableText (Contributed by projectgheist) Change 4007730 by Brandon.Schaefer Add a new way to symbolicate symbols for a crash at runtime Two new tools are used for this. 1) dump_syms Will generate a symbol file, which is to large to read from at runtime 2) BreakpadSymbolEncoder Takes the dump_syms file and encodes it in such a way we can do a binary search at runtime to find a Program Counter to a symbol we are looking for #review @Arciel.Rekman, @Anthony.Bills #jira UETOOL-1206 Change 4008429 by Lauren.Ridge Fixing undo bug when deleting user widgets from the widget tree #jira UE-56394 Change 4008581 by Cody.Albert Reinitialize needs to set the audio and caption tracks in addition to the video track or the currently selected track will be lost Change 4009605 by Lauren.Ridge Added Recently Opened assets filter under Other Filters in the Content Browser Change 4009797 by Anthony.Bills Linux: Update MultiArchRoot path to not cache. Move in tree toolchain location to match UBT convention and make sure the MultiArchRoot is checked before the system. Change 4010266 by Michael.Trepka Copy of CL 4010052 Moved some key event handling calls to the main thread on Mac to satisfy new macOS requirements #jira UE-54623 Change 4010838 by Arciel.Rekman Linux: limit allowed clang versions to 3.8-6.0. Change 4012160 by Matt.Kuhlenschmidt Changed the messagiing on the crash reporter dialog to reflect new bug submission process #jira UE-56475 Change 4013432 by Lauren.Ridge Fix for non-assets attempting to add to the Content Browser's recent filter #jira none Change 4016353 by Cody.Albert Improved copy/paste behavior for UMG editor: -Pasting in the designer while a canvas is selected will place the new widget under the cursor -Pasting multiple times while a canvas panel is selected in the hierarchy view will cascade the widgets starting at 0,0 -Pasting while something that isn't a panel is selected is now allowed, and will cascade the pasted widgets off the position of the selected widget (as siblings) -Newly pasted widgets will now be selected automatically -Pasting multiple widgets at once will try and maintain their relative positions if they're being pasted into a canvas panel Change 4017274 by Matt.Kuhlenschmidt Added some guards against invalid property handle access #jira UE-58026 Change 4017295 by Matt.Kuhlenschmidt Fix trying to apply delta to a mix of scene components and non scene components. Its acceptable to not have scene components in the selected component list #jira UE-57980 Change 4022021 by Rex.Hill Fix for audio desync and video fast-forwarding behavior. There long delay (500ms+) until samples start arriving unless we use RequestedTimeCurrent. After delay occurs samples begin arriving at accelerated speed until caught up to playback time leading to visual and audio problems. #jira UE-54592 Change 4023608 by Brandon.Schaefer Downscale memory if we dont have enough #jira UE-58073 #review-4023609 @Arciel.Rekman Change 4025618 by Michael.Dupuis #jira UE-58036: Apply world position offset correctly Change 4025661 by Michael.Dupuis #jira UE-57681: Added guard to prevent possible crash if either we have an invalid material or the material parent is invalid Change 4025675 by Michael.Dupuis #jira UE-52919: if no actor was found in the level skip moving the instances Change 4026336 by Brandon.Schaefer Manually generate *.sym files for Physx3 This should be done in the BuildPhysx file Change 4026627 by Rex.Hill Fix memory leak fix when playing video and main thread blocks #jira UE-57873 Change 4029635 by Yannick.Lange Fix VRMode loading assets only when VRMode starts. #jira UE-57797 Change 4030288 by Jamie.Dale Null FreeType face on load error to prevent potential crashes Change 4030782 by Rex.Hill Fix save BuildData after changing reflection capture in a new level #jira UE-57949 Change 4033560 by Michael.Dupuis #jira UE-57710: Added some guard to prevent crash/assert Change 4034244 by Michael.Trepka Copy of CL 4034116 Fixed arrow keys handling on Mac Change 4034708 by Lauren.Ridge PR #4699: UE-8508: Update config file to keep folder color in sync (Contributed by projectgheist) #jira UE-58251 Change 4034746 by Lauren.Ridge PR #4701: Add option to close tabs to the right of the active tab (Contributed by jesseyeh) #jira UE-58277 Change 4034873 by Lauren.Ridge Fix for not being able to enter simulate more than once in a row. #jira UE-58261 Change 4034922 by Lauren.Ridge PR #4387: Commands mapped in incorrect location (Contributed by projectgheist) #jira UE-53752 Change 4035484 by Lauren.Ridge Tentative fix for crash on pasting comment. All other accesses to UMaterialExpressionComment check its validity first #jira UE-57979 Change 4037111 by Brandon.Schaefer Try to use absolute path from dladdr if we can to find the sym files #jira UE-57858 #review-4013964 @Arciel.Rekman Change 4037366 by Brandon.Schaefer Dont check the command line before its inited #review-4037183 @Arciel.Rekman #jira UE-57947 Change 4037418 by Alexis.Matte Remove the checkSlow when adding polygon Change 4037745 by Brandon.Schaefer Use as much info as we can during ensure Just as fast as the old way but with more information #review-4037495 @Arciel.Rekman #jira UE-47770 Change 4037816 by Rex.Hill Import mesh optimization, BuildVertexBuffer Change 4037957 by Arciel.Rekman UBT: make it easier to try XGE on Linux. Change 4038401 by Lauren.Ridge Reordering is now correctly handled by undo. Reordering and then undoing will no longer cause a "ghost" widget to also be part of the tree. #jira UE-58206 Change 4039612 by Anthony.Bills Unix: Check for null StdOut and ReturnCode parameters, otherwise the code may dereference a null variable when the process fails to create. Change 4039754 by Alexis.Matte Remove the Render meshdescription, no need to carry this temporary data in the staticmesh Change 4039806 by Anthony.Bills Linux: UVS fixes - Update to use new Unix base platform. - Use bin/bash instead of usr/bin/bash (may need revisiting later). - Recompile Shipping version with changes. - Update Setup.sh to run from correct CWD (due to current limitations in the relative directory handling). Change 4039883 by Lauren.Ridge PR #4576: Save editor config to file first time a fav folder is added in the co. (Contributed by projectgheist) #jira UE-56249 Change 4040117 by Lauren.Ridge Replacing widgets should now also clear out references to the widget #jira UE-57045 Change 4040790 by Lauren.Ridge Tentative fix for Project Launcher crash when platform info not found #jira UE-58371 Change 4042136 by Arciel.Rekman UBT: refactor of LinuxToolChain to make it leaner and more configurable. - Made it possible to override SDK passed to the toolchain. - Simplified the code by using the same executable names on Windows and Linux (as .exe is optional), except where File.Exists() is needed (also remove a few) - Some minor renames to make it clear that SystemSDK means system compiler (which otherwise may be unclear) - Made changes to accomodate the new debug format. Change 4042930 by Brandon.Schaefer GCoreObjectArrayForDebugVisualizers was changed to FChunkedFixedUObjectArray reflect that in the Unix part Change 4043539 by Brandon.Schaefer Fix callsite address being used at times for the Program Counter Fix only reporting the actual callstack and not the crash handling callstacks #review-4041370 @Arciel.Rekman #jira UE-58477 Change 4043674 by Arciel.Rekman Added Linux ARM64 (AArch64) lib for MikkTSpace. - Now required for standalone games due to EditableMesh runtime plugin. Change 4043677 by Arciel.Rekman Linux: updated ARM64 (AArch64) version of SDL2. Change 4043690 by Arciel.Rekman Linux: allow compiling VulkanRHI for AArch64 (ARM64). Change 4045467 by Brandon.Schaefer Add Anthony Bills SetupToolchain.sh script Used to download the latest toolchain Change 4045940 by Michael.Trepka Return empty list instead of null from Mac GetDebugInfoExtensions() in UBT #jira UE-58470 Change 4046542 by Alexis.Matte Fix skeletal re-import material assignation #jira UE-58551 Change 4048262 by Brandon.Schaefer Rebuild SDL with pulse audio libs #jira UE-58577 Change 3887093 by Anthony.Bills Add bundled mono binary for Linux. - Unify some of the script structure across Mac and Linux. - This currently uses the same mono C# assemblies as Mac to keep the additional source size down. - If the Mac mono version is updated, the Linux version will also need to be updated to match the same mono git revision. - The system version of mono can still be used by setting the UE_USE_SYSTEM_MONO env var to 1. Change 4003226 by Michael.Dupuis Refactored StaticMeshInstancing to now use a command buffer to communicate with the GPU to prevent concurent access issues. It's mostly used in Editor or if runtime changes occur, otherwise the data is built and send to the GPU directly without keeping CPU copy. Changed how the density scaling was applied to be more optimal Removed UseDynamicInstanceBuffer as the concept is now irrelevant Change 3833097 by Jamie.Dale Localization Pipeline Optimization Manifest/Archives: Added FLocKey to keep an immutable string and its hash. This is used in several places within manifests and archives to minimize string hashing. FLocTextHelper also now take these in its API. This also fixes some places where manifests were being iterated by key rather than source string (as this was causing redundant work). Portable Object: Cleaned up a lot of redundant code, changed things to use FLocKey, and simplified a lot of string manipulation to use algorithms instead (which proved to be faster). Asset Gathering: Optimized the way garbage collection runs while gathering from assets so that we avoid purging assets that we still need to gather from (or are still active dependencies). This also sorts the assets so that we can try and evict dependencies from memory as soon as possible (in much the same way that the cooker does). Automation: The gather commandlet can now take multiple configs to process. This is used by automation to avoid starting the editor several times (which can save a significant amount of start-up overhead). [CL 4052378 by Lauren Ridge in Main branch]
2018-05-04 14:14:10 -04:00
//Fill the remap array
RemapVerts.AddZeroed(ReserveIndicesCount);
for (int32& RemapIndex : RemapVerts)
{
RemapIndex = INDEX_NONE;
}
//Initialize the wedge map array tracking correspondence between wedge index and rendering vertex index
OutWedgeMap.Reset();
OutWedgeMap.AddZeroed(ReserveIndicesCount);
float VertexComparisonThreshold = BuildSettings.bRemoveDegenerates ? THRESH_POINTS_ARE_SAME : 0.0f;
int32 WedgeIndex = 0;
for (const FTriangleID TriangleID : MeshDescription.Triangles().GetElementIDs())
{
const FPolygonGroupID PolygonGroupID = MeshDescription.GetTrianglePolygonGroup(TriangleID);
const int32 SectionIndex = PolygonGroupToSectionIndex[PolygonGroupID];
TArray<uint32>& SectionIndices = OutPerSectionIndices[SectionIndex];
TArrayView<const FVertexID> VertexIDs = MeshDescription.GetTriangleVertices(TriangleID);
FVector CornerPositions[3];
for (int32 TriVert = 0; TriVert < 3; ++TriVert)
{
CornerPositions[TriVert] = (FVector)VertexPositions[VertexIDs[TriVert]];
}
FOverlappingThresholds OverlappingThresholds;
OverlappingThresholds.ThresholdPosition = VertexComparisonThreshold;
// Don't process degenerate triangles.
if (PointsEqual(CornerPositions[0], CornerPositions[1], OverlappingThresholds)
|| PointsEqual(CornerPositions[0], CornerPositions[2], OverlappingThresholds)
|| PointsEqual(CornerPositions[1], CornerPositions[2], OverlappingThresholds))
{
WedgeIndex += 3;
continue;
}
TArrayView<const FVertexInstanceID> VertexInstanceIDs = MeshDescription.GetTriangleVertexInstances(TriangleID);
for (int32 TriVert = 0; TriVert < 3; ++TriVert, ++WedgeIndex)
{
const FVertexInstanceID VertexInstanceID = VertexInstanceIDs[TriVert];
const FVector& VertexPosition = CornerPositions[TriVert];
const FVector& VertexInstanceNormal = (FVector)VertexInstanceNormals[VertexInstanceID];
const FVector& VertexInstanceTangent = (FVector)VertexInstanceTangents[VertexInstanceID];
const float VertexInstanceBinormalSign = VertexInstanceBinormalSigns[VertexInstanceID];
FStaticMeshBuildVertex StaticMeshVertex;
Total revamp of mesh element attribute model. Attributes now have a number of possible types (FVector, FVector4, FVector2D, float, int, bool, FName, UObject*) and are exposed as individual flat arrays, indexed by element ID. For example, vertex positions are essentially exposed as an array of FVector which can be directly accessed and modified. This has a number of advantages: - It is completely extensible: new attributes can be created (even by a third party) and added to a mesh description without requiring a serialization version bump, or any change to the parent structures. - This is more efficient in batch operations which deal with a number of mesh elements in one go. - These attribute buffers can potentially be passed directly to third-party libraries without requiring any kind of transformation. - The distinct types allow for a better representation of the attribute being specified, without invalid values being possible (cf representing a bool value in an FVector4). Attributes also have default values, and a flags field which confers use-specific properties to them. Editable Mesh currently uses this to determine whether an attribute's value can be automatically initialized by lerping the values of its neighbours, as well as for identifying auto-generated attributes such as tangents/normals. This is desirable as it means that even unknown / third-party attributes can potentially be handled transparently by Editable Mesh, without requiring the code to be extended. Certain higher-level operations in EditableMesh have been optimized to make full use of vertex instances where possible. The welding/splitting of identical vertex instances has been removed from here, as the aim is to unify this with mesh utility code elsewhere. Various bug fixes. #rb Alexis.Matte [CL 3794563 by Richard TalbotWatkin in Dev-Geometry branch]
2017-12-07 13:02:12 -05:00
StaticMeshVertex.Position = FVector3f(VertexPosition * BuildSettings.BuildScale3D);
if (bIgnoreTangents)
{
StaticMeshVertex.TangentX = FVector3f(1.0f, 0.0f, 0.0f);
StaticMeshVertex.TangentY = FVector3f(0.0f, 1.0f, 0.0f);
}
else
{
StaticMeshVertex.TangentX = (FVector4f)ScaleMatrix.TransformVector(VertexInstanceTangent).GetSafeNormal();
StaticMeshVertex.TangentY = (FVector4f)ScaleMatrix.TransformVector(FVector::CrossProduct(VertexInstanceNormal, VertexInstanceTangent) * VertexInstanceBinormalSign).GetSafeNormal();
}
StaticMeshVertex.TangentZ = (FVector4f)ScaleMatrix.TransformVector(VertexInstanceNormal).GetSafeNormal();
if (bHasColors)
{
const FVector4f& VertexInstanceColor = VertexInstanceColors[VertexInstanceID];
const FLinearColor LinearColor(VertexInstanceColor);
StaticMeshVertex.Color = LinearColor.ToFColor(true);
}
else
{
StaticMeshVertex.Color = FColor::White;
}
const uint32 MaxNumTexCoords = FMath::Min<int32>(MAX_MESH_TEXTURE_COORDS_MD, MAX_STATIC_TEXCOORDS);
for (uint32 UVIndex = 0; UVIndex < MaxNumTexCoords; ++UVIndex)
{
if (UVIndex < NumTextureCoord)
{
StaticMeshVertex.UVs[UVIndex] = VertexInstanceUVs.Get(VertexInstanceID, UVIndex);
}
else
{
StaticMeshVertex.UVs[UVIndex] = FVector2f(0.0f, 0.0f);
}
}
//Never add duplicated vertex instance
//Use WedgeIndex since OverlappingCorners has been built based on that
const TArray<int32>& DupVerts = OverlappingCorners.FindIfOverlapping(WedgeIndex);
int32 Index = INDEX_NONE;
for (int32 k = 0; k < DupVerts.Num(); k++)
{
if (DupVerts[k] >= WedgeIndex)
{
break;
}
int32 Location = RemapVerts.IsValidIndex(DupVerts[k]) ? RemapVerts[DupVerts[k]] : INDEX_NONE;
if (Location != INDEX_NONE && AreVerticesEqual(StaticMeshVertex, StaticMeshBuildVertices[Location], VertexComparisonThreshold))
{
Index = Location;
break;
}
}
if (Index == INDEX_NONE)
{
Index = StaticMeshBuildVertices.Add(StaticMeshVertex);
}
RemapVerts[WedgeIndex] = Index;
OutWedgeMap[WedgeIndex] = Index;
SectionIndices.Add(Index);
}
}
//Optimize before setting the buffer
if (NumVertexInstances < 100000 * 3)
{
BuildOptimizationHelper::CacheOptimizeVertexAndIndexBuffer(StaticMeshBuildVertices, OutPerSectionIndices, OutWedgeMap);
Copying //UE4/Dev-Enterprise to //UE4/Dev-Main (Source: //UE4/Dev-Enterprise @ 4279600) #rb none #lockdown Nick.Penwarden ============================ MAJOR FEATURES & CHANGES ============================ Change 4073383 by Patrick.Boutot [AJA] Set base timecode for AJA TimecodeProvider Change 4075631 by Patrick.Boutot Change icon for TimecodeSynchronizer. Update TimecodeSynchronizer with the new AJA delayed open sources. Add TimecodeProvider to TimecodeSynchronizer. Can now sync with TimecodeProvider or a master. Make sure the source are ready before viewing them. Remove PreRoll command. Change 4077328 by JeanMichel.Dignard Fixed SoftObjectPtr/Paths becoming invalid when saving a new world since it's being moved from /Temp/Untitled to its own package. #jira UEENT-1423 Change 4077338 by Rex.Hill USD plugin updated to v8.4 with python support Change 4079063 by Rex.Hill USD sdk recompiled as vs2015 targeting older version of CRT, also dependency added for PythonScriptPlugin Change 4079911 by Rex.Hill USD pyd files recompiled Change 4080058 by Rex.Hill Fix usd plugin loading, added missing libtrace.dll Change 4080376 by Matt.Hoffman Improvements to Sequence Recorder's public API to expose more functionality for third parties. Change 4084984 by Matt.Hoffman Sequence Recorder can now set a global time dilation when recording starts, optionally ignoring the dilation when recording keys. This is useful for recording objects in your scene that move too fast to track with a camera but still ending up with the same length recording in the end. #jira UESP-670 Change 4086688 by Matt.Hoffman Exposes getting and setting keys from sequencer sections via the scripting layer. Examples for how to work with Python and key data can be found in /Plugins/MovieScene/SequencerScripting/Content/Python in the form of "sequencer_examples.py" and "sequencer_key_examples.py". Documentation on how to use these examples is included in the python file. #jira UESP-547 Change 4088904 by Max.Chen Sequence Recorder: Set actor tags as unique Change 4089176 by Max.Chen Sequence Recorder: Add option to record to the target level sequence playback range length. Change 4089180 by Max.Chen Sequence Recorder: Add protection agains null movie scene sections Change 4089205 by Max.Chen Sequence Recorder: Save recorded audio files if auto save is on. #jira UESP-660 Change 4089206 by Max.Chen Sequencer: When importing fbx, if a camera is created, force mapping to be by name matching only so that other nodes in the fbx file do not get mapped onto the newly created camera. #jira UE-59347 Change 4089214 by Max.Chen Sequence Recorder: Add support for looping/rolling takes #jira UESP-658 Change 4089280 by Max.Chen Sequence Recorder: Added support to specify properties from actor classes (camera rig rail - current position on rail) Change 4093824 by Andrew.Rodham Editor: Added option to class pickers to force use of class Display Names Change 4093826 by Andrew.Rodham Removed implicit gamma to linear conversion from EXR writer - This was only implemented for exr data that was supplied as 8 bits per channel (ie. uint8), but there is no way of communicating with the Image Writer API to tell it whether you want it to do that conversion. This code is too low level to be making assumptions about what color-space the data is in. - This ensures that R8G8B8A8 render targets exported as EXR are exported as-is without any modification #jira UESP-545 Change 4093830 by Andrew.Rodham Fixed shutdown crash when destroying a media player that was still playing Change 4093831 by Andrew.Rodham Fixed exception handling in png image wrapper Change 4093833 by Andrew.Rodham Slate: Fixed not being able to set a hyperlink on notifications with unbound attributes that had explicit values set Change 4093841 by Andrew.Rodham Added a utility struct for dealing with editor actor layers from within Blueprints Change 4093867 by Andrew.Rodham Sequencer: Added the ability to implement custom capture protocols for movie scene captures - Converted capture protocol settings and instances to be single UObjects. This unifies the two concepts, and allows for Blueprint implementations. - Removed capture protocol registry since it is no longer required. - Removed FCaptureProtocolID in favor of class discovery at runtime. - Added new module "ImageWriteQueue", responsible for asynchronously managing a queue of image file write operations. - Added new capture protocol for capturing final pixels to EXR (including burn-ins) - Added a new BP function, ExportToDisk, accessible on all UTexture properties for writing texture and render target data to image files - New global BP nodes for querying movie capture status: IsCaptureInProgress, FindCaptureProtocol - Removed Flush On Draw functionality from viewports and frame grabber since it is unnecessary. #jira UESP-545 Change 4094239 by Rex.Hill Export sequence to usd #jira UESP-563 Change 4094393 by Andrew.Rodham Renamed references of 'BufferName' to 'StreamName' for user defined capture protocols Change 4094622 by Patrick.Boutot Add MediaFrameworkUtilitites plugin. Add MediaBundle. An asset that create a MediaPlayer, MediaSource, MediaTexture and MaterialInstance. Add MediaBundleActor. Can auto play a MediaBundle when click & drag in the viewport. Add the Media category in placement mode. Add flag on the MediaPlayer that prevent it from closing when PIE is started or closed. Change 4094673 by Anousack.Kitisa Created widget to display metadata as list view of tags/values. #jira UEENT-1296 Change 4094795 by Simon.Therriault MediaFrameworkUtilities - Adding default media texture for default media bundle material - Changed default material to unlit Change 4094867 by Rex.Hill Usd sequence exporter camera rotation corrected Change 4096426 by JeanLuc.Corenthin - Fixed logic of FLayoutUV::FindCharts to properly extract the list of triangles based on a mesh description. - Fixed logic in FMeshDescriptionOperations::ConverToRawMesh & FMeshDescriptionOperations::ConvertHardEdgesToSmoothGroup to take in account the fact that the arrays are sparse arrays - Fixed logic in FQuadricSimplifierMeshReduction::ReduceMeshDescription which wrongly assumed that number of vertex instances equals three times the number of triangles. - Added early-out in UMeshDescription::ComputePolygonTriangulation when perimeter has 3 vertex indices - Changed version of static mesh and mesh description - Fixed issue with mismatching attribute set when generating LOD meshes #jira UEENT-887, UE-59474, UE-59471 Change 4097101 by Patrick.Boutot Remove warning in PropertyEditorClass when trying to load the "None" class. Change 4097443 by Rex.Hill USD export bake keys Change 4097468 by Patrick.Boutot Edit and initialize the timecode provider of the editor. Change 4097479 by Anousack.Kitisa Added support for commandlet and unattended script modes to Plugin Warden. #jira UE-57333 Change 4097578 by Rex.Hill USD export tweaks Change 4098257 by Simon.Therriault GarbageMatteCaptureComponent - Adding spawned actor tracking to be able to use GarbageMatteActor spawned in editor. Change 4100072 by Jamie.Dale Updated wrapped enums to be more consistent with native Python enums - Wrapped enums now generate values that are instances of the enum type itself, containing a name and value field (like native Python enums). - Wrapped enums are now strongly typed and do not allow implicit conversion from numbers (explicit casting is available, but throws if the value is unknown). - Wrapped enum entries may be compared against numbers (even numbers that don't have valid values) via the == and != operators (like IntEnum in Python). - Wrapped enums may now be iterated (like native Python enums). - Wrapped enums now return a length based on their number of entries (like native Python enums). - ScriptName meta-data can now be used with enum entries. Change 4100255 by Patrick.Boutot [MediaBundle] Modify the base shader to support "failed texture" Change 4103838 by Simon.Therriault MR Garbage Matte Component - Adding FocalDriver interface to be able to poll focal information from outside (cinecamera). Could be updated to be event driven. Change 4115616 by Rex.Hill USD Exporter now exposed to UI Change 4116333 by Simon.Therriault MediaBundle - Updated default media bundle to include lens distortion and chromakeying - Added possibility to spawn material editor for MediaBundle inner material - Fix for inner objects flags preventing asset deletion - Fix for CloseMedia not being called when changing map Lens Distortion - Fix for not being able to generate a Identity lens displacement map Change 4117952 by Rex.Hill Expose OpenEditorForAssets to python Change 4118498 by Rex.Hill Sequencer USD export can now export properties of actors in levels Change 4118515 by Rex.Hill Update sequencer export task comment Change 4118706 by Rex.Hill Sequencer USD updates Change 4118968 by Rex.Hill Sequencer USD export now supports visibility Change 4119702 by Simon.Therriault MediaBundle - Fix crash when changing MediaBundle on Actor multiple times. - Fix crash when Undoing after placing a MediaBundle and pressing Stop then Undo. - Fixed bad reference count in MediaBundle when undo/redo of MediaBundle setting changed on MediaBundleActor - Added PostEditChange after setting MaterialProperty to fix potential propagation. Change 4120060 by Patrick.Boutot Fix typo for TimecodeProviderClassName. Add "Config required restart" Add a button to reapply the CustomTimeStep or TimecodeProvider Change 4122062 by Krzysztof.Narkowicz Fixed movie burnout fixed timestep. Engine didn't use a fixed time step due to a following bug: 1. UAutomatedLevelSequenceCapture::Initialize calls UMovieSceneCapture::Initialize. 2. UMovieSceneCapture::Initialize creates FRealTimeCaptureStrategy and calls CaptureStrategy->OnInitialize(). 3. UAutomatedLevelSequenceCapture::Initialize changes CaptureStrategy to FFixedTimeStepCaptureStrategy, but no one calls CaptureStrategy->OnInitialize(); after that and this function is required to set the fixed time step. 4. Result: movies are burned out with variable time step, causing different inconsistencies between frames, settings and HW configurations. #jira none Change 4122236 by Anousack.Kitisa Made the "Import Into Level..." File menu action follow the EditorImport flag of a SceneImportFactory. #jira UE-57612 #jira UEENT-762 Change 4122588 by Rex.Hill Sequencer Export USD lights now supported Change 4122822 by JeanMichel.Dignard Fix for UV packing FlipX. Don't flip the empty columns at the end since they are always expected to be on the right side. The same was already done for FlipY. #jira UE-56664 Change 4123009 by JeanMichel.Dignard Copied fixes from MeshUtilities LayoutUV to MeshDescription LayoutUV Change 4123517 by JeanLuc.Corenthin Fixed crash when running cooked game crash with asset imported from datasmith #jira UE-60173 Change 4124569 by Patrick.Boutot [AJA] When the CustomTimeStep & TimecodeProvider signal is lost in the editor (not in PIE), try to re-synchronize every second. Change 4126421 by Max.Chen Sequencer: Add the ability to switch the takes of all the selected shots/subsections. #jira UESP-761 Change 4133010 by Simon.Therriault MediaBundle - Made assets in the bundle visible in the content browser (different package per asset) and updated to support duplication correctly - Quick fix for MaterialDynamicInstance garbage matte parameter not going back to default value when cleared. - Added looping option on the bundle Keyer and lens materials - Renamed some parameter groups to Keyer_XX Change 4135728 by Rex.Hill MovieSceneCapture crash fix when iteration on classes defined in python Change 4135732 by Rex.Hill Sequencer scripting: expose get playback range, sub sequence get sequence Change 4135734 by Rex.Hill USD python code refactored Change 4136017 by Matt.Hoffman Fixes FrameNumber nodes tripping an ensure when using them via Blueprints and fixes FrameNumbers & friends not being properly breakable in BP. #jira UE-60188 Change 4147959 by Patrick.Boutot Media Output Architecture. Support 8bits & 10bits color. Capture the buffer as is with the correct pixel format and the corredt target size. Change 4147962 by Patrick.Boutot Remove AjaMediaViewportOutput && AjaMediaViewportOutputImpl. Refactor AjaMediaOutput to extend MediaOutput. Refactor AjaMediaGrameGrabberProtocol to use AjaMediaCapture. Create AjaMediaCapture. Change 4148395 by Rex.Hill USD python code cleanup Change 4152901 by Rex.Hill Fix crash when recompiling blueprint or script class that serializes an object reference manually Change 4152906 by Rex.Hill USD level import/export exposed to UI Change 4152956 by Rex.Hill Rename unreal_usd to usd_unreal to avoid future module name conflicts Change 4153331 by Rex.Hill Simplify USD attribute definitions Change 4155472 by Rex.Hill USD level import now handles cameras and lights Change 4155832 by Patrick.Boutot Fix Packaging for MediaFrameworkUtilities Fix MediaPlayer that crash on close when the engine is closing. Change 4156020 by Mike.Zyracki LIVE LINK Sequencer Recording and Playback #jira UESP-714 #jira UESP-715 Support for Live Link Recording/Playback with Sequencer. Basically if we see a MotionController controlled by a LiveLink Subject or a LiveLink Component on a Actor we create a LiveLinkTrack for it that will record raw sequencer data into. We currently do that at the end of recording but will investigate saving it as we record. For Playback we create a Live Link Subject per recorded track and push up interpolated data per Engine Tick on Evaluate. We need to see if we need to send out raw data but that's complicated due to the fact that sequencer time may not be sequential but random, Moved FLiveLinkTimeFrame to LiveLinkTypes so we can grab raw data. Added functions to LiveLinkClient/Subject to get raw data so we dont' need to do expensive searches. Also changed that code so that we can only save the LiveLinkData when specified. We decided to have the sequencer own saving of the live link data so we explicilty turn on saving when we start to record and then turn if off at the end. Without this it's possible to easily run out of memory while LiveLink records. In order to record LiveLinkComponents under Actors we had to change ActorRecording to record ActorComponents and not jus SceneComponents. Not sure of any drawbacks with this but it seems to work well. Had to make sure we stll keeped attach/parent/child logic when recording. Change 4158488 by Rex.Hill USD scene import/export now uses UsdLux lights Change 4158742 by Rex.Hill USD: Add test for level export and import Change 4161645 by Patrick.Boutot Update MediaRecorder to use the ImageWriteQueue. Add flag in IImageWriteQueue.Enqueue to prevent block if the queue is full. Change 4161651 by Patrick.Boutot Modify MediaCompositing to use an existing MediaPlayer Change 4161657 by Patrick.Boutot Extend the SequenceRecorder to support additional object to record from other plugins. Add SequenceRecorder for MediaPlayer. Will record every frame to disk that the MediaPlayer produce. Change 4162699 by Rex.Hill USD export sequence updates Change 4163138 by Rex.Hill USD sequence export test added Change 4163426 by Mike.Zyracki Fix for Curve Names being kept and AutoSetting Tangents on Live Link Recording Change 4165714 by Patrick.Boutot [MediaCapture] Remove color box that tell the status of the MediaCapture. Add MediaCapture's name and use an image to represent the status. Use a ScrollBox around the "preview" output. Can select any actors. Only show the selectable camera grid when there is more than one camera. Change 4166652 by Rex.Hill Expose SetMobility to scripting Change 4167292 by Mike.Zyracki Make sure we call Finalize Evaluation when closing or deleting the Sequencer. This will make sure TearDown is called on sections which fixes issues with LiveLink Sources not getting deleted and probably also issues with MovieScenePlayers not getting released correctly. Also includes addition to show the SubjectName next to the Sequencer Source in the LiveLinkClient UI. Change 4170578 by Rex.Hill PackageTools exposed to scripting Change 4170619 by Rex.Hill Fix ReversePolygonFacing crash Change 4170621 by Rex.Hill USD mesh import can now be given list of individual meshes Change 4172495 by Matt.Hoffman Fixes some flipped logic in Sequencer Media Track that was preventing it from working as expected. Slightly simplifies the logic on setting up movie data, and ensures that the external movie player has a callback registered so that SeekTo calls will work. Makes it so that you can specify your own sound component with an external media player as a media player can have multiple sound components listening to it. Adds support for flagging the media player to loop to help cue some media sources like EXR to handle loop points better. #jira None Change 4173387 by Jon.Nabozny Bookmark usability and extensibility improvements Change 4173755 by Rex.Hill PackageTools namespace deprecation Change 4181799 by Patrick.Boutot Fix precesion error when importing a camera switcher in sequencer #jira UE-61212 Change 4184435 by Patrick.Boutot Only show the MediaCapture tab spawner in the level editor. Make sure the Material used to draw the render target is GCed. Change 4195803 by Patrick.Boutot Warn user if the AJA CustomTimeStep is used with VSync enabled. Change 4195866 by Patrick.Boutot Remove mention of CharBGR10A2 in AJA. The feature is not yet ready. Change 4196059 by Rex.Hill Fix linux compile due to a .cpp including BookMarkBase.h instead of BookmarkBase.h Change 4196380 by Patrick.Boutot MediaCapture capture the backbuffer when the Viewport don't use an internal texture. #jira UE-61601 Change 4199378 by Patrick.Boutot For MediaFramework, add support for 10bits RGB texture Change 4199380 by Patrick.Boutot [AJA] Add support for 10bits RGB texture in input Fix interlaced format that wasn't using the proper Stride value. Change 4200359 by Jamie.Dale Renamed some "K2_" prefixed functions for Python Change 4203016 by Max.Chen Sequencer: Add movie scene locking/read only. Fixed a few bugs with locked sections - shouldn't be able to create or move keys on locked sections #jira UESP-867 Change 4203018 by Max.Chen Sequencer: Test for movie scene read only before calling modify/transactions. #jira UESP-867 Change 4203622 by Simon.Therriault Bringing Aja MediaOutput MediaMode fix from Release 4.20 Change 4204895 by Rex.Hill Expose several file path functions to scripting Change 4206747 by Rex.Hill USD level import and export updates Change 4206783 by Rex.Hill USD updates Change 4207021 by Rex.Hill USD, fix rotation on level import when there is non-uniform scale Change 4207414 by Rex.Hill USD import static mesh material improvements Change 4209733 by Patrick.Boutot Change the log time to use the current frame Timecode #jira UEENT-1107 Change 4209738 by Patrick.Boutot Option to automatically try to reopen the MediaSource again if an error is detected Change 4210385 by Max.Chen Sequencer: Fix CurrentShot LocalTime computation by using sequence time in playback resolution to compute the local shot time. Also, fixed the burnin asset so that CurrentShotLocalTime is hooked up to ShotFrame instead of MasterTime. This fixes a bug where the burnin's {ShotFrame} is not reporting the local shot frame number. #jira UE-61728 Change 4219824 by Patrick.Boutot Use the correct EditorCondition for property MaxNumAncillaryFrameBuffe Change 4220706 by Louise.Rasmussen Sequencer: Syncronizes Sections using Source Timecode Relative to the first Selected Section #JIRA UESP-826 Change 4220708 by Louise.Rasmussen Sequencer: Adds SourceTimecode option to the Render Movie Settings Burn In #JIRA UESP-826 Change 4226970 by Patrick.Boutot Add a Timecode widget, TimecodeProvider widget and a TimecodeProvider Tab Change 4227333 by Rex.Hill USD Sequencer export now supports deltas Change 4227455 by Matt.Hoffman Adds support to the Audio Mixer Submix to pause and resume a recording. #jira UESEQ-77 Change 4230963 by Patrick.Boutot Make the namespace an import option Change 4234208 by Jon.Nabozny Fixed crash when 5 or more LiveLink sources were connected at the same time Change 4234273 by Jon.Nabozny Add methods in FApp to get the current Timecode FrameRate. Change 4237170 by Simon.Therriault MediaCapture Fix for MediaCapture panel not working in PIE Change 4243758 by Andrew.Rodham It's now possible to resolve pixel data from a render target whose texture resource is still pending creation Change 4244790 by Matt.Hoffman This adds experimental support to Sequencer's Render to Movie for exporting audio via rendering a second pass. This requires the new audio mixer (launch editor with "-audiomixer") and currently supports exporting to .wav. The second pass disables rendering in the Viewport and disables capturing frames during this pass which removes the overhead caused by rendering the scene. Complex scenes still evaluate the sequence which may impact performance in complex situations (such as the Fortnite Launch Trailer). Current Limitations: Requires the new audio mixer ("-audiomixer") The second pass must acheive real time framerates. The audio engine is only built to handle real time situations (due to the high precision needed, gotten via the platform clock) so any drops in engine framerate during the second pass will cause a desync of the audio (as there will be more samples captured than frames of video). The editor has significant overhead which often prevents achieving consistent real-time rates. Using "Capture in New Process" alleviates this issue, even without closing the Editor. Audio has been enabled for both image capture and audio capture passes, which means stuttery audio now plays back during image capture. Attempts to alleviate this issue ended up conflicting with some editor code that forces the audio multiplier to 1.0 each Tick(), so audio has to play on both image and audio passes. Forces background audio (otherwise your output audio wav will be blank!) when app is not in focus, though users should leave the app in focus for best performance. #jira UESEQ-77, UESP-669 Change 4246443 by Simon.Tourangeau Remove Beta flag from nDisplay plugin #jira UEENT-1716 Change 4246480 by Simon.Tourangeau Fix nDisplay plugin icon #jira UEENT-1715 Change 4246571 by Simon.Tourangeau Merging Lauren's VR Editor fixes 4085915 Gamma correction fixes for VR Mode Content Browser icons and camera previews 4087955 Adding a third looping option to the Sequencer Radial Menu. Selecting the Looping option now cycles through No Looping > Loop All > Loop Range 4089914 Adding set start/end range buttons to radial menu 4090502 Fixing sequencer looping not being set correctly 4092824 Cameras are now visible in VR Mode - interim implementation until Game Mode works entirely 4095161 Fix for opening a sequence blocking level editor tab drag and drop 4096999 Making a VR Edit show flags mode that is similar to Game Mode but without the Game flag set to true, does hide billboards. Camera hide/show behavior is now correct. 4097286 Placing cameras now only summons the preview panel once you release 4100941 New spawn location for camera preview window (in front and to the side, on whichever side matches your UI hand) 4102732 Hiding VR editor elements from camera preview 4103378 Added camera burnin text on preview windows as well. 4103466 Fixes for camera text 4103779 Fix for the actor previews not unpinning when entering VR mode. 4105722 Adding support for multiple viewport previews in VR mode, and not creating a new viewport interaction if one already exists when getting it. 4106982 Any dockable window can now be placed in the world. 4107298 Fix for crash when closing multiple camera previews 4107426 Fix for crash when connecting node with no texture set 4136343 UI windows docked "to the world" no longer scale with you and stay the size they are docked at. 4136345 Settings for tweaking VR mode movement 4147473 Fix for controllers not showing up 4147734 Sequencer scrubbing will now pause when removing your thumb from a Vive touchpad 4171489 Added external UI panel support to VREditor module. Created an example camera-adjusting UI 4186392 Second fix for sequencer scrubbing on the radial menu Change 4247984 by Jamie.Dale Fixed potential memory corruption caused by Python glue code generation #jira UE-62397 Change 4255471 by Anousack.Kitisa Added functionalities to add/insert/remove UV channel from a StaticMesh accessible through the StaticMeshEditor and scripting. #jira UEENT-1592 #jira UEENT-1597 #jira UEENT-1660 Change 4256323 by Anousack.Kitisa Added Polygon Selection Mode by smoothing group in the MeshEditor. #jira UEENT-1594 Change 4258012 by Homam.Bahnassi Extending UVEdit material function to support mirroring. #jira UE-57306 Change 4258231 by Jamie.Dale Fixed GetHostName failing to convert UTF-8 data correctly Change 4258579 by Jamie.Dale Ensure that packages re-created after deleting their only asset are marked as fully loaded Change 4258652 by Jamie.Dale Added script exposed method to convert an Unreal relative path to absolute Change 4259124 by Patrick.Boutot For MediaBundle, show or hide the failed texture on console. #jira UE-61672 Change 4259264 by Jamie.Dale Show an error if trying to use ExecutePythonScript without Python enabled #jira UE-62318 Change 4259451 by Jamie.Dale No longer use stale subtitles in dialogue waves #jira UE-61500 Change 4259511 by Jamie.Dale Fix crash when passing None as the class for find/load_asset #jira UE-62130 Change 4259542 by Patrick.Boutot Can select the TimecodeSynchronizer from the Toolbar menu. Add option to show it in the toolbar. Can be defaulted by user/machine. Change 4259582 by Patrick.Boutot Hide Edit & Paste from PropertyMenuAssetPicker Change 4260760 by Max.Chen Sequencer: Fix dereferencing null pointer - CameraNode Change 4260895 by Jamie.Dale Changing localization target settings now updates the gather INI files immediately Change 4262166 by Patrick.Boutot Add support for MediaSourceProxy and MediaOutputProxy. Change 4262535 by Andrew.Rodham Sequencer: Added a method for user-defined capture protocols to resolve a buffer and pass it directly to a bound delegate handler Originating source CL#4261391 Change 4262669 by Patrick.Boutot Add MediaProfile. It let the user select their media sources and media outputs by machine by user. Change 4264577 by Patrick.Boutot Change the type of FMediaFrameworkCaptureCameraViewportCameraOutputInfo.LockedCameraActors to LazyObject to enable cross level reference. #jira UE-62438 Include dependence to settings Change 4265750 by JeanLuc.Corenthin Fix array's size issues with MeshDescription utility functions #jira UEENT-1574 Change 4268181 by Patrick.Boutot Mark LockedCameraActors as deprecated. [CL 4279869 by JeanMichel Dignard in Main branch]
2018-08-13 12:29:41 -04:00
//check(OutWedgeMap.Num() == MeshDescription->VertexInstances().Num());
}
}
/**
* Utility function used inside FStaticMeshBuilder::Build() per-LOD loop to populate
* the Sections in a FStaticMeshLODResources from PerSectionIndices, as well as
* concatenate all section indices into CombinedIndicesOut.
* Returned bNeeds32BitIndicesOut indicates whether max vert index is larger than max int16
*/
void BuildCombinedSectionIndices(
const TArray<TArray<uint32>>& PerSectionIndices,
FStaticMeshSectionArray& SectionsOut,
TArray<uint32>& CombinedIndicesOut,
bool& bNeeds32BitIndicesOut)
{
bNeeds32BitIndicesOut = false;
for (int32 SectionIndex = 0; SectionIndex < SectionsOut.Num(); SectionIndex++)
{
FStaticMeshSection& Section = SectionsOut[SectionIndex];
const TArray<uint32>& SectionIndices = PerSectionIndices[SectionIndex];
Section.FirstIndex = 0;
Section.NumTriangles = 0;
Section.MinVertexIndex = 0;
Section.MaxVertexIndex = 0;
if (SectionIndices.Num())
{
Section.FirstIndex = CombinedIndicesOut.Num();
Section.NumTriangles = SectionIndices.Num() / 3;
CombinedIndicesOut.AddUninitialized(SectionIndices.Num());
uint32* DestPtr = &CombinedIndicesOut[Section.FirstIndex];
uint32 const* SrcPtr = SectionIndices.GetData();
Section.MinVertexIndex = *SrcPtr;
Section.MaxVertexIndex = *SrcPtr;
for (int32 Index = 0; Index < SectionIndices.Num(); Index++)
{
uint32 VertIndex = *SrcPtr++;
bNeeds32BitIndicesOut |= (VertIndex > MAX_uint16);
Section.MinVertexIndex = FMath::Min<uint32>(VertIndex, Section.MinVertexIndex);
Section.MaxVertexIndex = FMath::Max<uint32>(VertIndex, Section.MaxVertexIndex);
*DestPtr++ = VertIndex;
}
}
}
}
} // namespace UE::Private::StaticMeshBuilder
void BuildAllBufferOptimizations(FStaticMeshLODResources& StaticMeshLOD, const FMeshBuildSettings& LODBuildSettings, TArray< uint32 >& IndexBuffer, bool bNeeds32BitIndices, TArray< FStaticMeshBuildVertex >& StaticMeshBuildVertices)
{
TRACE_CPUPROFILER_EVENT_SCOPE(BuildAllBufferOptimizations);
if (StaticMeshLOD.AdditionalIndexBuffers == nullptr)
{
StaticMeshLOD.AdditionalIndexBuffers = new FAdditionalStaticMeshIndexBuffers();
}
const EIndexBufferStride::Type IndexBufferStride = bNeeds32BitIndices ? EIndexBufferStride::Force32Bit : EIndexBufferStride::Force16Bit;
// Build the reversed index buffer.
if (LODBuildSettings.bBuildReversedIndexBuffer)
{
TArray<uint32> InversedIndices;
const int32 IndexCount = IndexBuffer.Num();
InversedIndices.AddUninitialized(IndexCount);
for (int32 SectionIndex = 0; SectionIndex < StaticMeshLOD.Sections.Num(); ++SectionIndex)
{
const FStaticMeshSection& SectionInfo = StaticMeshLOD.Sections[SectionIndex];
const int32 SectionIndexCount = SectionInfo.NumTriangles * 3;
for (int32 i = 0; i < SectionIndexCount; ++i)
{
InversedIndices[SectionInfo.FirstIndex + i] = IndexBuffer[SectionInfo.FirstIndex + SectionIndexCount - 1 - i];
}
}
StaticMeshLOD.AdditionalIndexBuffers->ReversedIndexBuffer.SetIndices(InversedIndices, IndexBufferStride);
}
// Build the depth-only index buffer.
TArray<uint32> DepthOnlyIndices;
{
BuildOptimizationHelper::BuildDepthOnlyIndexBuffer(
DepthOnlyIndices,
StaticMeshBuildVertices,
IndexBuffer,
StaticMeshLOD.Sections
);
if (DepthOnlyIndices.Num() < 50000 * 3)
{
BuildOptimizationThirdParty::CacheOptimizeIndexBuffer(DepthOnlyIndices);
}
StaticMeshLOD.DepthOnlyIndexBuffer.SetIndices(DepthOnlyIndices, IndexBufferStride);
}
// Build the inversed depth only index buffer.
if (LODBuildSettings.bBuildReversedIndexBuffer)
{
TArray<uint32> ReversedDepthOnlyIndices;
const int32 IndexCount = DepthOnlyIndices.Num();
ReversedDepthOnlyIndices.AddUninitialized(IndexCount);
for (int32 i = 0; i < IndexCount; ++i)
{
ReversedDepthOnlyIndices[i] = DepthOnlyIndices[IndexCount - 1 - i];
}
StaticMeshLOD.AdditionalIndexBuffers->ReversedDepthOnlyIndexBuffer.SetIndices(ReversedDepthOnlyIndices, IndexBufferStride);
}
// Build a list of wireframe edges in the static mesh.
{
TArray<BuildOptimizationHelper::FMeshEdge> Edges;
TArray<uint32> WireframeIndices;
BuildOptimizationHelper::FStaticMeshEdgeBuilder(IndexBuffer, StaticMeshBuildVertices, Edges).FindEdges();
WireframeIndices.Empty(2 * Edges.Num());
for (int32 EdgeIndex = 0; EdgeIndex < Edges.Num(); EdgeIndex++)
{
BuildOptimizationHelper::FMeshEdge& Edge = Edges[EdgeIndex];
WireframeIndices.Add(Edge.Vertices[0]);
WireframeIndices.Add(Edge.Vertices[1]);
}
StaticMeshLOD.AdditionalIndexBuffers->WireframeIndexBuffer.SetIndices(WireframeIndices, IndexBufferStride);
}
}