41 using T = decltype(dummy);
42 const VArray<T> &values_typed = values.typed<T>();
43 for (const int i : values.index_range()) {
44 const float3 position = math::transform_point(object_to_world, positions[i]);
45 const T &value = values_typed[i];
48 size_t numstr_len = 0;
49 if constexpr (std::is_same_v<T, bool>) {
50 numstr_len = SNPRINTF_RLEN(numstr,
"%s", value ?
"True" :
"False");
52 else if constexpr (std::is_same_v<T, int8_t>) {
53 numstr_len = SNPRINTF_RLEN(numstr,
"%d", int(value));
55 else if constexpr (std::is_same_v<T, int>) {
56 numstr_len = SNPRINTF_RLEN(numstr,
"%d", value);
58 else if constexpr (std::is_same_v<T, int2>) {
59 numstr_len = SNPRINTF_RLEN(numstr,
"(%d, %d)", value.x, value.y);
61 else if constexpr (std::is_same_v<T, float>) {
62 numstr_len = SNPRINTF_RLEN(numstr,
"%g", value);
64 else if constexpr (std::is_same_v<T, float2>) {
65 numstr_len = SNPRINTF_RLEN(numstr,
"(%g, %g)", value.x, value.y);
67 else if constexpr (std::is_same_v<T, float3>) {
68 numstr_len = SNPRINTF_RLEN(numstr,
"(%g, %g, %g)", value.x, value.y, value.z);
70 else if constexpr (std::is_same_v<T, ColorGeometry4b>) {
71 const ColorGeometry4f color = value.decode();
72 numstr_len = SNPRINTF_RLEN(
73 numstr,
"(%.3f, %.3f, %.3f, %.3f)", color.r, color.g, color.b, color.a);
75 else if constexpr (std::is_same_v<T, ColorGeometry4f>) {
76 numstr_len = SNPRINTF_RLEN(
77 numstr,
"(%.3f, %.3f, %.3f, %.3f)", value.r, value.g, value.b, value.a);
79 else if constexpr (std::is_same_v<T, math::Quaternion>) {
80 numstr_len = SNPRINTF_RLEN(
81 numstr,
"(%.3f, %.3f, %.3f, %.3f)", value.w, value.x, value.y, value.z);
84 BLI_assert_unreachable();
88 dt, position, numstr, numstr_len, 0, 0, DRW_TEXT_CACHE_GLOBALSPACE, col, true, true);
void OVERLAY_viewer_attribute_text(const Object &object)