[Bf-blender-cvs] [e62a33e5725] master: Nodes: Show node description in Node add menu

Monique Dewanchand noreply at git.blender.org
Tue Jun 7 15:40:33 CEST 2022


Commit: e62a33e57256cb772e6dfce9ba7a3a58c3c08b0a
Author: Monique Dewanchand
Date:   Tue Jun 7 15:40:20 2022 +0200
Branches: master
https://developer.blender.org/rBe62a33e57256cb772e6dfce9ba7a3a58c3c08b0a

Nodes: Show node description in Node add menu

Though no nodes have descriptions currently, this patch makes it
possible to add descriptions that display in the add menu, for
custom node systems and existing builtin nodes.

Differential Revision: https://developer.blender.org/D14963

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

M	release/scripts/startup/bl_operators/node.py

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

diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index c64898fdfb9..a99a81e0c63 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -129,6 +129,15 @@ class NodeAddOperator:
 
         return result
 
+    @classmethod
+    def description(cls, context, properties):
+        nodetype = properties["type"]
+        bl_rna = bpy.types.Node.bl_rna_get_subclass(nodetype)
+        if bl_rna is not None:
+            return bl_rna.description
+        else:
+            return ""
+
 
 # Simple basic operator for adding a node
 class NODE_OT_add_node(NodeAddOperator, Operator):



More information about the Bf-blender-cvs mailing list