Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-05 13:38:50 +0300
committerJacques Lucke <jacques@blender.org>2021-03-05 13:38:50 +0300
commita32bf199d41023bec0bdb9b8223d974e8ee36bea (patch)
tree2187e9067c3e3272f953b9c8519cbaaec1b6a7dd
parent77136bd7b3a24290354a4a5cebbb0ca2cd59d5bd (diff)
support drawing ints
-rw-r--r--release/scripts/modules/bpy_spreadsheet.py4
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_from_python.cc19
2 files changed, 21 insertions, 2 deletions
diff --git a/release/scripts/modules/bpy_spreadsheet.py b/release/scripts/modules/bpy_spreadsheet.py
index 319d972eec9..1064f42ca26 100644
--- a/release/scripts/modules/bpy_spreadsheet.py
+++ b/release/scripts/modules/bpy_spreadsheet.py
@@ -29,10 +29,10 @@ class SpreadsheetDrawer:
return "Column: " + str(column_index)
def get_left_column_cell(self, row_index):
- return str(row_index + 100)
+ return row_index + 100
def get_content_cell(self, row_index, column_index):
- return str(row_index * column_index)
+ return row_index * column_index + 10
registered_drawers = {}
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_from_python.cc b/source/blender/editors/space_spreadsheet/spreadsheet_from_python.cc
index d4d615ad108..c0dca445e63 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_from_python.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_from_python.cc
@@ -117,6 +117,25 @@ class PythonSpreadsheetDrawer : public SpreadsheetDrawer {
0,
nullptr);
}
+ if (PyLong_Check(py_cell_content)) {
+ const int value = PyLong_AsLong(py_cell_content);
+ const std::string value_str = std::to_string(value);
+ uiDefIconTextBut(params.block,
+ UI_BTYPE_LABEL,
+ 0,
+ ICON_NONE,
+ value_str.c_str(),
+ params.xmin,
+ params.ymin,
+ params.width,
+ params.height,
+ nullptr,
+ 0,
+ 0,
+ 0,
+ 0,
+ nullptr);
+ }
}
};