2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-04-23 18:42:01 -04:00
|
|
|
|
|
|
|
|
#include "UnrealHeaderTool.h"
|
2014-08-15 16:12:22 -04:00
|
|
|
#include "ParserClass.h"
|
2014-06-02 07:02:29 -04:00
|
|
|
#include "Classes.h"
|
2014-04-23 18:42:01 -04:00
|
|
|
#include "ClassMaps.h"
|
|
|
|
|
|
|
|
|
|
FString FClass::GetNameWithPrefix(EEnforceInterfacePrefix::Type EnforceInterfacePrefix) const
|
|
|
|
|
{
|
|
|
|
|
const TCHAR* Prefix = 0;
|
|
|
|
|
|
|
|
|
|
if (HasAnyClassFlags(CLASS_Interface))
|
|
|
|
|
{
|
|
|
|
|
// Grab the expected prefix for interfaces (U on the first one, I on the second one)
|
|
|
|
|
switch (EnforceInterfacePrefix)
|
|
|
|
|
{
|
|
|
|
|
case EEnforceInterfacePrefix::None:
|
|
|
|
|
// For old-style files: "I" for interfaces, unless it's the actual "Interface" class, which gets "U"
|
|
|
|
|
if (GetFName() == NAME_Interface)
|
|
|
|
|
{
|
|
|
|
|
Prefix = TEXT("U");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Prefix = TEXT("I");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EEnforceInterfacePrefix::I:
|
|
|
|
|
Prefix = TEXT("I");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EEnforceInterfacePrefix::U:
|
|
|
|
|
Prefix = TEXT("U");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
check(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Get the expected class name with prefix
|
|
|
|
|
Prefix = GetPrefixCPP();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FString::Printf(TEXT("%s%s"), Prefix, *GetName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FClass* FClass::GetSuperClass() const
|
|
|
|
|
{
|
|
|
|
|
return static_cast<FClass*>(static_cast<const UClass*>(this)->GetSuperClass());
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-02 07:02:29 -04:00
|
|
|
FClass* FClass::GetClassWithin() const
|
|
|
|
|
{
|
|
|
|
|
return (FClass*)ClassWithin;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 18:42:01 -04:00
|
|
|
TArray<FClass*> FClass::GetInterfaceTypes() const
|
|
|
|
|
{
|
|
|
|
|
TArray<FClass*> Result;
|
|
|
|
|
for (auto& i : Interfaces)
|
|
|
|
|
{
|
|
|
|
|
Result.Add((FClass*)i.Class);
|
|
|
|
|
}
|
|
|
|
|
return Result;
|
|
|
|
|
}
|
2014-07-11 15:13:57 -04:00
|
|
|
|
|
|
|
|
void FClass::GetHideCategories(TArray<FString>& OutHideCategories) const
|
|
|
|
|
{
|
|
|
|
|
static const FName NAME_HideCategories(TEXT("HideCategories"));
|
|
|
|
|
if (HasMetaData(NAME_HideCategories))
|
|
|
|
|
{
|
|
|
|
|
const FString& HideCategories = GetMetaData(NAME_HideCategories);
|
2015-03-02 15:51:37 -05:00
|
|
|
HideCategories.ParseIntoArray(OutHideCategories, TEXT(" "), true);
|
2014-07-11 15:13:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FClass::GetShowCategories(TArray<FString>& OutShowCategories) const
|
|
|
|
|
{
|
|
|
|
|
static const FName NAME_ShowCategories(TEXT("ShowCategories"));
|
|
|
|
|
if (HasMetaData(NAME_ShowCategories))
|
|
|
|
|
{
|
|
|
|
|
const FString& ShowCategories = GetMetaData(NAME_ShowCategories);
|
2015-03-02 15:51:37 -05:00
|
|
|
ShowCategories.ParseIntoArray(OutShowCategories, TEXT(" "), true);
|
2014-07-11 15:13:57 -04:00
|
|
|
}
|
|
|
|
|
}
|
2015-09-08 09:23:57 -04:00
|
|
|
|
Copying //UE4/Dev-Blueprints to Dev-Main (//UE4/Dev-Main) @ 2781164
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2716841 on 2015/10/05 by Mike.Beach
(WIP) Cleaning up how we setup script assets for replacement on cook (aligning more with the Blueprint conversion tool).
#codereview Maciej.Mroz
Change 2719089 on 2015/10/07 by Maciej.Mroz
ToValidCPPIdentifierChars handles propertly '?' char.
#codereview Dan.Oconnor
Change 2719361 on 2015/10/07 by Maciej.Mroz
Generated native code for AnimBPGC - some preliminary changes.
Refactor: UAnimBlueprintGeneratedClass is not accessed directly in runtime. It is accessed via UAnimClassInterface interface.
Properties USkeletalMeshComponent::AnimBlueprintGeneratedClass and UInterpTrackFloatAnimBPParam::AnimBlueprintClass were changed into "TSubclassOf<UAnimInstance> AnimClass"
The UDynamicClass also can deliver the IAnimClassInterface interface. See UAnimClassData, IAnimClassInterface::GetFromClass and UDynamicClass::AnimClassImplementation.
#codereview Lina.Halper, Thomas.Sarkanen
Change 2719383 on 2015/10/07 by Maciej.Mroz
Debug-only code removed
Change 2720528 on 2015/10/07 by Dan.Oconnor
Fix for determinsitc cooking of async tasks and load asset nodes
#codereview Mike.Beach, Maciej.Mroz
Change 2721273 on 2015/10/08 by Maciej.Mroz
Blueprint Compiler Cpp Backend
- Anim Blueprints can be converted
- Various fixes/improvements
Change 2721310 on 2015/10/08 by Maciej.Mroz
refactor (cl#2719361) - no "auto" keyword
Change 2721727 on 2015/10/08 by Mike.Beach
(WIP) Setup the cook commandlet so it handles converted assets, replacing them with generated classes.
- Refactored the conversion manifest (using a map over an array)
- Centralized destination paths into a helper struct (for the manifest)
- Generating an Editor module that automatically hooks into the cook process when enabled
- Loading and applying native replacments for the cook
Change 2723276 on 2015/10/09 by Michael.Schoell
Blueprints duplicated for PIE will no longer register as dependencies to other Blueprint.
#jira UE-16695 - Editor freezes then crashes while attempting to save during PIE
#jira UE-21614 - [CrashReport] Crash while saving during PIE - FKismetEditorUtilities::CompileBlueprint() kismet2.cpp:736
Change 2724345 on 2015/10/11 by Ben.Cosh
Blueprint profiler at first pass, this includes the ability to instrument specific blueprints with realtime editor stat display.
#UEBP-21 - Profiling data capture and storage
#UEBP-13 - Performance capture landing page
#Branch UE4
#Proj BlueprintProfiler, BlueprintGraph, EditorStyle, Kismet, UnrealEd, CoreUObject, Engine
Change 2724613 on 2015/10/12 by Ben.Cosh
Incremental update for blueprint profiler to fix the way some of the reported stats cascade through events and branches and additionally some missed bits of code are refactored/removed.
#Branch UE4
#Proj BlueprintProfiler
#info Whilst looking into this I spotted the reason why the stats seem so erratic, There appears to be an issue with FText's use of EXPERIMENTAL_TEXT_FAST_DECIMAL_FORMAT which I have reported, but ideally disable this locally until a fix is integrated.
Change 2724723 on 2015/10/12 by Maciej.Mroz
Constructor of a dynamic class creates CDO.
#codereview Robert.Manuszewski
Change 2725108 on 2015/10/12 by Mike.Beach
[UE-21891] Minor fix to the array shuffle() function; now processes the last entry like all the others.
Change 2726358 on 2015/10/13 by Maciej.Mroz
UDataTable is properly saved even if its RowStruct is null.
https://udn.unrealengine.com/questions/264064/crash-using-hotreload-in-custom-datatable-cdo-clas.html
Change 2727395 on 2015/10/13 by Mike.Beach
(WIP) Second pass on the Blueprint conversion pipeline; setting it up for more optimal (speedier) performance.
* Using stubs for replacements (rather than loading dynamic replacement).
* Giving the cook commandlet more control (so a conversion could be ran directly).
* Now logging replacements by old object path (to account for UPackage replacement queries).
* Fix for [UE-21947], unshelved from CL 2724944 (by Maciej.Mroz).
#codereview Maciej.Mroz
Change 2727484 on 2015/10/13 by Mike.Beach
[UE-22008] Fixing up comment/tooltip typo for UActorComponent::bAutoActivate.
Change 2727527 on 2015/10/13 by Mike.Beach
Downgrading an inactionable EdGraph warning, while adding more info so we could possibly determine what's happening.
Change 2727702 on 2015/10/13 by Dan.Oconnor
Fix for crash in UDelegateProperty::GetCPPType when called on a function with no OwnerClass (events)
Change 2727968 on 2015/10/14 by Maciej.Mroz
Since ConstructorHelpers::FClassFinder is usually static, the loaded class should be in root set, to prevent the pointer stored in ConstructorHelpers::FClassFinder from being obsolete.
FindOrLoadClass behaves now like FindOrLoadObject.
#codereview Robert.Manuszewski, Nick.Whiting
Change 2728139 on 2015/10/14 by Phillip.Kavan
2015-11-25 18:47:20 -05:00
|
|
|
bool FClass::IsDynamic(const UField* Field)
|
2015-09-08 09:23:57 -04:00
|
|
|
{
|
|
|
|
|
static const FName NAME_ReplaceConverted(TEXT("ReplaceConverted"));
|
|
|
|
|
return Field->HasMetaData(NAME_ReplaceConverted);
|
2015-11-18 16:20:49 -05:00
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Dev-Blueprints to Dev-Main (//UE4/Dev-Main) @ 2781164
#lockdown Nick.Penwarden
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2716841 on 2015/10/05 by Mike.Beach
(WIP) Cleaning up how we setup script assets for replacement on cook (aligning more with the Blueprint conversion tool).
#codereview Maciej.Mroz
Change 2719089 on 2015/10/07 by Maciej.Mroz
ToValidCPPIdentifierChars handles propertly '?' char.
#codereview Dan.Oconnor
Change 2719361 on 2015/10/07 by Maciej.Mroz
Generated native code for AnimBPGC - some preliminary changes.
Refactor: UAnimBlueprintGeneratedClass is not accessed directly in runtime. It is accessed via UAnimClassInterface interface.
Properties USkeletalMeshComponent::AnimBlueprintGeneratedClass and UInterpTrackFloatAnimBPParam::AnimBlueprintClass were changed into "TSubclassOf<UAnimInstance> AnimClass"
The UDynamicClass also can deliver the IAnimClassInterface interface. See UAnimClassData, IAnimClassInterface::GetFromClass and UDynamicClass::AnimClassImplementation.
#codereview Lina.Halper, Thomas.Sarkanen
Change 2719383 on 2015/10/07 by Maciej.Mroz
Debug-only code removed
Change 2720528 on 2015/10/07 by Dan.Oconnor
Fix for determinsitc cooking of async tasks and load asset nodes
#codereview Mike.Beach, Maciej.Mroz
Change 2721273 on 2015/10/08 by Maciej.Mroz
Blueprint Compiler Cpp Backend
- Anim Blueprints can be converted
- Various fixes/improvements
Change 2721310 on 2015/10/08 by Maciej.Mroz
refactor (cl#2719361) - no "auto" keyword
Change 2721727 on 2015/10/08 by Mike.Beach
(WIP) Setup the cook commandlet so it handles converted assets, replacing them with generated classes.
- Refactored the conversion manifest (using a map over an array)
- Centralized destination paths into a helper struct (for the manifest)
- Generating an Editor module that automatically hooks into the cook process when enabled
- Loading and applying native replacments for the cook
Change 2723276 on 2015/10/09 by Michael.Schoell
Blueprints duplicated for PIE will no longer register as dependencies to other Blueprint.
#jira UE-16695 - Editor freezes then crashes while attempting to save during PIE
#jira UE-21614 - [CrashReport] Crash while saving during PIE - FKismetEditorUtilities::CompileBlueprint() kismet2.cpp:736
Change 2724345 on 2015/10/11 by Ben.Cosh
Blueprint profiler at first pass, this includes the ability to instrument specific blueprints with realtime editor stat display.
#UEBP-21 - Profiling data capture and storage
#UEBP-13 - Performance capture landing page
#Branch UE4
#Proj BlueprintProfiler, BlueprintGraph, EditorStyle, Kismet, UnrealEd, CoreUObject, Engine
Change 2724613 on 2015/10/12 by Ben.Cosh
Incremental update for blueprint profiler to fix the way some of the reported stats cascade through events and branches and additionally some missed bits of code are refactored/removed.
#Branch UE4
#Proj BlueprintProfiler
#info Whilst looking into this I spotted the reason why the stats seem so erratic, There appears to be an issue with FText's use of EXPERIMENTAL_TEXT_FAST_DECIMAL_FORMAT which I have reported, but ideally disable this locally until a fix is integrated.
Change 2724723 on 2015/10/12 by Maciej.Mroz
Constructor of a dynamic class creates CDO.
#codereview Robert.Manuszewski
Change 2725108 on 2015/10/12 by Mike.Beach
[UE-21891] Minor fix to the array shuffle() function; now processes the last entry like all the others.
Change 2726358 on 2015/10/13 by Maciej.Mroz
UDataTable is properly saved even if its RowStruct is null.
https://udn.unrealengine.com/questions/264064/crash-using-hotreload-in-custom-datatable-cdo-clas.html
Change 2727395 on 2015/10/13 by Mike.Beach
(WIP) Second pass on the Blueprint conversion pipeline; setting it up for more optimal (speedier) performance.
* Using stubs for replacements (rather than loading dynamic replacement).
* Giving the cook commandlet more control (so a conversion could be ran directly).
* Now logging replacements by old object path (to account for UPackage replacement queries).
* Fix for [UE-21947], unshelved from CL 2724944 (by Maciej.Mroz).
#codereview Maciej.Mroz
Change 2727484 on 2015/10/13 by Mike.Beach
[UE-22008] Fixing up comment/tooltip typo for UActorComponent::bAutoActivate.
Change 2727527 on 2015/10/13 by Mike.Beach
Downgrading an inactionable EdGraph warning, while adding more info so we could possibly determine what's happening.
Change 2727702 on 2015/10/13 by Dan.Oconnor
Fix for crash in UDelegateProperty::GetCPPType when called on a function with no OwnerClass (events)
Change 2727968 on 2015/10/14 by Maciej.Mroz
Since ConstructorHelpers::FClassFinder is usually static, the loaded class should be in root set, to prevent the pointer stored in ConstructorHelpers::FClassFinder from being obsolete.
FindOrLoadClass behaves now like FindOrLoadObject.
#codereview Robert.Manuszewski, Nick.Whiting
Change 2728139 on 2015/10/14 by Phillip.Kavan
2015-11-25 18:47:20 -05:00
|
|
|
bool FClass::IsOwnedByDynamicType(const UField* Field)
|
|
|
|
|
{
|
|
|
|
|
for (const UField* OuterField = Cast<const UField>(Field->GetOuter()); OuterField; OuterField = Cast<const UField>(OuterField->GetOuter()))
|
|
|
|
|
{
|
|
|
|
|
if (IsDynamic(OuterField))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString FClass::GetTypePackageName(const UField* Field)
|
2015-11-18 16:20:49 -05:00
|
|
|
{
|
|
|
|
|
static const FName NAME_ReplaceConverted(TEXT("ReplaceConverted"));
|
|
|
|
|
FString PackageName = Field->GetMetaData(NAME_ReplaceConverted);
|
|
|
|
|
if (PackageName.Len())
|
|
|
|
|
{
|
|
|
|
|
int32 ObjectDotIndex = INDEX_NONE;
|
|
|
|
|
// Strip the object name
|
|
|
|
|
if (PackageName.FindChar(TEXT('.'), ObjectDotIndex))
|
|
|
|
|
{
|
|
|
|
|
PackageName = PackageName.Mid(0, ObjectDotIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PackageName = Field->GetOutermost()->GetName();
|
|
|
|
|
}
|
|
|
|
|
return PackageName;
|
|
|
|
|
}
|