-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No fields found in struct #4
Comments
Hi exuvo, I think you are missing the RFKField() macro before the fields you want to reflect. #include "refureku/SimpleComponents.rfk.h"
...
struct RFKStruct() CircleComponent
{
RFKField()
float radius = 1; // in m
CircleComponent_GENERATED
};
...
File_GENERATED Let me know if this fixes your problem. |
Oh is there no way to automatically include all fields from the RFKStruct?
…On Mon, 26 Apr 2021, 16:59 Julien SOYSOUVANH, ***@***.***> wrote:
Hi exuvo,
I think you are missing the RFKField() macro before the fields you want to
reflect.
Try this
#include "refureku/SimpleComponents.rfk.h"
...struct RFKStruct() CircleComponent
{
RFKField()
float radius = 1; // in m
CircleComponent_GENERATED
};
...
File_GENERATED
Let me know if this fixes your problem.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPUKORT7Y7XEE4DK3SXD5LTKV5TVANCNFSM43SVNKMQ>
.
|
Sure, you are probably looking for the ParseAllNested property. #include <Refureku/NativeProperties.h>
#include "refureku/SimpleComponents.rfk.h"
...
struct RFKStruct(ParseAllNested) CircleComponent
{
float radius = 1; // in m
CircleComponent_GENERATED
};
...
File_GENERATED Let me know if this works out for you :) |
Had to set(GEN_PROPERTY_RTTI ON) too for the linking but it is working now! |
Followup question: What is the best way to check the type of a field? Is I see field.type which has a few is methods for some general information and its archetype->name has the literal name ex "float". |
The type of a field (class rfk::Type) is its archetype + all potential qualifiers (*, &, const, etc...). For example if you want to check if your field is a float*, you'll use: field.type == rfk::Type::getType<float*>() If you just wanna compare the archetype (regardless of the field qualifiers), you can write: field.type.archetype == rfk::getArchetype<float>() By the way, the rfk::getArchetype method automatically discards all type qualifiers so: field.type.archetype == rfk::getArchetype<float*>() will also return true if your field is a simple float. |
Ok thanks that clears everything up. |
You're very welcome! |
The generator runs with no errors but the resulting rfk.h does not contain any references to the field my struct has, only the base struct name. What am i missing?
Ex rfk::Struct const & s = CircleComponent::staticGetArchetype(); s.fields.size() is zero. s.memorySize however is 4 as i expect.
I am on linux building refureku as a subproject in cmake from source with gcc 10.2.0. RefurekuSettings is set using cmakes configure_file. I had to update the included libclang to my local libclang.so.11.1 as i have newer system libraries than what the older one was built against. I had to comment out the Library tests as it just keeps trying to use my projects RefurekuSettings.toml which obviously does not work for the tests. I can't even find the RefurekuSettings.toml for the tests so i was unable to fix that.
Complete file if you want.
The text was updated successfully, but these errors were encountered: