fix for error in my recent change to image save.

- relative path wasn't being made absolute.
- saving renders was always defaulting to multilayer exr, now use the output format set.
This commit is contained in:
Campbell Barton 2011-08-30 23:37:46 +00:00
parent c58a0c5eb8
commit 2883e035c8

@ -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)