Added Lossless Output option for h264 codec.
[blender.git] / source / blender / makesrna / intern / rna_scene.c
index a682c32..7ea0083 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "rna_internal.h"
 
+#include "DNA_brush_types.h"
 #include "DNA_group_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_particle_types.h"
@@ -136,7 +137,7 @@ EnumPropertyItem snap_element_items[] = {
 #endif
 
 #ifdef WITH_OPENEXR
-#  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_MULTI  {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, "OpenEXR 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
@@ -659,10 +660,10 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
                Scene *scene= ptr->id.data;
                RenderData *rd= &scene->r;
 #ifdef WITH_FFMPEG
-               ffmpeg_verify_image_type(rd);
+               ffmpeg_verify_image_type(rd, imf);
 #endif
 #ifdef WITH_QUICKTIME
-               quicktime_verify_image_type(rd);
+               quicktime_verify_image_type(rd, imf);
 #endif
                (void)rd;
        }
@@ -868,6 +869,19 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf
 #endif
 #endif
 
+static void rna_RenderSettings_ffmpegsettings_lossless_output_set(PointerRNA *ptr, int value)
+{
+       RenderData *rd = (RenderData*)ptr->data;
+
+       if (value)
+               rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
+       else
+               rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
+#ifdef WITH_FFMPEG
+       ffmpeg_verify_lossless_format(rd, &rd->im_format);
+#endif
+}
+
 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
 {
        RenderData *rd= (RenderData*)ptr->data;
@@ -999,7 +1013,7 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSE
                                WM_main_add_notifier(NC_NODE|NA_EDITED, node);
                                
                                if (node->type == CMP_NODE_IMAGE)
-                                       BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_RELOAD);
+                                       BKE_image_signal((Image *)node->id, NULL, IMA_SIGNAL_FREE);
                        }
                }
        }
@@ -1213,6 +1227,13 @@ static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
                G.fileflags &= ~G_FILE_AUTOPLAY;
 }
 
+static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
+{
+       GameData *gm = (GameData*)ptr->data;
+
+       if(ISKEYBOARD(value))
+               gm->exitkey=value;
+}
 
 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
 {
@@ -1267,8 +1288,6 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons
        }
 }
 
-
-
 /* note: without this, when Multi-Paint is activated/deactivated, the colors
  * will not change right away when multiple bones are selected, this function
  * is not for general use and only for the few cases where changing scene
@@ -1606,20 +1625,66 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-       /* Sculpt/Paint Unified Size and Strength */
+       /* Unified Paint Settings */
+       prop= RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NEVER_NULL);
+       RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
+       RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
+}
 
-       prop= RNA_def_property(srna, "sculpt_paint_use_unified_size", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_SIZE);
-       RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Radius",
-                                "Instead of per brush radius, the radius is shared across brushes");
+static void rna_def_unified_paint_settings(BlenderRNA  *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
 
-       prop= RNA_def_property(srna, "sculpt_paint_use_unified_strength", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "sculpt_paint_settings", SCULPT_PAINT_USE_UNIFIED_ALPHA);
-       RNA_def_property_ui_text(prop, "Sculpt/Paint Use Unified Strength",
-                                "Instead of per brush strength, the strength is shared across brushes");
+       srna= RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
+       RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
+
+       /* high-level flags to enable or disable unified paint settings */
+       prop= RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
+       RNA_def_property_ui_text(prop, "Use Unified Radius",
+                                "Instead of per-brush radius, the radius is shared across brushes");
+
+       prop= RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
+       RNA_def_property_ui_text(prop, "Use Unified Strength",
+                                "Instead of per-brush strength, the strength is shared across brushes");
+
+       /* unified paint settings that override the equivalent settings
+          from the active brush */
+       prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+       RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
+       RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
+       RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+
+       prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+       RNA_def_property_range(prop, 0.001, FLT_MAX);
+       RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
+       RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
+
+       prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+       RNA_def_property_float_sdna(prop, NULL, "alpha");
+       RNA_def_property_float_default(prop, 0.5f);
+       RNA_def_property_range(prop, 0.0f, 10.0f);
+       RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+       RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
+
+       prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
+       RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+       RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
+
+       prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
+       RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+       RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
+
+       prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
+       RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
 }
 
-
 static void rna_def_unit_settings(BlenderRNA  *brna)
 {
        StructRNA *srna;
@@ -2029,6 +2094,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
        StructRNA *srna;
        PropertyRNA *prop;
 
+       static EnumPropertyItem aasamples_items[]  ={
+               {0, "SAMPLES_0", 0, "Off", ""},
+               {2, "SAMPLES_2", 0, "2x", ""},
+               {4, "SAMPLES_4", 0, "4x", ""},
+               {8, "SAMPLES_8", 0, "8x", ""},
+               {16, "SAMPLES_16", 0, "16x", ""},
+               {0, NULL, 0, NULL, NULL}};
+
        static EnumPropertyItem framing_types_items[] ={
                {SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
                                       "Show the entire viewport in the display window, using bar horizontally or vertically"},
@@ -2098,11 +2171,23 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
        RNA_def_property_update(prop, NC_SCENE, NULL);
        
+       prop= RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "aasamples");
+       RNA_def_property_enum_items(prop, aasamples_items);
+       RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
+       
        prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
        RNA_def_property_int_sdna(prop, NULL, "depth");
        RNA_def_property_range(prop, 8, 32);
        RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
        RNA_def_property_update(prop, NC_SCENE, NULL);
+
+       prop= RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "exitkey");
+       RNA_def_property_enum_items(prop, event_type_items);
+       RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
+       RNA_def_property_ui_text(prop, "Exit Key",  "The key that exits the Game Engine");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
        
        // Do we need it here ? (since we already have it in World
        prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
@@ -2112,10 +2197,15 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
        RNA_def_property_update(prop, NC_SCENE, NULL);
        
        prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "fullscreen", 1.0);
+       RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
        RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
        RNA_def_property_update(prop, NC_SCENE, NULL);
 
+       prop= RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
+       RNA_def_property_ui_text(prop, "Desktop", "Uses the current desktop resultion in fullscreen mode");
+       RNA_def_property_update(prop, NC_SCENE, NULL);
+
        /* Framing */
        prop= RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "framing.type");
@@ -2919,7 +3009,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "ffcodecdata.flags", FFMPEG_AUTOSPLIT_OUTPUT);
        RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-       
+
+       prop= RNA_def_property(srna, "ffmpeg_lossless_output", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "ffcodecdata.flags", FFMPEG_LOSSLESS_OUTPUT);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderSettings_ffmpegsettings_lossless_output_set");
+       RNA_def_property_ui_text(prop, "Lossless Output", "Use losslecc output for video streams");
+       RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
        /* FFMPEG Audio*/
        prop= RNA_def_property(srna, "ffmpeg_audio_codec", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffcodecdata.audio_codec");
@@ -3214,7 +3310,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT);
        RNA_def_property_ui_text(prop, "Color Management", "Use linear workflow - gamma corrected imaging pipeline");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_RenderSettings_color_management_update");
-
+       
+       prop= RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT_PREDIVIDE);
+       RNA_def_property_ui_text(prop, "Color Unpremultipy", "For premultiplied alpha render output, do color space conversion on colors without alpha, to avoid fringing on light backgrounds");
+       RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
        prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
@@ -3422,14 +3522,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
        RNA_def_property_array(prop, 4);
        RNA_def_property_range(prop,0.0,1.0);
-       RNA_def_property_ui_text(prop, "Stamp Text Color", "Color to use for stamp text");
+       RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
        
        prop= RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
        RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
        RNA_def_property_array(prop, 4);
        RNA_def_property_range(prop,0.0,1.0);
-       RNA_def_property_ui_text(prop, "Stamp Background", "Color to use behind stamp text");
+       RNA_def_property_ui_text(prop, "Background", "Color to use behind stamp text");
        RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
        /* sequencer draw options */
@@ -4012,6 +4112,7 @@ void RNA_def_scene(BlenderRNA *brna)
 
        /* Nestled Data  */
        rna_def_tool_settings(brna);
+       rna_def_unified_paint_settings(brna);
        rna_def_unit_settings(brna);
        rna_def_scene_image_format_data(brna);
        rna_def_scene_render_data(brna);