Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_nodetree.c
| Context not available. | |||||
| 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) { | |||||
brecht: Don't check if `node` is `NULL`, it can't be. | |||||
| 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); | |||||
brechtUnsubmitted Done Inline ActionsFix comma position. brecht: Fix comma position. | |||||
| } | |||||
| 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. */ | ||||
| Context not available. | |||||
| 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); | ||||
| Context not available. | |||||
Don't check if node is NULL, it can't be.