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
|
||||
// They are used by GasaGen for the GasaDevOptionsCache
|
||||
|
||||
UPROPERTY(Config)
|
||||
TSoftObjectPtr<UDataTable> RandomBullshit;
|
||||
|
||||
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category="GAS")
|
||||
TArray< TSoftObjectPtr<UDataTable>> AttributeSets;
|
||||
|
||||
|
@ -11,6 +11,9 @@ void FGasaDevOptionsCache::CachedDevOptions()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
AttributeSets.Push( entry.LoadSynchronous() );
|
||||
|
@ -8,6 +8,8 @@ struct GASA_API FGasaDevOptionsCache
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY()
|
||||
UObject* RandomBullshit;
|
||||
UPROPERTY()
|
||||
TArray<UObject*> AttributeSets;
|
||||
UPROPERTY()
|
||||
|
@ -5,6 +5,8 @@
|
||||
// Editor Module
|
||||
#include "GasaEditorCommon.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "GasaEditor"
|
||||
|
||||
global String Project_Path;
|
||||
global String Root_Path;
|
||||
|
||||
@ -16,20 +18,25 @@ global Code UModule_GASA_API;
|
||||
|
||||
void Execute_GasaModule_Codegen()
|
||||
{
|
||||
FScopedSlowTask SlowTask(100.0f, LOCTEXT("RunningGasaGen", "Running GasaGen..."));
|
||||
SlowTask.MakeDialog(); // Shows a progress dialog
|
||||
|
||||
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [&SlowTask]()
|
||||
{
|
||||
Gasa::LogEditor("Executing: Gasa Module code generation.");
|
||||
|
||||
gen::init();
|
||||
|
||||
FString ue_project_path = FPaths::ConvertRelativePathToFull( FPaths::ProjectDir() );
|
||||
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);
|
||||
char const* ue_ansi_project_path = TCHAR_TO_ANSI(*ue_project_path);
|
||||
|
||||
FString ue_root_path = FPaths::GetPath( 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);
|
||||
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() );
|
||||
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);
|
||||
|
||||
@ -45,11 +52,11 @@ void Execute_GasaModule_Codegen()
|
||||
#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 );
|
||||
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")
|
||||
@ -59,50 +66,50 @@ void Execute_GasaModule_Codegen()
|
||||
|
||||
// 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_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));
|
||||
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();
|
||||
@ -110,5 +117,13 @@ void Execute_GasaModule_Codegen()
|
||||
//generate_HostWidgetController();
|
||||
|
||||
gen::deinit();
|
||||
|
||||
AsyncTask(ENamedThreads::GameThread, []()
|
||||
{
|
||||
// UI updates if needed
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
#undef GASA_API
|
||||
#undef ensureMsgf
|
||||
|
||||
|
||||
PRAGMA_DISABLE_OPTIMIZATION
|
||||
void generate_DevOptionsCache()
|
||||
{
|
||||
Array<CodeVar> GasaDevOptions_UPROPERTIES = Array<CodeVar>::init(GlobalAllocator);
|
||||
@ -162,7 +160,6 @@ void generate_DevOptionsCache()
|
||||
format_file( path_module_gasa "GasaDevOptionsCache.cpp" );
|
||||
}
|
||||
}
|
||||
PRAGMA_ENABLE_OPTIMIZATION
|
||||
|
||||
#pragma pop_macro("ensureMsgf")
|
||||
#pragma pop_macro("GASA_API")
|
||||
|
Loading…
Reference in New Issue
Block a user