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
This commit is contained in:
Monique Dewanchand 2022-06-07 15:40:20 +02:00 committed by Hans Goudey
parent ccf0d22e92
commit e62a33e572
1 changed files with 9 additions and 0 deletions

View File

@ -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):