Fix #32178, Adding "File Output" node crashes when a video output type is selected.
authorLukas Toenne <lukas.toenne@googlemail.com>
Wed, 25 Jul 2012 10:25:53 +0000 (10:25 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Wed, 25 Jul 2012 10:25:53 +0000 (10:25 +0000)
The image format for the node and sockets were not properly initialized. The file output node only supports image types (not movies), so it needs to check for proper format type after copying from the render settings.

source/blender/nodes/composite/nodes/node_composite_outputFile.c

index fcc8ed4a128b6d71decb0684fdba8d44bf5d063a..fd312d71f2cdd96e0b8281c148f15daa004aad7b 100644 (file)
@@ -123,6 +123,8 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, con
                        sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR;
                }
        }
+       else
+               BKE_imformat_defaults(&sockdata->format);
        /* use node data format by default */
        sockdata->use_node_format = TRUE;
        
@@ -174,9 +176,14 @@ static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp
                RenderData *rd = &ntemp->scene->r;
                BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
                nimf->format = rd->im_format;
+               if (BKE_imtype_is_movie(nimf->format.imtype)) {
+                       nimf->format.imtype= R_IMF_IMTYPE_OPENEXR;
+               }
                
-               format = &rd->im_format;
+               format = &nimf->format;
        }
+       else
+               BKE_imformat_defaults(&nimf->format);
        
        /* add one socket by default */
        ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);