Page MenuHome

Rename Label instead of Name in Node editor using F2 key

Authored by Antonio Vazquez (antoniov) on Apr 2 2019, 7:48 PM.



The rename of the Node is not valid because the display information is the label, so it looks strange press F2, rename and nothing happens.

This patch renames the label.

Diff Detail

Event Timeline

@Brecht Van Lommel (brecht) Where is the code to intialize new created Nodes? I want to be sure the Node Name is copied to Node Label to get a right initialization of the node.

This seems correct, other than the fact that new nodes don't get the name field filled out by default

  • Initialize Node Label

Still there is a problem with the default material of default Cube.

Edit: It looks the default material node is fixed. I think I looked at the wrong place before.

Brecht Van Lommel (brecht) requested changes to this revision.Apr 3 2019, 11:02 AM

We should not just make labels equal to names. That breaks the feature where a node label automatically changes to match the operation in e.g. a math node.

I think the F2 operator should put the name in the text field instead of leaving it empty, and not change anything else.

This revision now requires changes to proceed.Apr 3 2019, 11:02 AM

@Brecht Van Lommel (brecht) You mean don't copy the name to label, so remove versioning_280.c and node.c code, right?

Mabe I miss something, but F2 now it's not an operator, but a simple property. I don't know how set the value to property in python, maybe I need add C code in RNA for "label" property to fill it with name if it's empty.

Now, the label property is replace by name only if is empty.

This solves the empty labels and the math node issue.

@William Reynish (billreynish) Did you test last version? what do you think?

I think it seems alright.
Although one question is still with nodes like the math node. Currently it seems like it still works correctly, but the Label field doesn't update:

IMO this is no worse than before, when the Label field was simply blank in this case, so I think it seems like a good change overall.

@Brecht Van Lommel (brecht) thoughts?

Yes, I have seen the Math node works in its way... you change mode and the header changes, but not the name or label. I think there must be a "custom" code for this node type.

We will wait for @Brecht Van Lommel (brecht) opinion before moving the change to master.

Brecht Van Lommel (brecht) requested changes to this revision.Apr 11 2019, 12:41 PM

Approach seems fine, only minor comments.


Don't check if node is NULL, it can't be.


Fix comma position.

This revision now requires changes to proceed.Apr 11 2019, 12:41 PM
  • Don't check Node is NULL
  • Fix style
Antonio Vazquez (antoniov) marked 2 inline comments as done.Apr 11 2019, 1:11 PM

Included in commit 98b06c20a0d4