Fix part of #32377: TIFF not saving on windows to paths with special characters,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 22 Aug 2012 13:10:37 +0000 (13:10 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 22 Aug 2012 13:10:37 +0000 (13:10 +0000)
and DDS should not be in the list of file types because we can only load those
currently.

source/blender/imbuf/intern/dds/dds_api.cpp
source/blender/imbuf/intern/tiff.c
source/blender/makesrna/intern/rna_scene.c

index fba326f7865be2d1e3e552d61265d43ca1704a9d..1aaeb4766e1f7b7aa0fc905f6264990fa8f6ea8a 100644 (file)
 #include <stdio.h> // printf
 #include <fstream>
 
+#ifdef WIN32
+#include "utfconv.h"
+#endif
+
 extern "C" {
 
 #include "imbuf.h"
@@ -39,7 +43,6 @@ extern "C" {
 #include "IMB_imbuf.h"
 #include "IMB_allocimbuf.h"
 
-
 int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags)
 {
        return(0); /* todo: finish this function */
@@ -49,7 +52,15 @@ int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags)
        if (ibuf->rect == 0) return (0);
 
        /* open file for writing */
-       std::ofstream fildes(name);
+       std::ofstream fildes;
+
+#ifdef WIN32
+       wchar_t *wname = alloc_utf16_from_8(name, 0);
+       fildes.open(wname);
+       free(wname);
+#else
+       fildes.open(name);
+#endif
 
        /* write header */
        fildes << "DDS ";
index 985c575daaa0b987e331bd64c204ede902ca59fe..ac5f5da8a67243d500dbe6f8694624b31ca3e28f 100644 (file)
@@ -59,7 +59,9 @@
 
 #include "tiffio.h"
 
-
+#ifdef WIN32
+#include "utfconv.h"
+#endif
 
 /***********************
  * Local declarations. *
@@ -712,7 +714,13 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
        }
        else {
                /* create image as a file */
+#ifdef WIN32
+               wchar_t *wname = alloc_utf16_from_8(name, 0);
+               image = TIFFOpenW(wname, "w");
+               free(wname);
+#else
                image = TIFFOpen(name, "w");
+#endif
        }
        if (image == NULL) {
                fprintf(stderr,
index 09099ca5d9335481920b12789ac20b446202374c..a6f3c0095b51b2dc1e2bd030dabca9c617d4e814 100644 (file)
@@ -209,7 +209,7 @@ EnumPropertyItem snap_node_element_items[] = {
 
 #define IMAGE_TYPE_ITEMS_IMAGE_ONLY                                           \
        R_IMF_ENUM_BMP                                                            \
-       R_IMF_ENUM_DDS                                                            \
+       /* DDS save not supported yet R_IMF_ENUM_DDS */                           \
        R_IMF_ENUM_IRIS                                                           \
        R_IMF_ENUM_PNG                                                            \
        R_IMF_ENUM_JPEG                                                           \