From 01b3deb680f7e3b34adaad5b5a888e7bd44cfaa4 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 2 May 2012 07:18:51 +0000 Subject: A number of changes to node RNA and the file output node, to simplify socket types and make node code more robust for future nodes with extra socket data. * Removed the struct_type identifier from sockets completely. Any specialization of socket types can be done by using separate collections in RNA and customized socket draw callbacks in node type. Sockets themselves are pure data inputs/outputs now. Possibly the sock->storage data could also be removed, but this will change anyway with id properties in custom nodes. * Replaced the direct socket button draw calls by extra callbacks in node types. This allows nodes to draw sockets in specialized ways without referring to the additional struct_type identifier. Default is simply drawing the socket default_value button, only file output node overrides this atm. * File output node slots now use a separate file sub-path in their storage data, instead of using the socket name. That way the path is an actual PROP_FILEPATH property and it works better with the UI list template (name property is local to the data struct). * Node draw contexts for options on the node itself and detail buttons in the sidebar now have an extra context pointer "node" (uiLayoutSetContextPointer). This can be used to bind operator buttons to a specific node, instead of having to rely on the active/selected node(s) or making weak links via node name. Compare to modifiers and logic bricks, they use the same feature. * Added another operator for reordering custom input slots in the file output node. --- .../nodes/composite/nodes/node_composite_outputFile.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/blender/nodes') diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 2eb68c787fb..f89dcf63f64 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -48,12 +48,13 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, ImageFormatData *im_format) { NodeImageMultiFile *nimf = node->storage; - bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_RGBA); + bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, "", SOCK_RGBA); /* create format data for the input socket */ NodeImageMultiFileSocket *sockdata = MEM_callocN(sizeof(NodeImageMultiFileSocket), "socket image format"); sock->storage = sockdata; - sock->struct_type = SOCK_STRUCT_OUTPUT_FILE; + + BLI_strncpy(sockdata->path, name, sizeof(sockdata->path)); if (im_format) { sockdata->format= *im_format; @@ -188,7 +189,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack ibuf->profile = IB_PROFILE_LINEAR_RGB; /* get full path */ - BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sock->name); + BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sockdata->path); BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE); if (0 == BKE_write_ibuf(ibuf, filename, format)) @@ -229,6 +230,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) { if (in[i]->data) { + NodeImageMultiFileSocket *sockdata = sock->storage; CompBuf *cbuf = in[i]->data; char layname[EXR_LAY_MAXNAME]; char channelname[EXR_PASS_MAXNAME]; @@ -247,8 +249,8 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack continue; } - BLI_strncpy(layname, sock->name, sizeof(layname)); - BLI_strncpy(channelname, sock->name, sizeof(channelname)-2); + BLI_strncpy(layname, sockdata->path, sizeof(layname)); + BLI_strncpy(channelname, sockdata->path, sizeof(channelname)-2); channelname_ext = channelname + strlen(channelname); /* create channels */ -- cgit v1.2.3