I’m working on documenting the property system. It’s following a “book” format, so the whole concept gets a bit of an introduction before I get to the meatier technical parts. Just wondering if anyone is interested based on what I’ve wrote so far. The next step in my writing will be to dig into the sources and start documenting everything discussed so far.
Unreal Property System - Overview
Programs written in Java and .Net have a built-in ability to self-reflect on themselves at runtime, programs written in the C++ language do not, they need this functionality implemented manually. Unreal Engine 4 (UE4) implements reflection as the underlying mechanism driving its Property System. At compile-time markup embedded in the C++ preprocessor generates source files that provide the Property System with reflection data.
When you build your project the Unreal Header Tool (UHT) will parse over your sources and automatically generate reflected types based on markup it finds therein. Deciding how to markup the sources themselves is a bit more involved. To reflect a type some markup is required, some is optional, and some depends on the existence of other markup. The important thing is that both your markup and what you markup will be reflected in the generated source.
What we need to remember, then, is the cause and effect relationship between the input and output of the Unreal Header Tool. The input in this case is marked up C++, the output is the headers generated from parsing it. The documentation leaves the meaning of the markup a bit ambiguous and the output itself is an illegible rats nest of preprocessor “magic”, it’s not impossible to read, but not far from it. The good news is that each markup type maps directly to a member of a hand written C++ class hierarchy. By reading these sources we can discern what functionality is gained by marking up or C++, that is, by making our classes visible to the Property System.