Node Group asset description not showing as tooltip in the Add menu #103269

Closed
opened 2022-12-16 15:49:06 +01:00 by Dalai Felinto · 4 comments

Blender Version
Broken: 3.4
Worked: -

Short description of error
Node Group asset description not showing as tooltip in the Add menu

Exact steps for others to reproduce the error

  • Add some Node Groups to one of your asset libraries, add a description to them.
  • Find them in the Add menu, mouse hover.

You should see their description as tooltip. Instead now it shows the generic "Add a node group asset to the active node tree".

Note, it is working already for the search menu.

**Blender Version** Broken: 3.4 Worked: - **Short description of error** Node Group asset description not showing as tooltip in the Add menu **Exact steps for others to reproduce the error** * Add some Node Groups to one of your asset libraries, add a description to them. * Find them in the Add menu, mouse hover. You should see their description as tooltip. Instead now it shows the generic "Add a node group asset to the active node tree". Note, it is working already for the search menu.
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Author
Owner

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Hans Goudey was assigned by Dalai Felinto 2022-12-16 15:49:29 +01:00
Member

I expected this to work, but somehow the context doesn't contain the asset in the description callback.
OTOH, in my opinion the way we pass the asset as part of the context is quite weak, so it's not too surprising this doesn't work.

diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc
index 4bb550a553f..1ec14b1e14c 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -450,6 +450,22 @@ static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEven
   return OPERATOR_FINISHED;
 }
 
+static char *node_add_group_asset_get_description(struct bContext *C,
+                                                  struct wmOperatorType * /*op*/,
+                                                  struct PointerRNA * /*values*/)
+{
+  bool is_valid;
+  const AssetHandle handle = CTX_wm_asset_handle(C, &is_valid);
+  if (!is_valid) {
+    return nullptr;
+  }
+  const AssetMetaData &asset_data = *ED_asset_handle_get_metadata(&handle);
+  if (!asset_data.description) {
+    return nullptr;
+  }
+  return BLI_strdup(asset_data.description);
+}
+
 void NODE_OT_add_group_asset(wmOperatorType *ot)
 {
   ot->name = "Add Node Group Asset";
@@ -458,6 +474,7 @@ void NODE_OT_add_group_asset(wmOperatorType *ot)
 
   ot->invoke = node_add_group_asset_invoke;
   ot->poll = node_add_group_poll;
+  ot->get_description = node_add_group_asset_get_description;
 
   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
 }
I expected this to work, but somehow the context doesn't contain the asset in the description callback. OTOH, in my opinion the way we pass the asset as part of the context is quite weak, so it's not too surprising this doesn't work. ``` diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 4bb550a553f..1ec14b1e14c 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -450,6 +450,22 @@ static int node_add_group_asset_invoke(bContext *C, wmOperator *op, const wmEven return OPERATOR_FINISHED; } +static char *node_add_group_asset_get_description(struct bContext *C, + struct wmOperatorType * /*op*/, + struct PointerRNA * /*values*/) +{ + bool is_valid; + const AssetHandle handle = CTX_wm_asset_handle(C, &is_valid); + if (!is_valid) { + return nullptr; + } + const AssetMetaData &asset_data = *ED_asset_handle_get_metadata(&handle); + if (!asset_data.description) { + return nullptr; + } + return BLI_strdup(asset_data.description); +} + void NODE_OT_add_group_asset(wmOperatorType *ot) { ot->name = "Add Node Group Asset"; @@ -458,6 +474,7 @@ void NODE_OT_add_group_asset(wmOperatorType *ot) ot->invoke = node_add_group_asset_invoke; ot->poll = node_add_group_poll; + ot->get_description = node_add_group_asset_get_description; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; } ```
Author
Owner

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Bastien Montagne added this to the Pipeline, Assets & IO project 2023-02-09 15:39:30 +01:00
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:43:17 +01:00
Philipp Oeser added the
Interest
Pipeline, Assets & IO
label 2023-02-10 11:21:26 +01:00
Jacques Lucke self-assigned this 2023-02-20 13:43:20 +01:00
Hans Goudey was unassigned by Jacques Lucke 2023-02-20 13:43:21 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-02-22 17:39:15 +01:00
Bastien Montagne removed this from the Pipeline, Assets & IO project 2023-07-03 13:02:51 +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
2 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#103269
No description provided.