Michele Caini/entt: Release v3.4.0
Name: entt
Owner: Michele Caini
Release: EnTT v3.4.0
Released: 2020-05-08
License: MIT
Release Assets:
Changelog
config:- Added
ENTT_IS_EMPTYas an opaque way to recognize empty types (ENTT_DISABLE_ETOaffects also this variable).
- Added
core:- Added
entt::id_typeas an user-friendly alternative forENTT_ID_TYPE. - Added the
entt::type_indexclass sfinae-friendly template to assign library wide sequential identifiers to types. - Added
entt::has_type_index[_v]to know if a given typeThas assigned a library wide sequential identifier. - Added
entt::integral_constantas a shortcut for its standard counterpart.
- Added
entity:- Added
registry::remove_allto orphan entities. - Added
registry::patch<T>to replace an object in-place. - Added
registry::on_update<T>to attach listeners to observe changes. - Added
registry::emplace<T>to assign components to multiple entities at once. - Added
registry::insert<T>to assign components to entities. - Added
registry::get_or_emplace<T>get a component and construct it if it doesn't exist yet. registry::replacefrom arguments is no longer deprecated and still available.- Added
storage<T>::emplaceto assign objects to entities. - Added
storage<T>::insertto assign objects to multiple entities at once. - Added
sparse_set::emplaceto assign objects to entities. - Added
sparse_set::insertto assign objects to multiple entities at once. - Added
entt::invoke, a shortcut to invoke members on components from callbacks. - Added
registry::destroywith suggested version.
- Added
meta:- Added
meta_type::detachto make it possible to detach meta type from contexts (for example, during a visit). - Added a reviewed version of
meta_factory::typethat usestype_info<T>::id()as a default initializer. - Added
meta_type::type_idto get the type id of the underlying (erased) type. - Added
entt::resolve_ifto lookup meta types using custom predicates. - Added
entt::resolve_idto lookup meta types by identifier. - Added
entt::resolve_typeto lookup meta types by type id. - Added
meta_any::refto invoke aliasing constructor and get references to unmanaged objects.
- Added
Performance improvements here and there (more devirtualization, less branches, ...).
Build system
homebrew-enttis automatically updated on tags.- Updated installation process.
EnTT across boundaries
It turned out that the latest version had a problem when multiple registries containing different component types were used concurrently from different threads (see #449 for further details).
Because of this, the way used to make EnTT work across boundaries has changed and has been further refined. There exist now two paths within some of the data structure available in EnTT: the default one (also known as indexed access) based on the type_index class and its fallback based on the type_info class.
In particular:
When
EnTTis used standalone and its main classes (such as theregistry) are not pushed across boundaries, there is nothing to worry about.In case of linked libraries and when exporting the necessary symbols isn't a problem, use the
ENTT_API_IMPORTandENTT_API_EXPORTdefinitions as appropriate. This will makeEnTTuse the indexed access even across boundaries.In all other cases, suppress the index generation to force
EnTTto use a fallback:template<typename Type> struct entt::type_index<Type> {};It's recommended to use range operations as much as possible in this case.
The lib directory contains many examples for who's interested in the topic.
The meta system has not undergone any changes since its previous version.
Breaking changes
- Empty types are no longer returned nor are they available in any case.
- The
storageclass for empty types doesn't offer anymoreget,try_getand so on. - Views and groups no longer return empty types during a call to
eachand don't allow anymore togetan empty type for an entity. ENTT_DISABLE_ETOis no longer considered, useENTT_NO_ETOinstead.ENTT_ENABLE_ETOis no longer exported, useENTT_IS_EMPTYinstead.
- The
iterator_typealiases have been renamed toiteratorfor better integration.meta_type::idreturns the type identifier rather than the type id.basic_snapshot<T>::entitiesstores aside also destroyed entities, not only the ones still alive.basic_snapshot_loader<T>::entitiesexpects also destroyed entities, not only the ones still alive.basic_continuous_loader<T>::entitiesexpects also destroyed entities, not only the ones still alive.
Deprecated functions
All previously deprecated functions and classes have been removed. This is the list of features deprecated with this release:
registry::replacewith callbacks, useregistry::patchinstead.registry::on_replace, useregistry::on_updateinstead.registry::assign<T>for a single entity, useregistry::emplace<T>instead.registry::assign<T>for multiple entities, useregistry::insert<T>instead.registry::get_or_assign<T>, useregistry::get_or_emplace<T>instead.registry::snapshot,basic_snapshot<T>has now a constructor that accepts a reference to a registry.registry::loader,basic_snapshot_loader<T>has now a constructor that accepts a reference to a registry.storage<T>::constructfor a single entity, usestorage<T>::emplaceinstead.storage<T>::constructfor multiple entities, usestorage<T>::insertinstead.storage<T>::destroy, usestorage<T>::eraseinstead.sparse_set::constructfor a single entity, usesparse_set::emplaceinstead.sparse_set::constructfor multiple entities, usesparse_set::insertinstead.sparse_set::destroy, usesparse_set::eraseinstead.sparse_set::has, usesparse_set::containsinstead.group::less, usegroup::eachinstead.view::less, useview::eachinstead.meta_factory::alias, usemeta_factory::typeinstead.meta_type::alias, usemeta_type::idinstead.meta_data::alias, usemeta_data::idinstead.meta_func::alias, usemeta_func::idinstead.entt::as_alias_tandentt::as_alias, useentt::as_ref_tandentt::as_refinstead.entt::resolveby identifier, useentt::resolve_idinstead.observer::replace, useobserver::updateinstead.basic_snapshot<T>::destroyed, usebasic_snapshot<T>::entitiesinstead.basic_snapshot_loader<T>::destroyed, usebasic_snapshot_loader<T>::entitiesinstead.basic_continuous_loader<T>::destroyed, usebasic_continuous_loader<T>::entitiesinstead.basic_continuous_loader::has, usebasic_continuous_loader::containsinstead.
Any other business
The documentation is up-to-date and the library is battle-tested with 100% coverage as usual.
I've also updated the FAQs and the section EnTT in Action with more and more examples.
I started a long term process to reduce the number of instantiations and therefore speed up the compilation. This release contains some more changes in this regard. Still a work in progress though.