forked from bartvdbraak/blender
Fix for the node tree nodes.new API function, this wasn't setting the scene and main context pointers in the node template, used by file output node. Also the file output node itself now works in case of scene==NULL (might happen in some contexts).
This commit is contained in:
parent
12655edc84
commit
f342c7de45
@ -266,6 +266,8 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
|
||||
|
||||
ntemp.type = arg->type;
|
||||
ntemp.ngroup = arg->ngroup;
|
||||
ntemp.scene = CTX_data_scene(C);
|
||||
ntemp.main = CTX_data_main(C);
|
||||
|
||||
if (event == UI_NODE_LINK_DISCONNECT)
|
||||
node_socket_disconnect(bmain, ntree, node_to, sock_to);
|
||||
|
@ -578,7 +578,7 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA
|
||||
return item;
|
||||
}
|
||||
|
||||
static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports,
|
||||
static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports,
|
||||
int type, bNodeTree *group)
|
||||
{
|
||||
bNode *node;
|
||||
@ -591,6 +591,8 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor
|
||||
|
||||
ntemp.type = type;
|
||||
ntemp.ngroup = group;
|
||||
ntemp.scene = CTX_data_scene(C);
|
||||
ntemp.main = CTX_data_main(C);
|
||||
node = nodeAddNode(ntree, &ntemp);
|
||||
|
||||
if (node == NULL) {
|
||||
|
@ -90,15 +90,20 @@ int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node)
|
||||
|
||||
static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp)
|
||||
{
|
||||
RenderData *rd = &ntemp->scene->r;
|
||||
NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
|
||||
ImageFormatData *format = NULL;
|
||||
node->storage= nimf;
|
||||
|
||||
BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
|
||||
nimf->format = rd->im_format;
|
||||
if (ntemp->scene) {
|
||||
RenderData *rd = &ntemp->scene->r;
|
||||
BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
|
||||
nimf->format = rd->im_format;
|
||||
|
||||
format = &rd->im_format;
|
||||
}
|
||||
|
||||
/* add one socket by default */
|
||||
ntreeCompositOutputFileAddSocket(ntree, node, "Image", &rd->im_format);
|
||||
ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);
|
||||
}
|
||||
|
||||
static void free_output_file(bNode *node)
|
||||
|
Loading…
Reference in New Issue
Block a user