Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/node.cc
| Show First 20 Lines • Show All 3,336 Lines • ▼ Show 20 Lines | |||||
| /* ************ NODE TREE INTERFACE *************** */ | /* ************ NODE TREE INTERFACE *************** */ | ||||
| static bNodeSocket *make_socket_interface(bNodeTree *ntree, | static bNodeSocket *make_socket_interface(bNodeTree *ntree, | ||||
| eNodeSocketInOut in_out, | eNodeSocketInOut in_out, | ||||
| const char *idname, | const char *idname, | ||||
| const char *name) | const char *name) | ||||
| { | { | ||||
| bNodeSocketType *stype = nodeSocketTypeFind(idname); | bNodeSocketType *stype = nodeSocketTypeFind(idname); | ||||
| int own_index = ntree->cur_index++; | |||||
| if (stype == nullptr) { | if (stype == nullptr) { | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| bNodeSocket *sock = (bNodeSocket *)MEM_callocN(sizeof(bNodeSocket), "socket template"); | bNodeSocket *sock = (bNodeSocket *)MEM_callocN(sizeof(bNodeSocket), "socket template"); | ||||
| BLI_strncpy(sock->idname, stype->idname, sizeof(sock->idname)); | BLI_strncpy(sock->idname, stype->idname, sizeof(sock->idname)); | ||||
| node_socket_set_typeinfo(ntree, sock, stype); | node_socket_set_typeinfo(ntree, sock, stype); | ||||
| sock->in_out = in_out; | sock->in_out = in_out; | ||||
| sock->type = SOCK_CUSTOM; /* int type undefined by default */ | sock->type = SOCK_CUSTOM; /* int type undefined by default */ | ||||
| /* assign new unique index */ | /* assign new unique index */ | ||||
| own_index = ntree->cur_index++; | const int own_index = ntree->cur_index++; | ||||
| /* use the own_index as socket identifier */ | /* use the own_index as socket identifier */ | ||||
| if (in_out == SOCK_IN) { | if (in_out == SOCK_IN) { | ||||
| BLI_snprintf(sock->identifier, MAX_NAME, "Input_%d", own_index); | BLI_snprintf(sock->identifier, MAX_NAME, "Input_%d", own_index); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_snprintf(sock->identifier, MAX_NAME, "Output_%d", own_index); | BLI_snprintf(sock->identifier, MAX_NAME, "Output_%d", own_index); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,888 Lines • Show Last 20 Lines | |||||