Added RNA functions to group tree inputs/outputs for exposing internal sockets or adding custom sockets by name and type (fixes #26171). Changed a few function names for groups for consistency.
This commit is contained in:
@@ -186,7 +186,7 @@ void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
|
||||
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
||||
|
||||
struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
|
||||
int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex);
|
||||
int nodeFindNode(struct bNodeTree *ntree, struct bNodeSocket *sock, struct bNode **nodep, int *sockindex, int *in_out);
|
||||
|
||||
struct bNodeLink *nodeFindLink(struct bNodeTree *ntree, struct bNodeSocket *from, struct bNodeSocket *to);
|
||||
int nodeCountSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
|
||||
@@ -206,15 +206,14 @@ void ntreeClearTags(struct bNodeTree *ntree);
|
||||
struct bNode *nodeMakeGroupFromSelected(struct bNodeTree *ntree);
|
||||
int nodeGroupUnGroup(struct bNodeTree *ntree, struct bNode *gnode);
|
||||
|
||||
void nodeVerifyGroup(struct bNodeTree *ngroup);
|
||||
void nodeGroupVerify(struct bNodeTree *ngroup);
|
||||
void nodeGroupSocketUseFlags(struct bNodeTree *ngroup);
|
||||
|
||||
void nodeCopyGroup(struct bNode *gnode);
|
||||
void nodeGroupCopy(struct bNode *gnode);
|
||||
|
||||
struct bNodeSocket *nodeAddGroupSocket(struct bNodeTree *ngroup, const char *name, int type, int in_out);
|
||||
struct bNodeSocket *nodeAddGroupSocketCopy(struct bNodeTree *ngroup, struct bNodeSocket *copy, int in_out);
|
||||
void nodeAddAllGroupSockets(struct bNodeTree *ngroup);
|
||||
void nodeRemGroupSocket(struct bNodeTree *ngroup, struct bNodeSocket *gsock, int in_out);
|
||||
struct bNodeSocket *nodeGroupAddSocket(struct bNodeTree *ngroup, const char *name, int type, int in_out);
|
||||
void nodeGroupExposeAllSockets(struct bNodeTree *ngroup);
|
||||
void nodeGroupRemoveSocket(struct bNodeTree *ngroup, struct bNodeSocket *gsock, int in_out);
|
||||
|
||||
/* ************** COMMON NODES *************** */
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
|
||||
BLI_addtail(&ngroup->links, link);
|
||||
}
|
||||
else if(link->tonode && (link->tonode->flag & NODE_SELECT)) {
|
||||
gsock = nodeAddGroupSocketCopy(ngroup, link->tosock, SOCK_IN);
|
||||
gsock = nodeGroupAddSocket(ngroup, link->tosock->name, link->tosock->type, SOCK_IN);
|
||||
link->tosock->link = nodeAddLink(ngroup, NULL, gsock, link->tonode, link->tosock);
|
||||
link->tosock = node_add_group_socket(&gnode->inputs, gsock);
|
||||
link->tonode = gnode;
|
||||
@@ -487,7 +487,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
|
||||
if (gsock->link && gsock->link->fromsock==link->fromsock)
|
||||
break;
|
||||
if (!gsock) {
|
||||
gsock = nodeAddGroupSocketCopy(ngroup, link->fromsock, SOCK_OUT);
|
||||
gsock = nodeGroupAddSocket(ngroup, link->fromsock->name, link->fromsock->type, SOCK_OUT);
|
||||
gsock->link = nodeAddLink(ngroup, link->fromnode, link->fromsock, NULL, gsock);
|
||||
link->fromsock = node_add_group_socket(&gnode->outputs, gsock);
|
||||
}
|
||||
@@ -505,7 +505,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree)
|
||||
|
||||
/* here's a nasty little one, need to check users... */
|
||||
/* should become callbackable... */
|
||||
void nodeVerifyGroup(bNodeTree *ngroup)
|
||||
void nodeGroupVerify(bNodeTree *ngroup)
|
||||
{
|
||||
/* group changed, so we rebuild the type definition */
|
||||
// ntreeMakeGroupSockets(ngroup);
|
||||
@@ -627,21 +627,27 @@ bNode *nodeFindNodebyName(bNodeTree *ntree, const char *name)
|
||||
}
|
||||
|
||||
/* finds a node based on given socket */
|
||||
int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockindex)
|
||||
int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockindex, int *in_out)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *tsock;
|
||||
int index= 0;
|
||||
|
||||
for(node= ntree->nodes.first; node; node= node->next) {
|
||||
for(index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++)
|
||||
if(tsock==sock)
|
||||
for(index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++) {
|
||||
if(tsock==sock) {
|
||||
if (in_out) *in_out= SOCK_IN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tsock)
|
||||
break;
|
||||
for(index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++)
|
||||
if(tsock==sock)
|
||||
for(index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++) {
|
||||
if(tsock==sock) {
|
||||
if (in_out) *in_out= SOCK_OUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(tsock)
|
||||
break;
|
||||
}
|
||||
@@ -807,7 +813,7 @@ int nodeGroupUnGroup(bNodeTree *ntree, bNode *gnode)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void nodeCopyGroup(bNode *gnode)
|
||||
void nodeGroupCopy(bNode *gnode)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
|
||||
@@ -824,7 +830,7 @@ void nodeCopyGroup(bNode *gnode)
|
||||
sock->groupsock= sock->groupsock->new_sock;
|
||||
}
|
||||
|
||||
bNodeSocket *nodeAddGroupSocket(bNodeTree *ngroup, const char *name, int type, int in_out)
|
||||
bNodeSocket *nodeGroupAddSocket(bNodeTree *ngroup, const char *name, int type, int in_out)
|
||||
{
|
||||
bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket");
|
||||
|
||||
@@ -849,61 +855,29 @@ bNodeSocket *nodeAddGroupSocket(bNodeTree *ngroup, const char *name, int type, i
|
||||
return gsock;
|
||||
}
|
||||
|
||||
bNodeSocket *nodeAddGroupSocketCopy(bNodeTree *ngroup, bNodeSocket *copy, int in_out)
|
||||
{
|
||||
bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket");
|
||||
|
||||
/* copy name type and data */
|
||||
strcpy(gsock->name, copy->name);
|
||||
gsock->type = copy->type;
|
||||
gsock->ns = copy->ns;
|
||||
gsock->ns.data = NULL;
|
||||
gsock->flag = copy->flag;
|
||||
|
||||
gsock->next = gsock->prev = NULL;
|
||||
gsock->new_sock = NULL;
|
||||
gsock->groupsock = NULL;
|
||||
gsock->link = NULL;
|
||||
/* assign new unique index */
|
||||
gsock->own_index = ngroup->cur_index++;
|
||||
gsock->limit = (in_out==SOCK_IN ? 0xFFF : 1);
|
||||
|
||||
BLI_addtail(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock);
|
||||
|
||||
return gsock;
|
||||
}
|
||||
|
||||
void nodeAddAllGroupSockets(bNodeTree *ngroup)
|
||||
void nodeGroupExposeAllSockets(bNodeTree *ngroup)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *sock, *gsock;
|
||||
|
||||
printf("Verifying group '%s':\n", ngroup->id.name+2);
|
||||
for (node=ngroup->nodes.first; node; node=node->next) {
|
||||
printf("\tNode '%s':\n", node->name);
|
||||
for (sock=node->inputs.first; sock; sock=sock->next) {
|
||||
printf("\t\tInput '%s': link=%p, hidden=%d\n", sock->name, sock->link, (sock->flag & SOCK_HIDDEN));
|
||||
// if (sock->link) {
|
||||
// if (sock->link->fromnode)
|
||||
// printf("fromnode=%s ", sock->link->fromnode->name);
|
||||
// printf("fromsock=%s")
|
||||
// }
|
||||
if (!sock->link && !(sock->flag & SOCK_HIDDEN)) {
|
||||
gsock = nodeAddGroupSocketCopy(ngroup, sock, SOCK_IN);
|
||||
gsock = nodeGroupAddSocket(ngroup, sock->name, sock->type, SOCK_IN);
|
||||
sock->link = nodeAddLink(ngroup, NULL, gsock, node, sock);
|
||||
}
|
||||
}
|
||||
for (sock=node->outputs.first; sock; sock=sock->next) {
|
||||
printf("\t\tOutput '%s': #links=%d, hidden=%d\n", sock->name, nodeCountSocketLinks(ngroup, sock), (sock->flag & SOCK_HIDDEN));
|
||||
if (nodeCountSocketLinks(ngroup, sock)==0 && !(sock->flag & SOCK_HIDDEN)) {
|
||||
gsock = nodeAddGroupSocketCopy(ngroup, sock, SOCK_OUT);
|
||||
gsock = nodeGroupAddSocket(ngroup, sock->name, sock->type, SOCK_OUT);
|
||||
gsock->link = nodeAddLink(ngroup, node, sock, NULL, gsock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nodeRemGroupSocket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
|
||||
void nodeGroupRemoveSocket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
|
||||
{
|
||||
nodeRemSocketLinks(ngroup, gsock);
|
||||
switch (in_out) {
|
||||
|
||||
@@ -2108,7 +2108,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
|
||||
for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
|
||||
if (ntree->flag & NTREE_DO_VERSIONS) {
|
||||
/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
|
||||
nodeAddAllGroupSockets(ntree);
|
||||
nodeGroupExposeAllSockets(ntree);
|
||||
has_old_groups = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,7 +1014,7 @@ static void group_verify_cb(bContext *UNUSED(C), void *UNUSED(snode_v), void *ng
|
||||
{
|
||||
bNodeTree *ngroup= (bNodeTree*)ngroup_v;
|
||||
|
||||
nodeVerifyGroup(ngroup);
|
||||
nodeGroupVerify(ngroup);
|
||||
}
|
||||
|
||||
/* groups are, on creation, centered around 0,0 */
|
||||
|
||||
@@ -555,7 +555,7 @@ void node_tree_verify_groups(bNodeTree *nodetree)
|
||||
|
||||
/* does all materials */
|
||||
if(gnode)
|
||||
nodeVerifyGroup((bNodeTree *)gnode->id);
|
||||
nodeGroupVerify((bNodeTree *)gnode->id);
|
||||
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ static int node_group_socket_add_exec(bContext *C, wmOperator *op)
|
||||
else
|
||||
return OPERATOR_CANCELLED;
|
||||
|
||||
sock = nodeAddGroupSocket(ngroup, name, type, in_out);
|
||||
sock = nodeGroupAddSocket(ngroup, name, type, in_out);
|
||||
|
||||
node_tree_verify_groups(snode->nodetree);
|
||||
|
||||
@@ -715,7 +715,7 @@ static int node_group_socket_remove_exec(bContext *C, wmOperator *op)
|
||||
|
||||
sock = (bNodeSocket*)BLI_findlink(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, index);
|
||||
if (sock) {
|
||||
nodeRemGroupSocket(ngroup, sock, in_out);
|
||||
nodeGroupRemoveSocket(ngroup, sock, in_out);
|
||||
node_tree_verify_groups(snode->nodetree);
|
||||
|
||||
snode_notify(C, snode);
|
||||
@@ -2141,11 +2141,11 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
else if (outside_group_rect(snode) && (link->tonode || link->fromnode)) {
|
||||
/* automatically add new group socket */
|
||||
if (link->tonode && link->tosock) {
|
||||
link->fromsock = nodeAddGroupSocketCopy(snode->edittree, link->tosock, SOCK_IN);
|
||||
link->fromsock = nodeGroupAddSocket(snode->edittree, link->tosock->name, link->tosock->type, SOCK_IN);
|
||||
link->fromnode = NULL;
|
||||
}
|
||||
else if (link->fromnode && link->fromsock) {
|
||||
link->tosock = nodeAddGroupSocketCopy(snode->edittree, link->fromsock, SOCK_OUT);
|
||||
link->tosock = nodeGroupAddSocket(snode->edittree, link->fromsock->name, link->fromsock->type, SOCK_OUT);
|
||||
link->tonode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static char *rna_NodeSocket_path(PointerRNA *ptr)
|
||||
return BLI_sprintfN("outputs[%d]", socketindex);
|
||||
|
||||
/* node sockets */
|
||||
if (!nodeFindNode(ntree, sock, &node, NULL)) return NULL;
|
||||
if (!nodeFindNode(ntree, sock, &node, NULL, NULL)) return NULL;
|
||||
|
||||
socketindex = BLI_findindex(&node->inputs, sock);
|
||||
if (socketindex != -1)
|
||||
@@ -290,7 +290,7 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
bNodeTree *ntree= (bNodeTree*)ptr->id.data;
|
||||
bNode *node= (bNode*)ptr->data;
|
||||
|
||||
nodeVerifyGroup((bNodeTree *)node->id);
|
||||
nodeGroupVerify((bNodeTree *)node->id);
|
||||
|
||||
node_update(bmain, scene, ntree, node);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
||||
bNodeSocket *sock= (bNodeSocket*)ptr->data;
|
||||
bNode *node;
|
||||
|
||||
if (nodeFindNode(ntree, sock, &node, NULL))
|
||||
if (nodeFindNode(ntree, sock, &node, NULL, NULL))
|
||||
node_update(bmain, scene, ntree, node);
|
||||
}
|
||||
|
||||
@@ -377,9 +377,9 @@ static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *pt
|
||||
bNodeSocket *sock= (bNodeSocket*)ptr->data;
|
||||
bNode *node;
|
||||
|
||||
nodeVerifyGroup(ntree);
|
||||
nodeGroupVerify(ntree);
|
||||
|
||||
if (nodeFindNode(ntree, sock, &node, NULL))
|
||||
if (nodeFindNode(ntree, sock, &node, NULL, NULL))
|
||||
node_update(bmain, scene, ntree, node);
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *r
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to create node");
|
||||
}
|
||||
else {
|
||||
nodeVerifyGroup(ntree); /* update group node socket links*/
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
NodeTagChanged(ntree, node);
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
|
||||
@@ -587,7 +587,7 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNod
|
||||
id_us_min(node->id);
|
||||
|
||||
nodeFreeNode(ntree, node);
|
||||
nodeVerifyGroup(ntree); /* update group node socket links*/
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
}
|
||||
@@ -598,12 +598,12 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b
|
||||
bNodeLink *ret;
|
||||
bNode *fromnode, *tonode;
|
||||
|
||||
if (!nodeFindNode(ntree, in, &fromnode, NULL)) {
|
||||
if (!nodeFindNode(ntree, in, &fromnode, NULL, NULL)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to locate input socket's node in nodetree");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!nodeFindNode(ntree, out, &tonode, NULL)) {
|
||||
if (!nodeFindNode(ntree, out, &tonode, NULL, NULL)) {
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to locate output socket's node in nodetree");
|
||||
return NULL;
|
||||
}
|
||||
@@ -616,7 +616,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b
|
||||
if(ret) {
|
||||
NodeTagChanged(ntree, tonode);
|
||||
|
||||
nodeVerifyGroup(ntree); /* update group node socket links*/
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
|
||||
ntreeSolveOrder(ntree);
|
||||
|
||||
@@ -633,12 +633,76 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, bNod
|
||||
else {
|
||||
nodeRemLink(ntree, link);
|
||||
ntreeSolveOrder(ntree);
|
||||
nodeVerifyGroup(ntree); /* update group node socket links*/
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
}
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_input_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
|
||||
{
|
||||
/* XXX should check if tree is a group here! no good way to do this currently. */
|
||||
bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_IN);
|
||||
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
return gsock;
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_output_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
|
||||
{
|
||||
/* XXX should check if tree is a group here! no good way to do this currently. */
|
||||
bNodeSocket *gsock= nodeGroupAddSocket(ntree, name, type, SOCK_OUT);
|
||||
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
return gsock;
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *gsock;
|
||||
int index, in_out;
|
||||
|
||||
if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
|
||||
else if (in_out!=SOCK_IN)
|
||||
BKE_reportf(reports, RPT_ERROR, "Socket is not an input");
|
||||
else {
|
||||
/* XXX should check if tree is a group here! no good way to do this currently. */
|
||||
gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_IN);
|
||||
nodeAddLink(ntree, NULL, gsock, node, sock);
|
||||
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
return gsock;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *reports, bNodeSocket *sock)
|
||||
{
|
||||
bNode *node;
|
||||
bNodeSocket *gsock;
|
||||
int index, in_out;
|
||||
|
||||
if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
|
||||
BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
|
||||
else if (in_out!=SOCK_OUT)
|
||||
BKE_reportf(reports, RPT_ERROR, "Socket is not an output");
|
||||
else {
|
||||
/* XXX should check if tree is a group here! no good way to do this currently. */
|
||||
gsock = nodeGroupAddSocket(ntree, sock->name, sock->type, SOCK_OUT);
|
||||
nodeAddLink(ntree, node, sock, NULL, gsock);
|
||||
|
||||
nodeGroupVerify(ntree); /* update group node socket links*/
|
||||
WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
|
||||
return gsock;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static EnumPropertyItem prop_image_layer_items[] = {
|
||||
@@ -2661,12 +2725,39 @@ static void rna_def_node_link(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "To socket", "");
|
||||
}
|
||||
|
||||
static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *parm;
|
||||
FunctionRNA *func;
|
||||
|
||||
RNA_def_property_srna(cprop, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"));
|
||||
srna= RNA_def_struct(brna, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"), NULL);
|
||||
RNA_def_struct_sdna(srna, "bNodeTree");
|
||||
RNA_def_struct_ui_text(srna, "Group Sockets", "Collection of group sockets");
|
||||
|
||||
func= RNA_def_function(srna, "new", (in_out==SOCK_IN ? "rna_NodeTree_input_new" : "rna_NodeTree_output_new"));
|
||||
RNA_def_function_ui_description(func, "Add a socket to the group tree.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_string(func, "name", "Socket", 32, "Name", "Name of the socket");
|
||||
RNA_def_enum(func, "type", node_socket_type_items, SOCK_VALUE, "Type", "Type of socket");
|
||||
/* return value */
|
||||
parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket.");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func= RNA_def_function(srna, "expose", (in_out==SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
|
||||
RNA_def_function_ui_description(func, "Expose an internal socket in the group tree.");
|
||||
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
||||
RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose");
|
||||
/* return value */
|
||||
parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket.");
|
||||
RNA_def_function_return(func, parm);
|
||||
}
|
||||
|
||||
static void rna_def_nodetree(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
/* FunctionRNA *func; */
|
||||
/* PropertyRNA *parm; */
|
||||
|
||||
static EnumPropertyItem nodetree_type_items[] = {
|
||||
{NTREE_SHADER, "SHADER", 0, "Shader", ""},
|
||||
@@ -2707,11 +2798,13 @@ static void rna_def_nodetree(BlenderRNA *brna)
|
||||
RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
|
||||
RNA_def_property_struct_type(prop, "NodeSocket");
|
||||
RNA_def_property_ui_text(prop, "Inputs", "");
|
||||
rna_def_group_sockets_api(brna, prop, SOCK_IN);
|
||||
|
||||
prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
|
||||
RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
|
||||
RNA_def_property_struct_type(prop, "NodeSocket");
|
||||
RNA_def_property_ui_text(prop, "Outputs", "");
|
||||
rna_def_group_sockets_api(brna, prop, SOCK_OUT);
|
||||
}
|
||||
|
||||
static void rna_def_composite_nodetree(BlenderRNA *brna)
|
||||
|
||||
Reference in New Issue
Block a user