I need to use a method that improt Landscape data from png file. The method is in this file C:\Program Files (x86)\Epic Games\4.13\Engine\Source\Editor\LandscapeEditor\Private\LandscapeFileFormatPng.cpp.
As you can see is in the private folder. Is there a way to use it? Or you know a similar usable method that do the same things?
In your .Build.cs, you can add a dependency on the LandscapeEditor and get access to it’s private methods.
Simply add LandscapeEditor to your PrivateIncludePathModuleNames and PrivateDependencyModuleNames lists, regenerate your solution, and you should be good to go.
It works but now I got this error from LandscapeFileFormatInterface.h from the engine file. That’s weird.
I’d see what that line is trying to do. You may need to go look at LandscapeEditor.build.cs and see if it has some special dependency you need to bring over as well.
And you’re using UE 4.13 (enum stuff changed in 4.15)? What version of visual studio are you using?
visual studio version is 14.0.25431.01 and the UE version is 4.13
I have clean and rebuild and I include in the cpp file. It’s very weird.
That code seems fine. are you including this file in a header (.h) or source file(.cpp)? Have you tried a clean/rebuild (I know they aren’t fun)?
Yea that’s super weird. Last thought I have is search through the code for LandscapeFileFormatInterface.h and see if it required any special include order or whatever when it was included elsewhere.
It looks like it’s complaining about something in the struct before the enum ( maybe the TInlineAllocator), I’d manually include that allocator before the interface.h and see what you get.
Sorry I don’t understand about the allocator thing. What do you mean?
I don’t think there is way to do it without moving LandscapeFileFormatPng.h file to public and effectively modifying the engine. In order for function be linkable with mobule dll it need to be declared inside file in public folder, in private contains files for internal use only. Maybe there ways to access functionality of those function somewhere else?
I went and took a look and that header file is in the public folder. Have you tried adding LandscapeEditor to your PubicDependencyModuleNames in your .Build.cs (keep the private dependency as well)?
Now I’ve change version. I’m using the 4.15 and it works when I include. But when I use try to use the class it get this error
I don’t know I’ve never use engine class method
That’s the linker saying it can’t find the code for that class (which is in the private folder). Looking at a similar examples in the code (Landscape.Build.cs and AssetTools.Build.cs), it looks like you just need to add it to your PrivateIncludePathModulesNames and that should be it.
I think I see your problem. Leave LandscapeEditor in the PrivateDependencyModuleNames. Remove it from the other places.
Then add this line:
PrivateIncludePathModuleNames.Add(“LandscapeEditor”);
Notice this is different than PrivateIncludePaths and is specifically for adding private includes from another module.
Never mind. I’m an idiot. I see the issue.
FLandscapeHeightmapFileFormat_PNG isn’t exported so you can’t use it outside of the LandscapeEditor module.
The only way to change that would be to edit LandscapeHeightmapFileFormat_Png.h and add LANDSCAPEEDITOR_API to the class so it gets exported, then rebuild the engine.
I. E.
// In LandscapeHeightmapFileFormat_Png.h
class LANDSCAPEEDITOR_API FLandscapeHeightmapFileFormat_Png ...
If you’re building from source (GitHub). Sure. Not sure what else will fall out from that change but it should be okay, and that’s the only way.