update liquid template
This commit is contained in:
parent
b4fa0405fc
commit
fd98728283
@ -53,6 +53,10 @@ namespace refl
|
||||
ClassList = new List<ClassMeta>();
|
||||
ChildList = new List<ModuleMeta>();
|
||||
}
|
||||
public bool HasMeta()
|
||||
{
|
||||
return ClassList.Count > 0 || ChildList.Count > 0;
|
||||
}
|
||||
public static ClassMeta ParseCppClass(CppClass cppClass)
|
||||
{
|
||||
string parentName = "void";
|
||||
|
||||
@ -23,6 +23,7 @@ namespace refl
|
||||
public string NameSpace { get; set; } = "";
|
||||
public string ParentName { get; set; } = "";
|
||||
public string Indent { get; set; } = "";
|
||||
public string Indent2 { get; set; } = "";
|
||||
public string MetaName { get; set; } = "";
|
||||
public List<FieldMetaGenData> FieldList = new List<FieldMetaGenData>();
|
||||
|
||||
@ -30,6 +31,14 @@ namespace refl
|
||||
{
|
||||
Indent = indent;
|
||||
NameSpace = nameSpace;
|
||||
if (string.IsNullOrEmpty(nameSpace))
|
||||
{
|
||||
Indent2 = indent;
|
||||
}
|
||||
else
|
||||
{
|
||||
Indent2 = indent + "\t";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,12 +64,15 @@ namespace refl
|
||||
{
|
||||
foreach (var name in ModuleMeta.NameSet)
|
||||
{
|
||||
FileList.Add(name, new StringBuilder());
|
||||
var build = new StringBuilder();
|
||||
build.AppendLine("#pragma once");
|
||||
FileList.Add(name, build);
|
||||
}
|
||||
GenModuleMeta(module, null);
|
||||
string file_name = Path.GetFileName(target);
|
||||
string? dir = Path.GetDirectoryName(target);
|
||||
var output = new StringBuilder();
|
||||
output.AppendLine("#pragma once");
|
||||
foreach (var pair in FileList)
|
||||
{
|
||||
string path = $"{pair.Key}_{file_name}".ToLower();
|
||||
@ -75,7 +87,15 @@ namespace refl
|
||||
}
|
||||
public static void GenModuleMeta(ModuleMeta module, string? prefix)
|
||||
{
|
||||
if (!module.HasMeta())
|
||||
{
|
||||
return;
|
||||
}
|
||||
var gen = new ClassMetaGenData(prefix+"", module.NameSpace);
|
||||
if (prefix != null)
|
||||
{
|
||||
GenNamespaceBegin(gen);
|
||||
}
|
||||
foreach (var cls in module.ClassList)
|
||||
{
|
||||
GenClassMeta(cls, gen);
|
||||
@ -84,13 +104,32 @@ namespace refl
|
||||
{
|
||||
if(prefix == null)
|
||||
{
|
||||
GenModuleMeta(child, prefix + "\r");
|
||||
GenModuleMeta(child, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
GenModuleMeta(child, prefix + "\t");
|
||||
}
|
||||
}
|
||||
if (prefix != null)
|
||||
{
|
||||
GenNamespaceEnd(gen);
|
||||
}
|
||||
}
|
||||
public static void GenNamespaceBegin(ClassMetaGenData gen)
|
||||
{
|
||||
foreach (var name in ModuleMeta.NameSet)
|
||||
{
|
||||
string line = $"{gen.Indent}namespace {gen.NameSpace} {{";
|
||||
FileList[name].AppendLine(line);
|
||||
}
|
||||
}
|
||||
public static void GenNamespaceEnd(ClassMetaGenData gen)
|
||||
{
|
||||
foreach (var name in ModuleMeta.NameSet)
|
||||
{
|
||||
FileList[name].AppendLine($"{gen.Indent}}}");
|
||||
}
|
||||
}
|
||||
public static void GenClassMeta(ClassMeta cls, ClassMetaGenData gen)
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"profiles": {
|
||||
"refl": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "build F:\\csharp\\CppAst.NET\\src\\refl\\cpp\\vertex.h -o F:\\csharp\\CppAst.NET\\src\\refl\\cpp\\vertex_gen.inl -t F:\\csharp\\CppAst.NET\\src\\refl\\template\\refl.liquid -v"
|
||||
"commandLineArgs": "build F:\\csharp\\cppast\\src\\refl\\cpp\\vertex.h -o F:\\csharp\\cppast\\src\\refl\\cpp\\vertex_gen.inl -t F:\\csharp\\cppast\\src\\refl\\template\\refl.liquid -v"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,34 +1,220 @@
|
||||
struct vec3_Static_Meta {
|
||||
#pragma once
|
||||
struct TestMain1_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&vec3::x, &vec3::y, &vec3::z, &vec3::norm);
|
||||
return std::make_tuple(&TestMain1::x, &TestMain1::y, &TestMain1::z);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
StaticMemberField(&vec3::x, FName("x"), { 0.f}),
|
||||
StaticMemberField(&vec3::y, FName("y"), { 0.f}),
|
||||
StaticMemberField(&vec3::z, FName("z"), { 0.f}),
|
||||
StaticMethodField(&vec3::norm, FName("norm"), { {3,4} }),
|
||||
refl::StaticMemberField(&TestMain1::x, FName("x"), {}),
|
||||
refl::StaticMemberField(&TestMain1::y, FName("y"), {}),
|
||||
refl::StaticMemberField(&TestMain1::z, FName("z"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return fetch_meta_size<vec3_Static_Meta>();
|
||||
return refl::fetch_meta_size<TestMain1_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct vec3_Meta : public Meta {
|
||||
using MyStatic = vec3_Static_Meta;
|
||||
using MyUClass = UClass_Meta<vec3, vec3_parent>;;
|
||||
struct TestMain1_Meta : public refl::Meta {
|
||||
using MyStatic = TestMain1_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<TestMain1, void>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
StaticMemberField(&vec3::x, FName("x"), { 0.f}),
|
||||
StaticMemberField(&vec3::y, FName("y"), { 0.f}),
|
||||
StaticMemberField(&vec3::z, FName("z"), { 0.f}),
|
||||
StaticMethodField(&vec3::norm, FName("norm"), { {3,4} }),
|
||||
MemberField(&TestMain1::x, FName("x"), memory, {}),
|
||||
MemberField(&TestMain1::y, FName("y"), memory, {}),
|
||||
MemberField(&TestMain1::z, FName("z"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
namespace engineapi {
|
||||
struct Vector3_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&Vector3::x, &Vector3::y, &Vector3::z);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&Vector3::x, FName("x"), {}),
|
||||
refl::StaticMemberField(&Vector3::y, FName("y"), {}),
|
||||
refl::StaticMemberField(&Vector3::z, FName("z"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<Vector3_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct Vector3_Meta : public refl::Meta {
|
||||
using MyStatic = Vector3_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<Vector3, void>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&Vector3::x, FName("x"), memory, {}),
|
||||
MemberField(&Vector3::y, FName("y"), memory, {}),
|
||||
MemberField(&Vector3::z, FName("z"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
struct Vector2_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&Vector2::x, &Vector2::y);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&Vector2::x, FName("x"), { 1.0 }),
|
||||
refl::StaticMemberField(&Vector2::y, FName("y"), { 2.0 }),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<Vector2_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct Vector2_Meta : public refl::Meta {
|
||||
using MyStatic = Vector2_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<Vector2, void>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&Vector2::x, FName("x"), memory, { 1.0 }),
|
||||
MemberField(&Vector2::y, FName("y"), memory, { 2.0 }),
|
||||
};
|
||||
};
|
||||
};
|
||||
struct PosVertex_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&PosVertex::Position);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&PosVertex::Position, FName("Position"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<PosVertex_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct PosVertex_Meta : public refl::Meta {
|
||||
using MyStatic = PosVertex_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<PosVertex, Vertex>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&PosVertex::Position, FName("Position"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
struct TexVertex_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&TexVertex::Position, &TexVertex::Normal, &TexVertex::TexCoords);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&TexVertex::Position, FName("Position"), {}),
|
||||
refl::StaticMemberField(&TexVertex::Normal, FName("Normal"), {}),
|
||||
refl::StaticMemberField(&TexVertex::TexCoords, FName("TexCoords"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<TexVertex_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct TexVertex_Meta : public refl::Meta {
|
||||
using MyStatic = TexVertex_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<TexVertex, Vertex>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&TexVertex::Position, FName("Position"), memory, {}),
|
||||
MemberField(&TexVertex::Normal, FName("Normal"), memory, {}),
|
||||
MemberField(&TexVertex::TexCoords, FName("TexCoords"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
struct BoneVertex_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&BoneVertex::Position, &BoneVertex::TexCoords, &BoneVertex::Normal, &BoneVertex::Tangent, &BoneVertex::Weights, &BoneVertex::BoneIDs);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&BoneVertex::Position, FName("Position"), {}),
|
||||
refl::StaticMemberField(&BoneVertex::TexCoords, FName("TexCoords"), {}),
|
||||
refl::StaticMemberField(&BoneVertex::Normal, FName("Normal"), {}),
|
||||
refl::StaticMemberField(&BoneVertex::Tangent, FName("Tangent"), {}),
|
||||
refl::StaticMemberField(&BoneVertex::Weights, FName("Weights"), {}),
|
||||
refl::StaticMemberField(&BoneVertex::BoneIDs, FName("BoneIDs"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<BoneVertex_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct BoneVertex_Meta : public refl::Meta {
|
||||
using MyStatic = BoneVertex_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<BoneVertex, Vertex>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&BoneVertex::Position, FName("Position"), memory, {}),
|
||||
MemberField(&BoneVertex::TexCoords, FName("TexCoords"), memory, {}),
|
||||
MemberField(&BoneVertex::Normal, FName("Normal"), memory, {}),
|
||||
MemberField(&BoneVertex::Tangent, FName("Tangent"), memory, {}),
|
||||
MemberField(&BoneVertex::Weights, FName("Weights"), memory, {}),
|
||||
MemberField(&BoneVertex::BoneIDs, FName("BoneIDs"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
namespace hello {
|
||||
struct TestHello_Static_Meta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&TestHello::x, &TestHello::z);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&TestHello::x, FName("x"), {}),
|
||||
refl::StaticMemberField(&TestHello::z, FName("z"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<TestHello_Static_Meta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct TestHello_Meta : public refl::Meta {
|
||||
using MyStatic = TestHello_Static_Meta;
|
||||
using MyUClass = refl::UClass_Meta<TestHello, void>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&TestHello::x, FName("x"), memory, {}),
|
||||
MemberField(&TestHello::z, FName("z"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,28 +1,32 @@
|
||||
struct vec3_Static_UIMeta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&vec3::x);
|
||||
};
|
||||
#pragma once
|
||||
namespace engineapi {
|
||||
namespace hello {
|
||||
struct TestHello_Static_UIMeta {
|
||||
consteval static auto __StaticFields() {
|
||||
return std::make_tuple(&TestHello::y);
|
||||
};
|
||||
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
StaticMemberField(&vec3::x, FName("x"), {1.f}),
|
||||
};
|
||||
};
|
||||
consteval static auto __MakeStaticFields() {
|
||||
return std::array{
|
||||
refl::StaticMemberField(&TestHello::y, FName("y"), {}),
|
||||
};
|
||||
};
|
||||
|
||||
consteval static int Size() {
|
||||
return fetch_meta_size<vec3_Static_UIMeta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct vec3_UIMeta : public Meta {
|
||||
using MyStatic = vec3_Static_UIMeta;
|
||||
using MyUClass = UClass_Meta<vec3, vec3_parent>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
StaticMemberField(&vec3::x, FName("x"), {1.f}),
|
||||
};
|
||||
};
|
||||
};
|
||||
consteval static int Size() {
|
||||
return refl::fetch_meta_size<TestHello_Static_UIMeta>();
|
||||
};
|
||||
};
|
||||
|
||||
struct TestHello_UIMeta : public refl::Meta {
|
||||
using MyStatic = TestHello_Static_UIMeta;
|
||||
using MyUClass = refl::UClass_Meta<TestHello, void>;;
|
||||
inline static char s_data[MyStatic::Size()]{};
|
||||
static auto __MakeFields() {
|
||||
char* memory = &s_data[0];
|
||||
return std::array{
|
||||
MemberField(&TestHello::y, FName("y"), memory, {}),
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,45 +1,75 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
#define MAX_NUM_BONES_PER_VERTEX 4
|
||||
struct TestMain1 {
|
||||
__cppast(Meta = {})
|
||||
float x;
|
||||
__cppast(Meta = {})
|
||||
float y;
|
||||
__cppast(Meta = {})
|
||||
float z;
|
||||
};
|
||||
namespace engineapi {
|
||||
namespace hello {
|
||||
struct TestHello{
|
||||
__cppast(Meta = {})
|
||||
float x;
|
||||
__cppast(UIMeta = {})
|
||||
float y;
|
||||
__cppast(Meta = {})
|
||||
float z;
|
||||
};
|
||||
}
|
||||
struct Vector3 {
|
||||
__cppast(Meta = {})
|
||||
float x;
|
||||
__cppast(Meta = {})
|
||||
float y;
|
||||
__cppast(Meta = {})
|
||||
float z;
|
||||
};
|
||||
struct Vector2 {
|
||||
__cppast(Meta = { 1.0 })
|
||||
float x;
|
||||
__cppast(Meta = { 2.0 })
|
||||
float y;
|
||||
};
|
||||
struct Vertex {
|
||||
|
||||
struct vec3_parent {
|
||||
virtual int norm(int x1, int& x2) {
|
||||
x2 = x1 * x2;
|
||||
return x2;
|
||||
//cout << x2 << "vec3_parent::norm" << endl;
|
||||
}
|
||||
};
|
||||
struct vec3_Meta;
|
||||
struct vec3 : public vec3_parent {
|
||||
using MyMeta = vec3_Meta;
|
||||
__cppast(Meta = { 0.f}, UIMeta = {1.f})
|
||||
float x = 1;
|
||||
__cppast(Meta = { 0.f})
|
||||
float y = 2;
|
||||
__cppast(Meta = { 0.f})
|
||||
float z = 3;
|
||||
string name{ "hellohellohellohellohellohello" };
|
||||
__cppast(Meta = { {3,4} })
|
||||
int norm(int x1, int& x2)override {
|
||||
int tmp = x1 * 2 + 1;
|
||||
x1 = x2;
|
||||
x2 = tmp;
|
||||
return x2;
|
||||
//cout << x2 << "vec3::norm" << endl;
|
||||
}
|
||||
virtual float norm1(int& x1) {
|
||||
x1 = x1 * x * y * z;
|
||||
//x = x1;
|
||||
//y = x1 - 1;
|
||||
//z = x1 - 10;
|
||||
//cout << x1 << "::norm1" << endl;
|
||||
return x1;
|
||||
}
|
||||
static void norm2(int x1 = 10) {
|
||||
cout << x1 << "::norm2" << endl;
|
||||
}
|
||||
static void norm3(int x1 = 10) {
|
||||
x1 = x1 * 10;
|
||||
cout << x1 << "::norm3" << endl;
|
||||
}
|
||||
};
|
||||
#include "meta.vertex.inl"
|
||||
};
|
||||
struct PosVertex_Meta;
|
||||
struct PosVertex : public Vertex {
|
||||
using MyMeta = PosVertex_Meta;
|
||||
__cppast(Meta = {})
|
||||
Vector3 Position = {};
|
||||
};
|
||||
struct TexVertex_Meta;
|
||||
struct TexVertex : public Vertex {
|
||||
using MyMeta = TexVertex_Meta;
|
||||
__cppast(Meta = {})
|
||||
Vector3 Position = {};
|
||||
__cppast(Meta = {})
|
||||
Vector3 Normal = {};
|
||||
__cppast(Meta = {})
|
||||
Vector2 TexCoords = {};
|
||||
};
|
||||
struct BoneVertex_Meta;
|
||||
struct BoneVertex : public Vertex
|
||||
{
|
||||
using MyMeta = BoneVertex_Meta;
|
||||
__cppast(Meta = {})
|
||||
Vector3 Position = {};
|
||||
__cppast(Meta = {})
|
||||
Vector2 TexCoords = {};
|
||||
__cppast(Meta = {})
|
||||
Vector3 Normal = {};
|
||||
__cppast(Meta = {})
|
||||
Vector3 Tangent = {};
|
||||
// 骨骼蒙皮数据
|
||||
__cppast(Meta = {})
|
||||
float Weights[MAX_NUM_BONES_PER_VERTEX] = {};
|
||||
__cppast(Meta = {})
|
||||
uint32_t BoneIDs[MAX_NUM_BONES_PER_VERTEX] = {};
|
||||
};
|
||||
};
|
||||
#include "meta_vertex_gen.inl"
|
||||
@ -1,2 +1,3 @@
|
||||
#pragma once
|
||||
#include "meta_vertex_gen.inl"
|
||||
#include "uimeta_vertex_gen.inl"
|
||||
|
||||
@ -1,48 +1,41 @@
|
||||
{%- assign indent = Indent -%}
|
||||
{%- if NameSpace != blank -%}
|
||||
{{ indent }}namespace {{ NameSpace }} {
|
||||
{% capture newIndent %}{{ indent }} {% endcapture %}
|
||||
{%- assign indent = newIndent -%}
|
||||
{%- endif -%}
|
||||
{{ indent }}struct {{ Name }}_Static_{{MetaName}} {
|
||||
{{ indent }} consteval static auto __StaticFields() {
|
||||
{{ indent }} return std::make_tuple({% for field in FieldList %}&{{Name}}::{{field.Name}}{% unless forloop.last %}, {% endunless %}{% endfor %});
|
||||
{{ indent }} };
|
||||
|
||||
{{ indent }} consteval static auto __MakeStaticFields() {
|
||||
{{ indent }} return std::array{
|
||||
{{ indent }} {%- for field in FieldList -%}
|
||||
{{ indent }} {%- if field.IsMethod -%}
|
||||
{{ indent }} StaticMethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ indent }} {%- else -%}
|
||||
{{ indent }} StaticMemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ indent }} {%- endif -%}
|
||||
{{ indent }} {%- endfor -%}
|
||||
{{ indent }} };
|
||||
{{ indent }} };
|
||||
|
||||
{{ indent }} consteval static int Size() {
|
||||
{{ indent }} return fetch_meta_size<{{ Name }}_Static_{{MetaName}}>();
|
||||
{{ indent }} };
|
||||
{{ indent }}};
|
||||
|
||||
{{ indent }}struct {{ Name }}_{{MetaName}} : public Meta {
|
||||
{{ indent }} using MyStatic = {{ Name }}_Static_{{MetaName}};
|
||||
{{ indent }} using MyUClass = UClass_Meta<{{ Name }}, {{ ParentName }}>;;
|
||||
{{ indent }} inline static char s_data[MyStatic::Size()]{};
|
||||
{{ indent }} static auto __MakeFields() {
|
||||
{{ indent }} char* memory = &s_data[0];
|
||||
{{ indent }} return std::array{
|
||||
{{ indent }} {%- for field in FieldList -%}
|
||||
{{ indent }} {%- if field.IsMethod -%}
|
||||
{{ indent }} StaticMethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ indent }} {%- else -%}
|
||||
{{ indent }} StaticMemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ indent }} {%- endif -%}
|
||||
{{ indent }} {%- endfor -%}
|
||||
{{ indent }} };
|
||||
{{ indent }} };
|
||||
{{ indent }}};
|
||||
{% if NameSpace != blank %}
|
||||
{{ Indent }}}
|
||||
{% endif %}
|
||||
{%- assign NewLine = newline_to_br -%}
|
||||
{{ Indent2 }}struct {{ Name }}_Static_{{MetaName}} {
|
||||
{{ Indent2 }} consteval static auto __StaticFields() {
|
||||
{{ Indent2 }} return std::make_tuple({% for field in FieldList %}&{{Name}}::{{field.Name}}{% unless forloop.last %}, {% endunless %}{% endfor %});
|
||||
{{ Indent2 }} };
|
||||
{{ NewLine }}
|
||||
{{ Indent2 }} consteval static auto __MakeStaticFields() {
|
||||
{{ Indent2 }} return std::array{
|
||||
{{ NewLine }} {%- for field in FieldList -%}
|
||||
{{ NewLine }} {%- if field.IsMethod -%}
|
||||
{{ Indent2 }} refl::StaticMethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ NewLine }} {%- else -%}
|
||||
{{ Indent2 }} refl::StaticMemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"){% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ NewLine }} {%- endif -%}
|
||||
{{ NewLine }} {%- endfor -%}
|
||||
{{ Indent2 }} };
|
||||
{{ Indent2 }} };
|
||||
{{ NewLine }}
|
||||
{{ Indent2 }} consteval static int Size() {
|
||||
{{ Indent2 }} return refl::fetch_meta_size<{{ Name }}_Static_{{MetaName}}>();
|
||||
{{ Indent2 }} };
|
||||
{{ Indent2 }}};
|
||||
{{ NewLine }}
|
||||
{{ Indent2 }}struct {{ Name }}_{{MetaName}} : public refl::Meta {
|
||||
{{ Indent2 }} using MyStatic = {{ Name }}_Static_{{MetaName}};
|
||||
{{ Indent2 }} using MyUClass = refl::UClass_Meta<{{ Name }}, {{ ParentName }}>;;
|
||||
{{ Indent2 }} inline static char s_data[MyStatic::Size()]{};
|
||||
{{ Indent2 }} static auto __MakeFields() {
|
||||
{{ Indent2 }} char* memory = &s_data[0];
|
||||
{{ Indent2 }} return std::array{
|
||||
{{ NewLine }} {%- for field in FieldList -%}
|
||||
{{ NewLine }} {%- if field.IsMethod -%}
|
||||
{{ Indent2 }} MethodField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), memory{% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ NewLine }} {%- else -%}
|
||||
{{ Indent2 }} MemberField(&{{Name}}::{{field.Name}}, FName("{{field.Name}}"), memory{% if field.Meta %}, {{field.Meta}}{% endif %}),
|
||||
{{ NewLine }} {%- endif -%}
|
||||
{{ NewLine }} {%- endfor -%}
|
||||
{{ Indent2 }} };
|
||||
{{ Indent2 }} };
|
||||
{{ Indent2 }}};
|
||||
{{ NewLine }}
|
||||
Loading…
Reference in New Issue
Block a user