Download

Need plugin help with Landscape as input parameter

I’m trying to write a plugin that will create a custom Blueprint node so I can return Landscape information like number of components, resolution, and hopefully blend amounts from the layer info. I did not find a way to get this information from the built-in Blueprint nodes so I’m assuming I’ll need to write my own. However, I’m running into trouble with ALandscape.

I’m getting a compiler error “Unrecognized type ‘ALandscape’”.

MyPlugin.cpp



#include "MyPlugin.h"

IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, MyPlugin, "MyPlugin" );

UMyPlugin::UMyPlugin( const FObjectInitializer& ObjectInitializer ) : Super(ObjectInitializer){
}

bool UMyPlugin::LandscapeGetInfo( ALandscape* TheLandscape ){
	return true;
}


MyPlugin.h



#pragma once
#include "Engine.h"
#include "Runtime/Landscape/Classes/Landscape.h"
#include "MyPlugin.generated.h"

UCLASS()
class MYPLUGIN_API UMyPlugin : public UBlueprintFunctionLibrary {
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category = "MyPlugin")
	static bool LandscapeGetInfo( ALandscape* TheLandscape );
};


I also tried changing the code so AActor was the input argument and then try to cast AActor to ALandscape within the function. Like so:



bool UMyPlugin::LandscapeFunction2( AActor* landscapeActor ){
	ALandscape* theLandscape = Cast<ALandscape>(landscapeActor);
	return true;
}


But this gave me this error: “c:\program files\unreal engine\4.7\engine\source\runtime\landscape\classes\LandscapeInfo.h(4): fatal error C1083: Cannot open include file: ‘LandscapeInfo.generated.h’: No such file or directory.”

It is true that LandscapeInfo.generated.h does not exist and is being reference from LandscapeInfo.h. Am I supposed to be building this file somehow?

I’m using v4.7.3. What am I doing wrong?

Did you add the “Landscape”-Module to your modules list in your plugin settings (the .build.cs-file)?

https://docs.unrealengine.com/latest/INT/API/Runtime/Landscape/ALandscape/index.html

Every C++ class has a connected module which can be found at the end of the documentation page and there you will need Landscape.

Yes, that was it. I didn’t realize I had to do that. Thanks.