[Bf-blender-cvs] [5a71c3cb56e] temp-spreadsheet-editor: draw color attributes

Jacques Lucke noreply at git.blender.org
Thu Feb 25 13:33:58 CET 2021


Commit: 5a71c3cb56ec401ef8291da26583d43e1b142fba
Author: Jacques Lucke
Date:   Thu Feb 25 12:54:20 2021 +0100
Branches: temp-spreadsheet-editor
https://developer.blender.org/rB5a71c3cb56ec401ef8291da26583d43e1b142fba

draw color attributes

===================================================================

M	source/blender/editors/space_spreadsheet/space_spreadsheet.cc

===================================================================

diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
index 117108123ba..05a7ffe3c2f 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -636,6 +636,26 @@ static void gather_spreadsheet_data(const bContext *C,
         }
         break;
       }
+      case CD_PROP_COLOR: {
+        static std::array<char, 4> channel_char = {'R', 'G', 'B', 'A'};
+        for (const int i : IndexRange(4)) {
+          std::string header_name = attribute_name + " " + channel_char[i];
+          ColumnHeaderDrawer &header_drawer = resources.construct<TextColumnHeaderDrawer>(
+              "attribute header drawer", header_name);
+
+          auto get_value = [attribute, i](int index) {
+            blender::Color4f value;
+            attribute->get(index, &value);
+            return value[i];
+          };
+
+          CellDrawer &cell_drawer = resources.construct<FloatCellDrawer<decltype(get_value)>>(
+              "float cell drawer", get_value);
+
+          spreadsheet_layout.columns.append({100, &header_drawer, &cell_drawer});
+        }
+        break;
+      }
       case CD_PROP_INT32: {
         ColumnHeaderDrawer &header_drawer = resources.construct<TextColumnHeaderDrawer>(
             "attribute header drawer", attribute_name);



More information about the Bf-blender-cvs mailing list