Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-01-11 12:51:06 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-01-11 12:51:06 +0400
commit51bada696f77de9d7f673884cec9560218654fae (patch)
treed2434eac2fb74377592ee7c8c86d68b55733960c /source/blender/editors/space_node
parent782f0b63829a2c257a6e2942c49882f7fe04c33c (diff)
Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning characters and 1 for zero-terminator). CustomData layers names are also extended. Changed DNA structures and all places where length constants were hardcoded. All names which are "generating" from ID block should be limited by MAX_ID_NAME-2, all non-id names now has got own define called MAX_NAME which should be used all over for non-id names to make further name migration stuff easier. All name fields in DNA now have comment with constant which corresponds to hardcoded numeric value which should make it easier to further update this limits or even switch to non-hardcoded values in DNA. Special thanks to Campbell who helped figuring out some issues and helped a lot in finding all cases where hardcoded valued were still used in code. Both of forwards and backwards compatibility is stored with blender versions newer than January 5, 2011. Older versions had issue with placing null-terminator to DNA strings on file load which will lead to some unpredictable behavior or even crashes.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/drawnode.c4
-rw-r--r--source/blender/editors/space_node/node_edit.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 6c0cc15559c..285bac9c519 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -631,7 +631,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
if (sock->flag & SOCK_DYNAMIC) {
bt = uiDefBut(gnode->block, TEX, 0, "",
sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY,
- sock->name, 0, 31, 0, 0, "");
+ sock->name, 0, sizeof(sock->name), 0, 0, "");
if (in_out==SOCK_IN)
uiButSetFunc(bt, update_group_input_cb, snode, ngroup);
else
@@ -640,7 +640,7 @@ static void draw_group_socket_name(SpaceNode *snode, bNode *gnode, bNodeSocket *
else {
uiDefBut(gnode->block, LABEL, 0, sock->name,
sock->locx+xoffset, sock->locy+1+yoffset, 72, NODE_DY,
- NULL, 0, 31, 0, 0, "");
+ NULL, 0, sizeof(sock->name), 0, 0, "");
}
}
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 1fe754466f4..3523e6bd9ab 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -751,7 +751,7 @@ static int edit_node_poll(bContext *C)
static void edit_node_properties(wmOperatorType *ot)
{
/* XXX could node be a context pointer? */
- RNA_def_string(ot->srna, "node", "", 32, "Node", "");
+ RNA_def_string(ot->srna, "node", "", MAX_NAME, "Node", "");
RNA_def_int(ot->srna, "socket", 0, 0, MAX_SOCKET, "Socket", "", 0, MAX_SOCKET);
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Side", "");
}
@@ -779,7 +779,7 @@ static void edit_node_properties_get(wmOperator *op, bNodeTree *ntree, bNode **r
{
bNode *node;
bNodeSocket *sock=NULL;
- char nodename[32];
+ char nodename[MAX_NAME];
int sockindex;
int in_out;
@@ -889,7 +889,7 @@ static int node_group_socket_add_exec(bContext *C, wmOperator *op)
{
SpaceNode *snode = CTX_wm_space_node(C);
int in_out= -1;
- char name[32]= "";
+ char name[MAX_NAME]= "";
int type= SOCK_FLOAT;
bNodeTree *ngroup= snode->edittree;
/* bNodeSocket *sock; */ /* UNUSED */
@@ -932,7 +932,7 @@ void NODE_OT_group_socket_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "in_out", socket_in_out_items, SOCK_IN, "Socket Type", "Input or Output");
- RNA_def_string(ot->srna, "name", "", 32, "Name", "Group socket name");
+ RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Group socket name");
RNA_def_enum(ot->srna, "type", node_socket_type_items, SOCK_FLOAT, "Type", "Type of the group socket");
}
@@ -3451,7 +3451,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
}
else if(RNA_property_is_set(op->ptr, "name"))
{
- char name[32];
+ char name[MAX_ID_NAME-2];
RNA_string_get(op->ptr, "name", name);
ima= (Image *)find_id("IM", name);
@@ -3517,7 +3517,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH); //XXX TODO, relative_path
- RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign");
+ RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
}
/********************** New node tree operator *********************/