Geometry Nodes: show correct type in menu socket tooltips #121236

Merged
Jacques Lucke merged 7 commits from JacquesLucke/blender:menu-socket-tooltip into main 2024-05-05 09:30:18 +02:00
Member

Previously, menu sockets were sometimes shown as integers or strings in socket tooltips. Now, they are always shown as "Menu" type. This also changes how these values are logged. Previously, they were logged as strings. Now, only the integer identifier is logged and the name is looked up when drawing the tooltip.

Before:
image
image

After:
image
image

Previously, menu sockets were sometimes shown as integers or strings in socket tooltips. Now, they are always shown as "Menu" type. This also changes how these values are logged. Previously, they were logged as strings. Now, only the integer identifier is logged and the name is looked up when drawing the tooltip. Before: ![image](/attachments/30ee516e-f79b-4b26-8fd7-7a263ccb8cf4) ![image](/attachments/f27c7bf9-4351-404d-acc6-9dfda305554d) After: ![image](/attachments/a93f812e-b23d-4d05-a4e2-c3f32823ff98) ![image](/attachments/1ac082a2-c93b-4157-9b69-7304f3610b84)
Jacques Lucke added 1 commit 2024-04-30 00:07:24 +02:00
Jacques Lucke requested review from Hans Goudey 2024-04-30 00:11:45 +02:00
Iliya Katushenock reviewed 2024-04-30 00:45:51 +02:00
@ -1348,3 +1349,3 @@
if (socket_type.is<int>()) {
ss << fmt::format(TIP_("{} (Integer)"), *static_cast<int *>(socket_value));
const int socket_value_i = *static_cast<int *>(socket_value);

This is incorrect to do this after type cast, since this is not supported to convert int/float/... to menu index via link implicitly.
image

Also, i don't like idea of mixing int and menu in UI text formatting only due to the same data type. This will cause a lot of mess with subtypes and maybe additional features in the future.

This is incorrect to do this after type cast, since this is not supported to convert int/float/... to menu index via link implicitly. ![image](/attachments/18d94d0c-7151-4ae6-8f19-a69b816a3a11) Also, i don't like idea of mixing int and menu in UI text formatting only due to the same data type. This will cause a lot of mess with subtypes and maybe additional features in the future.
JacquesLucke marked this conversation as resolved
Jacques Lucke added 3 commits 2024-04-30 10:40:46 +02:00
Iliya Katushenock reviewed 2024-04-30 10:44:14 +02:00
@ -1338,0 +1352,4 @@
const bke::RuntimeNodeEnumItem *enum_item =
socket_storage->enum_items->find_item_by_identifier(item_identifier);
if (!enum_item) {
return;

Right now all types of socket value have tooltip even for null value
image

Right now all types of socket value have tooltip even for null value ![image](/attachments/f2bd5d02-7c15-47dc-92c7-32b43eed4977)
Author
Member

Seems to be a different case. Here we don't even have a null value, there is no value at all. That can be changed separately. The goal of this patch is to not show menu sockets as integers or strings.

Seems to be a different case. Here we don't even have a null value, there is no value at all. That can be changed separately. The goal of this patch is to not show menu sockets as integers or strings.
JacquesLucke marked this conversation as resolved
Iliya Katushenock reviewed 2024-04-30 10:56:31 +02:00
@ -179,4 +179,2 @@
};
auto log_menu_value = [&](Span<bke::RuntimeNodeEnumItem> enum_items, const int identifier) {
for (const bke::RuntimeNodeEnumItem &item : enum_items) {

Do you'd like to cleanup unused includes as separate change?

Do you'd like to cleanup unused includes as separate change?
JacquesLucke marked this conversation as resolved
Hans Goudey approved these changes 2024-04-30 14:53:07 +02:00
@ -1338,0 +1342,4 @@
return;
}
const int item_identifier = *static_cast<const int *>(buffer);
auto *socket_storage = socket.default_value_typed<bNodeSocketValueMenu>();
Member

const auto *

`const auto *`
JacquesLucke marked this conversation as resolved
Jacques Lucke added 3 commits 2024-04-30 15:01:29 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
8455c66a50
add const
Author
Member

@blender-bot build

@blender-bot build
Jacques Lucke merged commit 18600e430c into main 2024-05-05 09:30:18 +02:00
Jacques Lucke deleted branch menu-socket-tooltip 2024-05-05 09:30:21 +02:00
Sign in to join this conversation.
No reviewers
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
3 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#121236
No description provided.