Regression: Tab when renaming nodegroup sockets does not move to next socket #112538

Open
opened 2023-09-18 18:50:47 +02:00 by Simon Thommes · 8 comments
Member

System Information
Operating system: Linux-6.5.3-gentoo-r1-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.37 64 Bits, X11 UI
Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 535.104.05

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-17 18:06, hash: 6a76696faf05
Worked: Blender 3.6

Short description of error

Exact steps for others to reproduce the error

  • make nodegroup from proncibled bsdf
  • rename sockets
**System Information** Operating system: Linux-6.5.3-gentoo-r1-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.37 64 Bits, X11 UI Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 535.104.05 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-09-17 18:06, hash: `6a76696faf05` Worked: Blender 3.6 **Short description of error** <video src="/attachments/9f733dc8-ffa3-4050-9938-d204b0b39745" title="regression_nodegroup_input_names_tab-2023-09-18_18.47.56.mp4" controls></video> **Exact steps for others to reproduce the error** - make nodegroup from proncibled bsdf - rename sockets
Simon Thommes added the
Status
Needs Triage
Type
Report
Priority
Normal
labels 2023-09-18 18:50:48 +02:00
@LukasTonne
Lukas Tönne self-assigned this 2023-09-18 20:53:07 +02:00
Member

I think this is because the previous inputs/outputs lists used the UIList feature, while the new interface uses a tree view. So the solution will probably involve fixing the tree view in general.

I think this is because the previous inputs/outputs lists used the [`UIList`](https://projects.blender.org/blender/blender/src/commit/71b55b491e9cc1b82ecaaf5afa651b2afcee9894/scripts/startup/bl_ui/space_node.py#L813) feature, while the new interface uses a [tree view](https://projects.blender.org/blender/blender/src/commit/05c053cd2564f3a3035951a91107a6cedf54894b/source/blender/editors/interface/interface_template_node_tree_interface.cc#L497). So the solution will probably involve fixing the tree view in general.

I can confirm.

System Information
    Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 528.79
I can confirm. <details> <summary>System Information</summary> <ul> Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3060 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 528.79 </ul> </details>
Member

Will check on this

Will check on this
Member

Ah, heard @JulianEisel is already on it.

I had this test-drive (but not fully working)


diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc
index cd6c9ffaef2..bef54bb2165 100644
--- a/source/blender/editors/interface/interface_handlers.cc
+++ b/source/blender/editors/interface/interface_handlers.cc
@@ -9490,6 +9490,12 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
       ui_but_range_set_hard(post_but);
 
       button_activate_init(C, region, post_but, post_type);
+
+      if (post_but->type == UI_BTYPE_VIEW_ITEM) {
+        uiButViewItem *item_but = (uiButViewItem *)post_but;
+        UI_view_item_begin_rename(item_but->view_item);
+        ED_region_tag_redraw(region);
+      }
     }
     else if (!((event->type == EVT_BUT_CANCEL) && (event->val == 1))) {
       /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable,
diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc
index 8a1b3c32ad4..233988d4b18 100644
--- a/source/blender/editors/interface/interface_query.cc
+++ b/source/blender/editors/interface/interface_query.cc
@@ -44,7 +44,7 @@ bool ui_but_is_editable(const uiBut *but)
 
 bool ui_but_is_editable_as_text(const uiBut *but)
 {
-  return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU);
+  return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_VIEW_ITEM);
 }
 
 bool ui_but_is_toggle(const uiBut *but)
Ah, heard @JulianEisel is already on it. I had this test-drive (but not fully working) ```Diff diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index cd6c9ffaef2..bef54bb2165 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -9490,6 +9490,12 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) ui_but_range_set_hard(post_but); button_activate_init(C, region, post_but, post_type); + + if (post_but->type == UI_BTYPE_VIEW_ITEM) { + uiButViewItem *item_but = (uiButViewItem *)post_but; + UI_view_item_begin_rename(item_but->view_item); + ED_region_tag_redraw(region); + } } else if (!((event->type == EVT_BUT_CANCEL) && (event->val == 1))) { /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable, diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc index 8a1b3c32ad4..233988d4b18 100644 --- a/source/blender/editors/interface/interface_query.cc +++ b/source/blender/editors/interface/interface_query.cc @@ -44,7 +44,7 @@ bool ui_but_is_editable(const uiBut *but) bool ui_but_is_editable_as_text(const uiBut *but) { - return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU); + return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU, UI_BTYPE_VIEW_ITEM); } bool ui_but_is_toggle(const uiBut *but) ```
Hans Goudey added
Type
Bug
and removed
Type
Report
labels 2023-09-26 23:10:16 +02:00
Lukas Tönne removed their assignment 2023-09-28 10:46:40 +02:00
Member

I only briefly looked into this when Lukas asked me about it, to see if there's a quick fix.

To be clear, this is a missing feature in the tree-view, not a bug in the strict sense. Looks like a regression UI wise of course. @lichtwerk 's patch goes in the right direction I think.

I only briefly looked into this when Lukas asked me about it, to see if there's a quick fix. To be clear, this is a missing feature in the tree-view, not a bug in the strict sense. Looks like a regression UI wise of course. @lichtwerk 's patch goes in the right direction I think.
Member

I did make a little bit of progress, but couldn't get it to work yet. I ran into three main issues:

  • The new renaming can only start after the previous renaming has ended. So I had to use an afterfunc to start the new renaming.
  • The rename_but is always compares equal to itself, regardless of which row it belongs to. That causes issues in add_rename_button where the uiBut is always removed in UI_but_active_only.
  • The name is not selected by default after hitting tab.
diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc
index 6bc194febbd..985f50f1859 100644
--- a/source/blender/editors/interface/interface_handlers.cc
+++ b/source/blender/editors/interface/interface_handlers.cc
@@ -9488,12 +9488,24 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
 
     /* for jumping to the next button with tab while text editing */
     if (post_but) {
-      /* The post_but still has previous ranges (without the changes in active button considered),
-       * needs refreshing the ranges. */
-      ui_but_range_set_soft(post_but);
-      ui_but_range_set_hard(post_but);
+      if (post_but->type == UI_BTYPE_VIEW_ITEM) {
+        uiAfterFunc *after = ui_afterfunc_new();
+        after->func = [](bContext *C, void *arg1, void * /*arg2*/) {
+          ARegion *region = CTX_wm_region(C);
+          uiButViewItem *item_but = static_cast<uiButViewItem *>(arg1);
+          UI_view_item_begin_rename(item_but->view_item);
+          ED_region_tag_redraw(region);
+        };
+        after->func_arg1 = post_but;
+      }
+      else {
+        /* The post_but still has previous ranges (without the changes in active button
+         * considered), needs refreshing the ranges. */
+        ui_but_range_set_soft(post_but);
+        ui_but_range_set_hard(post_but);
 
-      button_activate_init(C, region, post_but, post_type);
+        button_activate_init(C, region, post_but, post_type);
+      }
     }
     else if (!((event->type == EVT_BUT_CANCEL) && (event->val == 1))) {
       /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable,
diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc
index 8a1b3c32ad4..733e101f006 100644
--- a/source/blender/editors/interface/interface_query.cc
+++ b/source/blender/editors/interface/interface_query.cc
@@ -44,7 +44,12 @@ bool ui_but_is_editable(const uiBut *but)
 
 bool ui_but_is_editable_as_text(const uiBut *but)
 {
-  return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU);
+  return ELEM(but->type,
+              UI_BTYPE_TEXT,
+              UI_BTYPE_NUM,
+              UI_BTYPE_NUM_SLIDER,
+              UI_BTYPE_SEARCH_MENU,
+              UI_BTYPE_VIEW_ITEM);
 }
 
 bool ui_but_is_toggle(const uiBut *but)
diff --git a/source/blender/editors/interface/views/abstract_view_item.cc b/source/blender/editors/interface/views/abstract_view_item.cc
index 0e9759f606f..90fb7fb3c2e 100644
--- a/source/blender/editors/interface/views/abstract_view_item.cc
+++ b/source/blender/editors/interface/views/abstract_view_item.cc
@@ -212,10 +212,11 @@ void AbstractViewItem::add_rename_button(uiBlock &block)
 
   const bContext *evil_C = reinterpret_cast<bContext *>(block.evil_C);
   ARegion *region = CTX_wm_region(evil_C);
+  UI_but_active_only_ex(evil_C, region, &block, rename_but, false);
   /* Returns false if the button was removed. */
-  if (UI_but_active_only(evil_C, region, &block, rename_but) == false) {
-    end_renaming();
-  }
+  // if (UI_but_active_only(evil_C, region, &block, rename_but) == false) {
+  //   end_renaming();
+  // }
 }
 
 /** \} */
I did make a little bit of progress, but couldn't get it to work yet. I ran into three main issues: * The new renaming can only start after the previous renaming has ended. So I had to use an `afterfunc` to start the new renaming. * The `rename_but` is always compares equal to itself, regardless of which row it belongs to. That causes issues in `add_rename_button` where the `uiBut` is always removed in `UI_but_active_only`. * The name is not selected by default after hitting tab. ```diff diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index 6bc194febbd..985f50f1859 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -9488,12 +9488,24 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) /* for jumping to the next button with tab while text editing */ if (post_but) { - /* The post_but still has previous ranges (without the changes in active button considered), - * needs refreshing the ranges. */ - ui_but_range_set_soft(post_but); - ui_but_range_set_hard(post_but); + if (post_but->type == UI_BTYPE_VIEW_ITEM) { + uiAfterFunc *after = ui_afterfunc_new(); + after->func = [](bContext *C, void *arg1, void * /*arg2*/) { + ARegion *region = CTX_wm_region(C); + uiButViewItem *item_but = static_cast<uiButViewItem *>(arg1); + UI_view_item_begin_rename(item_but->view_item); + ED_region_tag_redraw(region); + }; + after->func_arg1 = post_but; + } + else { + /* The post_but still has previous ranges (without the changes in active button + * considered), needs refreshing the ranges. */ + ui_but_range_set_soft(post_but); + ui_but_range_set_hard(post_but); - button_activate_init(C, region, post_but, post_type); + button_activate_init(C, region, post_but, post_type); + } } else if (!((event->type == EVT_BUT_CANCEL) && (event->val == 1))) { /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable, diff --git a/source/blender/editors/interface/interface_query.cc b/source/blender/editors/interface/interface_query.cc index 8a1b3c32ad4..733e101f006 100644 --- a/source/blender/editors/interface/interface_query.cc +++ b/source/blender/editors/interface/interface_query.cc @@ -44,7 +44,12 @@ bool ui_but_is_editable(const uiBut *but) bool ui_but_is_editable_as_text(const uiBut *but) { - return ELEM(but->type, UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, UI_BTYPE_SEARCH_MENU); + return ELEM(but->type, + UI_BTYPE_TEXT, + UI_BTYPE_NUM, + UI_BTYPE_NUM_SLIDER, + UI_BTYPE_SEARCH_MENU, + UI_BTYPE_VIEW_ITEM); } bool ui_but_is_toggle(const uiBut *but) diff --git a/source/blender/editors/interface/views/abstract_view_item.cc b/source/blender/editors/interface/views/abstract_view_item.cc index 0e9759f606f..90fb7fb3c2e 100644 --- a/source/blender/editors/interface/views/abstract_view_item.cc +++ b/source/blender/editors/interface/views/abstract_view_item.cc @@ -212,10 +212,11 @@ void AbstractViewItem::add_rename_button(uiBlock &block) const bContext *evil_C = reinterpret_cast<bContext *>(block.evil_C); ARegion *region = CTX_wm_region(evil_C); + UI_but_active_only_ex(evil_C, region, &block, rename_but, false); /* Returns false if the button was removed. */ - if (UI_but_active_only(evil_C, region, &block, rename_but) == false) { - end_renaming(); - } + // if (UI_but_active_only(evil_C, region, &block, rename_but) == false) { + // end_renaming(); + // } } /** \} */ ```
Member

I'll decrease the priority here. While technically a regression, it is not a blocking feature. The fix here will require adding this functionality the new tree-view in general.

I'll decrease the priority here. While technically a regression, it is not a blocking feature. The fix here will require adding this functionality the new tree-view in general.
Jacques Lucke added
Priority
Normal
and removed
Priority
High
labels 2023-10-20 16:05:28 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#112538
No description provided.