Overview of blueprint Compilation
I. Terms
Blueprint, similar to the C ++ language, must be compiled before being used in the game. When you click the compile button in the BP editor, the BP resource starts to convert the attribute and legend process into a class object for processing.
1. fkismetcompilercontext
This class is used for compilation. Each compilation generates a new instance. Save the compiled class and BP.
2. fkismetfunctioncontext
Saves information for a function, such as graph reference, attributes, and ufunction generation.
3. fnodehandlingfunctor
A help class is used to process nodes of a class in the compiler (Singleton. Contains the registration pin link generated by the function to generate the compilation status.
4. fkismetcompiledstatement
The compiler converts the node to the compiled state, and the backend converts it to a bytecode operation.
5. fkismetterm
The device of the legend, including literal, const, and variable reference ). Each data pin is connected to one of them. Of course, you can use nodehandlingfunctor to customize variables or intermediate results.
Ii. compilation process
The basic process is as follows:
The steps in orange are only available in full compilation.
Abbreviations:
Class default object (CDO)
Cleanup class
The class uses ublueprintgeneratedclass to generate objects, which are cleared and used repeatedly. the pointer does not have to be processed by ue4. The cleanandsanitizeclass function is used to erase function attributes and functions and initialize class objects. (Because the Class Object pool used by ue4 does not delete the class object, it replaces the old one with a new one each time ).
Create class attributes
Compile and iterate to find all uproperites required by the class through the newvairable array of the blueprint and other places (build scripts, etc.), and then use the createclassvariablesfromblueprint function to create uproperties within the uclass range. (First find the properites identifier, and then use the function to create the attribute ).
Create Function list
The compiler uses event graphs to create a function list. Each content calls the precompilefunction () function to construct a normal function diagram and pre-compiled function.
Process event charts
Use createandprocessubergraph () to implement the processing. This function copies all event charts to a big chart. After determining which nodes can be extended, it creates an event node for each function and fkismetfunctioncontext for each event chart.
Process function charts
You can use the processonefunctiongraphprocessing function to process regular function charts. This function copies each chart to a temporary chart to facilitate expansion. Create fkismetfunctioncontext for each function chart.
Pre-compiled Functions
Precompilefunction () is a pre-compiled function. The procedure is as follows:
· Dependency between execution list and computing data
· Change nodes without timelines or data dependencies.
· Run the node's registernets () function
· Create fkismetterms for function pinch values
· Create ufunction and associated attributes
Binding and link
The compiler perceives all uproperties and uproperties of the class, and binds and links to the class, including the property relationship, property size, and function ing. In this case, it is actually a default class object without final metadata.
Compile Functions
The next step is to use the node handle compile () function and the appendstatementfornode () function to generate the fkismetcompiledstatment object for the remaining nodes. (That is, the status object generated ). The appendstatementfornode function can also create a fkmismet object for local use.
Complete Compilation class
To finish compiling the class, compiler finalizes the class flags and propagates flags and metadata from the parent class before finally known a few final checks to make sure everything went alright in the compile.
Before the final compilation, make sure that all the checks are correct. The Compiler confirms the Class Identifier, propagation identifier, and metadata from the parent class.
Generate code
Backends converts the status of each function content to code. Use two backends:
· Fkismetcompilervmbackend-converts fkcs to an illusory Virtual Machine script byte stream. The byte stream is serialized as a function script array.
· Fkismetcppbackend-generate class C ++ code for debugging.
Copying default Object Attributes
Using the copypropertiesforunrelatedobjects () function, the compiler copies the value of the old default object to the new CDO. Property copying is serialized by tags, and can be correctly converted if the names are consistent. In this phase, the CDO component re-creates the instance and makes appropriate modifications. The generatedclass CDO is authoritative.
Rebuilding an instance
Because the class size or attribute will increase or decrease, the compiler needs to recreate the instance each time it compiles. During the process, tobjectiterator is used to locate all the class instances. When a new class is generated, the copypropertiesforunrelatedobjects function is used to copy the old instance to the new instance.
For details, see the fblueprintcompilereinstancer class.
====================
Address: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/TechnicalGuide/Compiler/index.html
Beginner translation, sincere and sincere! If you have any shortcomings, please provide more guidance!
Thank you!
Blueprint compilation process