Skip to content
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

Add support for component inheritance to the reflection framework #1345

Open
morganlaowang opened this issue Sep 9, 2024 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@morganlaowang
Copy link

Describe the bug
I use component like that:
struct Base
{
int base = 1;
}

struct A : Base
{
int base = 2;
int a = 2;
}

struct A : Base
{
int base = 3;
int b = 3;
}

I also used "e.component().is_a()" and also the struct B

I used system and query

I added the componets and changed the data from the explorer

Expected behavior
the data has wrong that the default value not used and the data changed not sync.
if I dont used inheritance the problem will not happened

Additional context
I use the version 4.0.1

@morganlaowang morganlaowang added the bug Something isn't working label Sep 9, 2024
@SanderMertens
Copy link
Owner

Can you share the entire code example that reproduces the issue, including where you add the component to an entity?

@morganlaowang
Copy link
Author

struct C
{
    int layer = 0;
    std::string d;
    int type = 0;
};

struct S:C
{
    int layer = 0;
    std::string d = "";
    int type = 1;

    float r;
};

struct B:C
{
    int layer = 0;
    std::string d = "";
    int type = 2;

    Vec3  p
};
	
	flecs::world.component<C>("C")
        .member("layer", &)
        .member("d", &C::d)
        .member("type", &C::type);

    flecs::world.component<B>("B")
        .member("layer", &B::layer)
        .member("p", &B::p).is_a<C>();

    flecs::world.component<S>("S")
        .member("layer", &S::layer)
        .member("r", &S::radius).is_a<C>();

@morganlaowang
Copy link
Author

and I used the
screenshot-20240910-142118
in flecs explorer durning runtime

@SanderMertens
Copy link
Owner

SanderMertens commented Sep 10, 2024

Which component did you add in the explorer and with which value? Can you share a screenshot that shows the issue?

Ah, I see the issue. The reflection framework doesn't interpret component inheritance yet. That's something that'll have to get addressed.

@SanderMertens SanderMertens changed the title component inheritance has the data error Add support for component inheritance to the reflection framework Dec 18, 2024
@SanderMertens SanderMertens added enhancement New feature or request and removed bug Something isn't working labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants