diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_userdef.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 146 |
1 files changed, 117 insertions, 29 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 1bad9570893..e60af76851e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -35,6 +35,8 @@ #include "BLI_utildefines.h" +#include "BKE_appdir.h" +#include "BKE_DerivedMesh.h" #include "BKE_sound.h" #include "BKE_addon.h" @@ -48,6 +50,7 @@ #include "WM_types.h" #include "BLF_translation.h" +#include "GPU_buffers.h" #ifdef WITH_CYCLES static EnumPropertyItem compute_device_type_items[] = { @@ -104,6 +107,10 @@ EnumPropertyItem navigation_mode_items[] = { #include "BKE_addon.h" +#ifdef WITH_SDL_DYNLOAD +# include "sdlew.h" +#endif + static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { WM_main_add_notifier(NC_WINDOW, NULL); @@ -137,6 +144,15 @@ static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene UI_reinit_font(); } +static void rna_userdef_vbo_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + Object *ob; + + for (ob = bmain->object.first; ob; ob = ob->id.next) { + GPU_drawobject_free(ob->derivedFinal); + } +} + static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; @@ -209,6 +225,14 @@ static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, Pointer rna_userdef_update(bmain, scene, ptr); } +static void rna_userdef_undo_steps_set(PointerRNA *ptr, int value) +{ + UserDef *userdef = (UserDef *)ptr->data; + + /* Do not allow 1 undo steps, useless and breaks undo/redo process (see T42531). */ + userdef->undosteps = (value == 1) ? 2 : value; +} + static void rna_userdef_select_mouse_set(PointerRNA *ptr, int value) { UserDef *userdef = (UserDef *)ptr->data; @@ -402,7 +426,7 @@ static void rna_userdef_pathcompare_remove(ReportList *reports, PointerRNA *path static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - BLI_temp_dir_init(U.tempdir); + BKE_tempdir_init(U.tempdir); } static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -502,37 +526,38 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) { -#ifdef WITH_JACK - int jack_supported = sound_is_jack_supported(); - - if (jack_supported) { - return audio_device_items; - } - else { - int index = 0; - int totitem = 0; - EnumPropertyItem *item = NULL; + int index = 0; + int totitem = 0; + EnumPropertyItem *item = NULL; - /* NONE */ - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); + /* NONE */ + RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); #ifdef WITH_SDL - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); +# ifdef WITH_SDL_DYNLOAD + if (sdlewInit() == SDLEW_SUCCESS) +# endif + { + RNA_enum_item_add(&item, &totitem, &audio_device_items[index]); + } + index++; #endif #ifdef WITH_OPENAL - RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); + RNA_enum_item_add(&item, &totitem, &audio_device_items[index++]); #endif - RNA_enum_item_end(&item, &totitem); - *r_free = true; - - return item; +#ifdef WITH_JACK + if (sound_is_jack_supported()) { + RNA_enum_item_add(&item, &totitem, &audio_device_items[index]); } -#else - (void)r_free; - return audio_device_items; + index++; #endif + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; } #ifdef WITH_INTERNATIONAL @@ -1018,6 +1043,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast"); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "widget_emboss", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "widget_emboss"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Widget Emboss", "Color of the 1px shadow line underlying widgets"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + /* axis */ prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "xaxis"); @@ -1457,6 +1488,26 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs } } +static void rna_def_userdef_theme_spaces_gpencil(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "gp_vertex", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Grease Pencil Vertex", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "gp_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Grease Pencil Vertex Select", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "gp_vertex_size", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 1, 10); + RNA_def_property_ui_text(prop, "Grease Pencil Vertex Size", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); +} + static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) { StructRNA *srna; @@ -1485,6 +1536,8 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Wire Edit", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + rna_def_userdef_theme_spaces_gpencil(srna); prop = RNA_def_property(srna, "lamp", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); @@ -1629,6 +1682,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Skin Root", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + prop = RNA_def_property(srna, "clipping_border_3d", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Clipping Border", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + rna_def_userdef_theme_spaces_paint_curves(srna); } @@ -2015,6 +2073,8 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna) rna_def_userdef_theme_spaces_main(srna); rna_def_userdef_theme_spaces_list_main(srna); + + rna_def_userdef_theme_spaces_gpencil(srna); prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "select"); @@ -2219,6 +2279,18 @@ static void rna_def_userdef_theme_space_time(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Current Frame", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "time_keyframe", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "time_keyframe"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Keyframe", "Base color for keyframe indicator lines"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "time_grease_pencil", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "time_gp_keyframe"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "Grease Pencil", "Color of Grease Pencil keyframes"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_image(BlenderRNA *brna) @@ -2234,8 +2306,10 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for the Image Editor"); rna_def_userdef_theme_spaces_main(srna); + rna_def_userdef_theme_spaces_gpencil(srna); rna_def_userdef_theme_spaces_vertex(srna); rna_def_userdef_theme_spaces_face(srna); + prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); @@ -2330,6 +2404,7 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings for the Sequence Editor"); rna_def_userdef_theme_spaces_main(srna); + rna_def_userdef_theme_spaces_gpencil(srna); prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); @@ -2741,6 +2816,8 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna) rna_def_userdef_theme_spaces_main(srna); rna_def_userdef_theme_spaces_list_main(srna); + + rna_def_userdef_theme_spaces_gpencil(srna); prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "marker_outline"); @@ -3259,7 +3336,12 @@ static void rna_def_userdef_view(BlenderRNA *brna) prop = RNA_def_property(srna, "use_quit_dialog", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_QUIT_PROMPT); RNA_def_property_ui_text(prop, "Prompt Quit", - "Asks for confirmation when quitting through the window close button"); + "Ask for confirmation when quitting through the window close button"); + + prop = RNA_def_property(srna, "use_gl_warn_support", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag2", USER_OPENGL_NO_WARN_SUPPORT); + RNA_def_property_ui_text(prop, "Warn On Deprecated OpenGL", + "Pop up a warning when an old OpenGL version is detected"); /* Toolbox click-hold delay */ prop = RNA_def_property(srna, "open_left_mouse_delay", PROP_INT, PROP_NONE); @@ -3458,7 +3540,8 @@ static void rna_def_userdef_edit(BlenderRNA *brna) /* Undo */ prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "undosteps"); - RNA_def_property_range(prop, 0, 64); + RNA_def_property_range(prop, 0, 256); + RNA_def_property_int_funcs(prop, NULL, "rna_userdef_undo_steps_set", NULL); RNA_def_property_ui_text(prop, "Undo Steps", "Number of undo steps available (smaller values conserve memory)"); prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE); @@ -3790,6 +3873,11 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Virtual Pixel Mode", "Modify the pixel size for hi-res devices"); RNA_def_property_update(prop, 0, "rna_userdef_virtual_pixel_update"); + prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_float_sdna(prop, NULL, "pixelsize"); + RNA_def_property_ui_text(prop, "Pixel Size", ""); + prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "font_path_ui"); RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font"); @@ -3931,7 +4019,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering"); /* this isn't essential but nice to check if VBO draws any differently */ - RNA_def_property_update(prop, NC_WINDOW, NULL); + RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_vbo_update"); prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter"); @@ -4428,18 +4516,18 @@ static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cpro RNA_def_property_srna(cprop, "Addons"); srna = RNA_def_struct(brna, "Addons", NULL); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); - RNA_def_struct_ui_text(srna, "User Addons", "Collection of addons"); + RNA_def_struct_ui_text(srna, "User Add-ons", "Collection of add-ons"); func = RNA_def_function(srna, "new", "rna_userdef_addon_new"); RNA_def_function_flag(func, FUNC_NO_SELF); - RNA_def_function_ui_description(func, "Add a new addon"); + RNA_def_function_ui_description(func, "Add a new add-on"); /* return type */ parm = RNA_def_pointer(func, "addon", "Addon", "", "Addon datablock"); RNA_def_function_return(func, parm); func = RNA_def_function(srna, "remove", "rna_userdef_addon_remove"); RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS); - RNA_def_function_ui_description(func, "Remove addon"); + RNA_def_function_ui_description(func, "Remove add-on"); parm = RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL | PROP_RNAPTR); RNA_def_property_clear_flag(parm, PROP_THICK_WRAP); @@ -4480,7 +4568,7 @@ void RNA_def_userdef(BlenderRNA *brna) {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""}, {USER_SECTION_EDIT, "EDITING", 0, "Editing", ""}, {USER_SECTION_INPUT, "INPUT", 0, "Input", ""}, - {USER_SECTION_ADDONS, "ADDONS", 0, "Addons", ""}, + {USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""}, {USER_SECTION_THEME, "THEMES", 0, "Themes", ""}, {USER_SECTION_FILE, "FILES", 0, "File", ""}, {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""}, |