Files
UnrealEngineUWP/Engine/Source/Editor/LandscapeEditor/Private/LandscapeFileFormatRaw.cpp

177 lines
6.1 KiB
C++
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
#include "LandscapeFileFormatRaw.h"
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340) #lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3209340 on 2016/11/23 by Ben.Marsh Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h. Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms. * Every header now includes everything it needs to compile. * There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first. * There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h. * Every .cpp file includes its matching .h file first. * This helps validate that each header is including everything it needs to compile. * No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more. * You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there. * There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible. * No engine code explicitly includes a precompiled header any more. * We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies. * PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files. Tool used to generate this transform is at Engine\Source\Programs\IncludeTool. [CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
#include "HAL/FileManager.h"
#include "Misc/FileHelper.h"
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
#define LOCTEXT_NAMESPACE "LandscapeEditor.NewLandscape"
TArray<FLandscapeFileResolution> CalculatePossibleRawResolutions(int64 FileSize)
{
TArray<FLandscapeFileResolution> PossibleResolutions;
// Find all possible heightmap sizes, between 8 and 8192 width/height
const int32 MinWidth = FMath::Max(8, (int32)FMath::DivideAndRoundUp(FileSize, (int64)8192));
const int32 MaxWidth = FMath::TruncToInt(FMath::Sqrt(static_cast<double>(FileSize)));
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
for (int32 Width = MinWidth; Width <= MaxWidth; Width++)
{
if (FileSize % Width == 0)
{
FLandscapeFileResolution ImportResolution;
ImportResolution.Width = Width;
ImportResolution.Height = FileSize / Width;
PossibleResolutions.Add(ImportResolution);
}
}
for (int32 i = PossibleResolutions.Num() - 1; i >= 0; --i)
{
FLandscapeFileResolution ImportResolution = PossibleResolutions[i];
if (ImportResolution.Width != ImportResolution.Height)
{
Swap(ImportResolution.Width, ImportResolution.Height);
PossibleResolutions.Add(ImportResolution);
}
}
return PossibleResolutions;
}
FLandscapeHeightmapFileFormat_Raw::FLandscapeHeightmapFileFormat_Raw()
{
FileTypeInfo.Description = LOCTEXT("FileFormatRaw_HeightmapDesc", "Heightmap .r16/.raw files");
FileTypeInfo.Extensions.Add(".r16");
FileTypeInfo.Extensions.Add(".raw");
FileTypeInfo.bSupportsExport = true;
}
FLandscapeFileInfo FLandscapeHeightmapFileFormat_Raw::Validate(const TCHAR* HeightmapFilename, FName LayerName) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
FLandscapeFileInfo Result;
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
int64 ImportFileSize = IFileManager::Get().FileSize(HeightmapFilename);
if (ImportFileSize < 0)
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_HeightmapFileReadError", "Error reading heightmap file");
}
else if (ImportFileSize == 0 || ImportFileSize % 2 != 0)
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_HeightmapFileInvalidSize", "The heightmap file has an invalid size (possibly not 16-bit?)");
}
else
{
Result.PossibleResolutions = CalculatePossibleRawResolutions(ImportFileSize / 2);
if (Result.PossibleResolutions.Num() == 0)
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_HeightmapFileInvalidSize", "The heightmap file has an invalid size (possibly not 16-bit?)");
}
}
return Result;
}
FLandscapeImportData<uint16> FLandscapeHeightmapFileFormat_Raw::Import(const TCHAR* HeightmapFilename, FName LayerName, FLandscapeFileResolution ExpectedResolution) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
FLandscapeImportData<uint16> Result;
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
TArray<uint8> TempData;
if (!FFileHelper::LoadFileToArray(TempData, HeightmapFilename, FILEREAD_Silent))
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_HeightmapFileReadError", "Error reading heightmap file");
}
else if (TempData.Num() != (ExpectedResolution.Width * ExpectedResolution.Height * 2))
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_HeightmapResolutionMismatch", "The heightmap file's resolution does not match the requested resolution");
}
else
{
Result.Data.Empty(ExpectedResolution.Width * ExpectedResolution.Height);
Result.Data.AddUninitialized(ExpectedResolution.Width * ExpectedResolution.Height);
FMemory::Memcpy(Result.Data.GetData(), TempData.GetData(), ExpectedResolution.Width * ExpectedResolution.Height * 2);
}
return Result;
}
void FLandscapeHeightmapFileFormat_Raw::Export(const TCHAR* HeightmapFilename, FName LayerName, TArrayView<const uint16> Data, FLandscapeFileResolution DataResolution, FVector Scale) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
TArray<uint8> TempData;
TempData.Empty(DataResolution.Width * DataResolution.Height * 2);
TempData.AddUninitialized(DataResolution.Width * DataResolution.Height * 2);
FMemory::Memcpy(TempData.GetData(), Data.GetData(), DataResolution.Width * DataResolution.Height * 2);
FFileHelper::SaveArrayToFile(TempData, HeightmapFilename);
}
//////////////////////////////////////////////////////////////////////////
FLandscapeWeightmapFileFormat_Raw::FLandscapeWeightmapFileFormat_Raw()
{
FileTypeInfo.Description = LOCTEXT("FileFormatRaw_WeightmapDesc", "Layer .r8/.raw files");
FileTypeInfo.Extensions.Add(".r8");
FileTypeInfo.Extensions.Add(".raw");
FileTypeInfo.bSupportsExport = true;
}
FLandscapeFileInfo FLandscapeWeightmapFileFormat_Raw::Validate(const TCHAR* WeightmapFilename, FName LayerName) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
FLandscapeFileInfo Result;
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
int64 ImportFileSize = IFileManager::Get().FileSize(WeightmapFilename);
if (ImportFileSize < 0)
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_LayerFileReadError", "Error reading layer file");
}
else
{
Result.PossibleResolutions = CalculatePossibleRawResolutions(ImportFileSize);
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
if (Result.PossibleResolutions.Num() == 0)
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_WeightmapFileInvalidSize", "The layer file has an invalid size");
}
}
return Result;
}
FLandscapeImportData<uint8> FLandscapeWeightmapFileFormat_Raw::Import(const TCHAR* WeightmapFilename, FName LayerName, FLandscapeFileResolution ExpectedResolution) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
FLandscapeImportData<uint8> Result;
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
TArray<uint8> TempData;
if (!FFileHelper::LoadFileToArray(TempData, WeightmapFilename, FILEREAD_Silent))
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_LayerFileReadError", "Error reading layer file");
}
else if (TempData.Num() != (ExpectedResolution.Width * ExpectedResolution.Height))
{
Result.ResultCode = ELandscapeImportResult::Error;
Result.ErrorMessage = LOCTEXT("Import_LayerResolutionMismatch", "The layer file's resolution does not match the requested resolution");
}
else
{
Result.Data = MoveTemp(TempData);
}
return Result;
}
void FLandscapeWeightmapFileFormat_Raw::Export(const TCHAR* WeightmapFilename, FName LayerName, TArrayView<const uint8> Data, FLandscapeFileResolution DataResolution, FVector Scale) const
Copying //UE4/Dev-Landscape to //UE4/Dev-Main (Source: //UE4/Dev-Landscape @ 3053591) #lockdown nick.penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3016060 on 2016/06/16 by Gareth.Martin Fixed check being hit in AActor::InvalidateLightingCacheDetailed when building lighting with grass (cloned from 4.12) #jira UE-31766 Change 3016346 on 2016/06/16 by Gareth.Martin Fixed crash when editing landscape component properties and then clicking in the editor viewport (cloned from 4.12) #jira UE-32060 Change 3016366 on 2016/06/16 by Gareth.Martin Refactor Landscape Select / Mask tools so that they don't share a common brush stroke class - they had no common code, there was just a massive if statement in there selecting between the two behaviours Change 3017787 on 2016/06/17 by Gareth.Martin Added Copy/Transform Algos Change 3019479 on 2016/06/20 by Gareth.Martin Fix for user-reported crash in landscape circle brush (https://udn.unrealengine.com/questions/298966/crash-in-flandscapebrushcircletick.html) Change 3020927 on 2016/06/21 by Gareth.Martin Fixed "Obj in another map" error when packaging a project containing Landscape for Android #jira UE-32194 Change 3021318 on 2016/06/21 by Gareth.Martin Fixed crash in PIE while using Landscape Splines with bPlaceSplineMeshesInStreamingLevels #jira UE-32034 Change 3024769 on 2016/06/23 by Gareth.Martin Allow creation of transient objects during saving, as they wouldn't be saved anyway (and the slate font system did during autosave and hit this check) #jira UE-32194 Change 3026457 on 2016/06/24 by Gareth.Martin Fixed crash when setting landscape component collision mip to an invalid value while in collision viewmode (cloned from 4.12) #jira UE-32415 Change 3032336 on 2016/06/29 by Gareth.Martin Fixed a long-standing issue with undo/redo nulling lazy pointers - Two objects are created which reference each other with lazy object pointers (e.g. ULandscapeComponent and ULandscapeHeightfieldCollisionComponent) - Undo - During undo, the first object saves its state and restores itself to a deleted (pendingkill) state - the second object then tries to save its state, but as the other object is marked pending kill it fails to resolve its lazy ptr and saves null instead - Redo - Lazy ptr is restored to the saved null instead of the actual original value Change 3032818 on 2016/06/29 by Gareth.Martin Removed all use of deferred exec commands from the landscape code This solves numerous crashes during commandlets etc with landscape infos not being initialized because they don't tick the engine #jira UE-31654 #jira UE-29568 Notes: Split CreateLandscapeInfo from GetLandscapeInfo (removing the default-true bool param from GetLandscapeInfo in the process), so it only gets created where intended Removed some unused properties/functions, e.g. ULandscapeInfo::bIsValid, bCurrentlyEditing Removed legacy landscape world composition code General cleanup Change 3032820 on 2016/06/29 by Gareth.Martin File missing from CL 3032818 (P4! Grr) Change 3037033 on 2016/07/04 by Gareth.Martin Capitalised variable names in Algo::Accumulate at Core's request Change 3037035 on 2016/07/04 by Gareth.Martin Improved Algo::Accumulate when used with movable types (e.g. FString) Change 3037373 on 2016/07/05 by Gareth.Martin Added FText property handle type Change 3039183 on 2016/07/06 by Gareth.Martin Landscape data plugin API - part 1: Import Change 3042473 on 2016/07/08 by Gareth.Martin Landscape data plugin API - part 2: Re-Import Change 3042484 on 2016/07/08 by Jack.Porter Pull request from AndrewScheidecker https://github.com/EpicGames/UnrealEngine/pull/1279 and updated to 4.13. Adapted GetStaticBatchElementVisibility to support changing visibility of batches with a single element (for view-dependent culling of static mesh elements) Added GetStaticBatchElementShadowVisibility that allows culling static mesh elements when rendering shadow depths using information about the light ** Any user-created vertex factory that implements GetStaticBatchElementVisibility will need to set bRequiresPerElementVisibility on their FMeshBatch. #1279 Change 3044665 on 2016/07/11 by Gareth.Martin Renamed Engine/FixedSizeArrayView to Core/Containers/ArrayView Note: The new and improved TArrayView (as agreed with core team) is *not* const-propogating. const TArrayView<T> does not imply "const T" and will not bind to a const TArray! You want TArrayView<const T> Change 3045936 on 2016/07/12 by Gareth.Martin Worked around Visual Studio 2013 bug with the new TArrayView #jira UE-33037 Change 3045964 on 2016/07/12 by Gareth.Martin Fix "cannot find shader" crash when using landscape with XY offsets #jira UE-33042 Change 3046311 on 2016/07/12 by Gareth.Martin Landscape data plugin API - part 3: Tiled landscapes Change 3047701 on 2016/07/13 by Gareth.Martin Landscape data plugin API - cleanup Change 3047894 on 2016/07/13 by Gareth.Martin Landscape data plugin API - part 4: Support inherent scale in landscape heightmap formats Change 3049656 on 2016/07/14 by Gareth.Martin Landscape data plugin API - Fix right-click layer import option to show plugin filetypes in the file selector Change 3050073 on 2016/07/14 by Gareth.Martin Update sequence recorder to new TArrayView following merge from main Change 3050096 on 2016/07/14 by Gareth.Martin Landscape data plugin API - part 5: Export! Change 3051521 on 2016/07/15 by Gareth.Martin Landscape data plugin API - part 6: Finishing up Change 3051783 on 2016/07/15 by Gareth.Martin Fixed the landscape info map not being transacted correctly, resulting in a crash if you undo the deletion of a landscape #jira UE-33291 Change 3053322 on 2016/07/18 by Gareth.Martin Fix landscapes not being registered correctly with their landscape info when hiding/showing them in world composition #jira UE-33346 Change 3053513 on 2016/07/18 by Jack.Porter Added LANDSCAPE_API to Landscape MaterialExpression classes #jira UE-25145 #1927 Change 3053591 on 2016/07/18 by Gareth.Martin Attempt to fix VS 2013 ICE #jira UE-33382 [CL 3053789 by Gareth Martin in Main branch]
2016-07-18 11:58:33 -04:00
{
FFileHelper::SaveArrayToFile(Data, WeightmapFilename);
}
#undef LOCTEXT_NAMESPACE