fix for error in my recent change to image save.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 30 Aug 2011 23:37:46 +0000 (23:37 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 30 Aug 2011 23:37:46 +0000 (23:37 +0000)
- relative path wasn't being made absolute.
- saving renders was always defaulting to multilayer exr, now use the output format set.

source/blender/editors/space_image/image_ops.c

index f96a8ea4d847d2f45a0ae6f65ae9341d7ae83a41..68f9e4d033e704b1003eec4e7feab18d81005302 100644 (file)
@@ -960,20 +960,19 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
 
        if(ibuf) {
                Image *ima= sima->image;
-               RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
 
                simopts->planes= ibuf->depth;
 
-               /* cant save multilayer sequence, ima->rr isn't valid for a specific frame */
-               if(rr && !(ima->source==IMA_SRC_SEQUENCE && ima->type==IMA_TYPE_MULTILAYER))
-                       simopts->imtype= R_MULTILAYER;
-               else if(ima->type==IMA_TYPE_R_RESULT)
+               if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
                        simopts->imtype= scene->r.imtype;
-               else if (ima->source == IMA_SRC_GENERATED)
+                       simopts->planes= scene->r.planes;
+               }
+               else if (ima->source == IMA_SRC_GENERATED) {
                        simopts->imtype= R_PNG;
-               else
+               }
+               else {
                        simopts->imtype= BKE_ftype_to_imtype(ibuf->ftype);
-
+               }
                simopts->subimtype= scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
                simopts->quality= ibuf->ftype & 0xff;
 
@@ -1000,8 +999,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
                        }
                        BLI_path_abs(simopts->filepath, G.main->name);
                }
-               /* cleanup */
-               BKE_image_release_renderresult(scene, ima);
        }
 
        ED_space_image_release_buffer(sima, lock);
@@ -1016,7 +1013,10 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
        // if (RNA_property_is_set(op->ptr, "subimtype")) simopts->subimtype= RNA_enum_get(op->ptr, "subimtype"); // XXX
        if (RNA_property_is_set(op->ptr, "file_quality")) simopts->quality= RNA_int_get(op->ptr, "file_quality");
 
-       if (RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", simopts->filepath);
+       if (RNA_property_is_set(op->ptr, "filepath")) {
+               RNA_string_get(op->ptr, "filepath", simopts->filepath);
+               BLI_path_abs(simopts->filepath, G.main->name);
+       }
 }
 
 static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)