[Bf-blender-cvs] [6ff897157c1] temp-spreadsheet-editor: draw vertex positions

Jacques Lucke noreply at git.blender.org
Mon Feb 22 16:56:20 CET 2021


Commit: 6ff897157c149ecd1f7bdb44ed7d35e00d879646
Author: Jacques Lucke
Date:   Mon Feb 22 13:45:29 2021 +0100
Branches: temp-spreadsheet-editor
https://developer.blender.org/rB6ff897157c149ecd1f7bdb44ed7d35e00d879646

draw vertex positions

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

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 d069e7ba26c..38fd52a4abe 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -16,6 +16,7 @@
 
 #include <cstring>
 
+#include "BLI_index_range.hh"
 #include "BLI_listbase.h"
 #include "BLI_utildefines.h"
 
@@ -24,6 +25,8 @@
 #include "ED_screen.h"
 #include "ED_space_api.h"
 
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
@@ -38,6 +41,8 @@
 
 #include "spreadsheet_intern.hh"
 
+using blender::IndexRange;
+
 static SpaceLink *spreadsheet_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
 {
   SpaceSpreadsheet *spreadsheet_space = (SpaceSpreadsheet *)MEM_callocN(sizeof(SpaceSpreadsheet),
@@ -91,17 +96,26 @@ static void spreadsheet_main_region_draw(const bContext *C, ARegion *region)
 
   const uiStyle *style = UI_style_get_dpi();
   uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
+
   uiLayout *layout = UI_block_layout(
-      block, UI_LAYOUT_VERTICAL, UI_LAYOUT_HEADER, 100, 100, 200, 1, 0, style);
+      block, UI_LAYOUT_VERTICAL, UI_LAYOUT_HEADER, 100, region->winy, 200, 1, 0, style);
   UI_block_layout_set_current(block, layout);
 
   uiLayout *col = uiLayoutColumn(layout, false);
 
   Object *active_object = CTX_data_active_object(C);
-  if (active_object != nullptr) {
+  if (active_object != nullptr && active_object->type == OB_MESH) {
     PointerRNA ptr;
     RNA_pointer_create(&active_object->id, &RNA_Object, active_object, &ptr);
     uiItemR(col, &ptr, "location", 0, "", ICON_NONE);
+
+    Mesh *mesh = (Mesh *)active_object->data;
+    for (const int i : IndexRange(mesh->totvert)) {
+      char buffer[64];
+      const MVert &vert = mesh->mvert[i];
+      snprintf(buffer, sizeof(buffer), "%f, %f, %f", vert.co[0], vert.co[1], vert.co[2]);
+      uiItemL(col, buffer, ICON_NONE);
+    }
   }
 
   uiItemL(col, "Hello World", ICON_ADD);



More information about the Bf-blender-cvs mailing list