diff --git a/engine/3rdparty/zlib/include/refl/detail/convert.inl b/engine/3rdparty/zlib/include/refl/detail/convert.inl index d2269df..c7da5c0 100644 --- a/engine/3rdparty/zlib/include/refl/detail/convert.inl +++ b/engine/3rdparty/zlib/include/refl/detail/convert.inl @@ -13,8 +13,8 @@ namespace refl { inline bool Convert::Construct(Any& dst, const Any& src) { if (dst.Check(src.cls)) { - dst.cls->InitObject((void*)dst.ptr); - dst.cls->CopyObject((void*)dst.ptr, src.ptr); + dst.cls->parent->InitObject((void*)dst.ptr); + dst.cls->parent->CopyObject((void*)dst.ptr, src.ptr); return true; } auto it = ClassMap.find(dst.cls); diff --git a/engine/3rdparty/zlib/include/refl/detail/field.inl b/engine/3rdparty/zlib/include/refl/detail/field.inl index 5941854..25b31e4 100644 --- a/engine/3rdparty/zlib/include/refl/detail/field.inl +++ b/engine/3rdparty/zlib/include/refl/detail/field.inl @@ -1,3 +1,4 @@ +#pragma once #include "uclass.h" namespace refl { template diff --git a/engine/3rdparty/zlib/include/refl/detail/meta.h b/engine/3rdparty/zlib/include/refl/detail/meta.h index 3e19ee7..4235a4c 100644 --- a/engine/3rdparty/zlib/include/refl/detail/meta.h +++ b/engine/3rdparty/zlib/include/refl/detail/meta.h @@ -18,6 +18,9 @@ namespace refl { for (auto& field : fields) { size += field.data.member.offset; } + if (size == 0) { + size = 1; + } return size; } enum MetaFlag :uint32_t { diff --git a/engine/3rdparty/zlib/include/refl/macro.h b/engine/3rdparty/zlib/include/refl/macro.h index 3bfa402..c4909f4 100644 --- a/engine/3rdparty/zlib/include/refl/macro.h +++ b/engine/3rdparty/zlib/include/refl/macro.h @@ -1,3 +1,4 @@ +#pragma once #if !defined(__cppast) #define __cppast(...) #endif \ No newline at end of file diff --git a/engine/3rdparty/zlib/test/refl/vertex.h b/engine/3rdparty/zlib/test/refl/vertex.h index e2dacf5..81fe330 100644 --- a/engine/3rdparty/zlib/test/refl/vertex.h +++ b/engine/3rdparty/zlib/test/refl/vertex.h @@ -12,14 +12,14 @@ struct vec3_parent { struct vec4 { string name{ "hello" }; }; -struct vec3_Meta; +class vec3_Meta; struct vec3 : public vec3_parent { using MyMeta = vec3_Meta; - __cppast(Meta = { 0.f}) + __cppast(Meta = { 1.f}) float x = 1; - __cppast(Meta = { 0.f}) + __cppast(Meta = { 2.f}) float y = 2; - __cppast(Meta = { 0.f}) + __cppast(Meta = { 5.f}) float z = 3; __cppast(Meta = { "hello meta"}) string name = "???"; @@ -50,5 +50,4 @@ struct vec3 : public vec3_parent { cout << x1 << "::norm3" << endl; } }; - #include "meta_vertex_gen.inl" \ No newline at end of file