Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/intern/node_socket.c
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
| struct Main; | struct Main; | ||||
| struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp, int in_out) | struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocketTemplate *stemp, int in_out) | ||||
| { | { | ||||
| bNodeSocket *sock = nodeAddStaticSocket(ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name); | bNodeSocket *sock = nodeAddStaticSocket(ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name); | ||||
| sock->flag |= stemp->flag; | sock->flag |= stemp->flag; | ||||
| sock->internal_links = stemp->internal_links; | |||||
| /* initialize default_value */ | /* initialize default_value */ | ||||
| switch (stemp->type) { | switch (stemp->type) { | ||||
| case SOCK_FLOAT: | case SOCK_FLOAT: | ||||
| { | { | ||||
| bNodeSocketValueFloat *dval = sock->default_value; | bNodeSocketValueFloat *dval = sock->default_value; | ||||
| dval->value = stemp->val1; | dval->value = stemp->val1; | ||||
| dval->min = stemp->min; | dval->min = stemp->min; | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp) | ||||
| for (sock = socklist->first; sock; sock = sock->next) { | for (sock = socklist->first; sock; sock = sock->next) { | ||||
| if (strncmp(sock->name, stemp->name, NODE_MAXSTR) == 0) | if (strncmp(sock->name, stemp->name, NODE_MAXSTR) == 0) | ||||
| break; | break; | ||||
| } | } | ||||
| if (sock) { | if (sock) { | ||||
| sock->type = stemp->type; | sock->type = stemp->type; | ||||
| sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit); | sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit); | ||||
| sock->flag |= stemp->flag; | sock->flag |= stemp->flag; | ||||
| sock->internal_links = stemp->internal_links; | |||||
| BLI_remlink(socklist, sock); | BLI_remlink(socklist, sock); | ||||
| return sock; | return sock; | ||||
| } | } | ||||
| else { | else { | ||||
| /* no socket for this template found, make a new one */ | /* no socket for this template found, make a new one */ | ||||
| sock = node_add_socket_from_template(ntree, node, stemp, in_out); | sock = node_add_socket_from_template(ntree, node, stemp, in_out); | ||||
| ▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines | |||||