diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-24 09:18:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-24 09:18:26 +0400 |
commit | df22957bfce70b704b6b93958814c1ca8b2211f5 (patch) | |
tree | a35104eb5ceb725431da197c98483f217e16ee1d | |
parent | 3b9b6051d93122a27da57908c987670e9f831e7f (diff) |
image format arg parsing for creator.c
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.
-rw-r--r-- | build_files/scons/tools/Blender.py | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 41 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/creator/CMakeLists.txt | 28 | ||||
-rw-r--r-- | source/creator/creator.c | 46 |
6 files changed, 52 insertions, 76 deletions
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index f9a9023c5ce..38cd960ebe1 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -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') diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 7233f9570f9..96c0371baf3 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -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); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ef764f2394d..964e15f494d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -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; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 720f2cc5b08..faacde9e44f 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -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 */ diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 57551eab01a..79a7f5bd910 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -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) diff --git a/source/creator/creator.c b/source/creator/creator.c index 3a356e709f7..67deb59205e 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -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"); |