diff --git a/docs/Manual.md b/docs/Manual.md index 0b02a6cd3..f0c91c851 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -634,8 +634,6 @@ Component disabling can be used to temporarily suspend and resume a component va #### Limitations Component disabling does not work for components not matched with the entity. If a query matches with a component from a base (prefab) or parent entity and the component is disabled for that entity, the query will not take this into account. If entities with disabled components from a base or parent entity need to be skipped. a query should manually check this. -Because component disabling is implemented with a type role, it cannot be used together with other type roles. This means that it is not possible to disable, for example, tags with `SWITCH` or `CASE` roles. Additionally since relationships rely on a role, it is currently not possible to disable relationships such as `(ChildOf, parent)` or `(IsA, prefab)`. - Another limitation is that currently the query NOT (!) operator does not take into account disabled entities. The optional operator (?) technically works, but a query is unable to see whether a component has been set or not as both the enabled and disabled values are returned to the application in a single array. ## Tagging diff --git a/docs/Queries.md b/docs/Queries.md index 0942141a1..f73ef0a70 100644 --- a/docs/Queries.md +++ b/docs/Queries.md @@ -1147,10 +1147,12 @@ while (ecs_filter_next(&it)) { ecs_id_t vs_id = ecs_field_id(&it, 2); if (vs_id == ecs_id(Velocity)) { - Velocity *v = ecs_field(&it, Velocity, 2); + // We can only use ecs_field if the field type is the same for all results, + // but we can get the table column directly. + Velocity *v = ecs_table_get_id(word, it.table, ecs_id(Velocity), it.offset); // iterate as usual } else if (vs_id == ecs_id(Speed)) { - Speed *s = ecs_field(&it, Speed, 2); + Speed *s = ecs_table_get_id(word, it.table, ecs_id(Speed), it.offset); // iterate as usual } } @@ -1174,10 +1176,12 @@ f.iter([&](flecs::iter& it) { flecs::id vs_id = it.id(2); if (vs_id == world.id()) { - auto v = it.field(2); + // We can only use ecs_field if the field type is the same for all results, + // but we can use range() to get the table column directly. + auto v = it.range().get(); // iterate as usual } else if (vs_id == world.id()) { - auto s = it.field(2); + auto s = it.range().get(); // iterate as usual } }); diff --git a/flecs.c b/flecs.c index c33a732a3..d9e463a35 100644 --- a/flecs.c +++ b/flecs.c @@ -33336,6 +33336,7 @@ void flecs_rest_parse_json_ser_iter_params( flecs_rest_bool_param(req, "term_ids", &desc->serialize_term_ids); flecs_rest_bool_param(req, "term_labels", &desc->serialize_term_labels); flecs_rest_bool_param(req, "ids", &desc->serialize_ids); + flecs_rest_bool_param(req, "id_labels", &desc->serialize_id_labels); flecs_rest_bool_param(req, "sources", &desc->serialize_sources); flecs_rest_bool_param(req, "variables", &desc->serialize_variables); flecs_rest_bool_param(req, "is_set", &desc->serialize_is_set); @@ -51538,6 +51539,7 @@ void flecs_json_serialize_id_label( flecs_json_next(buf); flecs_json_label(buf, world, obj); } + flecs_json_array_pop(buf); } static @@ -51691,7 +51693,7 @@ void flecs_json_serialize_iter_result_id_labels( const ecs_iter_t *it, ecs_strbuf_t *buf) { - flecs_json_memberl(buf, "ids"); + flecs_json_memberl(buf, "id_labels"); flecs_json_array_push(buf); for (int i = 0; i < it->field_count; i ++) {