static void update_output_file(bNodeTree *ntree, bNode *node) { bNodeSocket *sock, *sock_next; PointerRNA ptr; /* XXX fix for #36706: remove invalid sockets added with bpy API. * This is not ideal, but prevents crashes from missing storage. * FileOutput node needs a redesign to support this properly. */ for (sock = node->inputs.first; sock; sock = sock_next) { sock_next = sock->next; if (sock->storage == NULL) { nodeRemoveSocket(ntree, node, sock); } } for (sock = node->outputs.first; sock; sock = sock_next) { sock_next = sock->next; nodeRemoveSocket(ntree, node, sock); } cmp_node_update_default(ntree, node); /* automatically update the socket type based on linked input */ for (sock = node->inputs.first; sock; sock = sock->next) { if (sock->link) { RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); RNA_enum_set(&ptr, "type", sock->link->fromsock->type); } } }
static void update_output_file(bNodeTree *ntree, bNode *node) { bNodeSocket *sock; PointerRNA ptr; cmp_node_update_default(ntree, node); /* automatically update the socket type based on linked input */ for (sock = node->inputs.first; sock; sock = sock->next) { if (sock->link) { RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); RNA_enum_set(&ptr, "type", sock->link->fromsock->type); } } }