Rename Label instead of Name in Node editor using F2 key
See D4631 for more details Reviewers: @brecht @billreynish
This commit is contained in:
@@ -1084,11 +1084,11 @@ class TOPBAR_PT_name(Panel):
|
|||||||
row.prop(item, "name", text="")
|
row.prop(item, "name", text="")
|
||||||
found = True
|
found = True
|
||||||
elif space_type == 'NODE_EDITOR':
|
elif space_type == 'NODE_EDITOR':
|
||||||
layout.label(text="Node Name")
|
layout.label(text="Node Label")
|
||||||
item = context.active_node
|
item = context.active_node
|
||||||
if item:
|
if item:
|
||||||
row = row_with_icon(layout, 'NODE')
|
row = row_with_icon(layout, 'NODE')
|
||||||
row.prop(item, "name", text="")
|
row.prop(item, "label", text="")
|
||||||
found = True
|
found = True
|
||||||
else:
|
else:
|
||||||
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
|
if mode == 'POSE' or (mode == 'WEIGHT_PAINT' and context.pose_object):
|
||||||
|
@@ -1617,6 +1617,31 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
|
|||||||
BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
|
BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rna_Node_label_length(PointerRNA *ptr)
|
||||||
|
{
|
||||||
|
bNode *node = (bNode *)ptr->data;
|
||||||
|
|
||||||
|
if (node->label[0] == '\0') {
|
||||||
|
return strlen(node->name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return strlen(node->label);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rna_Node_label_get(PointerRNA *ptr, char *value)
|
||||||
|
{
|
||||||
|
bNode *node = (bNode *)ptr->data;
|
||||||
|
if (node->label[0] == '\0') {
|
||||||
|
strcpy(value, node->name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
strcpy(value, node->label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
|
static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
|
||||||
{
|
{
|
||||||
/* Adding an input to a group node is not working, simpler to add it to its underlying nodetree. */
|
/* Adding an input to a group node is not working, simpler to add it to its underlying nodetree. */
|
||||||
@@ -7977,6 +8002,7 @@ static void rna_def_node(BlenderRNA *brna)
|
|||||||
|
|
||||||
prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
|
prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
|
||||||
RNA_def_property_string_sdna(prop, NULL, "label");
|
RNA_def_property_string_sdna(prop, NULL, "label");
|
||||||
|
RNA_def_property_string_funcs(prop, "rna_Node_label_get", "rna_Node_label_length", NULL);
|
||||||
RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
|
RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
|
||||||
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
|
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user