x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to extend the ALandscape class?

I am trying to extend the ALandscape class. When I try to build just a blank class that the editor generates it throws a lot of errors complaining about virtual functions. I want to know if I should spend my time trying to figure out all of the virtual functions or is there a better method for doing this or another class I should be extending instead?

Thank you!

DAS JOE

Product Version: UE 4.9
Tags:
more ▼

asked Nov 05 '15 at 11:06 PM in C++ Programming

avatar image

Averagejoe
28 2 6 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey man, not sure if you're still trying this as it's been a while, but I'm trying to do the same thing (i.e Extend Landscape for my own purposes).

What I find is that all those linker errors are generated because those functions have been declared in their respective base classes but they lack a definition that isn't wrapped by the "IF_WITH_EDITOR" tag/macro/whatever If you look around, you can see that these functions do actually have definitions, but they're scattered around the Landscape classes and wrapped with the aforementioned tag. I believe that during compilation of the project the editor strips out these functions and does not include them in the compiled code, hence causing the linker errors.

I find that these functions are often actually inherited from a higher level base class, like AActor and thus are vital editor related functionality like EditorApplyScale/EditorApplyTranslation etc.

In essence, these functions NEED to be defined in some cases so that the editor knows what to do with your object. So there's no real choice except to comb through them and see which are necessary to your purpose, which are necessary to the editor and then copy/alter the definitions to your own Actor thats extending the Landscape class.

There will also be some that you probably won't need or care about, and I guess these can be left with a blank body. They will definitely NEED a body of some sort though, so watch out for that!

And further on, I'm sure this messing about will break some functionality, so make sure to be rigorous in your checking of what broke/didn't break.

Good luck! Hope this was helpful to someone.

EDIT :

After some searching, I found out that another issue with all the landscape classes, is that they are marked as MINIMAL_API, which means that in order to improve compilation times for these classes, only type information is exported and there is no access allowed to functions or variables.

Basically, if you are trying to mess with the Landscape classes on a binary version of the engine, you might as well give up.

If you feel daring, and want to try messing with the source code of the engine in order to strip these tags out and recompile the editor/engine from source, it is possible, but I believe that at this time, especially if you are a solo developer(which I am) or on a small team, you might be better off trying to find other solutions to the problem of dynamic terrain.

Solutions that don't involve extending the ALandscape classes. Perhaps the FProceduralMeshComponent classes might be of interest to you?

In either case, I hope this helped someone!

more ▼

answered May 24 '16 at 11:03 PM

avatar image

Nightmask3
57 6 11 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question