Merge branch 'blender-v4.2-release'

This commit is contained in:
Jacques Lucke
2024-06-14 19:26:32 +02:00
3 changed files with 11 additions and 3 deletions

View File

@@ -90,6 +90,7 @@ enum class CPPTypeFlags {
Hashable = 1 << 0,
Printable = 1 << 1,
EqualityComparable = 1 << 2,
IdentityDefaultValue = 1 << 3,
BasicType = Hashable | Printable | EqualityComparable,
};

View File

@@ -231,8 +231,14 @@ CPPType::CPPType(TypeTag<T> /*type*/,
default_construct_indices_ = default_construct_indices_cb<T>;
value_initialize_ = value_initialize_cb<T>;
value_initialize_indices_ = value_initialize_indices_cb<T>;
static T default_value;
default_value_ = &default_value;
if constexpr (bool(Flags & CPPTypeFlags::IdentityDefaultValue)) {
static const T default_value = T::identity();
default_value_ = &default_value;
}
else {
static const T default_value = T();
default_value_ = &default_value;
}
}
if constexpr (std::is_destructible_v<T>) {
destruct_ = destruct_cb<T>;

View File

@@ -66,7 +66,8 @@ BLI_CPP_TYPE_MAKE(uint64_t, CPPTypeFlags::BasicType)
BLI_CPP_TYPE_MAKE(blender::ColorGeometry4f, CPPTypeFlags::BasicType)
BLI_CPP_TYPE_MAKE(blender::ColorGeometry4b, CPPTypeFlags::BasicType)
BLI_CPP_TYPE_MAKE(blender::math::Quaternion, CPPTypeFlags::BasicType)
BLI_CPP_TYPE_MAKE(blender::math::Quaternion,
CPPTypeFlags::BasicType | CPPTypeFlags::IdentityDefaultValue)
BLI_CPP_TYPE_MAKE(std::string, CPPTypeFlags::BasicType)