Setting up GasaGen in the editor module

issues with clang format...
This commit is contained in:
2024-10-21 22:39:40 -04:00
parent 2522f4df6c
commit c492613179
23 changed files with 27581 additions and 14 deletions

View File

@ -2,7 +2,7 @@
#if GASA_INTELLISENSE_DIRECTIVES
#pragma once
#include "gen.hpp"
#include "GasaGenCommon.cpp"
// #include "GasaGenCommon.cpp"
using namespace gen;
#endif

View File

@ -27,7 +27,8 @@ void gen_FGasaDevOptionsCache()
if ( member->Type == ECode::Untyped && member->Name.starts_with(str_UPROPERTY) )
++ member;
if ( member->Type == ECode::Variable
&& ( member->ValueType->Name.starts_with( txt("TSoftClassPtr"))
&& ( member->ValueType->Name.starts_with( txt("TArray< TSoftObjectPtr"))
|| member->ValueType->Name.starts_with( txt("TSoftClassPtr"))
|| member->ValueType->Name.starts_with( txt("TSoftObjectPtr")) )
)
GasaDevOptions_UPROPERTIES.append(member.cast<CodeVar>());
@ -36,6 +37,10 @@ void gen_FGasaDevOptionsCache()
CodeComment generation_notice = def_comment(txt("Generated by GasaGen/GasaGen_DevOptionsCache.cpp"));
CodeType t_UClassPtr = parse_type(code(UClass*));
CodeType t_UObjectPtr = parse_type(code(UObject*));
CodeType t_Array_UObjectPtr = parse_type(code(TArray< UObject* >));
Builder header = Builder::open( path_module_gasa "GasaDevOptionsCache.h" );
{
header.print( generation_notice );
@ -49,9 +54,6 @@ void gen_FGasaDevOptionsCache()
{
CodeBody body = def_body(ECode::Struct_Body);
{
CodeType t_UClassPtr = parse_type(code(UClass*));
CodeType t_UObjectPtr = parse_type(code(UObject*));
body.append(UHT_GENERATED_BODY);
body.append(fmt_newline);
for (CodeVar var : GasaDevOptions_UPROPERTIES)
@ -64,6 +66,10 @@ void gen_FGasaDevOptionsCache()
body.append(UHT_UPROPERTY);
body.append( def_variable(t_UObjectPtr, var->Name));
}
if ( var->ValueType->Name.starts_with( txt("TArray< TSoftObjectPtr") )) {
body.append(UHT_UPROPERTY);
body.append( def_variable(t_Array_UObjectPtr, var->Name));
}
}
body.append(fmt_newline);
body.append( parse_function(code( void CachedDevOptions(); )));
@ -107,6 +113,25 @@ void gen_FGasaDevOptionsCache()
cached_property_assignments.append(fmt_newline);
for (CodeVar var : GasaDevOptions_UPROPERTIES)
{
if ( var->ValueType.to_string().starts_with(txt("TArray")) )
{
#pragma push_macro("TEXT")
#undef TEXT
Code assignment = code_fmt( "property_array", (StrC)var->Name, stringize(
for ( auto& entry : DevOpts-> <property_array> )
{
<property_array>.Push( entry.LoadSynchronous() );
ensureMsgf(entry != nullptr, TEXT("An <property_array> entry is null, DO NOT RUN PIE or else you may get a crash if not handled in BP or C++"));
}
));
#pragma pop_macro("TEXT")
cached_property_assignments.append(assignment);
cached_property_assignments.append(fmt_newline);
cached_property_assignments.append(fmt_newline);
continue;
}
#pragma push_macro("TEXT")
#undef TEXT
Code assignment = code_fmt( "property", (StrC)var->Name, stringize(

View File

@ -335,8 +335,6 @@ void gen_UGasaAttributeSet()
Super::PreAttributeChange(Attribute, NewValue);
<attribute_clamps>
PreAttributeChange_Custom();
}
)));
@ -348,8 +346,6 @@ void gen_UGasaAttributeSet()
Props.Populate(Data);
<attribute_clamps>
PostAttributeChange_Custom();
}
)));
}

View File

@ -1106,5 +1106,4 @@ String csv_write_string_delimiter( AllocatorInfo a, CSV_Object* obj, char delimi
#pragma endregion CSV
#include "scanner.hpp"
GEN_NS_END