Cleanup: Use enum for "in" vs. "out" node sockets
This commit is contained in:
@@ -483,14 +483,14 @@ void ntreeBlendReadExpand(struct BlendExpander *expander, struct bNodeTree *ntre
|
|||||||
/** \name Node Tree Interface
|
/** \name Node Tree Interface
|
||||||
* \{ */
|
* \{ */
|
||||||
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
|
struct bNodeSocket *ntreeFindSocketInterface(struct bNodeTree *ntree,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *identifier);
|
const char *identifier);
|
||||||
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
|
struct bNodeSocket *ntreeAddSocketInterface(struct bNodeTree *ntree,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
const char *name);
|
const char *name);
|
||||||
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
|
struct bNodeSocket *ntreeInsertSocketInterface(struct bNodeTree *ntree,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
struct bNodeSocket *next_sock,
|
struct bNodeSocket *next_sock,
|
||||||
const char *name);
|
const char *name);
|
||||||
@@ -556,30 +556,32 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype);
|
|||||||
} \
|
} \
|
||||||
((void)0)
|
((void)0)
|
||||||
|
|
||||||
struct bNodeSocket *nodeFindSocket(const struct bNode *node, int in_out, const char *identifier);
|
struct bNodeSocket *nodeFindSocket(const struct bNode *node,
|
||||||
|
eNodeSocketInOut in_out,
|
||||||
|
const char *identifier);
|
||||||
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
|
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
const char *name);
|
const char *name);
|
||||||
struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree,
|
struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
struct bNodeSocket *next_sock,
|
struct bNodeSocket *next_sock,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
const char *name);
|
const char *name);
|
||||||
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
int type,
|
int type,
|
||||||
int subtype,
|
int subtype,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
const char *name);
|
const char *name);
|
||||||
struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree,
|
struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
int type,
|
int type,
|
||||||
int subtype,
|
int subtype,
|
||||||
struct bNodeSocket *next_sock,
|
struct bNodeSocket *next_sock,
|
||||||
|
@@ -1364,7 +1364,9 @@ GHashIterator *nodeSocketTypeGetIterator(void)
|
|||||||
return BLI_ghashIterator_new(nodesockettypes_hash);
|
return BLI_ghashIterator_new(nodesockettypes_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bNodeSocket *nodeFindSocket(const bNode *node, int in_out, const char *identifier)
|
struct bNodeSocket *nodeFindSocket(const bNode *node,
|
||||||
|
eNodeSocketInOut in_out,
|
||||||
|
const char *identifier)
|
||||||
{
|
{
|
||||||
const ListBase *sockets = (in_out == SOCK_IN) ? &node->inputs : &node->outputs;
|
const ListBase *sockets = (in_out == SOCK_IN) ? &node->inputs : &node->outputs;
|
||||||
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
|
LISTBASE_FOREACH (bNodeSocket *, sock, sockets) {
|
||||||
@@ -1521,7 +1523,7 @@ void nodeModifySocketType(
|
|||||||
|
|
||||||
bNodeSocket *nodeAddSocket(bNodeTree *ntree,
|
bNodeSocket *nodeAddSocket(bNodeTree *ntree,
|
||||||
bNode *node,
|
bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
const char *name)
|
const char *name)
|
||||||
@@ -1543,7 +1545,7 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree,
|
|||||||
|
|
||||||
bNodeSocket *nodeInsertSocket(bNodeTree *ntree,
|
bNodeSocket *nodeInsertSocket(bNodeTree *ntree,
|
||||||
bNode *node,
|
bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
bNodeSocket *next_sock,
|
bNodeSocket *next_sock,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
@@ -1704,7 +1706,7 @@ const char *nodeStaticSocketInterfaceType(int type, int subtype)
|
|||||||
|
|
||||||
bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree,
|
bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree,
|
||||||
bNode *node,
|
bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
int type,
|
int type,
|
||||||
int subtype,
|
int subtype,
|
||||||
const char *identifier,
|
const char *identifier,
|
||||||
@@ -1724,7 +1726,7 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree,
|
|||||||
|
|
||||||
bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree,
|
bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree,
|
||||||
bNode *node,
|
bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
int type,
|
int type,
|
||||||
int subtype,
|
int subtype,
|
||||||
bNodeSocket *next_sock,
|
bNodeSocket *next_sock,
|
||||||
@@ -3220,7 +3222,7 @@ void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
|
|||||||
/* ************ NODE TREE INTERFACE *************** */
|
/* ************ NODE TREE INTERFACE *************** */
|
||||||
|
|
||||||
static bNodeSocket *make_socket_interface(bNodeTree *ntree,
|
static bNodeSocket *make_socket_interface(bNodeTree *ntree,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
@@ -3256,7 +3258,9 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree,
|
|||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree, int in_out, const char *identifier)
|
bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree,
|
||||||
|
eNodeSocketInOut in_out,
|
||||||
|
const char *identifier)
|
||||||
{
|
{
|
||||||
ListBase *sockets = (in_out == SOCK_IN) ? &ntree->inputs : &ntree->outputs;
|
ListBase *sockets = (in_out == SOCK_IN) ? &ntree->inputs : &ntree->outputs;
|
||||||
LISTBASE_FOREACH (bNodeSocket *, iosock, sockets) {
|
LISTBASE_FOREACH (bNodeSocket *, iosock, sockets) {
|
||||||
@@ -3268,7 +3272,7 @@ bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree, int in_out, const char *
|
|||||||
}
|
}
|
||||||
|
|
||||||
bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree,
|
bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
const char *idname,
|
const char *idname,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
@@ -3284,8 +3288,11 @@ bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree,
|
|||||||
return iosock;
|
return iosock;
|
||||||
}
|
}
|
||||||
|
|
||||||
bNodeSocket *ntreeInsertSocketInterface(
|
bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree,
|
||||||
bNodeTree *ntree, int in_out, const char *idname, bNodeSocket *next_sock, const char *name)
|
eNodeSocketInOut in_out,
|
||||||
|
const char *idname,
|
||||||
|
bNodeSocket *next_sock,
|
||||||
|
const char *name)
|
||||||
{
|
{
|
||||||
bNodeSocket *iosock = make_socket_interface(ntree, in_out, idname, name);
|
bNodeSocket *iosock = make_socket_interface(ntree, in_out, idname, name);
|
||||||
if (in_out == SOCK_IN) {
|
if (in_out == SOCK_IN) {
|
||||||
@@ -3304,7 +3311,7 @@ struct bNodeSocket *ntreeAddSocketInterfaceFromSocket(bNodeTree *ntree,
|
|||||||
bNodeSocket *from_sock)
|
bNodeSocket *from_sock)
|
||||||
{
|
{
|
||||||
bNodeSocket *iosock = ntreeAddSocketInterface(
|
bNodeSocket *iosock = ntreeAddSocketInterface(
|
||||||
ntree, from_sock->in_out, from_sock->idname, from_sock->name);
|
ntree, static_cast<eNodeSocketInOut>(from_sock->in_out), from_sock->idname, from_sock->name);
|
||||||
if (iosock) {
|
if (iosock) {
|
||||||
if (iosock->typeinfo->interface_from_socket) {
|
if (iosock->typeinfo->interface_from_socket) {
|
||||||
iosock->typeinfo->interface_from_socket(ntree, iosock, from_node, from_sock);
|
iosock->typeinfo->interface_from_socket(ntree, iosock, from_node, from_sock);
|
||||||
@@ -3319,7 +3326,11 @@ struct bNodeSocket *ntreeInsertSocketInterfaceFromSocket(bNodeTree *ntree,
|
|||||||
bNodeSocket *from_sock)
|
bNodeSocket *from_sock)
|
||||||
{
|
{
|
||||||
bNodeSocket *iosock = ntreeInsertSocketInterface(
|
bNodeSocket *iosock = ntreeInsertSocketInterface(
|
||||||
ntree, from_sock->in_out, from_sock->idname, next_sock, from_sock->name);
|
ntree,
|
||||||
|
static_cast<eNodeSocketInOut>(from_sock->in_out),
|
||||||
|
from_sock->idname,
|
||||||
|
next_sock,
|
||||||
|
from_sock->name);
|
||||||
if (iosock) {
|
if (iosock) {
|
||||||
if (iosock->typeinfo->interface_from_socket) {
|
if (iosock->typeinfo->interface_from_socket) {
|
||||||
iosock->typeinfo->interface_from_socket(ntree, iosock, from_node, from_sock);
|
iosock->typeinfo->interface_from_socket(ntree, iosock, from_node, from_sock);
|
||||||
|
@@ -41,7 +41,7 @@ extern "C" {
|
|||||||
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
struct bNodeSocketTemplate *stemp,
|
struct bNodeSocketTemplate *stemp,
|
||||||
int in_out);
|
eNodeSocketInOut in_out);
|
||||||
|
|
||||||
void node_verify_socket_templates(struct bNodeTree *ntree, struct bNode *node);
|
void node_verify_socket_templates(struct bNodeTree *ntree, struct bNode *node);
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
||||||
struct bNode *node,
|
struct bNode *node,
|
||||||
struct bNodeSocketTemplate *stemp,
|
struct bNodeSocketTemplate *stemp,
|
||||||
int in_out)
|
eNodeSocketInOut in_out)
|
||||||
{
|
{
|
||||||
bNodeSocket *sock = nodeAddStaticSocket(
|
bNodeSocket *sock = nodeAddStaticSocket(
|
||||||
ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name);
|
ntree, node, in_out, stemp->type, stemp->subtype, stemp->identifier, stemp->name);
|
||||||
@@ -102,8 +102,11 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
|
|||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bNodeSocket *verify_socket_template(
|
static bNodeSocket *verify_socket_template(bNodeTree *ntree,
|
||||||
bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp)
|
bNode *node,
|
||||||
|
eNodeSocketInOut in_out,
|
||||||
|
ListBase *socklist,
|
||||||
|
bNodeSocketTemplate *stemp)
|
||||||
{
|
{
|
||||||
bNodeSocket *sock;
|
bNodeSocket *sock;
|
||||||
|
|
||||||
@@ -132,7 +135,7 @@ static bNodeSocket *verify_socket_template(
|
|||||||
|
|
||||||
static void verify_socket_template_list(bNodeTree *ntree,
|
static void verify_socket_template_list(bNodeTree *ntree,
|
||||||
bNode *node,
|
bNode *node,
|
||||||
int in_out,
|
eNodeSocketInOut in_out,
|
||||||
ListBase *socklist,
|
ListBase *socklist,
|
||||||
bNodeSocketTemplate *stemp_first)
|
bNodeSocketTemplate *stemp_first)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user