this change introduces enforcement of 'const-correctness' into implemented function graphs.
summary:
if you have a function declared in C++ like this:
UFUNCTION(BlueprintImplementableEvent)
int32 MyFunctionThatReturnsSomeValue() const;
if you implement that (BPIE) function in a Blueprint that's parented to that native class, it will now be flagged as 'const'. this makes any properties of 'self' read-only within the context of that graph, which means the compiler will emit an error if you try to set a property or otherwise call a non-const, non-static function with 'self' as the target.
if there happens to already be an implemented const function in a Blueprint that was in place prior to this change, the compiler will emit a warning instead of an error, in order to allow existing Blueprints that may currently be "violating" const within the context of a const BPIE function to still compile, while still alerting to issues that should probably be addressed.
notes:
1) this also applies to BlueprintNativeEvent (BPNE) implementations, and also when implementing BPIE/BPNE interface methods that are also declared as const
2) a const BPIE/BPNE function with no return value and no output parameters will be implemented as a "normal" impure function, and not as an event as in the non-const case
3) a const BPIE/BPNE function with a return value and/or output parameters will currently be implemented as a pure function, regardless of whether or not BlueprintCallable is specified
4) this CL also retains some consolidation of static function validation code that i had previously done, mostly to allow static functions to more easily be whitelisted for const function graphs
#codereview Nick.Whiting, Michael.Noland
[CL 2368059 by Phillip Kavan in Main branch]
UE-4916
#change Replaced CLASS_Temporary (UHT-only flag) with CLASS_Constructed to check if a class needs to be constructed or not in generated code
#change Modified code generator to make sure UClasses don't get reconstructed if not required
[CL 2351525 by Robert Manuszewski in Main branch]
In order to use new feature user have to change GENERATED_UCLASS_BODY() macro to the new GENERATED_BODY(). Then no constructor is implicitly declared. If there is no constructor declared in UCLASS then PCIP one is declared and defined that passes PCIP down to super-class. On the other hand if there is a constructor declared then UObject system expects to have one of the default or PCIP constructor to initialize a class during loading from disk, default object creation, etc. and it expects that user will declare and define one.
There is a possibility now to create UCLASS with the default constructor (i.e. no PCIP).
New macro is encouraged by standard classes and in-editor wizards templates.
#codereview Robert.Manuszewski
[CL 2325282 by Jaroslaw Palczynski in Main branch]
* InterfaceCast deprecation version number changed to 4.6.
* Double-underscored identifiers replaced with names which aren't reserved.
#codereview robert.manuszewski,mike.fricker
[CL 2314098 by Steve Robb in Main branch]
* Cast can be used for every UClass/interface cast:
- Up/down UObject hierarchy.
- From interfaces to UObjects.
- From UObjects to interfaces.
- Between interfaces.
* InterfaceCast has been deprecated.
* dynamic_cast can now be used instead of Cast.
* dynamic_cast between two UType pointers will be equivalent to Cast, but with dynamic_cast syntax and semantics.
* dynamic_cast of references is equivalent to a CastChecked - if it fails, it will fatally log rather than throw a std::bad_cast exception (UE doesn't support exceptions).
* If the two types involved are not UTypes, it should continue to act like a normal dynamic_cast.
* dynamic_cast<void*> works as expected.
* All/many Casts in CoreUObject changed to dynamic_cast to show this behaviour.
* Some refactoring.
#codereview robert.manuszewski,mike.fricker
[CL 2312800 by Steve Robb in Main branch]
#change Added code to make sure the script package is created before UEnums and UStructs get registered
[CL 2306655 by Robert Manuszewski in Main branch]
- Fixed a couple issues with Android fat binaries (cleaning and obb being archived multiple times)
- Touched Engine.h to force a UHT refresh
#codereview Robert.Manuszewski
[CL 2305487 by Josh Adams in Main branch]