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