minor changes
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Nov 2011 17:14:29 +0000 (17:14 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Nov 2011 17:14:29 +0000 (17:14 +0000)
- avoid duplicate image enum definitions.
- move image UI format & bw/rgb/rgba onto 1 line.
- add 'make config' convenience target to run ccmake or cmake-gui

GNUmakefile
source/blender/editors/space_image/image_buttons.c
source/blender/makesrna/intern/rna_scene.c

index 2ac3439..478f0c3 100644 (file)
@@ -92,6 +92,17 @@ CMAKE_CONFIG = cmake $(BUILD_CMAKE_ARGS) \
                      -DCMAKE_BUILD_TYPE:STRING=$(BUILD_TYPE)
 
 
+# -----------------------------------------------------------------------------
+# Tool for 'make config'
+
+# X11 spesific
+ifdef DISPLAY
+       CMAKE_CONFIG_TOOL = cmake-gui
+else 
+       CMAKE_CONFIG_TOOL = ccmake
+endif
+
+
 # -----------------------------------------------------------------------------
 # Build Blender
 all:
@@ -115,8 +126,15 @@ lite: all
 headless: all
 bpy: all
 
+
 # -----------------------------------------------------------------------------
-# Helo for build targets
+# Configuration (save some cd'ing around)
+config:
+       $(CMAKE_CONFIG_TOOL) $(BUILD_DIR)
+
+
+# -----------------------------------------------------------------------------
+# Help for build targets
 help:
        @echo ""
        @echo "Convenience targets provided for building blender, (multiple at once can be used)"
@@ -125,6 +143,8 @@ help:
        @echo "  * headless  - build without an interface (renderfarm or server automation)"
        @echo "  * bpy       - build as a python module which can be loaded from python directly"
        @echo ""
+       @echo "  * config    - run cmake configuration tool to set build options"
+       @echo ""
        @echo "  Note, passing the argument 'BUILD_DIR=path' when calling make will override the default build dir."
        @echo "  Note, passing the argument 'BUILD_CMAKE_ARGS=args' lets you add cmake arguments."
        @echo ""
index 720102a..71cfa51 100644 (file)
@@ -791,14 +791,16 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
        /* some settings depend on this being a scene thats rendered */
        const short is_render_out= (id && GS(id->name) == ID_SCE);
 
-       uiLayout *col, *row;
+       uiLayout *col, *row, *colsub, *rowsub;
 
        col= uiLayoutColumn(layout, 0);
 
-       uiItemR(col, imfptr, "file_format", 0, "", ICON_NONE);
-       
-       row= uiLayoutRow(col, 0);
-       uiItemR(row, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
+       row= uiLayoutSplit(col, 0.5f, 0);
+       colsub= uiLayoutColumn(row, 0);
+       uiItemR(colsub, imfptr, "file_format", 0, "", ICON_NONE);
+       colsub= uiLayoutColumn(row, 0);
+       rowsub= uiLayoutRow(colsub, 0);
+       uiItemR(rowsub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
 
        /* only display depth setting if multiple depths can be used */
        if((ELEM6(depth_ok,
index 8e162f2..c128657 100644 (file)
@@ -103,83 +103,87 @@ EnumPropertyItem snap_element_items[] = {
        {0, NULL, 0, NULL, NULL}};
 
 
-/* note on duplicate block, perhaps we should use some trick to avoid
- * the duplicate, but with the inline defines it becomes very tricky
- * this awaits someone who has very good preprocessor-fu.
- * for now just make sure they stay in sync - campbell */
+/* workaround for duplice enums,
+ * have each enum line as a defne then conditionally set it or not
+ */
 
-EnumPropertyItem image_only_type_items[] = {
+#define R_IMF_ENUM_BMP      {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
+#define R_IMF_ENUM_IRIS     {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
+#define R_IMF_ENUM_PNG      {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
+#define R_IMF_ENUM_JPEG     {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
+#define R_IMF_ENUM_TAGA     {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
+#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
 
 
-    /* --- duplicate block warning (see below) --- */
-#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
-       {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
 #ifdef WITH_DDS
-       {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
+#  define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
+#else
+#  define R_IMF_ENUM_DDS
 #endif
-       {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
-       {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
-       {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
+
 #ifdef WITH_OPENJPEG
-       {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
+#  define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
+#else
+#  define R_IMF_ENUM_JPEG2K
 #endif
-       {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
-       {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
-       {0, "", 0, " ", NULL},
+
 #ifdef WITH_CINEON
-       {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
-       {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
+#  define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
+#  define R_IMF_ENUM_DPX    {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
+#else
+#  define R_IMF_ENUM_CINEON
+#  define R_IMF_ENUM_DPX
 #endif
+
 #ifdef WITH_OPENEXR
-       {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
-       {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
+#  define R_IMF_ENUM_EXR_MULTI  {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
+#  define R_IMF_ENUM_EXR        {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
+#else
+#  define R_IMF_ENUM_EXR_MULTI
+#  define R_IMF_ENUM_EXR
 #endif
+
 #ifdef WITH_HDR
-       {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
+#  define R_IMF_ENUM_HDR  {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
+#else
+#  define R_IMF_ENUM_HDR
 #endif
+
 #ifdef WITH_TIFF
-       {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
+#  define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
+#else
+#  define R_IMF_ENUM_TIFF
 #endif
-    /* --- end duplicate block (see below) --- */
 
 
-       {0, NULL, 0, NULL, NULL}};
+#define IMAGE_TYPE_ITEMS_IMAGE_ONLY                                           \
+       R_IMF_ENUM_BMP                                                            \
+       R_IMF_ENUM_DDS                                                            \
+       R_IMF_ENUM_IRIS                                                           \
+       R_IMF_ENUM_PNG                                                            \
+       R_IMF_ENUM_JPEG                                                           \
+       R_IMF_ENUM_JPEG2K                                                         \
+       R_IMF_ENUM_TAGA                                                           \
+       R_IMF_ENUM_TAGA_RAW                                                       \
+       {0, "", 0, " ", NULL},                                                    \
+       R_IMF_ENUM_CINEON                                                         \
+       R_IMF_ENUM_DPX                                                            \
+       R_IMF_ENUM_EXR_MULTI                                                      \
+       R_IMF_ENUM_EXR                                                            \
+       R_IMF_ENUM_HDR                                                            \
+       R_IMF_ENUM_TIFF                                                           \
 
-EnumPropertyItem image_type_items[] = {
-       {0, "", 0, "Image", NULL},
 
+EnumPropertyItem image_only_type_items[] = {
 
-    /* --- duplicate block warning (see above) --- */
-#define IMAGE_TYPE_ITEMS_IMAGE_ONLY
-       {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
-#ifdef WITH_DDS
-       {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
-#endif
-       {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
-       {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
-       {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
-#ifdef WITH_OPENJPEG
-       {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
-#endif
-       {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
-       {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
-       {0, "", 0, " ", NULL},
-#ifdef WITH_CINEON
-       {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
-       {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
-#endif
-#ifdef WITH_OPENEXR
-       {R_IMF_IMTYPE_MULTILAYER, "MULTILAYER", ICON_FILE_IMAGE, "MultiLayer", "Output image in multilayer OpenEXR format"},
-       {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
-#endif
-#ifdef WITH_HDR
-       {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
-#endif
-#ifdef WITH_TIFF
-       {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
-#endif
-    /* --- end duplicate block (see above) --- */
+       IMAGE_TYPE_ITEMS_IMAGE_ONLY
+
+    {0, NULL, 0, NULL, NULL}};
+
+EnumPropertyItem image_type_items[] = {
+       {0, "", 0, "Image", NULL},
 
+       IMAGE_TYPE_ITEMS_IMAGE_ONLY
 
        {0, "", 0, "Movie", NULL},
 #ifdef _WIN32