[Bf-blender-cvs] [27373011dec] temp-spreadsheet-editor: initial drawing into block directly

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


Commit: 27373011decb34c9bb717751348ff5db1994204c
Author: Jacques Lucke
Date:   Mon Feb 22 16:13:37 2021 +0100
Branches: temp-spreadsheet-editor
https://developer.blender.org/rB27373011decb34c9bb717751348ff5db1994204c

initial drawing into block directly

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

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 358d53c68f3..580ae11089a 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -96,33 +96,49 @@ static void spreadsheet_main_region_draw(const bContext *C, ARegion *region)
 
   UI_ThemeClearColor(TH_BACK);
 
-  const uiStyle *style = UI_style_get_dpi();
-  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
+  // const uiStyle *style = UI_style_get_dpi();
+  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS_NONE);
 
-  uiLayout *layout = UI_block_layout(
-      block, UI_LAYOUT_VERTICAL, UI_LAYOUT_HEADER, 100, region->winy, 200, 1, 0, style);
-  UI_block_layout_set_current(block, layout);
+  // uiLayout *layout = UI_block_layout(
+  //     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);
+  // uiLayout *col = uiLayoutColumn(layout, false);
 
   Object *active_object = CTX_data_active_object(C);
   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);
-    }
+    // 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);
+    // }
+    static float value = 42.5f;
+    uiBut *but = uiDefButF(block,
+                           UI_BTYPE_NUM,
+                           0,
+                           "Hey",
+                           0,
+                           300,
+                           150,
+                           UI_UNIT_Y,
+                           &value,
+                           0.0f,
+                           100.0f,
+                           0,
+                           0,
+                           "My tip");
+    UI_but_disable(but, "cannot edit");
   }
 
-  uiItemL(col, "Hello World", ICON_ADD);
+  // uiItemL(col, "Hello World", ICON_ADD);
 
-  UI_block_layout_resolve(block, nullptr, nullptr);
+  // UI_block_layout_resolve(block, nullptr, nullptr);
   UI_block_end(C, block);
   UI_block_draw(C, block);
 }



More information about the Bf-blender-cvs mailing list