25
$\begingroup$

I'd like to have a node like the Frame node but one that can have lots of text, not just a header. I've looked and it looks like there isn't any such capability so far, so I was wondering how easy it would be for someone to create a custom Comment node as an add-on or script (I don't know the differences between the two). I myself would love to leave detailed comments in complex node trees so that I can figure out what I was doing/what to do when I come back to them months later.

$\endgroup$
1

5 Answers 5

33
$\begingroup$

Since version 2.74, blender has has the ability to display text blocks in the node editor.
See the manual.

screenshot

Add a frame node, then in the properties region add the text block you want to display. (A text block is simply a file made in blender's text editor.)
frame node properties
The frame will display the text exactly as it is in the text editor without word wrapping, you have to add the line brakes in manually (by pressing Enter at the end of the line).
This is the easiest way to make notations in the node editor.

$\endgroup$
3
  • $\begingroup$ I can't figure out how to add text to the Text: input $\endgroup$
    – endolith
    Commented Oct 4, 2020 at 4:01
  • $\begingroup$ @endolith go to blender's text editor Shift + F11 then press the "New" button to make a new text data-block. Now that text file will show up in the list so you can add it to the frame node. $\endgroup$
    – David
    Commented Oct 13, 2020 at 0:14
  • 1
    $\begingroup$ It seems that since at least blender 3.1.2, the frame node does in fact wrap words. $\endgroup$ Commented Jun 4, 2022 at 6:11
8
$\begingroup$

Alternatively, if you want something quick and easy ..enter image description here

$\endgroup$
2
  • $\begingroup$ I'm sorry. I didn't mean it to be snippity, and I'm sorry if I have offended you in any way.. The grease pencil is a good idea, I personally just can't imagine writing with a mouse (maybe it's just me). $\endgroup$
    – gandalf3
    Commented Mar 17, 2014 at 18:59
  • 4
    $\begingroup$ Well, really all art on a computer is difficult with a mouse. It wasn't until I got a pen tablet that I stopped suffering from claw hand after a couple of hours of work. Now I can go all day, every day without destroying my hand. Combine that with pressure sensitivity and the extra price is well worth the extra money. Sorry for the 'Fake Gandalf' comment. Name calling is totally inappropriate under any circumstances. $\endgroup$ Commented Mar 17, 2014 at 19:12
6
$\begingroup$

There's no support for text wrapping in Blender, so it's impossible to have a multi-line label or StringProperty. But it's possible to have a collection of strings and draw them in a column inside of a custom node:

Comment Node Addon

bl_info = {
    "name": "Comment Node",
    "author": "CoDEmanX",
    "version": (1, 0),
    "blender": (2, 67, 0),
    "location": "Node Editor > Add > Other Nodes > Comment",
    "description": "Add a node comment node (string property collection)",
    "warning": "",
    "wiki_url": "",
    "category": "Node"}

import bpy
from bpy.types import Node, Operator
from bpy.props import BoolProperty, IntProperty, CollectionProperty

class NodeComment(Operator):
    bl_idname = "node.comment"
    bl_label = "Node Comment"

    index = IntProperty(default=-1)

    @classmethod
    def poll(cls, context):
        return (context.area.type == 'NODE_EDITOR' and
                context.area.spaces[0].node_tree.nodes.active is not None and
                context.area.spaces[0].node_tree.nodes.active.bl_idname == CommentNode.bl_idname)

    def execute(self, context):
        node = context.area.spaces[0].node_tree.nodes.active
        if self.index == -1:
            node.myCollProperty.add()
            node.myBoolProperty = True
        else:
            try:
                node.myCollProperty.remove(self.index)
            except IndexError:
                print("Invalid collection index")
                return {'CANCELLED'}
        return {'FINISHED'}

# Derived from the Node base type.
class CommentNode(Node):
    # === Basics ===
    # Description string
    '''A comment node'''
    # Optional identifier string. If not explicitly defined, the python class name is used.
    bl_idname = 'CommentNodeType'
    # Label for nice name display
    bl_label = 'Comment Node'
    # Icon identifier
    bl_icon = 'GREASEPENCIL'

    myBoolProperty = bpy.props.BoolProperty(name="Edit")
    myCollProperty = bpy.props.CollectionProperty(type=bpy.types.PropertyGroup)

    def init(self, context):
        self.width = 300

    # Copy function to initialize a copied node from an existing one.
    def copy(self, node):
        print("Copying from node ", node)

    # Free function to clean up on removal.
    def free(self):
        print("Removing node ", self, ", Goodbye!")

    # Additional buttons displayed on the node.
    def draw_buttons(self, context, layout):
        #layout.label("Node settings")

        row = layout.row(True)
        row.operator(NodeComment.bl_idname, text="Add", icon="ZOOMIN").index = -1
        row.prop(self, "myBoolProperty", text="", icon="GREASEPENCIL")

        col = layout.column(True)

        if self.myBoolProperty:
            for i, line in enumerate(self.myCollProperty):
                row = col.row(True)
                row.prop(line, "name", text="")
                row.operator(NodeComment.bl_idname, text="", icon="ZOOMOUT").index = i
        else:
            for line in self.myCollProperty:
                col.label(line.name)

import nodeitems_utils
from nodeitems_utils import NodeCategory, NodeItem

# our own base class with an appropriate poll function,
# so the categories only show up in our own tree type
class MyNodeCategory(NodeCategory):
    pass

# all categories in a list
node_categories = [
    # identifier, label, items list
    MyNodeCategory("OTHERNODES", "Other Nodes", items=[
        NodeItem(CommentNode.bl_idname, label="Comment"),
        ]),
    ]


def register():
    bpy.utils.register_class(NodeComment)
    bpy.utils.register_class(CommentNode)

    try:
        nodeitems_utils.register_node_categories("CUSTOM_NODES", node_categories)
    except:
        pass


def unregister():
    nodeitems_utils.unregister_node_categories("CUSTOM_NODES")

    bpy.utils.register_class(NodeComment)
    bpy.utils.register_class(CommentNode)


if __name__ == "__main__":
    register()
$\endgroup$
4
  • $\begingroup$ Thanks, that looks like the best viable solution since there's no other real comment node, but I don't know anything about coding for blender, so how would I implement this? $\endgroup$ Commented Mar 17, 2014 at 12:02
  • 1
    $\begingroup$ Not sure what you mean, you can install above code as addon and use the comment node (I hope!). Haven't tested it in-depth, so better check before production if it's kept in .blend on save while addon is disabled. $\endgroup$
    – CodeManX
    Commented Mar 17, 2014 at 12:36
  • $\begingroup$ Thom Blair, save the code above as a .py file and place it in the Blender\2.69\scripts\addons\ directory. Then in Blender you can go to user preferences>addons and you should be able to find it and enable it by checking the check mark. Then it should work in Blender. $\endgroup$
    – cybrbeast
    Commented Mar 17, 2014 at 12:49
  • $\begingroup$ Thanks! That worked great! Thankfully someone had just mentioned how to install a script to me, so I'm just listing the steps below for anyone else: (1) open the Text Editor window (2) click the New Text button (3) paste in the code (4) click the Run Script button (5) then CTRL + U to save the startup file $\endgroup$ Commented Mar 17, 2014 at 12:55
5
$\begingroup$

There is an addon that can make it possible adding Note Nodes.

It is stated everything needed on the BlenderArtists page where addon was posted, I will make short summary here to not make this answer link-only.

Functionality. You can create the node from a panel (which opens with N) in the node editor called Note. Either an empty node or from clipboard.

A note can either be linked to a blender text buffer or store text. If text is stored a linked file is ignored. You access settings of the node from the properties of the node (press N to open).

(Italic is mine).

What it looks like:

enter image description here

image from BA post


Download

Documentation

$\endgroup$
2
  • $\begingroup$ Also please note that only people with this addon can read your note as is stated on documentation page $\endgroup$
    – Mr Zak
    Commented Jun 22, 2015 at 19:02
  • $\begingroup$ I tried to install this add-on to the latest version of Blender 3.2, but the load failed due to errors. $\endgroup$
    – Drewf
    Commented Jun 30, 2022 at 16:06
4
$\begingroup$

This is silly but it's also instant, built-in and easy unlike the other answers. Downside is you're limited to one short line. Simply set the 'Label' property of the node you're commenting.

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .