image format arg parsing for creator.c
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Nov 2011 05:18:26 +0000 (05:18 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Nov 2011 05:18:26 +0000 (05:18 +0000)
move these checks from creator into BKE's image.c, this way we dont need the defines for creator, scons was missing DDS, HDR & Cineon  for example and nobody noticed.

build_files/scons/tools/Blender.py
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/intern/image.c
source/blender/makesdna/DNA_scene_types.h
source/creator/CMakeLists.txt
source/creator/creator.c

index f9a9023c5ce3c3935d9582cd7e831cc4986de706..38cd960ebe15f4595b34987ca275037789c65ed1 100644 (file)
@@ -319,20 +319,11 @@ def creator(env):
     incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']]
 
     defs = []
-    if env['WITH_BF_QUICKTIME']:
-        incs.append(env['BF_QUICKTIME_INC'])
-        defs.append('WITH_QUICKTIME')
 
     if env['WITH_BF_BINRELOC']:
         incs.append('#/extern/binreloc/include')
         defs.append('WITH_BINRELOC')
 
-    if env['WITH_BF_OPENEXR']:
-        defs.append('WITH_OPENEXR')
-
-    if env['WITH_BF_TIFF']:
-        defs.append('WITH_TIFF')
-
     if env['WITH_BF_SDL']:
         defs.append('WITH_SDL')
 
index 7233f9570f9f6d47f04543a48498bbe132ba68c9..96c0371baf33895fa6752f4addd71744ae21a23c 100644 (file)
@@ -65,6 +65,8 @@ int           BKE_imtype_supports_compress(const char imtype);
 int            BKE_imtype_supports_quality(const char imtype);
 char   BKE_imtype_valid_depths(const char imtype);
 
+char    BKE_imtype_from_arg(const char *arg);
+
 struct anim *openanim(const char *name, int flags, int streamindex);
 
 void   image_de_interlace(struct Image *ima, int odd);
index ef764f2394d21a14566142b08772ed1e85141055..964e15f494d3f00682e2e144805452fe141d3727 100644 (file)
@@ -971,6 +971,47 @@ char BKE_imtype_valid_depths(const char imtype)
        }
 }
 
+
+/* string is from command line --render-format arg, keep in sync with
+ * creator.c help info */
+char BKE_imtype_from_arg(const char *imtype_arg)
+{
+       if      (!strcmp(imtype_arg,"TGA")) return R_IMF_IMTYPE_TARGA;
+       else if (!strcmp(imtype_arg,"IRIS")) return R_IMF_IMTYPE_IRIS;
+#ifdef WITH_DDS
+       else if (!strcmp(imtype_arg,"DDS")) return R_IMF_IMTYPE_DDS;
+#endif
+       else if (!strcmp(imtype_arg,"JPEG")) return R_IMF_IMTYPE_JPEG90;
+       else if (!strcmp(imtype_arg,"IRIZ")) return R_IMF_IMTYPE_IRIZ;
+       else if (!strcmp(imtype_arg,"RAWTGA")) return R_IMF_IMTYPE_RAWTGA;
+       else if (!strcmp(imtype_arg,"AVIRAW")) return R_IMF_IMTYPE_AVIRAW;
+       else if (!strcmp(imtype_arg,"AVIJPEG")) return R_IMF_IMTYPE_AVIJPEG;
+       else if (!strcmp(imtype_arg,"PNG")) return R_IMF_IMTYPE_PNG;
+       else if (!strcmp(imtype_arg,"AVICODEC")) return R_IMF_IMTYPE_AVICODEC;
+       else if (!strcmp(imtype_arg,"QUICKTIME")) return R_IMF_IMTYPE_QUICKTIME;
+       else if (!strcmp(imtype_arg,"BMP")) return R_IMF_IMTYPE_BMP;
+#ifdef WITH_HDR
+       else if (!strcmp(imtype_arg,"HDR")) return R_IMF_IMTYPE_RADHDR;
+#endif
+#ifdef WITH_TIFF
+       else if (!strcmp(imtype_arg,"TIFF")) return R_IMF_IMTYPE_TIFF;
+#endif
+#ifdef WITH_OPENEXR
+       else if (!strcmp(imtype_arg,"EXR")) return R_IMF_IMTYPE_OPENEXR;
+       else if (!strcmp(imtype_arg,"MULTILAYER")) return R_IMF_IMTYPE_MULTILAYER;
+#endif
+       else if (!strcmp(imtype_arg,"MPEG")) return R_IMF_IMTYPE_FFMPEG;
+       else if (!strcmp(imtype_arg,"FRAMESERVER")) return R_IMF_IMTYPE_FRAMESERVER;
+#ifdef WITH_CINEON
+       else if (!strcmp(imtype_arg,"CINEON")) return R_IMF_IMTYPE_CINEON;
+       else if (!strcmp(imtype_arg,"DPX")) return R_IMF_IMTYPE_DPX;
+#endif
+#ifdef WITH_OPENJPEG
+       else if (!strcmp(imtype_arg,"JP2")) return R_IMF_IMTYPE_JP2;
+#endif
+       else return R_IMF_IMTYPE_INVALID;
+}
+
 int BKE_add_image_extension(char *string, const char imtype)
 {
        const char *extension= NULL;
index 720f2cc5b08116c315547732cef14cb2e3bd54f7..faacde9e44f85764c68c87d53206dfc0102c635c 100644 (file)
@@ -277,6 +277,8 @@ typedef struct ImageFormatData {
 #define R_IMF_IMTYPE_XVID           32
 #define R_IMF_IMTYPE_THEORA         33
 
+#define R_IMF_IMTYPE_INVALID        255
+
 /* ImageFormatData.flag */
 #define R_IMF_FLAG_ZBUF         (1<<0)   /* was R_OPENEXR_ZBUF */
 #define R_IMF_FLAG_PREVIEW_JPG  (1<<1)   /* was R_PREVIEW_JPG */
index 57551eab01a9f4b60d0b1f382fcef6ccda774e40..79a7f5bd910e866a54dd7e083a522478da5c097a 100644 (file)
@@ -40,34 +40,6 @@ blender_include_dirs(
        ../blender/windowmanager
 )
 
-if(WITH_CODEC_QUICKTIME)
-       add_definitions(-DWITH_QUICKTIME)
-endif()
-
-if(WITH_IMAGE_OPENEXR)
-       add_definitions(-DWITH_OPENEXR)
-endif()
-
-if(WITH_IMAGE_OPENJPEG)
-       add_definitions(-DWITH_OPENJPEG)
-endif()
-
-if(WITH_IMAGE_TIFF)
-       add_definitions(-DWITH_TIFF)
-endif()
-
-if(WITH_IMAGE_DDS)
-       add_definitions(-DWITH_DDS)
-endif()
-
-if(WITH_IMAGE_CINEON)
-       add_definitions(-DWITH_CINEON)
-endif()
-
-if(WITH_IMAGE_HDR)
-       add_definitions(-DWITH_HDR)
-endif()
-
 if(WITH_LIBMV)
        blender_include_dirs(../../extern/libmv)
        add_definitions(-DWITH_LIBMV)
index 3a356e709f7bfcaef8e79147592a5b25c30260d4..67deb59205e01346e0adbca62c6b6f47995e3564 100644 (file)
@@ -77,6 +77,7 @@
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_sound.h"
+#include "BKE_image.h"
 
 #include "IMB_imbuf.h" // for IMB_init
 
@@ -300,7 +301,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
        printf ("  $BLENDER_USER_CONFIG      Directory for user configuration files.\n");
        printf ("  $BLENDER_USER_SCRIPTS     Directory for user scripts.\n");
        printf ("  $BLENDER_SYSTEM_SCRIPTS   Directory for system wide scripts.\n");
-       printf ("  $BLENDER_USER_DATAFILES   Directory for user data files (icons, translations, ..).\n");
+       printf ("  $BLENDER_USER_DAT`AFILES   Directory for user data files (icons, translations, ..).\n");
        printf ("  $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
        printf ("  $BLENDER_SYSTEM_PYTHON    Directory for system python libraries.\n");
 #ifdef WIN32
@@ -582,47 +583,14 @@ static int set_image_type(int argc, const char **argv, void *data)
                const char *imtype = argv[1];
                Scene *scene= CTX_data_scene(C);
                if (scene) {
-                       char imtype_new;
+                       const char imtype_new= BKE_imtype_from_arg(imtype);
 
-                       if      (!strcmp(imtype,"TGA")) imtype_new = R_IMF_IMTYPE_TARGA;
-                       else if (!strcmp(imtype,"IRIS")) imtype_new = R_IMF_IMTYPE_IRIS;
-#ifdef WITH_DDS
-                       else if (!strcmp(imtype,"DDS")) imtype_new = R_IMF_IMTYPE_DDS;
-#endif
-                       else if (!strcmp(imtype,"JPEG")) imtype_new = R_IMF_IMTYPE_JPEG90;
-                       else if (!strcmp(imtype,"IRIZ")) imtype_new = R_IMF_IMTYPE_IRIZ;
-                       else if (!strcmp(imtype,"RAWTGA")) imtype_new = R_IMF_IMTYPE_RAWTGA;
-                       else if (!strcmp(imtype,"AVIRAW")) imtype_new = R_IMF_IMTYPE_AVIRAW;
-                       else if (!strcmp(imtype,"AVIJPEG")) imtype_new = R_IMF_IMTYPE_AVIJPEG;
-                       else if (!strcmp(imtype,"PNG")) imtype_new = R_IMF_IMTYPE_PNG;
-                       else if (!strcmp(imtype,"AVICODEC")) imtype_new = R_IMF_IMTYPE_AVICODEC;
-                       else if (!strcmp(imtype,"QUICKTIME")) imtype_new = R_IMF_IMTYPE_QUICKTIME;
-                       else if (!strcmp(imtype,"BMP")) imtype_new = R_IMF_IMTYPE_BMP;
-#ifdef WITH_HDR
-                       else if (!strcmp(imtype,"HDR")) imtype_new = R_IMF_IMTYPE_RADHDR;
-#endif
-#ifdef WITH_TIFF
-                       else if (!strcmp(imtype,"TIFF")) imtype_new = R_IMF_IMTYPE_TIFF;
-#endif
-#ifdef WITH_OPENEXR
-                       else if (!strcmp(imtype,"EXR")) imtype_new = R_IMF_IMTYPE_OPENEXR;
-                       else if (!strcmp(imtype,"MULTILAYER")) imtype_new = R_IMF_IMTYPE_MULTILAYER;
-#endif
-                       else if (!strcmp(imtype,"MPEG")) imtype_new = R_IMF_IMTYPE_FFMPEG;
-                       else if (!strcmp(imtype,"FRAMESERVER")) imtype_new = R_IMF_IMTYPE_FRAMESERVER;
-#ifdef WITH_CINEON
-                       else if (!strcmp(imtype,"CINEON")) imtype_new = R_IMF_IMTYPE_CINEON;
-                       else if (!strcmp(imtype,"DPX")) imtype_new = R_IMF_IMTYPE_DPX;
-#endif
-#ifdef WITH_OPENJPEG
-                       else if (!strcmp(imtype,"JP2")) imtype_new = R_IMF_IMTYPE_JP2;
-#endif
-                       else {
+                       if (imtype_new == R_IMF_IMTYPE_INVALID) {
                                printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
-                               imtype_new= scene->r.im_format.imtype;
                        }
-
-                       scene->r.im_format.imtype= imtype_new;
+                       else {
+                               scene->r.im_format.imtype= imtype_new;
+                       }
                }
                else {
                        printf("\nError: no blend loaded. order the arguments so '-F  / --render-format' is after the blend is loaded.\n");