[Bf-blender-cvs] [996937ed2e1] temp-geometry-nodes-attribute-search: Debugging changes

Hans Goudey noreply at git.blender.org
Mon Feb 22 21:39:44 CET 2021


Commit: 996937ed2e15f71a6c81aec4212890b38ac240b1
Author: Hans Goudey
Date:   Mon Feb 22 12:25:35 2021 -0600
Branches: temp-geometry-nodes-attribute-search
https://developer.blender.org/rB996937ed2e15f71a6c81aec4212890b38ac240b1

Debugging changes

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

M	source/blender/editors/interface/interface_handlers.c
M	source/blender/editors/space_node/drawnode.c

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

diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 3a4eda29206..6f2504ccb87 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -171,7 +171,7 @@ static bool ui_mouse_motion_keynav_test(struct uiKeyNavLock *keynav, const wmEve
 /* pixels to move the cursor to get out of keyboard navigation */
 #define BUTTON_KEYNAV_PX_LIMIT 8
 
-#define MENU_TOWARDS_MARGIN 20      /* margin in pixels */
+#define MENU_TOWARDS_MARGIN 20 /* margin in pixels */
 #define MENU_TOWARDS_WIGGLE_ROOM 64 /* tolerance in pixels */
 /* drag-lock distance threshold in pixels */
 #define BUTTON_DRAGLOCK_THRESH 3
@@ -8115,6 +8115,10 @@ static void button_activate_init(bContext *C,
   /* activate button */
   but->flag |= UI_ACTIVE;
 
+  if (but->type == UI_BTYPE_SEARCH_MENU) {
+    printf("ACTIVATING SEARCH MENU BUTTON\n");
+  }
+
   but->active = data;
 
   /* we disable auto_open in the block after a threshold, because we still
@@ -8295,6 +8299,9 @@ static void button_activate_exit(
   /* clean up button */
   if (but->active) {
     MEM_freeN(but->active);
+    if (but->type == UI_BTYPE_SEARCH_MENU) {
+      printf("DEACTIVATING SEARCH MENU BUTTON\n");
+    }
     but->active = NULL;
   }
 
@@ -10719,6 +10726,10 @@ static int ui_region_handler(bContext *C, const wmEvent *event, void *UNUSED(use
     return retval;
   }
 
+  if (event->type == LEFTMOUSE) {
+    printf("sdf");
+  }
+
   /* either handle events for already activated button or try to activate */
   uiBut *but = ui_region_find_active_but(region);
   uiBut *listbox = ui_list_find_mouse_over(region, event);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 07070cb2840..85375d0cc9b 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -22,6 +22,8 @@
  * \brief lower level node drawing for nodes (boarders, headers etc), also node layout.
  */
 
+#include "MEM_guardedalloc.h"
+
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_system.h"
@@ -3390,12 +3392,21 @@ static void std_node_socket_draw(
 
       uiBlock *block = uiLayoutGetBlock(row);
 
-      static char search[256] = "";
+      // uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
+
+      bNodeSocketValueString *socket_value = (bNodeSocketValueString *)sock->default_value;
+
+      char *buffer = MEM_mallocN(256, __func__);
+
+      strcpy(buffer, socket_value->value);
+
+      // static char search[256] = "WORK";
+      // uiBut *but = uiDefButS(
+      //     block, UI_BTYPE_SEARCH_MENU, 0, "test", 0, 0, 0, 0, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
       uiBut *but = uiDefSearchBut(
-          block, search, 0, ICON_NONE, sizeof(search), 10, 10, 200, UI_UNIT_Y, 0, 0, "");
+          block, buffer, 0, ICON_NONE, 256, 10, 10, 200, UI_UNIT_Y, 0, 0, "");
       button_add_attribute_search(C, node, sock, but);
 
-      // uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
       break;
     }
     case SOCK_OBJECT: {



More information about the Bf-blender-cvs mailing list