Blender V5.0
spreadsheet_layout.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <iomanip>
6#include <sstream>
7
8#include <fmt/format.h>
9
10#include "BLF_api.hh"
11
12#include "BLI_color.hh"
13#include "BLI_math_matrix.hh"
16#include "BLI_string.h"
17
18#include "BKE_instances.hh"
19
21
24#include "spreadsheet_layout.hh"
25
26#include "DNA_meshdata_types.h"
27
28#include "UI_interface.hh"
29#include "UI_resources.hh"
30
31#include "BLT_translation.hh"
32
33/* Need to do our own padding in some cases because we use low-level ui code to draw the
34 * spreadsheet. */
35#define CELL_PADDING_X (0.15f * SPREADSHEET_WIDTH_UNIT)
36
38
39static std::string format_matrix_to_grid(const float4x4 &matrix)
40{
41 auto format_element = [](float value) {
42 if (math::abs(value) < 1e-4f) {
43 return fmt::format("{:.3}", value);
44 }
45 return fmt::format("{:.6}", value);
46 };
47
48 /* Transpose to be able to print row by row. */
49 const float4x4 t_matrix = math::transpose(matrix);
50 std::array<std::array<std::string, 4>, 4> formatted_elements;
51 std::array<size_t, 4> column_widths = {};
52 for (const int row_i : IndexRange(4)) {
53 for (const int col_i : IndexRange(4)) {
54 formatted_elements[row_i][col_i] = format_element(t_matrix[row_i][col_i]);
55 column_widths[col_i] = std::max(column_widths[col_i],
56 formatted_elements[row_i][col_i].length());
57 }
58 }
59
60 fmt::memory_buffer buf;
61 for (const int row_i : IndexRange(4)) {
62 for (const int col_i : IndexRange(4)) {
63 fmt::format_to(
64 fmt::appender(buf), "{:>{}}", formatted_elements[row_i][col_i], column_widths[col_i]);
65 if (col_i < 3) {
66 fmt::format_to(fmt::appender(buf), " ");
67 }
68 }
69 if (row_i < 3) {
70 fmt::format_to(fmt::appender(buf), "\n");
71 }
72 }
73 return fmt::to_string(buf);
74}
75
77 private:
78 const SpreadsheetLayout &spreadsheet_layout_;
79
80 public:
81 SpreadsheetLayoutDrawer(const SpreadsheetLayout &spreadsheet_layout)
82 : spreadsheet_layout_(spreadsheet_layout)
83 {
84 tot_columns = spreadsheet_layout.columns.size();
85 tot_rows = spreadsheet_layout.row_indices.size();
86 left_column_width = spreadsheet_layout.index_column_width;
87 }
88
89 void draw_top_row_cell(int column_index, const CellDrawParams &params) const final
90 {
91 const StringRefNull name = spreadsheet_layout_.columns[column_index].values->name();
92 uiBut *but = uiDefIconTextBut(params.block,
94 0,
95 ICON_NONE,
96 name,
97 params.xmin,
98 params.ymin,
99 params.width,
100 params.height,
101 nullptr,
102 std::nullopt);
104 but,
105 [](bContext * /*C*/, void *arg, blender::StringRef /*tip*/) {
106 return *static_cast<std::string *>(arg);
107 },
108 MEM_new<std::string>(__func__, name),
109 [](void *arg) { MEM_delete(static_cast<std::string *>(arg)); });
110 /* Center-align column headers. */
113 }
114
115 void draw_left_column_cell(int row_index, const CellDrawParams &params) const final
116 {
117 const int real_index = spreadsheet_layout_.row_indices[row_index];
118 std::string index_str = std::to_string(real_index);
119 uiBut *but = uiDefIconTextBut(params.block,
121 0,
122 ICON_NONE,
123 index_str,
124 params.xmin,
125 params.ymin,
126 params.width,
127 params.height,
128 nullptr,
129 std::nullopt);
130 /* Right-align indices. */
133 }
134
135 void draw_content_cell(int row_index, int column_index, const CellDrawParams &params) const final
136 {
137 const int real_index = spreadsheet_layout_.row_indices[row_index];
138 const ColumnValues &column = *spreadsheet_layout_.columns[column_index].values;
139 if (real_index > column.size()) {
140 return;
141 }
142
143 const GVArray &data = column.data();
144 const CPPType &type = data.type();
145 BUFFER_FOR_CPP_TYPE_VALUE(type, buffer);
146 data.get_to_uninitialized(real_index, buffer);
147 this->draw_content_cell_value(GPointer(type, buffer), params, column);
148 type.destruct(buffer);
149 }
150
151 void draw_content_cell_value(const GPointer value_ptr,
152 const CellDrawParams &params,
153 const ColumnValues &column) const
154 {
155 const CPPType &type = *value_ptr.type();
156 if (type.is<int>()) {
157 this->draw_int(params, *value_ptr.get<int>(), column.display_hint());
158 return;
159 }
160 if (type.is<int64_t>()) {
161 this->draw_int(params, *value_ptr.get<int64_t>(), column.display_hint());
162 return;
163 }
164 if (type.is<int8_t>()) {
165 const int8_t value = *value_ptr.get<int8_t>();
166 const std::string value_str = std::to_string(value);
167 uiBut *but = uiDefIconTextBut(params.block,
169 0,
170 ICON_NONE,
171 value_str,
172 params.xmin,
173 params.ymin,
174 params.width,
175 params.height,
176 nullptr,
177 std::nullopt);
178 /* Right-align Integers. */
181 return;
182 }
183 if (type.is<short2>()) {
184 const int2 value = int2(*value_ptr.get<short2>());
185 this->draw_int_vector(params, Span(&value.x, 2));
186 return;
187 }
188 if (type.is<int2>()) {
189 const int2 value = *value_ptr.get<int2>();
190 this->draw_int_vector(params, Span(&value.x, 2));
191 return;
192 }
193 if (type.is<int3>()) {
194 const int3 value = *value_ptr.get<int3>();
195 this->draw_int_vector(params, Span(&value.x, 3));
196 return;
197 }
198 if (type.is<float>()) {
199 const float value = *value_ptr.get<float>();
200 std::stringstream ss;
201 ss << std::fixed << std::setprecision(3) << value;
202 const std::string value_str = ss.str();
203 uiBut *but = uiDefIconTextBut(params.block,
205 0,
206 ICON_NONE,
207 value_str,
208 params.xmin,
209 params.ymin,
210 params.width,
211 params.height,
212 nullptr,
213 std::nullopt);
215 but,
216 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
217 return fmt::format("{:f}", *((float *)argN));
218 },
219 MEM_dupallocN<float>(__func__, value),
220 MEM_freeN);
221 /* Right-align Floats. */
224 return;
225 }
226 if (type.is<bool>()) {
227 const bool value = *value_ptr.get<bool>();
228 const int icon = value ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
229 uiBut *but = uiDefIconTextBut(params.block,
231 0,
232 icon,
233 "",
234 params.xmin,
235 params.ymin,
236 params.width,
237 params.height,
238 nullptr,
239 std::nullopt);
241 return;
242 }
243 if (type.is<float2>()) {
244 const float2 value = *value_ptr.get<float2>();
245 this->draw_float_vector(params, Span(&value.x, 2));
246 return;
247 }
248 if (type.is<float3>()) {
249 const float3 value = *value_ptr.get<float3>();
250 this->draw_float_vector(params, Span(&value.x, 3));
251 return;
252 }
253 if (type.is<ColorGeometry4f>()) {
254 const ColorGeometry4f value = *value_ptr.get<ColorGeometry4f>();
255 this->draw_float_vector(params, Span(&value.r, 4));
256 return;
257 }
258 if (type.is<ColorGeometry4b>()) {
259 const ColorGeometry4b value = *value_ptr.get<ColorGeometry4b>();
260 this->draw_byte_color(params, value);
261 return;
262 }
263 if (type.is<math::Quaternion>()) {
264 const float4 value = float4(*value_ptr.get<math::Quaternion>());
265 this->draw_float_vector(params, Span(&value.x, 4));
266 return;
267 }
268 if (type.is<float4x4>()) {
269 this->draw_float4x4(params, *value_ptr.get<float4x4>());
270 return;
271 }
272 if (type.is<bke::InstanceReference>()) {
273 const bke::InstanceReference value = *value_ptr.get<bke::InstanceReference>();
274 const StringRefNull name = value.name().is_empty() ? IFACE_("(Geometry)") : value.name();
275 const int icon = get_instance_reference_icon(value);
278 0,
279 icon,
280 name.c_str(),
281 params.xmin,
282 params.ymin,
283 params.width,
284 params.height,
285 nullptr,
286 std::nullopt);
287 return;
288 }
289 if (type.is<std::string>()) {
292 0,
293 ICON_NONE,
294 *value_ptr.get<std::string>(),
295 params.xmin + CELL_PADDING_X,
296 params.ymin,
297 params.width - 2.0f * CELL_PADDING_X,
298 params.height,
299 nullptr,
300 std::nullopt);
301 return;
302 }
303 if (type.is<MStringProperty>()) {
305 *prop = *value_ptr.get<MStringProperty>();
306 uiBut *but = uiDefIconTextBut(params.block,
308 0,
309 ICON_NONE,
310 StringRef(prop->s, prop->s_len),
311 params.xmin + CELL_PADDING_X,
312 params.ymin,
313 params.width - 2.0f * CELL_PADDING_X,
314 params.height,
315 nullptr,
316 std::nullopt);
317
319 but,
320 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
321 const MStringProperty &prop = *static_cast<MStringProperty *>(argN);
322 return std::string(StringRef(prop.s, prop.s_len));
323 },
324 prop,
325 MEM_freeN);
326 return;
327 }
328 if (type.is<nodes::BundleItemValue>()) {
329 const nodes::BundleItemValue &value = *value_ptr.get<nodes::BundleItemValue>();
330 if (const nodes::BundleItemSocketValue *socket_value =
331 std::get_if<nodes::BundleItemSocketValue>(&value.value))
332 {
333 const bke::SocketValueVariant &value_variant = socket_value->value;
334 if (value_variant.is_single()) {
335 const GPointer single_value_ptr = value_variant.get_single_ptr();
336 this->draw_content_cell_value(single_value_ptr, params, column);
337 return;
338 }
339 }
340 this->draw_undrawable(params);
341 return;
342 }
343 this->draw_undrawable(params);
344 }
345
346 void draw_float_vector(const CellDrawParams &params, const Span<float> values) const
347 {
348 BLI_assert(!values.is_empty());
349 const float segment_width = float(params.width) / values.size();
350 for (const int i : values.index_range()) {
351 std::stringstream ss;
352 const float value = values[i];
353 ss << " " << std::fixed << std::setprecision(3) << value;
354 const std::string value_str = ss.str();
355 uiBut *but = uiDefIconTextBut(params.block,
357 0,
358 ICON_NONE,
359 value_str,
360 params.xmin + i * segment_width,
361 params.ymin,
362 segment_width,
363 params.height,
364 nullptr,
365 std::nullopt);
366
368 but,
369 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
370 return fmt::format("{:f}", *((float *)argN));
371 },
372 MEM_dupallocN<float>(__func__, value),
373 MEM_freeN);
374 /* Right-align Floats. */
377 }
378 }
379
381 const int64_t value,
382 const ColumnValueDisplayHint display_hint) const
383 {
384 std::string value_str;
385 switch (display_hint) {
388 BLI_str_format_byte_unit(dst, value, true);
389 value_str = dst;
390 break;
391 }
392 default: {
395 value_str = dst;
396 break;
397 }
398 }
399 uiBut *but = uiDefIconTextBut(params.block,
401 0,
402 ICON_NONE,
403 value_str,
404 params.xmin,
405 params.ymin,
406 params.width,
407 params.height,
408 nullptr,
409 std::nullopt);
410 switch (display_hint) {
413 but,
414 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
417 return fmt::format("{} {}", dst, TIP_("bytes"));
418 },
419 MEM_dupallocN<int64_t>(__func__, value),
420 MEM_freeN);
421 break;
422 }
423 default: {
425 but,
426 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
427 return fmt::format("{}", *(int64_t *)argN);
428 },
429 MEM_dupallocN<int64_t>(__func__, value),
430 MEM_freeN);
431 break;
432 }
433 }
434 /* Right-align Integers. */
437 }
438
439 void draw_int_vector(const CellDrawParams &params, const Span<int> values) const
440 {
441 BLI_assert(!values.is_empty());
442 const float segment_width = float(params.width) / values.size();
443 for (const int i : values.index_range()) {
444 std::stringstream ss;
445 const int value = values[i];
446 ss << " " << value;
447 const std::string value_str = ss.str();
448 uiBut *but = uiDefIconTextBut(params.block,
450 0,
451 ICON_NONE,
452 value_str,
453 params.xmin + i * segment_width,
454 params.ymin,
455 segment_width,
456 params.height,
457 nullptr,
458 std::nullopt);
460 but,
461 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
462 return fmt::format("{}", *((int *)argN));
463 },
464 MEM_dupallocN<int>(__func__, value),
465 MEM_freeN);
466 /* Right-align Floats. */
469 }
470 }
471
473 {
474 const ColorGeometry4f float_color = color::decode(color);
475 Span<float> values(&float_color.r, 4);
476 const float segment_width = float(params.width) / values.size();
477 for (const int i : values.index_range()) {
478 std::stringstream ss;
479 const float value = values[i];
480 ss << " " << std::fixed << std::setprecision(3) << value;
481 const std::string value_str = ss.str();
482 uiBut *but = uiDefIconTextBut(params.block,
484 0,
485 ICON_NONE,
486 value_str,
487 params.xmin + i * segment_width,
488 params.ymin,
489 segment_width,
490 params.height,
491 nullptr,
492 std::nullopt);
493 /* Right-align Floats. */
496
497 /* Tooltip showing raw byte values. Encode values in pointer to avoid memory allocation. */
499 but,
500 [](bContext * /*C*/, void *argN, const StringRef /*tip*/) {
501 const uint32_t uint_color = POINTER_AS_UINT(argN);
502 ColorGeometry4b color = *(ColorGeometry4b *)&uint_color;
503 return fmt::format(fmt::runtime(TIP_("Byte Color (sRGB encoded):\n{} {} {} {}")),
504 color.r,
505 color.g,
506 color.b,
507 color.a);
508 },
509 POINTER_FROM_UINT(*(uint32_t *)&color),
510 nullptr);
511 }
512 }
513
514 void draw_float4x4(const CellDrawParams &params, const float4x4 &value) const
515 {
516 uiBut *but = this->draw_undrawable(params);
517 /* Center alignment. */
520 but,
521 [](bContext & /*C*/, uiTooltipData &tip, uiBut * /*but*/, void *argN) {
522 const float4x4 matrix = *static_cast<const float4x4 *>(argN);
525 },
526 MEM_dupallocN<float4x4>(__func__, value),
527 MEM_freeN);
528 }
529
531 {
532 uiBut *but = uiDefIconTextBut(params.block,
534 0,
535 ICON_NONE,
536 "...",
537 params.xmin,
538 params.ymin,
539 params.width,
540 params.height,
541 nullptr,
542 std::nullopt);
543 /* Center alignment. */
545 return but;
546 }
547
548 int column_width(int column_index) const final
549 {
550 return spreadsheet_layout_.columns[column_index].width;
551 }
552};
553
554template<typename T>
555static float estimate_max_column_width(const float min_width,
556 const int fontid,
557 const std::optional<int64_t> max_sample_size,
558 const VArray<T> &data,
559 FunctionRef<std::string(const T &)> to_string)
560{
561 if (const std::optional<T> value = data.get_if_single()) {
562 const std::string str = to_string(*value);
563 return std::max(min_width, BLF_width(fontid, str.c_str(), str.size()));
564 }
565 const int sample_size = max_sample_size.value_or(data.size());
566 float width = min_width;
567 for (const int i : data.index_range().take_front(sample_size)) {
568 const std::string str = to_string(data[i]);
569 const float value_width = BLF_width(fontid, str.c_str(), str.size());
570 width = std::max(width, value_width);
571 }
572 return width;
573}
574
575float ColumnValues::fit_column_values_width_px(const std::optional<int64_t> &max_sample_size) const
576{
577 const int fontid = BLF_default();
579
580 auto get_min_width = [&](const float min_width) {
581 return max_sample_size.has_value() ? min_width : 0.0f;
582 };
583
584 const eSpreadsheetColumnValueType column_type = this->type();
585 switch (column_type) {
587 return 2.0f * SPREADSHEET_WIDTH_UNIT;
588 }
590 return 2.0f * SPREADSHEET_WIDTH_UNIT;
591 }
594 get_min_width(3 * SPREADSHEET_WIDTH_UNIT),
595 fontid,
596 max_sample_size,
597 data_.typed<int8_t>(),
598 [](const int value) { return fmt::format("{}", value); });
599 }
602 get_min_width(3 * SPREADSHEET_WIDTH_UNIT),
603 fontid,
604 max_sample_size,
605 data_.typed<int>(),
606 [](const int value) { return fmt::format("{}", value); });
607 }
610 fontid,
611 max_sample_size,
612 data_.typed<int64_t>(),
613 [](const int64_t value) {
614 char dst[BLI_STR_FORMAT_INT64_GROUPED_SIZE];
615 BLI_str_format_int64_grouped(dst, value);
616 return std::string(dst);
617 });
618 }
621 get_min_width(3 * SPREADSHEET_WIDTH_UNIT),
622 fontid,
623 max_sample_size,
624 data_.typed<float>(),
625 [](const float value) { return fmt::format("{:.3f}", value); });
626 }
628 if (data_.type().is<short2>()) {
630 get_min_width(6 * SPREADSHEET_WIDTH_UNIT),
631 fontid,
632 max_sample_size,
633 data_.typed<short2>(),
634 [](const short2 value) { return fmt::format("{} {}", value.x, value.y); });
635 }
637 get_min_width(6 * SPREADSHEET_WIDTH_UNIT),
638 fontid,
639 max_sample_size,
640 data_.typed<int2>(),
641 [](const int2 value) { return fmt::format("{} {}", value.x, value.y); });
642 }
645 get_min_width(9 * SPREADSHEET_WIDTH_UNIT),
646 fontid,
647 max_sample_size,
648 data_.typed<int3>(),
649 [](const int3 value) { return fmt::format("{} {} {}", value.x, value.y, value.z); });
650 }
653 get_min_width(6 * SPREADSHEET_WIDTH_UNIT),
654 fontid,
655 max_sample_size,
656 data_.typed<float2>(),
657 [](const float2 value) { return fmt::format("{:.3f} {:.3f}", value.x, value.y); });
658 }
661 get_min_width(9 * SPREADSHEET_WIDTH_UNIT),
662 fontid,
663 max_sample_size,
664 data_.typed<float3>(),
665 [](const float3 value) {
666 return fmt::format("{:.3f} {:.3f} {:.3f}", value.x, value.y, value.z);
667 });
668 }
671 get_min_width(12 * SPREADSHEET_WIDTH_UNIT),
672 fontid,
673 max_sample_size,
674 data_.typed<ColorGeometry4f>(),
675 [](const ColorGeometry4f value) {
676 return fmt::format(
677 "{:.3f} {:.3f} {:.3f} {:.3f}", value.r, value.g, value.b, value.a);
678 });
679 }
682 get_min_width(12 * SPREADSHEET_WIDTH_UNIT),
683 fontid,
684 max_sample_size,
685 data_.typed<ColorGeometry4b>(),
686 [](const ColorGeometry4b value) {
687 return fmt::format("{} {} {} {}", value.r, value.g, value.b, value.a);
688 });
689 }
692 get_min_width(12 * SPREADSHEET_WIDTH_UNIT),
693 fontid,
694 max_sample_size,
695 data_.typed<math::Quaternion>(),
696 [](const math::Quaternion value) {
697 return fmt::format(
698 "{:.3f} {:.3f} {:.3f} {:.3f}", value.x, value.y, value.z, value.w);
699 });
700 }
702 return UI_ICON_SIZE + 0.5f * UI_UNIT_X +
704 get_min_width(8 * SPREADSHEET_WIDTH_UNIT),
705 fontid,
706 max_sample_size,
708 [](const bke::InstanceReference &value) {
709 const StringRef name = value.name().is_empty() ? IFACE_("(Geometry)") :
710 value.name();
711 return name;
712 });
713 }
715 if (data_.type().is<std::string>()) {
717 fontid,
718 max_sample_size,
719 data_.typed<std::string>(),
720 [](const StringRef value) { return value; });
721 }
722 if (data_.type().is<MStringProperty>()) {
724 get_min_width(SPREADSHEET_WIDTH_UNIT),
725 fontid,
726 max_sample_size,
727 data_.typed<MStringProperty>(),
728 [](const MStringProperty &value) { return StringRef(value.s, value.s_len); });
729 }
730 break;
731 }
733 return 12 * SPREADSHEET_WIDTH_UNIT;
734 }
736 break;
737 }
738 }
739 return 2.0f * SPREADSHEET_WIDTH_UNIT;
740}
741
742float ColumnValues::fit_column_width_px(const std::optional<int64_t> &max_sample_size) const
743{
744 const float padding_px = 0.5 * SPREADSHEET_WIDTH_UNIT;
745 const float min_width_px = SPREADSHEET_WIDTH_UNIT;
746
747 const float data_width_px = this->fit_column_values_width_px(max_sample_size);
748
749 const int fontid = BLF_default();
751 const float name_width_px = BLF_width(fontid, name_.data(), name_.size());
752
753 const float width_px = std::max(min_width_px,
754 padding_px + std::max(data_width_px, name_width_px));
755 return width_px;
756}
757
758std::unique_ptr<SpreadsheetDrawer> spreadsheet_drawer_from_layout(
759 const SpreadsheetLayout &spreadsheet_layout)
760{
761 return std::make_unique<SpreadsheetLayoutDrawer>(spreadsheet_layout);
762}
763
764} // namespace blender::ed::spreadsheet
void BLF_size(int fontid, float size)
Definition blf.cc:443
int BLF_default()
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
Definition blf.cc:802
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
#define BLI_STR_FORMAT_INT64_GROUPED_SIZE
Definition BLI_string.h:25
#define BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE
Definition BLI_string.h:31
void BLI_str_format_byte_unit(char dst[BLI_STR_FORMAT_INT64_BYTE_UNIT_SIZE], long long int bytes, bool base_10) ATTR_NONNULL(1)
Definition string.cc:1207
size_t BLI_str_format_int64_grouped(char dst[BLI_STR_FORMAT_INT64_GROUPED_SIZE], int64_t num) ATTR_NONNULL(1)
Definition string.cc:1195
#define POINTER_AS_UINT(i)
#define POINTER_FROM_UINT(i)
#define TIP_(msgid)
#define IFACE_(msgid)
eSpreadsheetColumnValueType
@ SPREADSHEET_VALUE_TYPE_INT8
@ SPREADSHEET_VALUE_TYPE_FLOAT
@ SPREADSHEET_VALUE_TYPE_INT32_2D
@ SPREADSHEET_VALUE_TYPE_BYTE_COLOR
@ SPREADSHEET_VALUE_TYPE_UNKNOWN
@ SPREADSHEET_VALUE_TYPE_FLOAT3
@ SPREADSHEET_VALUE_TYPE_BOOL
@ SPREADSHEET_VALUE_TYPE_STRING
@ SPREADSHEET_VALUE_TYPE_INT32_3D
@ SPREADSHEET_VALUE_TYPE_QUATERNION
@ SPREADSHEET_VALUE_TYPE_FLOAT4X4
@ SPREADSHEET_VALUE_TYPE_INT32
@ SPREADSHEET_VALUE_TYPE_BUNDLE_ITEM
@ SPREADSHEET_VALUE_TYPE_INT64
@ SPREADSHEET_VALUE_TYPE_FLOAT2
@ SPREADSHEET_VALUE_TYPE_COLOR
@ SPREADSHEET_VALUE_TYPE_INSTANCES
#define SPREADSHEET_WIDTH_UNIT
#define UI_SCALE_FAC
#define UI_ICON_SIZE
uiBut * uiDefIconTextBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, int icon, blender::StringRef str, int x, int y, short width, short height, void *poin, std::optional< blender::StringRef > tip)
void UI_but_func_tooltip_custom_set(uiBut *but, uiButToolTipCustomFunc func, void *arg, uiFreeArgFunc free_arg)
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg)
void UI_tooltip_text_field_add(uiTooltipData &data, std::string text, std::string suffix, const uiTooltipStyle style, const uiTooltipColorID color_id, const bool is_pad=false)
void UI_but_drawflag_enable(uiBut *but, int flag)
@ UI_TIP_STYLE_MONO
void UI_but_drawflag_disable(uiBut *but, int flag)
@ UI_TIP_LC_VALUE
#define UI_DEFAULT_TEXT_POINTS
#define UI_UNIT_X
@ UI_BUT_TEXT_RIGHT
@ UI_BUT_ICON_LEFT
@ UI_BUT_TEXT_LEFT
BMesh const char void * data
long long int int64_t
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
Definition btVector3.h:257
bool is() const
void destruct(void *ptr) const
ChannelStorageType r
const CPPType * type() const
const void * get() const
constexpr int64_t size() const
Definition BLI_span.hh:252
constexpr IndexRange index_range() const
Definition BLI_span.hh:401
constexpr bool is_empty() const
Definition BLI_span.hh:260
constexpr bool is_empty() const
StringRefNull name() const
Definition instances.cc:120
eSpreadsheetColumnValueType type() const
float fit_column_values_width_px(const std::optional< int64_t > &max_sample_size=std::nullopt) const
float fit_column_width_px(const std::optional< int64_t > &max_sample_size=std::nullopt) const
void draw_top_row_cell(int column_index, const CellDrawParams &params) const final
void draw_int(const CellDrawParams &params, const int64_t value, const ColumnValueDisplayHint display_hint) const
void draw_byte_color(const CellDrawParams &params, const ColorGeometry4b color) const
void draw_content_cell_value(const GPointer value_ptr, const CellDrawParams &params, const ColumnValues &column) const
void draw_left_column_cell(int row_index, const CellDrawParams &params) const final
void draw_int_vector(const CellDrawParams &params, const Span< int > values) const
void draw_content_cell(int row_index, int column_index, const CellDrawParams &params) const final
uiBut * draw_undrawable(const CellDrawParams &params) const
void draw_float_vector(const CellDrawParams &params, const Span< float > values) const
void draw_float4x4(const CellDrawParams &params, const float4x4 &value) const
SpreadsheetLayoutDrawer(const SpreadsheetLayout &spreadsheet_layout)
nullptr float
#define str(s)
static const char * to_string(const Interpolation &interp)
Definition gl_shader.cc:103
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define T
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
Definition BLI_color.hh:77
static float estimate_max_column_width(const float min_width, const int fontid, const std::optional< int64_t > max_sample_size, const VArray< T > &data, FunctionRef< std::string(const T &)> to_string)
int get_instance_reference_icon(const bke::InstanceReference &reference)
std::unique_ptr< SpreadsheetDrawer > spreadsheet_drawer_from_layout(const SpreadsheetLayout &spreadsheet_layout)
static std::string format_matrix_to_grid(const float4x4 &matrix)
QuaternionBase< float > Quaternion
MatBase< T, NumCol, NumRow > transpose(const MatBase< T, NumRow, NumCol > &mat)
T abs(const T &a)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
blender::VecBase< int16_t, 2 > short2
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
const char * name
#define CELL_PADDING_X
std::variant< BundleItemSocketValue, BundleItemInternalValue > value
i
Definition text_draw.cc:230