diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_action.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_animation.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_boid.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_pose.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_rna.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 55 |
14 files changed, 72 insertions, 48 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 4f4e5c0c22e..c6c5b54f989 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -242,6 +242,12 @@ if(WITH_MOD_OCEANSIM) endif() if(WITH_SDL) + if(WITH_SDL_DYNLOAD) + add_definitions(-DWITH_SDL_DYNLOAD) + list(APPEND INC + ../../../../extern/sdlew/include + ) + endif() add_definitions(-DWITH_SDL) endif() diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 30b7e41cdab..7ff671a0e9b 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -124,6 +124,9 @@ if env['WITH_BF_FFTW3']: defs.append('WITH_FFTW3') if env['WITH_BF_SDL']: + if env['WITH_BF_SDL_DYNLOAD']: + defs.append('WITH_SDL_DYNLOAD') + incs += ' #extern/sdlew/include' defs.append('WITH_SDL') if env['WITH_BF_OPENAL']: diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 806b9d0d5ad..e681552103b 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1630,9 +1630,10 @@ bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop) if (RNA_property_array_check(prop)) len = RNA_property_array_length(ptr, prop); - for (index = 0; index < len; index++) - if (rna_get_fcurve(ptr, prop, index, NULL, &driven)) + for (index = 0; index < len; index++) { + if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven)) return true; + } return false; } @@ -4959,7 +4960,7 @@ bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const cha if (prop) { int i; - bool cmp; + bool cmp = false; RNA_property_enum_items(C, ptr, prop, &item, NULL, &free); i = RNA_enum_from_identifier(item, enumname); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4cac5d413ea..8d7a05896a3 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -197,7 +197,7 @@ static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, bAction *act = (bAction *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&act->markers) - 1); + *max = max_ii(0, BLI_listbase_count(&act->markers) - 1); } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index f2881bf2541..12fa754e636 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -414,7 +414,7 @@ static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, i KeyingSet *ks = (KeyingSet *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&ks->paths) - 1); + *max = max_ii(0, BLI_listbase_count(&ks->paths) - 1); } static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr) @@ -445,7 +445,7 @@ static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *report /* if data is valid, call the API function for this */ if (keyingset) { ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method); - keyingset->active_path = BLI_countlist(&keyingset->paths); + keyingset->active_path = BLI_listbase_count(&keyingset->paths); } else { BKE_report(reports, RPT_ERROR, "Keying set path could not be added"); diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 6233649fb12..33048a7196b 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -169,7 +169,7 @@ static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min { BoidState *state = (BoidState *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&state->rules) - 1); + *max = max_ii(0, BLI_listbase_count(&state->rules) - 1); } static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr) @@ -235,7 +235,7 @@ static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int { BoidSettings *boids = (BoidSettings *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&boids->states) - 1); + *max = max_ii(0, BLI_listbase_count(&boids->states) - 1); } static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 4288bf2dddb..229cdaa6005 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -203,7 +203,7 @@ static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data; *min = 0; - *max = BLI_countlist(&canvas->surfaces) - 1; + *max = BLI_listbase_count(&canvas->surfaces) - 1; } /* uvlayer */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 690468a5278..8ebeeafbc58 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -583,7 +583,7 @@ static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min Object *ob = (Object *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&ob->defbase) - 1); + *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1); } void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index) @@ -736,7 +736,7 @@ static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int * { Object *ob = (Object *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&ob->particlesystem) - 1); + *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1); } static int rna_Object_active_particle_system_index_get(PointerRNA *ptr) @@ -941,6 +941,7 @@ static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str) static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Object_internal_update(bmain, scene, ptr); + WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL); } @@ -1240,7 +1241,7 @@ static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, i *min = 0; if (key) { - *max = BLI_countlist(&key->block) - 1; + *max = BLI_listbase_count(&key->block) - 1; if (*max < 0) *max = 0; } else { diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 1b926d77074..5c5f0c1ec36 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -892,7 +892,7 @@ static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *pt { ParticleSystem *psys = (ParticleSystem *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&psys->targets) - 1); + *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1); } static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr) @@ -1009,7 +1009,7 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min { ParticleSettings *part = (ParticleSettings *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&part->dupliweights) - 1); + *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1); } static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index f9d0e86183e..f72f97b1681 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -421,7 +421,7 @@ static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, in bPose *pose = (ob) ? ob->pose : NULL; *min = 0; - *max = pose ? max_ii(0, BLI_countlist(&pose->agroups) - 1) : 0; + *max = pose ? max_ii(0, BLI_listbase_count(&pose->agroups) - 1) : 0; } static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr) @@ -454,7 +454,7 @@ static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, in bPose *pose = (bPose *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&pose->agroups) - 1); + *max = max_ii(0, BLI_listbase_count(&pose->agroups) - 1); } #if 0 diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 8f2537105c1..4f51ec5468c 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -984,7 +984,7 @@ static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, Point /* optional, for faster lookups */ static int rna_BlenderRNA_structs_length(PointerRNA *ptr) { - return BLI_countlist(&((BlenderRNA *)ptr->data)->structs); + return BLI_listbase_count(&((BlenderRNA *)ptr->data)->structs); } static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr) { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 70ce87ab68b..519a52b04e2 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1063,7 +1063,7 @@ static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr) static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; - int num_layers = BLI_countlist(&rd->layers); + int num_layers = BLI_listbase_count(&rd->layers); rd->actlay = min_ff(value, num_layers - 1); } @@ -1073,7 +1073,7 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi RenderData *rd = (RenderData *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&rd->layers) - 1); + *max = max_ii(0, BLI_listbase_count(&rd->layers) - 1); } static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr) @@ -1228,7 +1228,7 @@ static char *rna_SceneRenderLayer_path(PointerRNA *ptr) static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { - return (BLI_countlist(&R_engines) > 1); + return (BLI_listbase_count(&R_engines) > 1); } static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) @@ -1485,7 +1485,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0); if (ks) { - sce->active_keyingset = BLI_countlist(&sce->keyingsets); + sce->active_keyingset = BLI_listbase_count(&sce->keyingsets); return ks; } else { @@ -1645,7 +1645,7 @@ static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, in FreestyleConfig *config = (FreestyleConfig *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&config->linesets) - 1); + *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1); } static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index b13bdedaffd..33c35313b38 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -178,7 +178,7 @@ static void rna_uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const c } static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, const char *text_ctxt, - int translate, int icon, int emboss) + int translate, int icon, int emboss, int icon_value) { wmOperatorType *ot; int flag; @@ -192,6 +192,10 @@ static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char * /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate); + if (icon_value && !icon) { + icon = icon_value; + } + flag = UI_ITEM_O_RETURN_PROPS; flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG; @@ -551,6 +555,10 @@ void RNA_api_ui_layout(StructRNA *srna) func = RNA_def_function(srna, "operator", "rna_uiItemO"); api_ui_item_op_common(func); RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, just the icon/text"); + parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED); + RNA_def_property_ui_text(parm, "Icon Value", + "Override automatic icon of the item " + "(use it e.g. with custom material icons returned by icon()...)"); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in, return when 'properties' is set to true"); RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index ab82c5abf86..ab5039df627 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -104,6 +104,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); @@ -510,37 +514,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 @@ -4443,18 +4448,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); @@ -4495,7 +4500,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", ""}, |