Made the codgen run on async
This commit is contained in:
parent
a1a5f2f309
commit
d4bf7cfaec
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
Binary file not shown.
@ -16,6 +16,9 @@ public:
|
|||||||
// NOTE(Ed): Any Soft-References must have their includes defined in GasaDevOptions.cpp
|
// NOTE(Ed): Any Soft-References must have their includes defined in GasaDevOptions.cpp
|
||||||
// They are used by GasaGen for the GasaDevOptionsCache
|
// They are used by GasaGen for the GasaDevOptionsCache
|
||||||
|
|
||||||
|
UPROPERTY(Config)
|
||||||
|
TSoftObjectPtr<UDataTable> RandomBullshit;
|
||||||
|
|
||||||
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="GAS")
|
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="GAS")
|
||||||
TArray< TSoftObjectPtr<UDataTable>> AttributeSets;
|
TArray< TSoftObjectPtr<UDataTable>> AttributeSets;
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ void FGasaDevOptionsCache::CachedDevOptions()
|
|||||||
{
|
{
|
||||||
UGasaDevOptions* DevOpts = GetMutDevOptions();
|
UGasaDevOptions* DevOpts = GetMutDevOptions();
|
||||||
|
|
||||||
|
RandomBullshit = DevOpts->RandomBullshit.LoadSynchronous();
|
||||||
|
ensureMsgf( RandomBullshit != nullptr, TEXT( "RandomBullshit is null, DO NOT RUN PIE or else you may get a crash if not handled in BP or C++" ) );
|
||||||
|
|
||||||
for ( auto& entry : DevOpts->AttributeSets )
|
for ( auto& entry : DevOpts->AttributeSets )
|
||||||
{
|
{
|
||||||
AttributeSets.Push( entry.LoadSynchronous() );
|
AttributeSets.Push( entry.LoadSynchronous() );
|
||||||
|
@ -8,6 +8,8 @@ struct GASA_API FGasaDevOptionsCache
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
UObject* RandomBullshit;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TArray<UObject*> AttributeSets;
|
TArray<UObject*> AttributeSets;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// Editor Module
|
// Editor Module
|
||||||
#include "GasaEditorCommon.h"
|
#include "GasaEditorCommon.h"
|
||||||
|
|
||||||
|
#define LOCTEXT_NAMESPACE "GasaEditor"
|
||||||
|
|
||||||
global String Project_Path;
|
global String Project_Path;
|
||||||
global String Root_Path;
|
global String Root_Path;
|
||||||
|
|
||||||
@ -16,99 +18,112 @@ global Code UModule_GASA_API;
|
|||||||
|
|
||||||
void Execute_GasaModule_Codegen()
|
void Execute_GasaModule_Codegen()
|
||||||
{
|
{
|
||||||
Gasa::LogEditor("Executing: Gasa Module code generation.");
|
FScopedSlowTask SlowTask(100.0f, LOCTEXT("RunningGasaGen", "Running GasaGen..."));
|
||||||
|
SlowTask.MakeDialog(); // Shows a progress dialog
|
||||||
|
|
||||||
gen::init();
|
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [&SlowTask]()
|
||||||
|
|
||||||
FString ue_project_path = FPaths::ConvertRelativePathToFull( FPaths::ProjectDir() );
|
|
||||||
FPaths::NormalizeDirectoryName(ue_project_path);
|
|
||||||
char const* ue_ansi_project_path = TCHAR_TO_ANSI( * ue_project_path);
|
|
||||||
|
|
||||||
FString ue_root_path = FPaths::GetPath( ue_project_path );
|
|
||||||
FPaths::NormalizeDirectoryName(ue_root_path);
|
|
||||||
char const* ue_ansi_rooot_path = TCHAR_TO_ANSI( * ue_project_path);
|
|
||||||
|
|
||||||
Project_Path = String::make_length(GlobalAllocator, ue_ansi_project_path, ue_project_path.Len() );
|
|
||||||
Root_Path = String::make_length(GlobalAllocator, ue_ansi_rooot_path, ue_root_path.Len() );
|
|
||||||
UE_LOG(LogTemp, Log, TEXT("Current ROOT Directory: %s"), *ue_project_path);
|
|
||||||
UE_LOG(LogTemp, Log, TEXT("Current Project Directory: %s"), *ue_root_path);
|
|
||||||
|
|
||||||
// Initialize Globals
|
|
||||||
{
|
{
|
||||||
#pragma push_macro("UCLASS")
|
Gasa::LogEditor("Executing: Gasa Module code generation.");
|
||||||
#pragma push_macro("UPROPERTY")
|
|
||||||
#pragma push_macro("USTRUCT")
|
|
||||||
#pragma push_macro("GENERATED_BODY")
|
|
||||||
#pragma push_macro("GASA_API")
|
|
||||||
#undef UCLASS
|
|
||||||
#undef UPROPERTY
|
|
||||||
#undef USTRUCT
|
|
||||||
#undef GENERATED_BODY
|
|
||||||
#undef GASA_API
|
|
||||||
UHT_UCLASS = code_str( UCLASS() );
|
|
||||||
UHT_UPROPERTY = code_str( UPROPERTY() );
|
|
||||||
UHT_USTRUCT = code_str( USTRUCT() );
|
|
||||||
UHT_GENERATED_BODY = code_str( GENERATED_BODY()\n );
|
|
||||||
UModule_GASA_API = code_str( GASA_API );
|
|
||||||
#pragma pop_macro("UCLASS")
|
|
||||||
#pragma pop_macro("UPROPERTY")
|
|
||||||
#pragma pop_macro("USTRUCT")
|
|
||||||
#pragma pop_macro("GENERATED_BODY")
|
|
||||||
#pragma pop_macro("GASA_API")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Populate Defines
|
gen::init();
|
||||||
{
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_CLASS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DELEGATE_RetVal_OneParam));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DELEGATE_RetVal_ThreeParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DELEGATE_SixParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_EVENT_ThreeParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_EVENT_TwoParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_FUNCTION));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_LOG_CATEGORY_EXTERN));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_OneParam));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_ThreeParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_MULTICAST_DELEGATE_TwoParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_OneParam));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DEFINE_ACTORDESC_TYPE));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_ENUM_CLASS_FLAGS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_FORCEINLINE_DEBUGGABLE));
|
|
||||||
// PreprocessorDefines.append( get_cached_string(str_FORCEINLINE));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_GENERATED_BODY));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_GENERATED_UCLASS_BODY));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_GENERATED_USTRUCT_BODY));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_PRAGMA_DISABLE_DEPRECATION_WARNINGS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_PRAGMA_ENABLE_DEPRECATION_WARNINGS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_PROPERTY_BINDING_IMPLEMENTATION));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_RESULT_DECL));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_SLATE_BEGIN_ARGS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_SLATE_END_ARGS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_TEXT));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UCLASS));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UENUM));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UFUNCTION));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UMETA));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UPARAM));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UPROPERTY));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_USTRUCT));
|
|
||||||
PreprocessorDefines.append( get_cached_string(str_UE_REQUIRES));
|
|
||||||
}
|
|
||||||
|
|
||||||
//generate_AttributeSets();
|
FString ue_project_path = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir());
|
||||||
generate_DevOptionsCache();
|
FPaths::NormalizeDirectoryName(ue_project_path);
|
||||||
//generate_HostWidgetController();
|
char const* ue_ansi_project_path = TCHAR_TO_ANSI(*ue_project_path);
|
||||||
|
|
||||||
gen::deinit();
|
FString ue_root_path = FPaths::GetPath(ue_project_path);
|
||||||
|
FPaths::NormalizeDirectoryName(ue_root_path);
|
||||||
|
char const* ue_ansi_rooot_path = TCHAR_TO_ANSI(*ue_project_path);
|
||||||
|
|
||||||
|
Project_Path = String::make_length(GlobalAllocator, ue_ansi_project_path, ue_project_path.Len());
|
||||||
|
Root_Path = String::make_length(GlobalAllocator, ue_ansi_rooot_path, ue_root_path.Len());
|
||||||
|
UE_LOG(LogTemp, Log, TEXT("Current ROOT Directory: %s"), *ue_project_path);
|
||||||
|
UE_LOG(LogTemp, Log, TEXT("Current Project Directory: %s"), *ue_root_path);
|
||||||
|
|
||||||
|
// Initialize Globals
|
||||||
|
{
|
||||||
|
#pragma push_macro("UCLASS")
|
||||||
|
#pragma push_macro("UPROPERTY")
|
||||||
|
#pragma push_macro("USTRUCT")
|
||||||
|
#pragma push_macro("GENERATED_BODY")
|
||||||
|
#pragma push_macro("GASA_API")
|
||||||
|
#undef UCLASS
|
||||||
|
#undef UPROPERTY
|
||||||
|
#undef USTRUCT
|
||||||
|
#undef GENERATED_BODY
|
||||||
|
#undef GASA_API
|
||||||
|
UHT_UCLASS = code_str(UCLASS());
|
||||||
|
UHT_UPROPERTY = code_str(UPROPERTY());
|
||||||
|
UHT_USTRUCT = code_str(USTRUCT());
|
||||||
|
UHT_GENERATED_BODY = code_str(GENERATED_BODY()\n);
|
||||||
|
UModule_GASA_API = code_str(GASA_API);
|
||||||
|
#pragma pop_macro("UCLASS")
|
||||||
|
#pragma pop_macro("UPROPERTY")
|
||||||
|
#pragma pop_macro("USTRUCT")
|
||||||
|
#pragma pop_macro("GENERATED_BODY")
|
||||||
|
#pragma pop_macro("GASA_API")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Populate Defines
|
||||||
|
{
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_CLASS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_RetVal_OneParam));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_RetVal_ThreeParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DELEGATE_SixParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FiveParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_FourParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_NineParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_SevenParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_EVENT_ThreeParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_EVENT_TwoParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_FUNCTION));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_LOG_CATEGORY_EXTERN));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_OneParam));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_ThreeParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_MULTICAST_DELEGATE_TwoParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_OneParam));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_TwoParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DECLARE_TS_MULTICAST_DELEGATE_ThreeParams));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DEFINE_ACTORDESC_TYPE));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_ENUM_CLASS_FLAGS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_FORCEINLINE_DEBUGGABLE));
|
||||||
|
// PreprocessorDefines.append( get_cached_string(str_FORCEINLINE));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_GENERATED_BODY));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_GENERATED_UCLASS_BODY));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_GENERATED_USTRUCT_BODY));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_PRAGMA_DISABLE_DEPRECATION_WARNINGS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_PRAGMA_ENABLE_DEPRECATION_WARNINGS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_PROPERTY_BINDING_IMPLEMENTATION));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_RESULT_DECL));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_SLATE_BEGIN_ARGS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_SLATE_END_ARGS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_TEXT));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UCLASS));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UENUM));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UFUNCTION));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UMETA));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UPARAM));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UPROPERTY));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_USTRUCT));
|
||||||
|
PreprocessorDefines.append(get_cached_string(str_UE_REQUIRES));
|
||||||
|
}
|
||||||
|
|
||||||
|
//generate_AttributeSets();
|
||||||
|
generate_DevOptionsCache();
|
||||||
|
//generate_HostWidgetController();
|
||||||
|
|
||||||
|
gen::deinit();
|
||||||
|
|
||||||
|
AsyncTask(ENamedThreads::GameThread, []()
|
||||||
|
{
|
||||||
|
// UI updates if needed
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef LOCTEXT_NAMESPACE
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#undef GASA_API
|
#undef GASA_API
|
||||||
#undef ensureMsgf
|
#undef ensureMsgf
|
||||||
|
|
||||||
|
|
||||||
PRAGMA_DISABLE_OPTIMIZATION
|
|
||||||
void generate_DevOptionsCache()
|
void generate_DevOptionsCache()
|
||||||
{
|
{
|
||||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(GlobalAllocator);
|
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(GlobalAllocator);
|
||||||
@ -162,7 +160,6 @@ void generate_DevOptionsCache()
|
|||||||
format_file( path_module_gasa "GasaDevOptionsCache.cpp" );
|
format_file( path_module_gasa "GasaDevOptionsCache.cpp" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRAGMA_ENABLE_OPTIMIZATION
|
|
||||||
|
|
||||||
#pragma pop_macro("ensureMsgf")
|
#pragma pop_macro("ensureMsgf")
|
||||||
#pragma pop_macro("GASA_API")
|
#pragma pop_macro("GASA_API")
|
||||||
|
Loading…
Reference in New Issue
Block a user