Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-11-20 17:32:07 +0300
committerTon Roosendaal <ton@blender.org>2005-11-20 17:32:07 +0300
commitc52170b4ed83a279af5d1a065d173969fe3d24cd (patch)
treec7bde0a344cfc7734e4214147bb925c216370ddc /source/blender/src/toets.c
parent36a9ae941510a12d092e76ac1d2cf1d731d793d3 (diff)
Patch provided by Alfredo de Greef
This adds Radiance HDR image file support. So now at least we can save the 'fbuf' (4x32 bits float colors) in Blender. It doesn't change anything for internal support in imbuf for floa colors, so when reading .hdr files it still converts it to 32 bits RGBA. As an extra I've added that saving images with F3 now also adds the optional extension, when the F10 "Extensions" option is set. One important note; I don't know the proper license for the code, it was provided without... will await feedback from Alfredo about it. For now I've added the standard Blender GPL header.
Diffstat (limited to 'source/blender/src/toets.c')
-rw-r--r--source/blender/src/toets.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index ecee8a9a8c7..721738b8931 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -63,6 +63,7 @@
#include "BKE_depsgraph.h"
#include "BKE_displist.h"
#include "BKE_global.h"
+#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_scene.h"
@@ -73,9 +74,9 @@
#include "BIF_editsound.h"
#include "BIF_editmesh.h"
#include "BIF_interface.h"
+#include "BKE_object.h"
#include "BIF_poseobject.h"
#include "BIF_renderwin.h"
-#include "BKE_object.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_toets.h"
@@ -115,6 +116,11 @@ static void write_imag(char *name)
/* from file select */
char str[256];
+ /* addImageExtension() checks for if extension was already set */
+ if(G.scene->r.scemode & R_EXTENSION)
+ if(strlen(name)<FILE_MAXDIR+FILE_MAXFILE-5)
+ addImageExtension(name);
+
strcpy(str, name);
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
@@ -141,6 +147,13 @@ void schrijfplaatje(char *name)
unsigned int *temprect=0;
char str[FILE_MAXDIR+FILE_MAXFILE];
+ /* radhdr: temporary call for direct float buffer save for HDR format */
+ if ((R.r.imtype==R_RADHDR) && (R.rectftot))
+ {
+ imb_savehdr_fromfloat(R.rectftot, name, R.rectx, R.recty);
+ return;
+ }
+
/* has RGBA been set? If so: use alpha channel for color zero */
IMB_alpha_to_col0(FALSE);
@@ -191,6 +204,11 @@ void schrijfplaatje(char *name)
else printf("no zbuf\n");
}
}
+ else if(R.r.imtype==R_RADHDR) {
+ /* radhdr: save hdr from rgba buffer, not really recommended, probably mistake, so warn user */
+ error("Will save, but you might want to enable the floatbuffer to save a real HDRI...");
+ ibuf->ftype= RADHDR;
+ }
else if(R.r.imtype==R_PNG) {
ibuf->ftype= PNG;
}
@@ -467,6 +485,8 @@ int untitled(char * name)
int save_image_filesel_str(char *str)
{
switch(G.scene->r.imtype) {
+ case R_RADHDR:
+ strcpy(str, "Save Radiance HDR"); return 1;
case R_PNG:
strcpy(str, "Save PNG"); return 1;
case R_BMP: