From 489444b7a8ddc22bb9daf527e094344ce82e6680 Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Thu, 17 Sep 2026 14:25:21 +0200 Subject: [PATCH 1/4] fix(attribute): Fixed has_value() function when no_value is set at std::nan --- include/geode/basic/sparse_attribute.hpp | 6 +++--- include/geode/basic/variable_attribute.hpp | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/geode/basic/sparse_attribute.hpp b/include/geode/basic/sparse_attribute.hpp index c41b38dd8..8e5a00095 100644 --- a/include/geode/basic/sparse_attribute.hpp +++ b/include/geode/basic/sparse_attribute.hpp @@ -84,11 +84,11 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( value( element ) == default_values_.no_value ) + if( std::isnan( default_values_.no_value ) ) { - return false; + return std::isnan( value( element ) ); } - return true; + return value( element ) != default_values_.no_value; } void set_value( index_t element, T value ) diff --git a/include/geode/basic/variable_attribute.hpp b/include/geode/basic/variable_attribute.hpp index 57a2ab128..8f0e907ca 100644 --- a/include/geode/basic/variable_attribute.hpp +++ b/include/geode/basic/variable_attribute.hpp @@ -73,11 +73,11 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( values_[element] == default_values_.no_value ) + if( std::isnan( default_values_.no_value ) ) { - return false; + return std::isnan( value( element ) ); } - return true; + return values_[element] != default_values_.no_value; } void set_value( index_t element, T value ) @@ -342,11 +342,11 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( value( element ) == default_values_.no_value ) + if( std::isnan( default_values_.no_value ) ) { - return false; + return std::isnan( value( element ) ); } - return true; + return value( element ) != default_values_.no_value; } void set_value( index_t element, bool value ) From 862e53eb31e091644c9741ddc006e4f72656a0fe Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Thu, 17 Sep 2026 15:14:25 +0200 Subject: [PATCH 2/4] fix commit --- include/geode/basic/sparse_attribute.hpp | 7 +++++-- include/geode/basic/variable_attribute.hpp | 11 +++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/geode/basic/sparse_attribute.hpp b/include/geode/basic/sparse_attribute.hpp index 8e5a00095..8dcc14636 100644 --- a/include/geode/basic/sparse_attribute.hpp +++ b/include/geode/basic/sparse_attribute.hpp @@ -84,9 +84,12 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( std::isnan( default_values_.no_value ) ) + if constexpr( std::is_floating_point_v< T > ) { - return std::isnan( value( element ) ); + if( std::isnan( default_values_.no_value ) ) + { + return std::isnan( value( element ) ); + } } return value( element ) != default_values_.no_value; } diff --git a/include/geode/basic/variable_attribute.hpp b/include/geode/basic/variable_attribute.hpp index 8f0e907ca..5b7564d79 100644 --- a/include/geode/basic/variable_attribute.hpp +++ b/include/geode/basic/variable_attribute.hpp @@ -73,9 +73,12 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( std::isnan( default_values_.no_value ) ) + if constexpr( std::is_floating_point_v< T > ) { - return std::isnan( value( element ) ); + if( std::isnan( default_values_.no_value ) ) + { + return std::isnan( value( element ) ); + } } return values_[element] != default_values_.no_value; } @@ -342,10 +345,6 @@ namespace geode [[nodiscard]] bool has_value( index_t element ) const override { - if( std::isnan( default_values_.no_value ) ) - { - return std::isnan( value( element ) ); - } return value( element ) != default_values_.no_value; } From 8fc16f81ed5d74ebb8b7af2ec17a513808f8c1ad Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Thu, 17 Sep 2026 15:57:00 +0200 Subject: [PATCH 3/4] fix wrong test --- include/geode/basic/variable_attribute.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/geode/basic/variable_attribute.hpp b/include/geode/basic/variable_attribute.hpp index 5b7564d79..bc2d811e9 100644 --- a/include/geode/basic/variable_attribute.hpp +++ b/include/geode/basic/variable_attribute.hpp @@ -77,7 +77,7 @@ namespace geode { if( std::isnan( default_values_.no_value ) ) { - return std::isnan( value( element ) ); + return !std::isnan( value( element ) ); } } return values_[element] != default_values_.no_value; From fb26148b25c273f5769b7c999c106100b4580e0c Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Thu, 17 Sep 2026 17:01:21 +0200 Subject: [PATCH 4/4] added missing operator for ComponentMeshElement --- include/geode/model/mixin/core/component_mesh_element.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/geode/model/mixin/core/component_mesh_element.hpp b/include/geode/model/mixin/core/component_mesh_element.hpp index c48014e0d..55ee4d4ce 100644 --- a/include/geode/model/mixin/core/component_mesh_element.hpp +++ b/include/geode/model/mixin/core/component_mesh_element.hpp @@ -55,6 +55,12 @@ namespace geode && element_id == other.element_id; } + [[nodiscard]] bool operator!=( const ComponentMeshElement& other ) const + { + return component_id != other.component_id + || element_id != other.element_id; + } + template < typename Archive > void serialize( Archive& serializer ) {