Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_spreadsheet/spreadsheet_layout.cc
| Show All 18 Lines | |||||
| #include "spreadsheet_layout.hh" | #include "spreadsheet_layout.hh" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "BKE_geometry_set.hh" | |||||
| #include "BLF_api.h" | #include "BLF_api.h" | ||||
| namespace blender::ed::spreadsheet { | namespace blender::ed::spreadsheet { | ||||
| class SpreadsheetLayoutDrawer : public SpreadsheetDrawer { | class SpreadsheetLayoutDrawer : public SpreadsheetDrawer { | ||||
| private: | private: | ||||
| const SpreadsheetLayout &spreadsheet_layout_; | const SpreadsheetLayout &spreadsheet_layout_; | ||||
| ▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | else if (cell_value.value_collection.has_value()) { | ||||
| nullptr, | nullptr, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| nullptr); | nullptr); | ||||
| } | } | ||||
| else if (cell_value.value_geometry_set.has_value()) { | else if (cell_value.value_geometry_set.has_value()) { | ||||
| uiDefIconTextBut(params.block, | const GeometrySet &geometry_set = *cell_value.value_geometry_set->geometry_set; | ||||
| UI_BTYPE_LABEL, | StringRefNull name = geometry_set.name(); | ||||
| if (name.is_empty()) { | |||||
| name = "Geometry"; | |||||
| } | |||||
| uiBut *but = uiDefIconTextBut(params.block, | |||||
| UI_BTYPE_BUT, | |||||
| 0, | 0, | ||||
| ICON_MESH_DATA, | ICON_MESH_DATA, | ||||
| "Geometry", | name.c_str(), | ||||
| params.xmin, | params.xmin, | ||||
| params.ymin, | params.ymin, | ||||
| params.width, | params.width, | ||||
| params.height, | params.height, | ||||
| nullptr, | nullptr, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| nullptr); | nullptr); | ||||
| UI_but_func_tooltip_set( | |||||
| but, | |||||
| [](bContext *UNUSED(C), void *arg, const char *UNUSED(tip)) { | |||||
| const GeometrySet &geometry_set = *(const GeometrySet *)arg; | |||||
| std::string tooltip = geometry_set.to_tooltip(); | |||||
| if (StringRef(tooltip).endswith(".\n")) { | |||||
| /* Remove final dot and newline. */ | |||||
| tooltip.resize(tooltip.size() - 2); | |||||
| } | |||||
| return BLI_strdup(tooltip.c_str()); | |||||
| }, | |||||
| (void *)&geometry_set, | |||||
| nullptr); | |||||
| } | } | ||||
| } | } | ||||
| void draw_float_vector(const CellDrawParams ¶ms, const Span<float> values) const | void draw_float_vector(const CellDrawParams ¶ms, const Span<float> values) const | ||||
| { | { | ||||
| BLI_assert(!values.is_empty()); | BLI_assert(!values.is_empty()); | ||||
| const float segment_width = (float)params.width / values.size(); | const float segment_width = (float)params.width / values.size(); | ||||
| for (const int i : values.index_range()) { | for (const int i : values.index_range()) { | ||||
| Show All 38 Lines | |||||