Nodes: better default name for custom node tree datablocks

Use NodeTree.bl_label instead of "NodeTree" for more descriptive name.

Implemented by Iliya Katueshenock.

Differential Revision: https://developer.blender.org/D16856
This commit is contained in:
David Ballesteros 2023-01-05 18:14:35 +01:00 committed by Brecht Van Lommel
parent 8a65e33d41
commit 59ce7bf5a9
1 changed files with 7 additions and 6 deletions

View File

@ -844,17 +844,18 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
if (!ntreeTypeFind(idname)) {
BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname);
return OPERATOR_CANCELLED;
}
if (RNA_struct_property_is_set(op->ptr, "name")) {
RNA_string_get(op->ptr, "name", treename_buf);
treename = treename_buf;
}
else {
treename = DATA_("NodeTree");
}
if (!ntreeTypeFind(idname)) {
BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname);
return OPERATOR_CANCELLED;
const bNodeTreeType *type = ntreeTypeFind(idname);
treename = type->ui_name;
}
ntree = ntreeAddTree(bmain, treename, idname);