Download

How to add a class derived from ALandScape class

I cannot add a based landscape class that derives it’s parent from the main landscape class.
I want to have access to the landscape module so I want to have a landscape tyoe of class.
So here is an image, it’s possible to create.

Why is it possible to add if it does not work ?
They say landscape and landscape proxy are classes with minimal api support ?
Is there no way to get access to landscape module API with any class ?

When the class is created the class does not validate and throws multiple errors.
I looked around, added it to the build.cs module, some said to do that because it does not know about the landscape module.

PrivateDependencyModuleNames.AddRange(new string[] {
“OnlineSubsystem”,
“OnlineSubsystemUtils”,
“Landscape”,
“LandscapeEditor”,
“Steamworks”});

Could I do the same with a regular AActor class(MyActor) basic type of class, does it have access to the Landscape module ?

Here are the errors, to note the class has no code in it added, it’s blank, so I haven’t added anything. It generates errors uppon trying to create the class after it finishes it gives these errors.

CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2019: unresolved external symbol “public: __cdecl ALandscapeProxy::ALandscapeProxy(class FObjectInitializer const &)” (??0ALandscapeProxy@@QEAA@AEBVFObjectInitializer@@@Z) referenced in function “public: __cdecl AMyLand::AMyLand(class FObjectInitializer const &)” (??0AMyLand@@QEAA@AEBVFObjectInitializer@
@@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: __cdecl ALandscapeProxy::ALandscapeProxy(class FObjectInitializer const &)” (??0ALandscapeProxy@@QEAA@AEBVFObjectInitializer@@@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2019: unresolved external symbol “public: virtual __cdecl ALandscapeProxy::~ALandscapeProxy(void)” (??1ALandscapeProxy@@UEAA@XZ) referenced in function “public: virtual __cdecl AMyLand::~AMyLand(void)” (??1AMyLand@@UEAA@XZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual __cdecl ALandscapeProxy::~ALandscapeProxy(void)” (??1ALandscapeProxy@@UEAA@XZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeLODDistanceFactor(float)” (?ChangeLODDistanceFactor@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeLODDistanceFactor(float)” (?ChangeLODDistanceFactor@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeTessellationComponentScreenSize(float)” (?ChangeTessellationComponentScreenSize@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeTessellationComponentScreenSize(float)” (?ChangeTessellationComponentScreenSize@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeComponentScreenSizeToUseSubSections(float)” (?ChangeComponentScreenSizeToUseSubSections@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeComponentScreenSizeToUseSubSections(float)” (?ChangeComponentScreenSizeToUseSubSections@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeUseTessellationComponentScreenSizeFalloff(bool)” (?ChangeUseTessellationComponentScreenSizeFalloff@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeUseTessellationComponentScreenSizeFalloff(bool)” (?ChangeUseTessellationComponentScreenSizeFalloff@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeTessellationComponentScreenSizeFalloff(float)” (?ChangeTessellationComponentScreenSizeFalloff@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::ChangeTessellationComponentScreenSizeFalloff(float)” (?ChangeTessellationComponentScreenSizeFalloff@ALandscapeProxy@@UEAAXM@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostRegisterAllComponents(void)” (?PostRegisterAllComponents@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostRegisterAllComponents(void)” (?PostRegisterAllComponents@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::UnregisterAllComponents(bool)” (?UnregisterAllComponents@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::UnregisterAllComponents(bool)” (?UnregisterAllComponents@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::BeginDestroy(void)” (?BeginDestroy@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::BeginDestroy(void)” (?BeginDestroy@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::IsReadyForFinishDestroy(void)” (?IsReadyForFinishDestroy@ALandscapeProxy@@UEAA_NXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::IsReadyForFinishDestroy(void)” (?IsReadyForFinishDestroy@ALandscapeProxy@@UEAA_NXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::FinishDestroy(void)” (?FinishDestroy@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::FinishDestroy(void)” (?FinishDestroy@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::Destroyed(void)” (?Destroyed@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::Destroyed(void)” (?Destroyed@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::EditorApplyScale(struct FVector const &,struct FVector const *,bool,bool,bool)” (?EditorApplyScale@ALandscapeProxy@@UEAAXAEBUFVector@@PEBU2@_N22@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::EditorApplyScale(struct FVector const &,struct FVector const *,bool,bool,bool)” (?EditorApplyScale@ALandscapeProxy@@UEAAXAEBUFVector@@PEBU2@_N22@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::EditorApplyMirror(struct FVector const &,struct FVector const &)” (?EditorApplyMirror@ALandscapeProxy@@UEAAXAEBUFVector@@0@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::EditorApplyMirror(struct FVector const &,struct FVector const &)” (?EditorApplyMirror@ALandscapeProxy@@UEAAXAEBUFVector@@0@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditMove(bool)” (?PostEditMove@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditMove(bool)” (?PostEditMove@ALandscapeProxy@@UEAAX_N@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::ShouldImport(class FString *,bool)” (?ShouldImport@ALandscapeProxy@@UEAA_NPEAVFString@@_N@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::ShouldImport(class FString *,bool)” (?ShouldImport@ALandscapeProxy@@UEAA_NPEAVFString@@_N@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::ShouldExport(void)” (?ShouldExport@ALandscapeProxy@@UEAA_NXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual bool __cdecl ALandscapeProxy::ShouldExport(void)” (?ShouldExport@ALandscapeProxy@@UEAA_NXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::TickActor(float,enum ELevelTick,struct FActorTickFunction &)” (?TickActor@ALandscapeProxy@@UEAAXMW4ELevelTick@@AEAUFActorTickFunction@@@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::TickActor(float,enum ELevelTick,struct FActorTickFunction &)” (?TickActor@ALandscapeProxy@@UEAAXMW4ELevelTick@@AEAUFActorTickFunction@@@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl ALandscapeProxy::ShouldTickIfViewportsOnly(void)const " (?ShouldTickIfViewportsOnly@ALandscapeProxy@@UEBA_NXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl ALandscapeProxy::ShouldTickIfViewportsOnly(void)const " (?ShouldTickIfViewportsOnly@ALandscapeProxy@@UEBA_NXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PreSave(class ITargetPlatform const *)” (?PreSave@ALandscapeProxy@@UEAAXPEBVITargetPlatform@@@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PreSave(class ITargetPlatform const *)” (?PreSave@ALandscapeProxy@@UEAAXPEBVITargetPlatform@@@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::Serialize(class FArchive &)” (?Serialize@ALandscapeProxy@@UEAAXAEAVFArchive@@@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::Serialize(class FArchive &)” (?Serialize@ALandscapeProxy@@UEAAXAEAVFArchive@@@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostLoad(void)” (?PostLoad@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostLoad(void)” (?PostLoad@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditChangeProperty(struct FPropertyChangedEvent &)” (?PostEditChangeProperty@ALandscapeProxy@@UEAAXAEAUFPropertyChangedEvent@@@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditChangeProperty(struct FPropertyChangedEvent &)” (?PostEditChangeProperty@ALandscapeProxy@@UEAAXAEAUFPropertyChangedEvent@@@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditImport(void)” (?PostEditImport@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl ALandscapeProxy::PostEditImport(void)” (?PostEditImport@ALandscapeProxy@@UEAAXXZ)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UMaterialInterface * __cdecl ALandscapeProxy::GetLandscapeMaterial(signed char)const " (?GetLandscapeMaterial@ALandscapeProxy@@UEBAPEAVUMaterialInterface@@C@Z)
CompilerResultsLog: Error: MyLand.gen.cpp.obj : error LNK2001: unresolved external symbol "public: virtual class UMaterialInterface * __cdecl ALandscapeProxy::GetLandscapeMaterial(signed char)const " (?GetLandscapeMaterial@ALandscapeProxy@@UEBAPEAVUMaterialInterface@@C@Z)
CompilerResultsLog: Error: MyLand.cpp.obj : error LNK2001: unresolved external symbol

ALandscape is marked with MinimalAPI (something like: visible but unreachable) specifier and is practically editor-only class.

Emaer, then why others can get functions, vars from it ?

(Unreal Engine 4 Scripting with C++ Cookbook - William Sherif, Stephen Whittle - Google Books)
Here is an example where it uses arrays from the class derived from that class, it uses it to cast not only get landscapes, there are other tutorials where it is used to set the landscapes after being modified, all by C++ code. All these calls are made from this landscape class that has all these things.

So maybe it’s not so minimal and minimal may not mean impossible to get.
So I thought that maybe it was not minimal long ago, and these manuals are older.

Anyway someone told me that minimal api does not mean that I cannot get things from it, but I don’t know if he was right.

Okay so ask your self this, why have it on the doc page, the functions vars to use, they list it and then say sorry it’s minimal api, you can’t use it but we just displayed it here just for show.

If I get it to work and it does not return anything I want, then I’m going to use runtime mesh component, seems more decent than PMC.

I wanted to create dynamic layers for the landscape format to see how far I can go with that, but with a solid layer at the bottom, the main layer and on top these layers.

MinimalAPI description says: Causes only the class's type information to be exported for use by other modules. The class can be cast to, but the functions of the class cannot be called

Because it is still worth for people who want to make editor(not runtime) plugins.

Depends on your requirements you have two choices:
1.) write editor extension plugin based on ALandscape
2.) write your own landscape system based on PMC/RMC.

I’m going to take your advice but still look around, you may be right for the most part but there is maybe a gate where I can somehow get vars and functions.

1.) write editor extension plugin based on ALandscape
2.) write your own landscape system based on PMC /RMC .

Number two yay, but PMC has only some size, I don’t think you can extend it beyond that size, maybe RMC you can go with the size as much as you want ?

That is I think the main problem and why I wanted the landscape module.

PMC is a real bad option, it’s made if you want to build objects , it’s not intended for terrain I think, tho you can make small terrain with it, people said it’s size is a problem, it has a limited size.

Look here emaer.

Houdini technology system base line (C): UE4 Landscape Component of the next multi-selection support (titanwolf.org)

They use stuff like SetHeightData search for it in their CPP.

Now on to :slight_smile: FLandscapeEditDataInterface::SetHeightData | Unreal Engine Documentation

As you can see it’s a function that is part of the landscape class

So they are using the landscape data inside their Cpp file.
You see they some how got access to the Landscape module but it links to landscapeedit.h
Maybe landscapedit is not minimal api ? just a thought.

Look what it says in the docs page.
Remarks
Heightmap access
Exactly what I need with my png file. :crossed_fingers:

I don’t understand this module, it has many classes, landscapeedit.h class is part of the main landscape.h class ?

It’s include is.
#include “LandscapeEdit.h”

The docs page
FLandscapeEditDataInterface::SetHeightData | Unreal Engine Documentation

| — | — |
|Header|/Engine/Source/Runtime/Landscape/Public/LandscapeEdit.h|
|Include|#include “LandscapeEdit.h”|
|Source|/Engine/Source/Runtime/Landscape/Private/LandscapeEditInterface.cpp|

Syntax

void SetHeightData
(
int32 X1,
int32 Y1,
int32 X2,
int32 Y2,
const uint16 * InData,
int32 InStride,
bool InCalcNormals,
const uint16 * InNormalData,
const uint16 * InHeightAlphaBlendData,
const uint8 * InHeightRaiseLowerData,
bool InCreateComponents,
UTexture2D * InHeightmap,
UTexture2D * InXYOffsetmapTexture,
bool InUpdateBounds,
bool InUpdateCollision,
bool InGenerateMips
)

Remarks

Heightmap access

Yes. Because this is for editor.

This is FLandscapeEditDataInterface class. Defined in LandscapeEdit.h. Whole content of this file is guarded with WITH_EDITOR macro.

Like I said before. You can use anything from the Landscape module, but only in the editor builds.
Any code that uses functions from Landscape must be wrapped by the WITH_EDITOR macro. This means that code will be kicked off from the shipped version of game.

Sadly you are right yes, it’s the edit version.
So how can I extend this in my CPP file ? to make it work.
As I understand it’s for the editor interface with the import interface it has on heightmaps and so on, the actually import interface where you import image, load layers all in editor, but there must be a way to extend it to cpp

Here is a pice of code I found tho this function is depreciated and might not work in favour of the new one as you can see I got it from a cpp file

LandscapeEditorUtils::SetHeightmapData( landscape, Data );
ULandscapeInfo::RecreateLandscapeInfo( GetWorld(), 1 );

You are right Emaer, I can not make use of SetHeightData.
I try to inlcude the landscapeEdit.h in my header file then it says it’s missing the foliage header, because landscapeEdit.h contains it’s self an include to some foliage.h header file , strange it’s not in the same folder with it, with this foliage header, I checked where the LandscapeEdit.h is and there is no foliage file with it in the same folder but elsewhere.

I compiled with out errors to get landscape data so this I managed to do to get the array so I can set some values to it, but now I need to set height map to it and this is the only thing they have to setheightdata, but that is not part of Landscape.h but LandscapeEdit.h.

I was right, the module moved, it’s a new module with a new runtime, why I could pass code in, I just had to update my include file path towards the new location of the header file , the runtime location.

Now how to set hight map lol