jpeg2000 presets were broken.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 28 Sep 2009 12:10:13 +0000 (12:10 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 28 Sep 2009 12:10:13 +0000 (12:10 +0000)
release/scripts/ui/buttons_scene.py
source/blender/makesrna/intern/rna_scene.c

index 8bb172e8cd15171aa27f5306bc2a53280956cfe2..88947aac86c824372d1494037ba162847c2647c6 100644 (file)
@@ -254,12 +254,11 @@ class SCENE_PT_output(RenderButtonsPanel):
                        split = layout.split()
                        col = split.column()
                        col.itemL(text="Depth:")
-                       col.row().itemR(rd, "jpeg_depth", expand=True)
+                       col.row().itemR(rd, "jpeg2k_depth", expand=True)
 
                        col = split.column()
-                       col.itemR(rd, "jpeg_preset", text="")
-                       col.itemR(rd, "jpeg_ycc")
-                       col.itemR(rd, "exr_preview")
+                       col.itemR(rd, "jpeg2k_preset", text="")
+                       col.itemR(rd, "jpeg2k_ycc")
                        
                elif rd.file_format in ('CINEON', 'DPX'):
                        split = layout.split()
index 1d8ebdce36918d0b4b90aa569652d064bfd43ee2..95678678569e8ee71247cd5cf9bd3ef8b48c0a26 100644 (file)
@@ -257,6 +257,41 @@ static void rna_SceneRenderData_file_format_set(PointerRNA *ptr, int value)
 #endif
 }
 
+void rna_SceneRenderData_jpeg2k_preset_update(RenderData *rd)
+{
+       rd->subimtype &= ~(R_JPEG2K_12BIT|R_JPEG2K_16BIT | R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS);
+       
+       switch(rd->jp2_depth) {
+       case 8:         break;
+       case 12:        rd->subimtype |= R_JPEG2K_12BIT; break;
+       case 16:        rd->subimtype |= R_JPEG2K_16BIT; break;
+       }
+       
+       switch(rd->jp2_preset) {
+       case 1: rd->subimtype |= R_JPEG2K_CINE_PRESET;                                          break;
+       case 2: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS;      break;
+       case 3: rd->subimtype |= R_JPEG2K_CINE_PRESET;                                          break;
+       case 4: rd->subimtype |= R_JPEG2K_CINE_PRESET;                                          break;
+       case 5: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS;      break;
+       case 6: rd->subimtype |= R_JPEG2K_CINE_PRESET;                                          break;
+       case 7: rd->subimtype |= R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS;      break;
+       }
+}
+
+static void rna_SceneRenderData_jpeg2k_preset_set(PointerRNA *ptr, int value)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       rd->jp2_preset= value;
+       rna_SceneRenderData_jpeg2k_preset_update(rd);
+}
+
+static void rna_SceneRenderData_jpeg2k_depth_set(PointerRNA *ptr, int value)
+{
+       RenderData *rd= (RenderData*)ptr->data;
+       rd->jp2_depth= value;
+       rna_SceneRenderData_jpeg2k_preset_update(rd);
+}
+
 static int rna_SceneRenderData_active_layer_index_get(PointerRNA *ptr)
 {
        RenderData *rd= (RenderData*)ptr->data;
@@ -1229,19 +1264,19 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 #ifdef WITH_OPENJPEG
        static EnumPropertyItem jp2_preset_items[] = {
                {0, "NO_PRESET", 0, "No Preset", ""},
-               {1, "R_JPEG2K_CINE_PRESET", 0, "Cinema 24fps 2048x1080", ""},
-               {2, "R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS", 0, "Cinema 48fps 2048x1080", ""},
-               {3, "R_JPEG2K_CINE_PRESET", 0, "Cinema 24fps 4096x2160", ""},
-               {4, "R_JPEG2K_CINE_PRESET", 0, "Cine-Scope 24fps 2048x858", ""},
-               {5, "R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS", 0, "Cine-Scope 48fps 2048x858", ""},
-               {6, "R_JPEG2K_CINE_PRESET", 0, "Cine-Flat 24fps 1998x1080", ""},
-               {7, "R_JPEG2K_CINE_PRESET|R_JPEG2K_CINE_48FPS", 0, "Cine-Flat 48fps 1998x1080", ""},
+               {1, "CINE_24FPS", 0, "Cinema 24fps 2048x1080", ""},
+               {2, "CINE_48FPS", 0, "Cinema 48fps 2048x1080", ""},
+               {3, "CINE_24FPS_4K", 0, "Cinema 24fps 4096x2160", ""},
+               {4, "CINE_SCOPE_48FPS", 0, "Cine-Scope 24fps 2048x858", ""},
+               {5, "CINE_SCOPE_48FPS", 0, "Cine-Scope 48fps 2048x858", ""},
+               {6, "CINE_FLAT_24FPS", 0, "Cine-Flat 24fps 1998x1080", ""},
+               {7, "CINE_FLAT_48FPS", 0, "Cine-Flat 48fps 1998x1080", ""},
                {0, NULL, 0, NULL, NULL}};
                
        static EnumPropertyItem jp2_depth_items[] = {
-               {0, "8", 0, "8", ""},
-               {R_JPEG2K_12BIT, "16", 0, "16", ""},
-               {R_JPEG2K_16BIT, "32", 0, "32", ""},
+               {8, "8", 0, "8", "8 bit color channels"},
+               {12, "12", 0, "12", "12 bit color channels"},
+               {16, "16", 0, "16", "16 bit color channels"},
                {0, NULL, 0, NULL, NULL}};
 #endif
 
@@ -1414,19 +1449,21 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 #ifdef WITH_OPENJPEG
        /* Jpeg 2000 */
 
-       prop= RNA_def_property(srna, "jpeg_preset", PROP_ENUM, PROP_NONE);
-       RNA_def_property_enum_bitflag_sdna(prop, NULL, "jp2_preset");
+       prop= RNA_def_property(srna, "jpeg2k_preset", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "jp2_preset");
        RNA_def_property_enum_items(prop, jp2_preset_items);
+       RNA_def_property_enum_funcs(prop, NULL, "rna_SceneRenderData_jpeg2k_preset_set", NULL);
        RNA_def_property_ui_text(prop, "Preset", "Use a DCI Standard preset for saving jpeg2000");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
-       prop= RNA_def_property(srna, "jpeg_depth", PROP_ENUM, PROP_NONE);
+       prop= RNA_def_property(srna, "jpeg2k_depth", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_bitflag_sdna(prop, NULL, "jp2_depth");
        RNA_def_property_enum_items(prop, jp2_depth_items);
+       RNA_def_property_enum_funcs(prop, NULL, "rna_SceneRenderData_jpeg2k_depth_set", NULL);
        RNA_def_property_ui_text(prop, "Depth", "Bit depth per channel");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
-       prop= RNA_def_property(srna, "jpeg_ycc", PROP_BOOLEAN, PROP_NONE);
+       prop= RNA_def_property(srna, "jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_JPEG2K_YCC);
        RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);