diff options
Diffstat (limited to 'source/blender/makesrna')
50 files changed, 857 insertions, 278 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 061133a9fcf..b1a631cc610 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -154,6 +154,8 @@ extern EnumPropertyItem viewport_shade_items[]; extern EnumPropertyItem navigation_mode_items[]; +extern EnumPropertyItem file_sort_items[]; + int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo); int rna_node_tree_idname_to_enum(const char *idname); struct bNodeTreeType *rna_node_tree_type_from_enum(int value); diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 089fbe11307..1ed4982cf94 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -45,6 +45,7 @@ incs = [ '../blenfont', '../blenkernel', '../blenlib', + '../blentranslation', '../bmesh', '../depsgraph', '../editors/include', @@ -59,7 +60,8 @@ incs = [ ] incs = ' '.join(incs) -defs = env['BF_GL_DEFINITIONS'] +defs = [] +defs += env['BF_GL_DEFINITIONS'] if env['WITH_BF_SMOKE']: defs.append('WITH_SMOKE') @@ -146,6 +148,9 @@ if env['WITH_BF_OPENSUBDIV']: incs += ' #/intern/opensubdiv' defs.append('WITH_OPENSUBDIV') +if env['WITH_BF_AUDASPACE']: + defs.append('WITH_AUDASPACE') + if env['OURPLATFORM'] == 'linux': cflags='-pthread' diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 3ebce1a7af0..987b594421f 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -315,10 +315,11 @@ endif() blender_include_dirs( . .. + ../../blenfont ../../blenkernel ../../blenlib ../../bmesh - ../../blenfont + ../../blentranslation ../../depsgraph ../../gpu ../../imbuf @@ -349,7 +350,7 @@ target_link_libraries(makesrna bf_dna_blenlib) # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes add_custom_command( OUTPUT ${GENSRC} - COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesrna ${CMAKE_CURRENT_BINARY_DIR}/ + COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/ DEPENDS makesrna ) diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index 0a9f9eec08c..8307e4cec6f 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -53,7 +53,8 @@ makesrna_tool = env.Clone() rna = env.Clone() makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ') -defs = env['BF_GL_DEFINITIONS'] +defs = [] +defs += env['BF_GL_DEFINITIONS'] incs = [ '#/intern/guardedalloc', @@ -64,6 +65,7 @@ incs = [ '../../blenfont', '../../blenkernel', '../../blenlib', + '../../blentranslation', '../../bmesh', '../../depsgraph', '../../editors/include', @@ -161,6 +163,9 @@ if env['WITH_BF_OPENSUBDIV']: defs.append('WITH_OPENSUBDIV') incs += ' #intern/opensubdiv' +if env['WITH_BF_AUDASPACE']: + defs.append('WITH_AUDASPACE') + if env['OURPLATFORM'] == 'linux': cflags='-pthread' diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 0f00dd7a586..e887397f4d7 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1079,11 +1079,18 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA fprintf(f, " return %s(ptr);\n", manualfunc); } else { - rna_print_data_get(f, dp); + if (dp->dnaarraylength <= 1 || dp->dnalengthname) + rna_print_data_get(f, dp); + + if (dp->dnaarraylength > 1) + fprintf(f, " return "); + else + fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname); + if (dp->dnalengthname) - fprintf(f, " return (data->%s == NULL) ? 0 : data->%s;\n", dp->dnaname, dp->dnalengthname); + fprintf(f, "data->%s;\n", dp->dnalengthname); else - fprintf(f, " return (data->%s == NULL) ? 0 : %d;\n", dp->dnaname, dp->dnalengthfixed); + fprintf(f, "%d;\n", dp->dnalengthfixed); } fprintf(f, "}\n\n"); } diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index f3bd5fc5cef..f0119c7d665 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -66,7 +66,7 @@ EnumPropertyItem id_type_items[] = { {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""}, {ID_MB, "META", ICON_META_DATA, "MetaBall", ""}, {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""}, - {ID_MC, "MOVIECLIP", ICON_CLIP, "MovieClip", ""}, + {ID_MC, "MOVIECLIP", ICON_CLIP, "MovieClip", ""}, {ID_NT, "NODETREE", ICON_NODETREE, "NodeTree", ""}, {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""}, {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""}, @@ -74,12 +74,12 @@ EnumPropertyItem id_type_items[] = { {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""}, {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""}, {ID_SCR, "SCREEN", ICON_SPLITSCREEN, "Screen", ""}, - {ID_SO, "SOUND", ICON_PLAY_AUDIO, "Sound", ""}, + {ID_SO, "SOUND", ICON_PLAY_AUDIO, "Sound", ""}, {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""}, {ID_TXT, "TEXT", ICON_TEXT, "Text", ""}, {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""}, {ID_WM, "WINDOWMANAGER", ICON_FULLSCREEN, "Window Manager", ""}, - {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""}, + {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""}, {0, NULL, 0, NULL, NULL} }; @@ -126,7 +126,7 @@ static int rna_ID_name_editable(PointerRNA *ptr) return false; } - return true; + return PROP_EDITABLE; } short RNA_type_to_ID_code(StructRNA *type) @@ -472,18 +472,19 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); } - BKE_previewimg_ensure(prv_img, size); + BKE_previewimg_clear_single(prv_img, size); if (values[0] && values[1]) { prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect"); - } - prv_img->w[size] = values[0]; - prv_img->h[size] = values[1]; + prv_img->w[size] = values[0]; + prv_img->h[size] = values[1]; + } prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED); } + static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION], enum eIconSizes size) { ID *id = ptr->id.data; @@ -527,6 +528,70 @@ static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum prv_img->flag[size] |= PRV_USER_EDITED; } + +static int rna_ImagePreview_pixels_float_get_length( + PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION], enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + BLI_assert(sizeof(unsigned int) == 4); + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + length[0] = prv_img->w[size] * prv_img->h[size] * 4; + + return length[0]; +} + +static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + unsigned char *data = (unsigned char *)prv_img->rect[size]; + const size_t len = prv_img->w[size] * prv_img->h[size] * 4; + size_t i; + + BLI_assert(sizeof(unsigned int) == 4); + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + BKE_previewimg_ensure(prv_img, size); + + for (i = 0; i < len; i++) { + values[i] = data[i] * (1.0f / 255.0f); + } +} + +static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, const float *values, enum eIconSizes size) +{ + ID *id = ptr->id.data; + PreviewImage *prv_img = (PreviewImage *)ptr->data; + + unsigned char *data = (unsigned char *)prv_img->rect[size]; + const size_t len = prv_img->w[size] * prv_img->h[size] * 4; + size_t i; + + BLI_assert(sizeof(unsigned int) == 4); + + if (id != NULL) { + BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); + } + + for (i = 0; i < len; i++) { + data[i] = FTOCHAR(values[i]); + } + prv_img->flag[size] |= PRV_USER_EDITED; +} + + static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, int value) { rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW); @@ -557,6 +622,22 @@ static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW); } +static int rna_ImagePreview_image_pixels_float_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values) +{ + rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW); +} + +static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values) +{ + rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW); +} + + static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, int value) { rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON); @@ -587,6 +668,22 @@ static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values) rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON); } +static int rna_ImagePreview_icon_pixels_float_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values) +{ + rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON); +} + +static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values) +{ + rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON); +} + + static int rna_ImagePreview_icon_id_get(PointerRNA *ptr) { /* Using a callback here allows us to only generate icon matching that preview when icon_id is requested. */ @@ -600,6 +697,14 @@ static void rna_ImagePreview_icon_reload(PreviewImage *prv) } } +static PointerRNA rna_IDPreview_get(PointerRNA *ptr) +{ + ID *id = (ID *)ptr->data; + PreviewImage *prv_img = BKE_previewimg_id_ensure(id); + + return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img); +} + #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -746,6 +851,15 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length"); RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL); + prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_multi_array(prop, 1, NULL); + RNA_def_property_ui_text(prop, "Float Image Pixels", + "Image pixels components, as floats (RGBA concatenated values)"); + RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length"); + RNA_def_property_float_funcs(prop, "rna_ImagePreview_image_pixels_float_get", + "rna_ImagePreview_image_pixels_float_set", NULL); + prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED); @@ -765,6 +879,14 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length"); RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL); + prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_multi_array(prop, 1, NULL); + RNA_def_property_ui_text(prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)"); + RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length"); + RNA_def_property_float_funcs(prop, "rna_ImagePreview_icon_pixels_float_get", + "rna_ImagePreview_icon_pixels_float_set", NULL); + prop = RNA_def_int(srna, "icon_id", 0, INT_MIN, INT_MAX, "Icon ID", "Unique integer identifying this preview as an icon (zero means invalid)", INT_MIN, INT_MAX); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -840,6 +962,11 @@ static void rna_def_ID(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from"); + prop = RNA_def_pointer(srna, "preview", "ImagePreview", "Preview", + "Preview image and icon of this datablock (None if not supported for this type of data)"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL); + /* functions */ func = RNA_def_function(srna, "copy", "rna_ID_copy"); RNA_def_function_ui_description(func, "Create a copy of this datablock (not supported for all datablocks)"); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 7b3049228e4..b41568d0aba 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -43,7 +43,7 @@ #include "BLI_math.h" #include "BLF_api.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_animsys.h" #include "BKE_context.h" @@ -1256,9 +1256,9 @@ static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { int i; - /* Note: Only do those tests once, and then use BLF_pgettext. */ - bool do_iface = BLF_translate_iface(); - bool do_tooltip = BLF_translate_tooltips(); + /* Note: Only do those tests once, and then use BLT_pgettext. */ + bool do_iface = BLT_translate_iface(); + bool do_tooltip = BLT_translate_tooltips(); EnumPropertyItem *nitem; if (!(do_iface || do_tooltip)) @@ -1289,10 +1289,10 @@ static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item for (i = 0; nitem[i].identifier; i++) { if (nitem[i].name && do_iface) { - nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name); + nitem[i].name = BLT_pgettext(prop->translation_context, nitem[i].name); } if (nitem[i].description && do_tooltip) { - nitem[i].description = BLF_pgettext(NULL, nitem[i].description); + nitem[i].description = BLT_pgettext(NULL, nitem[i].description); } } @@ -1505,8 +1505,8 @@ bool RNA_property_enum_name_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA if (result) { if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { - if (BLF_translate_iface()) { - *name = BLF_pgettext(prop->translation_context, *name); + if (BLT_translate_iface()) { + *name = BLT_pgettext(prop->translation_context, *name); } } } @@ -1570,7 +1570,9 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop) prop = rna_ensure_property(prop); flag = prop->editable ? prop->editable(ptr) : prop->flag; - return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION)); + return ((flag & PROP_EDITABLE) && + (flag & PROP_REGISTER) == 0 && + (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION))); } bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop) @@ -4720,6 +4722,7 @@ char *RNA_path_full_struct_py(struct PointerRNA *ptr) char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) { char *id_path; + const char *data_delim; char *data_path; char *ret; @@ -4733,13 +4736,15 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index) data_path = RNA_path_from_ID_to_property(ptr, prop); + data_delim = (data_path && data_path[0] == '[') ? "" : "."; + if ((index == -1) || (RNA_property_array_check(prop) == false)) { - ret = BLI_sprintfN("%s.%s", - id_path, data_path); + ret = BLI_sprintfN("%s%s%s", + id_path, data_delim, data_path); } else { - ret = BLI_sprintfN("%s.%s[%d]", - id_path, data_path, index); + ret = BLI_sprintfN("%s%s%s[%d]", + id_path, data_delim, data_path, index); } MEM_freeN(id_path); if (data_path) { diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 424e2004749..b8a490ea904 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -650,13 +650,14 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "TimelineMarker"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE | PROP_LIB_EXCEPTION); RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get", "rna_Action_active_pose_marker_set", NULL, NULL); RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this action"); prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "active_marker"); + RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get", "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range"); RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker"); @@ -688,6 +689,7 @@ static void rna_def_action(BlenderRNA *brna) prop = RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "markers", NULL); RNA_def_property_struct_type(prop, "TimelineMarker"); + RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); /* T45689 - so that the list isn't greyed out; adding/removing is still banned though */ RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this action, for labeling poses"); rna_def_action_pose_markers(brna, prop); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index 83a6d728d80..b425a454d33 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -35,7 +35,7 @@ #include "BLI_utildefines.h" #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_access.h" @@ -999,13 +999,13 @@ static void rna_def_sound_actuator(BlenderRNA *brna) RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2); RNA_def_property_range(prop, 0.0, 2.0); RNA_def_property_ui_text(prop, "Volume", "Initial volume of the sound"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_LOGIC, NULL); prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_range(prop, -12.0, 12.0, 1, 2); RNA_def_property_ui_text(prop, "Pitch", "Pitch of the sound"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_LOGIC, NULL); /* floats - 3D Parameters */ @@ -1706,6 +1706,7 @@ static void rna_def_game_actuator(BlenderRNA *brna) {ACT_GAME_QUIT, "QUIT", 0, "Quit Game", ""}, {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""}, {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""}, + {ACT_GAME_SCREENSHOT, "SCREENSHOT", 0, "Screenshot", ""}, {0, NULL, 0, NULL, NULL} }; @@ -1722,8 +1723,8 @@ static void rna_def_game_actuator(BlenderRNA *brna) /* ACT_GAME_LOAD */ prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH); RNA_def_property_ui_text(prop, "File", - "Load this blend file, use the \"//\" prefix for a path relative to the current " - "blend file"); + "The file to use, depending on the mode (e.g. the blend file to load or a destination " + "for saving a screenshot) - use the \"//\" prefix for a relative path"); RNA_def_property_update(prop, NC_LOGIC, NULL); /*XXX to do: an operator that calls file_browse with relative_path on and blender filtering active */ } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index ac30c615438..165c969ebc2 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -97,7 +97,7 @@ static int rna_AnimData_action_editable(PointerRNA *ptr) if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) return 0; else - return 1; + return PROP_EDITABLE; } static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) @@ -381,7 +381,7 @@ static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr) KeyingSet *ks = (KeyingSet *)ptr->data; /* only editable if there are some paths to change to */ - return (BLI_listbase_is_empty(&ks->paths) == false); + return (BLI_listbase_is_empty(&ks->paths) == false) ? PROP_EDITABLE : 0; } static PointerRNA rna_KeyingSet_active_ksPath_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 93e5ceaa229..3e41ea4134c 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -746,7 +746,7 @@ static void rna_def_edit_bone(BlenderRNA *brna) prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "roll"); - RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 0.1, 2); + RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2); RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update"); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 2c69331f50a..93cbd5fa246 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -510,7 +510,7 @@ static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, Brush *me = (Brush *)(ptr->data); switch (mode) { - case PAINT_SCULPT: + case ePaintSculpt: switch (me->sculpt_tool) { case SCULPT_TOOL_DRAW: case SCULPT_TOOL_CREASE: @@ -550,8 +550,8 @@ static EnumPropertyItem *rna_Brush_direction_itemf(bContext *C, PointerRNA *ptr, } break; - case PAINT_TEXTURE_2D: - case PAINT_TEXTURE_PROJECTIVE: + case ePaintTexture2D: + case ePaintTextureProjective: switch (me->imagepaint_tool) { case PAINT_TOOL_SOFTEN: return prop_soften_sharpen_items; @@ -581,9 +581,9 @@ static EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C, PointerRNA *UNUSED( }; switch (mode) { - case PAINT_SCULPT: - case PAINT_TEXTURE_2D: - case PAINT_TEXTURE_PROJECTIVE: + case ePaintSculpt: + case ePaintTexture2D: + case ePaintTextureProjective: return sculpt_stroke_method_items; default: diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index abc489bb9b0..860ed5e49ab 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -28,7 +28,7 @@ #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "DNA_action_types.h" #include "DNA_constraint_types.h" @@ -412,6 +412,7 @@ static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA va if (ob) { if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) { data->camera = ob; + id_lib_extern((ID *)ob); } } else { @@ -428,6 +429,7 @@ static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerR if (ob) { if (ob->type == OB_MESH && ob != (Object *)ptr->id.data) { data->depth_ob = ob; + id_lib_extern((ID *)ob); } } else { @@ -457,6 +459,7 @@ static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA v if (ob) { if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) { data->camera = ob; + id_lib_extern((ID *)ob); } } else { diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c index 605e28653f9..1a0f3c30b03 100644 --- a/source/blender/makesrna/intern/rna_controller.c +++ b/source/blender/makesrna/intern/rna_controller.c @@ -31,7 +31,7 @@ #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_enum_types.h" diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index fc028a46b78..65175e37518 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -34,7 +34,7 @@ #include "BLI_utildefines.h" #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_font.h" @@ -385,6 +385,7 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value) /* set as bevobj, there could be infinity loop in displist calculation */ if (ob->type == OB_CURVE && ob->data != cu) { cu->bevobj = ob; + id_lib_extern((ID *)ob); } } else { @@ -427,6 +428,7 @@ static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value) /* set as bevobj, there could be infinity loop in displist calculation */ if (ob->type == OB_CURVE && ob->data != cu) { cu->taperobj = ob; + id_lib_extern((ID *)ob); } } else { @@ -747,11 +749,12 @@ static int rna_Curve_is_editmode_get(PointerRNA *ptr) #else +static const float tilt_limit = DEG2RADF(21600.0f); + static void rna_def_bpoint(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - const float tilt_limit = DEG2RADF(21600.0f); srna = RNA_def_struct(brna, "SplinePoint", NULL); RNA_def_struct_sdna(srna, "BPoint"); @@ -785,7 +788,7 @@ static void rna_def_bpoint(BlenderRNA *brna) prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "alfa"); RNA_def_property_range(prop, -tilt_limit, tilt_limit); - RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 0.1, 3); + RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3); RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); @@ -872,7 +875,8 @@ static void rna_def_beztriple(BlenderRNA *brna) /* Number values */ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "alfa"); - /*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/ + RNA_def_property_range(prop, -tilt_limit, tilt_limit); + RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3); RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index a239bf3ae4c..3b01305110c 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -42,7 +42,7 @@ #include "BLI_listbase.h" #include "BLI_ghash.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" @@ -736,7 +736,7 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */ srna->description = ""; /* may be overwritten later RNA_def_struct_translation_context */ - srna->translation_context = BLF_I18NCONTEXT_DEFAULT_BPYRNA; + srna->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA; srna->flag |= STRUCT_UNDO; if (!srnafrom) srna->icon = ICON_DOT; @@ -984,7 +984,7 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon) void RNA_def_struct_translation_context(StructRNA *srna, const char *context) { - srna->translation_context = context ? context : BLF_I18NCONTEXT_DEFAULT_BPYRNA; + srna->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA; } /* Property Definition */ @@ -1113,7 +1113,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier prop->subtype = subtype; prop->name = identifier; prop->description = ""; - prop->translation_context = BLF_I18NCONTEXT_DEFAULT_BPYRNA; + prop->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA; /* a priori not raw editable */ prop->rawtype = -1; @@ -1314,8 +1314,10 @@ void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, bool consecutive) /** * The values hare are a little confusing: * - * \param step For floats this is (step / 100), why /100? - nobody knows. - * for int's, whole values are used. + * \param step: Used as the value to increase/decrease when clicking on number buttons, + * \as well as scaling mouse input for click-dragging number buttons. + * For floats this is (step * UI_PRECISION_FLOAT_SCALE), why? - nobody knows. + * For ints, whole values are used. * * \param precision The number of zeros to show * (as a whole number - common range is 1 - 6), see PRECISION_FLOAT_MAX @@ -2106,7 +2108,7 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, void RNA_def_property_translation_context(PropertyRNA *prop, const char *context) { - prop->translation_context = context ? context : BLF_I18NCONTEXT_DEFAULT_BPYRNA; + prop->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA; } /* Functions */ @@ -2857,7 +2859,7 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *iden ASSERT_SOFT_HARD_LIMITS; - prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len != 0) ? PROP_EULER : PROP_ANGLE); + prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len >= 3) ? PROP_EULER : PROP_ANGLE); if (len != 0) { RNA_def_property_array(prop, len); if (default_value) RNA_def_property_float_array_default(prop, default_value); @@ -2868,7 +2870,7 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *iden } if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax); RNA_def_property_ui_text(prop, ui_name, ui_description); - RNA_def_property_ui_range(prop, softmin, softmax, 1, 3); + RNA_def_property_ui_range(prop, softmin, softmax, 10, 3); return prop; } diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index 01feb3cb748..16e0f17eac5 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -343,12 +343,12 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna) prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "animStart"); - RNA_def_property_range(prop, 0, 100); + RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "Start Time", "Simulation time of the first blender frame (in seconds)"); prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "animEnd"); - RNA_def_property_range(prop, 0, 100); + RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_text(prop, "End Time", "Simulation time of the last blender frame (in seconds)"); prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); @@ -627,12 +627,12 @@ static void rna_def_fluidsim_control(BlenderRNA *brna) prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "cpsTimeStart"); - RNA_def_property_range(prop, 0.0, 100.0); + RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_text(prop, "Start Time", "Time when the control particles are activated"); prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "cpsTimeEnd"); - RNA_def_property_range(prop, 0.0, 100.0); + RNA_def_property_range(prop, 0.0, FLT_MAX); RNA_def_property_ui_text(prop, "End Time", "Time when the control particles are deactivated"); prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 7d7df0f91a7..80a52a0a3d1 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -33,7 +33,7 @@ #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_access.h" #include "RNA_define.h" @@ -73,7 +73,7 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) if (gpl->flag & GP_LAYER_LOCKED) return 0; else - return 1; + return PROP_EDITABLE; } static void rna_GPencilLayer_line_width_range(PointerRNA *ptr, int *min, int *max, diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 0d0b440ec08..64b4d17b17d 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -78,6 +78,16 @@ static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), } } +static int rna_Image_is_stereo_3d_get(PointerRNA *ptr) +{ + return BKE_image_is_stereo((Image *)ptr->data); +} + +static int rna_Image_is_multiview_get(PointerRNA *ptr) +{ + return BKE_image_is_multiview((Image *)ptr->data); +} + static int rna_Image_dirty_get(PointerRNA *ptr) { return BKE_image_is_dirty((Image *)ptr->data); @@ -539,6 +549,11 @@ static void rna_def_imageuser(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image"); + prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "pass"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ + RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image"); + prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */ @@ -561,9 +576,9 @@ static void rna_def_image_packed_files(BlenderRNA *brna) prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "filepath"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_struct_name_property(srna, prop); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + RNA_api_image_packed_file(srna); } static void rna_def_render_slot(BlenderRNA *brna) @@ -711,12 +726,12 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update"); prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_IS_STEREO); + RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL); RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_IS_MULTIVIEW); + RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL); RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index f187a0e1804..1efa41d1b00 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -63,6 +63,14 @@ #include "MEM_guardedalloc.h" +static void rna_ImagePackedFile_save(ImagePackedFile *imapf, ReportList *reports) +{ + if (writePackedFile(reports, imapf->filepath, imapf->packedfile, 0) != RET_OK) { + BKE_reportf(reports, RPT_ERROR, "Image could not save packed file to '%s'", + imapf->filepath); + } +} + static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports, const char *path, Scene *scene) { ImBuf *ibuf; @@ -115,17 +123,10 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r BLI_strncpy(filename, image->name, sizeof(filename)); BLI_path_abs(filename, ID_BLEND_PATH(bmain, &image->id)); - if (BKE_image_has_packedfile(image)) { - ImagePackedFile *imapf; + /* note, we purposefully ignore packed files here, + * developers need to explicitly write them via 'packed_files' */ - for (imapf = image->packedfiles.first; imapf; imapf = imapf->next) { - if (writePackedFile(reports, imapf->filepath, imapf->packedfile, 0) != RET_OK) { - BKE_reportf(reports, RPT_ERROR, "Image '%s' could not save packed file to '%s'", - image->id.name + 2, imapf->filepath); - } - } - } - else if (IMB_saveiff(ibuf, filename, ibuf->flags)) { + if (IMB_saveiff(ibuf, filename, ibuf->flags)) { image->type = IMA_TYPE_IMAGE; if (image->source == IMA_SRC_GENERATED) @@ -295,6 +296,15 @@ static void rna_Image_buffers_free(Image *image) #else +void RNA_api_image_packed_file(StructRNA *srna) +{ + FunctionRNA *func; + + func = RNA_def_function(srna, "save", "rna_ImagePackedFile_save"); + RNA_def_function_ui_description(func, "Save the packed file to its filepath"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); +} + void RNA_api_image(StructRNA *srna) { FunctionRNA *func; diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index eab14be9085..72cd2ce55b8 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -260,6 +260,7 @@ void RNA_api_camera(StructRNA *srna); void RNA_api_curve(StructRNA *srna); void RNA_api_fcurves(StructRNA *srna); void RNA_api_drivers(StructRNA *srna); +void RNA_api_image_packed_file(struct StructRNA *srna); void RNA_api_image(struct StructRNA *srna); void RNA_api_lattice(struct StructRNA *srna); void RNA_api_operator(struct StructRNA *srna); diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 04cba835ae2..b567e0f00f3 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -35,7 +35,7 @@ #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_access.h" #include "RNA_define.h" @@ -83,7 +83,7 @@ static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value) /* make sure the name is truly unique */ if (ptr->id.data) { Key *key = rna_ShapeKey_find_key(ptr->id.data); - BLI_uniquename(&key->block, kb, CTX_DATA_(BLF_I18NCONTEXT_ID_SHAPEKEY, "Key"), '.', + BLI_uniquename(&key->block, kb, CTX_DATA_(BLT_I18NCONTEXT_ID_SHAPEKEY, "Key"), '.', offsetof(KeyBlock, name), sizeof(kb->name)); } @@ -156,6 +156,112 @@ static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value) #undef SHAPEKEY_SLIDER_TOL +/* ***** Normals accessors for shapekeys. ***** */ +/* Note: with this we may recompute several times the same data, should we want to access verts, then polys, then loops + * normals... However, such case looks rather unlikely - and not worth adding some kind of caching in KeyBlocks. + */ + +static Mesh *rna_KeyBlock_normals_get_mesh(PointerRNA *ptr, ID *id) +{ + Key *key = rna_ShapeKey_find_key((id == NULL && ptr != NULL) ? ptr->id.data : id); + id = key ? key->from : NULL; + + if (id != NULL) { + switch (GS(id->name)) { + case ID_ME: + return (Mesh *)id; + case ID_OB: + { + Object *ob = (Object *)id; + if (ob->type == OB_MESH) { + return ob->data; + } + } + } + } + + return NULL; +} + +static int rna_KeyBlock_normals_vert_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL); + + length[0] = me ? me->totvert : 0; + length[1] = 3; + + return (length[0] * length[1]); +} + +static void rna_KeyBlock_normals_vert_calc(ID *id, KeyBlock *data, int *normals_len, float **normals) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id); + + *normals_len = (me ? me->totvert : 0) * 3; + + if (ELEM(NULL, me, data) || (me->totvert == 0)) { + *normals = NULL; + return; + } + + *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__); + + BKE_keyblock_mesh_calc_normals(data, me, (float (*)[3])(*normals), NULL, NULL); +} + +static int rna_KeyBlock_normals_poly_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL); + + length[0] = me ? me->totpoly : 0; + length[1] = 3; + + return (length[0] * length[1]); +} + +static void rna_KeyBlock_normals_poly_calc(ID *id, KeyBlock *data, int *normals_len, float **normals) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id); + + *normals_len = (me ? me->totpoly : 0) * 3; + + if (ELEM(NULL, me, data) || (me->totpoly == 0)) { + *normals = NULL; + return; + } + + *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__); + + BKE_keyblock_mesh_calc_normals(data, me, NULL, (float (*)[3])(*normals), NULL); +} + +static int rna_KeyBlock_normals_loop_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL); + + length[0] = me ? me->totloop : 0; + length[1] = 3; + + return (length[0] * length[1]); +} + +static void rna_KeyBlock_normals_loop_calc(ID *id, KeyBlock *data, int *normals_len, float **normals) +{ + Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id); + + *normals_len = (me ? me->totloop : 0) * 3; + + if (ELEM(NULL, me, data) || (me->totloop == 0)) { + *normals = NULL; + return; + } + + *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__); + + BKE_keyblock_mesh_calc_normals(data, me, NULL, NULL, (float (*)[3])(*normals)); +} + + PointerRNA rna_object_shapekey_index_get(ID *id, int value) { Key *key = rna_ShapeKey_find_key(id); @@ -558,7 +664,8 @@ static void rna_def_keydata(BlenderRNA *brna) static void rna_def_keyblock(BlenderRNA *brna) { StructRNA *srna; - PropertyRNA *prop; + PropertyRNA *prop, *parm; + FunctionRNA *func; srna = RNA_def_struct(brna, "ShapeKey", NULL); RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys datablock"); @@ -633,6 +740,36 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Data", ""); RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", NULL, NULL, NULL); + + /* XXX multi-dim dynamic arrays are very badly supported by (py)rna currently, those are defined for the day + * it works better, for now user will get a 1D tuple... + **/ + func = RNA_def_function(srna, "normals_vertex_get", "rna_KeyBlock_normals_vert_calc"); + RNA_def_function_ui_description(func, "Compute local space vertices' normals for this shape key"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE); + RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT); + RNA_def_property_multi_array(parm, 2, NULL); + RNA_def_property_range(parm, -1.0f, 1.0f); + RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_vert_len"); + + func = RNA_def_function(srna, "normals_polygon_get", "rna_KeyBlock_normals_poly_calc"); + RNA_def_function_ui_description(func, "Compute local space faces' normals for this shape key"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE); + RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT); + RNA_def_property_multi_array(parm, 2, NULL); + RNA_def_property_range(parm, -1.0f, 1.0f); + RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_poly_len"); + + func = RNA_def_function(srna, "normals_split_get", "rna_KeyBlock_normals_loop_calc"); + RNA_def_function_ui_description(func, "Compute local space face corners' normals for this shape key"); + RNA_def_function_flag(func, FUNC_USE_SELF_ID); + parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE); + RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_OUTPUT); + RNA_def_property_multi_array(parm, 2, NULL); + RNA_def_property_range(parm, -1.0f, 1.0f); + RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_loop_len"); } static void rna_def_key(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index 6140a34b271..3cd51f5d66f 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -30,7 +30,7 @@ #include "BLI_math_base.h" #include "BLI_math_rotation.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -349,7 +349,7 @@ static void rna_def_lamp(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, lamp_type_items); RNA_def_property_ui_text(prop, "Type", "Type of Lamp"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_LAMP); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LAMP); RNA_def_property_update(prop, 0, "rna_Lamp_draw_update"); prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE); diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 60e5f6d205c..035e9d15641 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -175,7 +175,7 @@ static int rna_Lattice_size_editable(PointerRNA *ptr) { Lattice *lt = (Lattice *)ptr->data; - return lt->key == NULL; + return (lt->key == NULL) ? PROP_EDITABLE : 0; } static void rna_Lattice_points_u_set(PointerRNA *ptr, int value) diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8b5ed66e217..5a0da0b7651 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -36,6 +36,7 @@ #include "DNA_ID.h" #include "DNA_modifier_types.h" #include "DNA_space_types.h" +#include "DNA_object_types.h" #include "BLI_utildefines.h" #include "BLI_path_util.h" @@ -88,7 +89,6 @@ #include "DNA_lamp_types.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" -#include "DNA_object_types.h" #include "DNA_speaker_types.h" #include "DNA_sound_types.h" #include "DNA_text_types.h" @@ -107,7 +107,7 @@ #include "ED_screen.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #ifdef WITH_PYTHON # include "BPY_extern.h" @@ -352,12 +352,17 @@ static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int id_us_min(&image->id); return image; } -static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath) +static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) { Image *ima; errno = 0; - ima = BKE_image_load(bmain, filepath); + if (check_existing) { + ima = BKE_image_load_exists(filepath); + } + else { + ima = BKE_image_load(bmain, filepath); + } if (!ima) { BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, @@ -436,12 +441,17 @@ static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerR } } -static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath) +static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) { VFont *font; - errno = 0; - font = BKE_vfont_load(bmain, filepath); + + if (check_existing) { + font = BKE_vfont_load_exists(bmain, filepath); + } + else { + font = BKE_vfont_load(bmain, filepath); + } if (!font) BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, @@ -483,12 +493,13 @@ static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRN } } -static Brush *rna_Main_brushes_new(Main *bmain, const char *name) +static Brush *rna_Main_brushes_new(Main *bmain, const char *name, int mode) { - Brush *brush = BKE_brush_add(bmain, name); + Brush *brush = BKE_brush_add(bmain, name, mode); id_us_min(&brush->id); return brush; } + static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr) { Brush *brush = brush_ptr->data; @@ -552,9 +563,17 @@ static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRN } } -static bSound *rna_Main_sounds_load(Main *bmain, const char *name) +static bSound *rna_Main_sounds_load(Main *bmain, const char *name, int check_existing) { - bSound *sound = BKE_sound_new_file(bmain, name); + bSound *sound; + + if (check_existing) { + sound = BKE_sound_new_file_exists(bmain, name); + } + else { + sound = BKE_sound_new_file(bmain, name); + } + id_us_min(&sound->id); return sound; } @@ -674,12 +693,18 @@ static void rna_Main_palettes_remove(Main *bmain, ReportList *reports, PointerRN } } -static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath) +static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) { MovieClip *clip; errno = 0; - clip = BKE_movieclip_file_add(bmain, filepath); + + if (check_existing) { + clip = BKE_movieclip_file_add_exists(bmain, filepath); + } + else { + clip = BKE_movieclip_file_add(bmain, filepath); + } if (!clip) BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath, @@ -1206,6 +1231,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Load a new image into the main database"); parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded"); /* return type */ parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock"); RNA_def_function_return(func, parm); @@ -1350,6 +1376,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Load a new font into the main database"); parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded"); /* return type */ parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock"); RNA_def_function_return(func, parm); @@ -1422,6 +1449,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a new brush to the main database"); parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock"); RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_enum(func, "mode", object_mode_items, OB_MODE_TEXTURE_PAINT, "", "Paint Mode for the new brush"); /* return type */ parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock"); RNA_def_function_return(func, parm); @@ -1612,6 +1640,7 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a new sound to the main database from a file"); parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded"); /* return type */ parm = RNA_def_pointer(func, "sound", "Sound", "", "New text datablock"); RNA_def_function_return(func, parm); @@ -1835,6 +1864,7 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file"); parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded"); /* return type */ parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index b660236ea4f..1a8cea143a1 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -35,7 +35,7 @@ #include "DNA_object_types.h" /* SELECT */ #include "DNA_scene_types.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_movieclip.h" #include "BKE_tracking.h" @@ -976,7 +976,7 @@ static void rna_def_mask_layer(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "falloff"); RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items); RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL); /* filling options */ diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index a1fa6ab13be..d7e566ff431 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -237,7 +237,7 @@ static int rna_Material_active_texture_editable(PointerRNA *ptr) { Material *ma = (Material *)ptr->id.data; - return has_current_material_texture(ma); + return has_current_material_texture(ma) ? PROP_EDITABLE : 0; } static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 632b07c19ce..1459157112e 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -136,8 +136,9 @@ static void rna_Mesh_normals_split_custom_do(Mesh *mesh, float (*custom_loopnors } else { polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, __func__); - BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, - polynors, false); + BKE_mesh_calc_normals_poly( + mesh->mvert, NULL, mesh->totvert, + mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, polynors, false); free_polynors = true; } diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h index f68a48c075b..0f42596ff13 100644 --- a/source/blender/makesrna/intern/rna_mesh_utils.h +++ b/source/blender/makesrna/intern/rna_mesh_utils.h @@ -81,7 +81,7 @@ CustomDataLayer *layer; \ if (data) { \ int index = CustomData_get_##active_type##_layer_index(data, layer_type); \ - layer = (index == -1) ? NULL: &data->layers[index]; \ + layer = (index == -1) ? NULL : &data->layers[index]; \ } \ else { \ layer = NULL; \ diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index affaef3aa7b..9bddb6c06de 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -40,7 +40,7 @@ #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_animsys.h" #include "BKE_data_transfer.h" @@ -92,7 +92,7 @@ EnumPropertyItem modifier_type_items[] = { {0, "", 0, N_("Deform"), ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, - {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Corrective Smooth", ""}, + {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Corrective Smooth", ""}, {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""}, {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""}, {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""}, @@ -549,9 +549,11 @@ RNA_MOD_OBJECT_SET(Shrinkwrap, auxTarget, OB_MESH); static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value) { HookModifierData *hmd = ptr->data; + Object *ob = (Object *)value.data; - hmd->object = (Object *)value.data; - BKE_object_modifier_hook_reset((Object *)ptr->id.data, hmd); + hmd->object = ob; + id_lib_extern((ID *)ob); + BKE_object_modifier_hook_reset(ob, hmd); } static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr) @@ -562,8 +564,10 @@ static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr) static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value) { - Object **ob = (Object **)ptr->data; - *ob = value.data; + Object **ob_p = (Object **)ptr->data; + Object *ob = (Object *)value.data; + id_lib_extern((ID *)ob); + *ob_p = ob; } #undef RNA_MOD_OBJECT_SET @@ -1119,6 +1123,13 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv); RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + +#ifdef WITH_OPENSUBDIV + prop = RNA_def_property(srna, "use_opensubdiv", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_opensubdiv", 1); + RNA_def_property_ui_text(prop, "Use OpenSubdiv", "Use OpenSubdiv for the subdivisions (viewport only)"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); +#endif } static void rna_def_modifier_generic_map_info(StructRNA *srna) @@ -1187,7 +1198,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, modifier_warp_falloff_items); RNA_def_property_ui_text(prop, "Falloff Type", ""); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE); @@ -1486,7 +1497,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna) prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "angle"); RNA_def_property_range(prop, 0, DEG2RAD(180)); - RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2); + RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 10, 2); RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1733,7 +1744,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, modifier_warp_falloff_items); /* share the enum */ RNA_def_property_ui_text(prop, "Falloff Type", ""); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE); @@ -1957,7 +1968,7 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna) prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 100, 2); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2); RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -1982,9 +1993,11 @@ static void rna_def_modifier_displace(BlenderRNA *brna) {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"}, {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"}, {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal", - "Use the texture's intensity value to displace in the normal direction"}, + "Use the texture's intensity value to displace along the vertex normal"}, + {MOD_DISP_DIR_CLNOR, "CUSTOM_NORMAL", 0, "Custom Normal", + "Use the texture's intensity value to displace along the (averaged) custom normal (falls back to vertex)"}, {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ", - "Use the texture's RGB values to displace the mesh in the XYZ direction"}, + "Use the texture's RGB values to displace the mesh in the XYZ direction"}, {0, NULL, 0, NULL, NULL} }; @@ -2792,7 +2805,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "bevel_angle"); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 100, 2); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2); RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -3042,7 +3055,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); - RNA_def_property_ui_range(prop, -10, 10, 1, 3); + RNA_def_property_ui_range(prop, -10.0, 10.0, 1.0, 3); RNA_def_property_ui_text(prop, "Factor", "Amount to deform object"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -3050,7 +3063,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "factor"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_float_default(prop, DEG2RADF(45.0f)); - RNA_def_property_ui_range(prop, -M_PI, M_PI, DEG2RAD(1), 3); + RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3); RNA_def_property_ui_text(prop, "Angle", "Angle of deformation"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -3246,7 +3259,7 @@ static void rna_def_modifier_screw(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 2, -1); + RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, -1); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_text(prop, "Angle", "Angle of revolution"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -3463,7 +3476,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items); RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE); @@ -3669,7 +3682,7 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items); RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, 0, "rna_Modifier_update"); /* Common masking properties. */ diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 07c784f2822..0e8ed5eea8d 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -107,6 +107,16 @@ static void rna_NlaStrip_transform_update(Main *UNUSED(bmain), Scene *UNUSED(sce NlaStrip *strip = (NlaStrip *)ptr->data; BKE_nlameta_flush_transforms(strip); + + /* set the flag */ + if ((strip->flag & NLASTRIP_FLAG_AUTO_BLENDS) && ptr->id.data) { + /* validate state to ensure that auto-blend gets applied immediately */ + IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data; + + if (iat->adt) { + BKE_nla_validate_state(iat->adt); + } + } } static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value) @@ -280,7 +290,7 @@ static int rna_NlaStrip_action_editable(PointerRNA *ptr) return 0; /* should be ok, though we may still miss some cases */ - return 1; + return PROP_EDITABLE; } static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value) @@ -546,7 +556,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_start_frame_set", NULL); RNA_def_property_ui_text(prop, "Start Frame", ""); RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); - + prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "end"); RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_end_frame_set", NULL); @@ -588,13 +598,13 @@ static void rna_def_nlastrip(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "actstart"); RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_start_frame_set", NULL); RNA_def_property_ui_text(prop, "Action Start Frame", "First frame from action to use"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */ + RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); prop = RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "actend"); RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_end_frame_set", NULL); RNA_def_property_ui_text(prop, "Action End Frame", "Last frame from action to use"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */ + RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); /* Action Reuse */ prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE); @@ -604,7 +614,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) * (minimum should still be > 0 though) if needed... */ RNA_def_property_range(prop, 0.1f, 1000.0f); RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */ + RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "scale"); @@ -613,7 +623,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) * due to numeric errors */ RNA_def_property_range(prop, 0.0001f, 1000.0f); RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action"); - RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */ + RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); /* Strip's F-Curves */ prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 105829ef389..a51dffb8ca3 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -32,7 +32,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "DNA_material_types.h" #include "DNA_mesh_types.h" @@ -792,6 +792,11 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock); if (ret) { + + /* not an issue from the UI, clear hidden from API to keep valid state. */ + fromsock->flag &= ~SOCK_HIDDEN; + tosock->flag &= ~SOCK_HIDDEN; + if (tonode) nodeUpdate(ntree, tonode); @@ -3011,10 +3016,14 @@ static int point_density_color_source_from_shader(NodeShaderTexPointDensity *sha } } -/* TODO(sergey): This functio nassumes allocated array was passed, +/* TODO(sergey): This function assumes allocated array was passed, * works fine with Cycles via C++ RNA, but fails with call from python. */ -void rna_ShaderNodePointDensity_density_calc(bNode *self, Scene *scene, int *length, float **values) +void rna_ShaderNodePointDensity_density_calc(bNode *self, + Scene *scene, + int settings, + int *length, + float **values) { NodeShaderTexPointDensity *shader_point_density = self->storage; PointDensity pd; @@ -3046,6 +3055,7 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self, Scene *scene, int *len /* Single-threaded sampling of the voxel domain. */ RE_sample_point_density(scene, &pd, shader_point_density->resolution, + settings == 1, *values); /* We're done, time to clean up. */ @@ -3538,17 +3548,29 @@ static void def_sh_tex_sky(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static const EnumPropertyItem sh_tex_prop_color_space_items[] = { + {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color", + "Image contains color data, and will be converted to linear color for rendering"}, + {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", + "Image contains non-color data, for example a displacement or normal map, " + "and will not be converted"}, + {0, NULL, 0, NULL, NULL} +}; + +static const EnumPropertyItem sh_tex_prop_interpolation_items[] = { + {SHD_INTERP_LINEAR, "Linear", 0, "Linear", + "Linear interpolation"}, + {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", + "No interpolation (sample closest texel)"}, + {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", + "Cubic interpolation (CPU only)"}, + {SHD_INTERP_SMART, "Smart", 0, "Smart", + "Bicubic when magnifying, else bilinear (OSL only)"}, + {0, NULL, 0, NULL, NULL} +}; + static void def_sh_tex_environment(StructRNA *srna) { - static const EnumPropertyItem prop_color_space_items[] = { - {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color", - "Image contains color data, and will be converted to linear color for rendering"}, - {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", - "Image contains non-color data, for example a displacement or normal map, " - "and will not be converted"}, - {0, NULL, 0, NULL, NULL} - }; - static const EnumPropertyItem prop_projection_items[] = { {SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular", "Equirectangular or latitude-longitude projection"}, @@ -3570,7 +3592,7 @@ static void def_sh_tex_environment(StructRNA *srna) def_sh_tex(srna); prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items); RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR); RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3580,6 +3602,11 @@ static void def_sh_tex_environment(StructRNA *srna) RNA_def_property_ui_text(prop, "Projection", "Projection of the input image"); RNA_def_property_update(prop, 0, "rna_Node_update"); + prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items); + RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation"); + RNA_def_property_update(prop, 0, "rna_Node_update"); + prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); @@ -3590,15 +3617,6 @@ static void def_sh_tex_environment(StructRNA *srna) static void def_sh_tex_image(StructRNA *srna) { - static const EnumPropertyItem prop_color_space_items[] = { - {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color", - "Image contains color data, and will be converted to linear color for rendering"}, - {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data", - "Image contains non-color data, for example a displacement or normal map, " - "and will not be converted"}, - {0, NULL, 0, NULL, NULL} - }; - static const EnumPropertyItem prop_projection_items[] = { {SHD_PROJ_FLAT, "FLAT", 0, "Flat", "Image is projected flat using the X and Y coordinates of the texture vector"}, @@ -3611,18 +3629,6 @@ static void def_sh_tex_image(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - static const EnumPropertyItem prop_interpolation_items[] = { - {SHD_INTERP_LINEAR, "Linear", 0, "Linear", - "Linear interpolation"}, - {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", - "No interpolation (sample closest texel)"}, - {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", - "Cubic interpolation (CPU only)"}, - {SHD_INTERP_SMART, "Smart", 0, "Smart", - "Bicubic when magnifying, else bilinear (OSL only)"}, - {0, NULL, 0, NULL, NULL} - }; - static EnumPropertyItem prop_image_extension[] = { {SHD_IMAGE_EXTENSION_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {SHD_IMAGE_EXTENSION_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, @@ -3643,7 +3649,7 @@ static void def_sh_tex_image(StructRNA *srna) def_sh_tex(srna); prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_color_space_items); + RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items); RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR); RNA_def_property_ui_text(prop, "Color Space", "Image file color space"); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3654,7 +3660,7 @@ static void def_sh_tex_image(StructRNA *srna) RNA_def_property_update(prop, 0, "rna_Node_update"); prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_interpolation_items); + RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items); RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation"); RNA_def_property_update(prop, 0, "rna_Node_update"); @@ -3929,6 +3935,13 @@ static void def_sh_tex_pointdensity(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; + /* TODO(sergey): Use some mnemonic names for the hardcoded values here. */ + static EnumPropertyItem calc_mode_items[] = { + {0, "VIEWPORT", 0, "Viewport", "Canculate density using viewport settings"}, + {1, "RENDER", 0, "Render", "Canculate duplis using render settings"}, + {0, NULL, 0, NULL, NULL} + }; + prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "id"); RNA_def_property_struct_type(prop, "Object"); @@ -3981,6 +3994,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna) func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc"); RNA_def_function_ui_description(func, "Calculate point density"); RNA_def_pointer(func, "scene", "Scene", "", ""); + RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); /* TODO, See how array size of 0 works, this shouldnt be used. */ prop = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0); RNA_def_property_flag(prop, PROP_DYNAMIC); @@ -4769,7 +4783,7 @@ static void def_cmp_dilate_erode(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "falloff"); RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items); RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } @@ -4957,9 +4971,9 @@ static void def_cmp_color_spill(StructRNA *srna) }; static EnumPropertyItem limit_channel_items[] = { - {1, "R", 0, "R", "Limit by Red"}, - {2, "G", 0, "G", "Limit by Green"}, - {3, "B", 0, "B", "Limit by Blue"}, + {0, "R", 0, "R", "Limit by Red"}, + {1, "G", 0, "G", "Limit by Green"}, + {2, "B", 0, "B", "Limit by Blue"}, {0, NULL, 0, NULL, NULL} }; @@ -6426,7 +6440,7 @@ static void def_cmp_keying(StructRNA *srna) RNA_def_property_enum_sdna(prop, NULL, "feather_falloff"); RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items); RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 7e1b0df9ce7..39739867c8b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -107,13 +107,13 @@ static EnumPropertyItem dupli_items[] = { #endif static EnumPropertyItem collision_bounds_items[] = { - {OB_BOUND_BOX, "BOX", 0, "Box", ""}, - {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, - {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, - {OB_BOUND_CONE, "CONE", 0, "Cone", ""}, - {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", 0, "Convex Hull", ""}, - {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""}, - {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""}, + {OB_BOUND_BOX, "BOX", ICON_MESH_CUBE, "Box", ""}, + {OB_BOUND_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""}, + {OB_BOUND_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""}, + {OB_BOUND_CONE, "CONE", ICON_MESH_CONE, "Cone", ""}, + {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", ""}, + {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", ICON_MESH_MONKEY, "Triangle Mesh", ""}, + {OB_BOUND_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""}, /*{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, */ {0, NULL, 0, NULL, NULL} }; @@ -535,11 +535,14 @@ static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value) /* must not let this be set if the object belongs in this group already, * thus causing a cycle/infinite-recursion leading to crashes on load [#25298] */ - if (BKE_group_object_exists(grp, ob) == 0) + if (BKE_group_object_exists(grp, ob) == 0) { ob->dup_group = grp; - else + id_lib_extern((ID *)grp); + } + else { BKE_report(NULL, RPT_ERROR, "Cannot set dupli-group as object belongs in group being instanced, thus causing a cycle"); + } } static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value) @@ -710,7 +713,7 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value) Object *ob = (Object *)ptr->id.data; DAG_id_tag_update(value.data, 0); - assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_USERPREF); + assign_material(ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING); } static int rna_Object_active_material_editable(PointerRNA *ptr) @@ -882,7 +885,7 @@ static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value) Object *ob = (Object *)ptr->id.data; int index = (Material **)ptr->data - ob->mat; - assign_material(ob, value.data, index + 1, BKE_MAT_ASSIGN_USERPREF); + assign_material(ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING); } static int rna_MaterialSlot_link_get(PointerRNA *ptr) @@ -1771,6 +1774,14 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_float_default(prop, 55.0f); RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall"); + prop = RNA_def_property(srna, "jump_max", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "max_jumps"); + RNA_def_property_range(prop, 1, CHAR_MAX); + RNA_def_property_ui_range(prop, 1, 10, 1, 1); + RNA_def_property_int_default(prop, 1); + RNA_def_property_ui_text(prop, "Max Jumps", + "The maximum number of jumps the character can make before it hits the ground"); + /* Collision Masks */ prop = RNA_def_property(srna, "collision_group", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "col_group", 1); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 75becb341b9..2766540ab69 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -1639,7 +1639,7 @@ static void rna_def_softbody(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Goal Default", - "Default Goal (vertex target position) value, when no Vertex Group used"); + "Default Goal (vertex target position) value"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 78631fdffc3..6676e9dc1c4 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -45,7 +45,7 @@ #include "RNA_define.h" #include "RNA_enum_types.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "rna_internal.h" diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index afbb97f519d..27ff0a63e75 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -41,7 +41,7 @@ #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "WM_types.h" @@ -192,7 +192,7 @@ static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) /* copy the new name into the name slot */ BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name)); - BLI_uniquename(&ob->pose->agroups, agrp, CTX_DATA_(BLF_I18NCONTEXT_ID_ARMATURE, "Group"), '.', + BLI_uniquename(&ob->pose->agroups, agrp, CTX_DATA_(BLT_I18NCONTEXT_ID_ARMATURE, "Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name)); } @@ -1062,6 +1062,17 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + prop = RNA_def_property(srna, "custom_shape_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "custom_scale"); + RNA_def_property_range(prop, 0.0f, 1000.0f); + RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape"); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + + prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE); + RNA_def_property_ui_text(prop, "Use Bone Size", "Scale the custom object by the bone length"); + RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); + prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "custom_tx"); RNA_def_property_struct_type(prop, "PoseBone"); diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c index a2c19e55056..454816d4e0a 100644 --- a/source/blender/makesrna/intern/rna_property.c +++ b/source/blender/makesrna/intern/rna_property.c @@ -32,7 +32,7 @@ #include "BLI_path_util.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_enum_types.h" diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 58a12f62644..395cb7c443d 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -53,7 +53,7 @@ EnumPropertyItem rigidbody_object_type_items[] = { EnumPropertyItem rigidbody_object_shape_items[] = { {RB_SHAPE_BOX, "BOX", ICON_MESH_CUBE, "Box", "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"}, {RB_SHAPE_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""}, - {RB_SHAPE_CAPSULE, "CAPSULE", ICON_OUTLINER_OB_META, "Capsule", ""}, + {RB_SHAPE_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""}, {RB_SHAPE_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""}, {RB_SHAPE_CONE, "CONE", ICON_MESH_CONE, "Cone", ""}, {RB_SHAPE_CONVEXH, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index db00f149758..5fb6fa19fda 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -40,7 +40,7 @@ #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_editmesh.h" #include "BKE_paint.h" @@ -156,7 +156,7 @@ EnumPropertyItem mesh_select_mode_items[] = { }; EnumPropertyItem snap_element_items[] = { - {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_ALIGN, "Increment", "Snap to increments of grid"}, + {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"}, {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"}, {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"}, @@ -165,7 +165,7 @@ EnumPropertyItem snap_element_items[] = { }; EnumPropertyItem snap_node_element_items[] = { - {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_INCREMENT, "Grid", "Snap to grid"}, + {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"}, {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_SNAP_EDGE, "Node X", "Snap to left/right node border"}, {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_SNAP_EDGE, "Node Y", "Snap to top/bottom node border"}, {SCE_SNAP_MODE_NODE_XY, "NODE_XY", ICON_SNAP_EDGE, "Node X / Y", "Snap to any node border"}, @@ -366,12 +366,12 @@ EnumPropertyItem views_format_multiview_items[] = { EnumPropertyItem stereo3d_display_items[] = { {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", - "Render views for left and right eyes as two differently filtered colors in a single image " - "(anaglyph glasses are required)"}, + "Render views for left and right eyes as two differently filtered colors in a single image " + "(anaglyph glasses are required)"}, {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", - "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, + "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"}, {S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential", - "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"}, + "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"}, {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"}, {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"}, {0, NULL, 0, NULL, NULL} @@ -432,7 +432,7 @@ EnumPropertyItem stereo3d_interlace_type_items[] = { static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { - ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings); + ED_space_image_uv_sculpt_update(bmain->wm.first, scene); } static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) @@ -554,6 +554,7 @@ static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value) return; } + id_lib_extern((ID *)set); scene->set = set; } @@ -1950,7 +1951,7 @@ static void rna_Stereo3dFormat_update(Main *UNUSED(bmain), Scene *UNUSED(scene), ImBuf *ibuf; void *lock; - if ((ima->flag & IMA_IS_STEREO) == 0) + if (!BKE_image_is_stereo(ima)) return; ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); @@ -2219,7 +2220,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID); RNA_def_property_ui_text(prop, "Absolute Grid Snap", "Absolute grid alignment while translating (based on the pivot center)"); - RNA_def_property_ui_icon(prop, ICON_SNAP_INCREMENT, 0); + RNA_def_property_ui_icon(prop, ICON_SNAP_GRID, 0); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE); @@ -2550,7 +2551,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "overhang_max"); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display"); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -2589,7 +2590,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "distort_min"); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display"); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -2597,7 +2598,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "distort_max"); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display"); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -2606,7 +2607,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "sharp_min"); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display"); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); @@ -2614,7 +2615,7 @@ static void rna_def_statvis(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "sharp_max"); RNA_def_property_float_default(prop, 0.5f); RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f)); - RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 0.001, 3); + RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3); RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display"); RNA_def_property_update(prop, 0, "rna_EditMesh_update"); } @@ -3814,6 +3815,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) 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_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_default(prop, ESCKEY); 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"); @@ -4828,7 +4830,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Volume", "Audio volume"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); #endif @@ -6482,7 +6484,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "audio.volume"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Volume", "Audio volume"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_update(prop, NC_SCENE, NULL); RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL); diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c index cbc02858f78..dec305de192 100644 --- a/source/blender/makesrna/intern/rna_sensor.c +++ b/source/blender/makesrna/intern/rna_sensor.c @@ -33,7 +33,7 @@ #include "BLI_utildefines.h" #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -458,14 +458,16 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna) prop = RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "key"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL); RNA_def_property_ui_text(prop, "Key", ""); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_WINDOWMANAGER); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_WINDOWMANAGER); RNA_def_property_update(prop, NC_LOGIC, NULL); prop = RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "qual"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL); RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -473,6 +475,7 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna) prop = RNA_def_property(srna, "modifier_key_2", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "qual2"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL); RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code"); RNA_def_property_update(prop, NC_LOGIC, NULL); @@ -813,7 +816,7 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - static EnumPropertyItem event_type_items[] = { + static EnumPropertyItem event_type_joystick_items[] = { {SENS_JOY_BUTTON, "BUTTON", 0, "Button", ""}, {SENS_JOY_AXIS, "AXIS", 0, "Axis", ""}, {SENS_JOY_HAT, "HAT", 0, "Hat", ""}, @@ -854,7 +857,8 @@ static void rna_def_joystick_sensor(BlenderRNA *brna) prop = RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); - RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_enum_items(prop, event_type_joystick_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on"); RNA_def_property_update(prop, NC_LOGIC, NULL); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 879c765978f..2192eae9fe6 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -35,7 +35,7 @@ #include "BLI_math.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_animsys.h" #include "BKE_global.h" @@ -1430,7 +1430,7 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_items(prop, seq_type_items); RNA_def_property_ui_text(prop, "Type", ""); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SEQUENCE); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); @@ -2036,7 +2036,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "volume"); RNA_def_property_range(prop, 0.0f, 100.0f); RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); @@ -2044,7 +2044,7 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "pitch"); RNA_def_property_range(prop, 0.1f, 10.0f); RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); @@ -2307,10 +2307,16 @@ static void rna_def_gaussian_blur(StructRNA *srna) static void rna_def_text(StructRNA *srna) { - static EnumPropertyItem text_align_items[] = { - {SEQ_TEXT_ALIGN_LEFT, "LEFT", 0, "Left", ""}, - {SEQ_TEXT_ALIGN_CENTER, "CENTER", 0, "Center", ""}, - {SEQ_TEXT_ALIGN_RIGHT, "RIGHT", 0, "Right", ""}, + static EnumPropertyItem text_align_x_items[] = { + {SEQ_TEXT_ALIGN_X_LEFT, "LEFT", 0, "Left", ""}, + {SEQ_TEXT_ALIGN_X_CENTER, "CENTER", 0, "Center", ""}, + {SEQ_TEXT_ALIGN_X_RIGHT, "RIGHT", 0, "Right", ""}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem text_align_y_items[] = { + {SEQ_TEXT_ALIGN_Y_TOP, "TOP", 0, "Top", ""}, + {SEQ_TEXT_ALIGN_Y_CENTER, "CENTER", 0, "Center", ""}, + {SEQ_TEXT_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", ""}, {0, NULL, 0, NULL, NULL} }; @@ -2324,17 +2330,30 @@ static void rna_def_text(StructRNA *srna) RNA_def_property_ui_range(prop, 0.0f, 1000, 1, -1); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_NONE); + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", "Location of the text"); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); - prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "wrap_width", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "wrap_width"); + RNA_def_property_ui_text(prop, "Wrap Width", "Word wrap width as factor, zero disables"); + RNA_def_property_range(prop, 0, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + + prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "align"); - RNA_def_property_enum_items(prop, text_align_items); - RNA_def_property_ui_text(prop, "Align", ""); + RNA_def_property_enum_items(prop, text_align_x_items); + RNA_def_property_ui_text(prop, "Align X", ""); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); + + prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "align_y"); + RNA_def_property_enum_items(prop, text_align_y_items); + RNA_def_property_ui_text(prop, "Align Y", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 4df0b8df0f7..b9db36628ee 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -29,7 +29,7 @@ #include "MEM_guardedalloc.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_image.h" #include "BKE_key.h" @@ -219,6 +219,24 @@ static EnumPropertyItem buttons_texture_context_items[] = { {0, NULL, 0, NULL, NULL} }; + +static EnumPropertyItem fileselectparams_recursion_level_items[] = { + {0, "NONE", 0, "None", "Only list current directory's content, with no recursion"}, + {1, "BLEND", 0, "Blend File", "List .blend files' content"}, + {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"}, + {3, "ALL_2", 0, "Two Levels", "List all sub-directories' content, two levels of recursion"}, + {4, "ALL_3", 0, "Three Levels", "List all sub-directories' content, three levels of recursion"}, + {0, NULL, 0, NULL, NULL} +}; + +EnumPropertyItem file_sort_items[] = { + {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"}, + {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"}, + {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"}, + {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"}, + {0, NULL, 0, NULL, NULL} +}; + #ifdef RNA_RUNTIME #include "DNA_anim_types.h" @@ -712,7 +730,7 @@ static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr) static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) { - ED_space_image_paint_update(bmain->wm.first, scene->toolsettings); + ED_space_image_paint_update(bmain->wm.first, scene); } @@ -1522,6 +1540,37 @@ static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNU /* File browser. */ +static int rna_FileSelectParams_use_lib_get(PointerRNA *ptr) +{ + FileSelectParams *params = ptr->data; + + return params && (params->type == FILE_LOADLIB); +} + +static EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf( + bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free) +{ + FileSelectParams *params = ptr->data; + + if (params && params->type != FILE_LOADLIB) { + EnumPropertyItem *item = NULL; + int totitem = 0; + + RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 0); + RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 2); + RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 3); + RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 4); + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; + } + + *r_free = false; + return fileselectparams_recursion_level_items; +} + static void rna_FileBrowser_FSMenuEntry_path_get(PointerRNA *ptr, char *value) { char *path = ED_fsmenu_entry_get_path(ptr->data); @@ -1568,7 +1617,7 @@ static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr) { FSMenuEntry *fsm = ptr->data; - return fsm->save; + return fsm->save ? PROP_EDITABLE : 0; } static void rna_FileBrowser_FSMenu_next(CollectionPropertyIterator *iter) @@ -3625,7 +3674,7 @@ static void rna_def_console_line(BlenderRNA *brna) "rna_ConsoleLine_body_set"); RNA_def_property_ui_text(prop, "Line", "Text in the line"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_TEXT); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT); prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */ RNA_def_property_int_sdna(prop, NULL, "cursor"); @@ -3686,23 +3735,13 @@ static void rna_def_fileselect_params(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem file_display_items[] = { - {FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"}, - {FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"}, - {FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"}, + {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"}, + {FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"}, + {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem file_sort_items[] = { - {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", - "Sort the file list alphabetically"}, - {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", - "Sort the file list by extension"}, - {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"}, - {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"}, - {0, NULL, 0, NULL, NULL} - }; - - static EnumPropertyItem thumbnail_size_items[] = { + static EnumPropertyItem display_size_items[] = { {32, "TINY", 0, "Tiny", ""}, {64, "SMALL", 0, "Small", ""}, {128, "NORMAL", 0, "Normal", ""}, @@ -3710,6 +3749,61 @@ static void rna_def_fileselect_params(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem file_filter_idtypes_items[] = { + {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action datablocks"}, + {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature datablocks"}, + {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes datablocks"}, + {FILTER_ID_CA, "CAMERA", ICON_CAMERA_DATA, "Cameras", "Show/hide Camera datablocks"}, + {FILTER_ID_CU, "CURVE", ICON_CURVE_DATA, "Curves", "Show/hide Curve datablocks"}, + {FILTER_ID_GD, "GREASE_PENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Show/hide Grease pencil datablocks"}, + {FILTER_ID_GR, "GROUP", ICON_GROUP, "Groups", "Show/hide Group datablocks"}, + {FILTER_ID_IM, "IMAGE", ICON_IMAGE_DATA, "Images", "Show/hide Image datablocks"}, + {FILTER_ID_LA, "LAMP", ICON_LAMP_DATA, "Lamps", "Show/hide Lamp datablocks"}, + {FILTER_ID_LS, "LINESTYLE", ICON_LINE_DATA, + "Freestyle Linestyles", "Show/hide Freestyle's Line Style datablocks"}, + {FILTER_ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattices", "Show/hide Lattice datablocks"}, + {FILTER_ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Materials", "Show/hide Material datablocks"}, + {FILTER_ID_MB, "METABALL", ICON_META_DATA, "Metaballs", "Show/hide Metaball datablocks"}, + {FILTER_ID_MC, "MOVIE_CLIP", ICON_CLIP, "Movie Clips", "Show/hide Movie Clip datablocks"}, + {FILTER_ID_ME, "MESH", ICON_MESH_DATA, "Meshes", "Show/hide Mesh datablocks"}, + {FILTER_ID_MSK, "MASK", ICON_MOD_MASK, "Masks", "Show/hide Mask datablocks"}, + {FILTER_ID_NT, "NODE_TREE", ICON_NODETREE, "Node Trees", "Show/hide Node Tree datablocks"}, + {FILTER_ID_OB, "OBJECT", ICON_OBJECT_DATA, "Objects", "Show/hide Object datablocks"}, + {FILTER_ID_PA, "PARTICLE_SETTINGS", ICON_PARTICLE_DATA, + "Particles Settings", "Show/hide Particle Settings datablocks"}, + {FILTER_ID_PAL, "PALETTE", ICON_COLOR, "Palettes", "Show/hide Palette datablocks"}, + {FILTER_ID_PC, "PAINT_CURVE", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve datablocks"}, + {FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene datablocks"}, + {FILTER_ID_SPK, "SPEAKER", ICON_SPEAKER, "Speakers", "Show/hide Speaker datablocks"}, + {FILTER_ID_SO, "SOUND", ICON_SOUND, "Sounds", "Show/hide Sound datablocks"}, + {FILTER_ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Textures", "Show/hide Texture datablocks"}, + {FILTER_ID_TXT, "TEXT", ICON_TEXT, "Texts", "Show/hide Text datablocks"}, + {FILTER_ID_VF, "FONT", ICON_FONT_DATA, "Fonts", "Show/hide Font datablocks"}, + {FILTER_ID_WO, "WORLD", ICON_WORLD_DATA, "Worlds", "Show/hide World datablocks"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem file_filter_idcategories_items[] = { + {FILTER_ID_SCE, + "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"}, + {FILTER_ID_AC, + "ANIMATION", ICON_ANIM_DATA, "Animations", "Show/hide animation data"}, + {FILTER_ID_OB | FILTER_ID_GR, + "OBJECT", ICON_GROUP, "Objects & Groups", "Show/hide objects and groups"}, + {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME, + "GEOMETRY", ICON_MESH_DATA, "Geometry", "Show/hide meshes, curves, lattice, armatures and metaballs data"}, + {FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE, + "SHADING", ICON_MATERIAL_DATA, "Shading", + "Show/hide materials, nodetrees, textures and Freestyle's linestyles"}, + {FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO, + "IMAGE", ICON_IMAGE_DATA, "Images & Sounds", "Show/hide images, movie clips, sounds and masks"}, + {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_SPK | FILTER_ID_WO, + "ENVIRONMENT", ICON_WORLD_DATA, "Environment", "Show/hide worlds, lamps, cameras and speakers"}, + {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT | FILTER_ID_VF, + "MISC", ICON_GREASEPENCIL, "Miscellaneous", "Show/hide other data types"}, + {0, NULL, 0, NULL, NULL} + }; + srna = RNA_def_struct(brna, "FileSelectParams", NULL); RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters"); @@ -3728,12 +3822,23 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "use_library_browsing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Library Browser", "Whether we may browse blender files' content or not"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_boolean_funcs(prop, "rna_FileSelectParams_use_lib_get", NULL); + prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "display"); RNA_def_property_enum_items(prop, file_display_items); RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "recursion_level", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, fileselectparams_recursion_level_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FileSelectParams_recursion_level_itemf"); + RNA_def_property_ui_text(prop, "Recursion", "Numbers of dirtree levels to show simultaneously"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER); RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files"); @@ -3803,7 +3908,27 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Filter Folder", "Show folders"); RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); - + + prop = RNA_def_property(srna, "use_filter_blendid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDERLIB); + RNA_def_property_ui_text(prop, "Filter Blender IDs", "Show .blend files items (objects, materials, etc.)"); + RNA_def_property_ui_icon(prop, ICON_BLENDER, 0); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + + prop = RNA_def_property(srna, "filter_id", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "filter_id"); + RNA_def_property_enum_items(prop, file_filter_idtypes_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Filter ID types", "Which ID types to show/hide, when browsing a library"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + + prop = RNA_def_property(srna, "filter_id_category", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "filter_id"); + RNA_def_property_enum_items(prop, file_filter_idcategories_items); + RNA_def_property_flag(prop, PROP_ENUM_FLAG); + RNA_def_property_ui_text(prop, "Filter ID categories", "Which ID categories to show/hide, when browsing a library"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL); + prop = RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "filter_glob"); RNA_def_property_ui_text(prop, "Extension Filter", ""); @@ -3815,10 +3940,11 @@ static void rna_def_fileselect_params(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); - prop = RNA_def_property(srna, "thumbnail_size", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "display_size", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "thumbnail_size"); - RNA_def_property_enum_items(prop, thumbnail_size_items); - RNA_def_property_ui_text(prop, "Thumbnails Size", "Change the size of the thumbnails"); + RNA_def_property_enum_items(prop, display_size_items); + RNA_def_property_ui_text(prop, "Display Size", + "Change the size of the display (width of columns or thumbnails size)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL); } @@ -4364,7 +4490,7 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "view"); RNA_def_property_enum_items(prop, view_items); RNA_def_property_ui_text(prop, "View", "Type of the clip editor view"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_MOVIECLIP); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update"); /* show pattern */ @@ -4550,7 +4676,7 @@ static void rna_def_space_clip(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "gpencil_src"); RNA_def_property_enum_items(prop, gpencil_source_items); RNA_def_property_ui_text(prop, "Grease Pencil Source", "Where the grease pencil comes from"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_MOVIECLIP); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP); RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL); /* pivot point */ diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c index d237dcffc96..31a4e672983 100644 --- a/source/blender/makesrna/intern/rna_speaker.c +++ b/source/blender/makesrna/intern/rna_speaker.c @@ -35,7 +35,7 @@ #include "DNA_speaker_types.h" #include "DNA_sound_types.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #ifdef RNA_RUNTIME @@ -62,7 +62,7 @@ static void rna_def_speaker(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_ui_text(prop, "Mute", "Mute the speaker"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */ prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE); @@ -142,14 +142,14 @@ static void rna_def_speaker(BlenderRNA *brna) prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Volume", "How loud the sound is"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */ prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, 0.1f, 10.0f); RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound"); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_SOUND); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND); /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */ diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c index 867e6dcd8ff..46299799966 100644 --- a/source/blender/makesrna/intern/rna_test.c +++ b/source/blender/makesrna/intern/rna_test.c @@ -61,7 +61,7 @@ (void)0 #define DEF_GET_SET(type, arr) \ - void rna_Test_ ## arr ## _get(PointerRNA *ptr, type * values) \ + void rna_Test_ ## arr ## _get(PointerRNA *ptr, type * values) \ { \ memcpy(values, arr, sizeof(arr)); \ } \ @@ -70,10 +70,10 @@ { \ memcpy(arr, values, sizeof(arr)); \ } \ - (void)0 + ((void)0) #define DEF_GET_SET_LEN(arr, max) \ - static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \ + static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \ { \ return arr ## _len; \ } \ @@ -87,7 +87,7 @@ \ return 1; \ } \ - (void)0 + ((void)0) DEF_VARS(float, f); DEF_VARS(int, i); diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c index 46477007962..fb9d447850a 100644 --- a/source/blender/makesrna/intern/rna_text.c +++ b/source/blender/makesrna/intern/rna_text.c @@ -30,7 +30,7 @@ #include "MEM_guardedalloc.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_text.h" @@ -139,7 +139,7 @@ static void rna_def_text_line(BlenderRNA *brna) RNA_def_property_string_funcs(prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set"); RNA_def_property_ui_text(prop, "Line", "Text in the line"); RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL); - RNA_def_property_translation_context(prop, BLF_I18NCONTEXT_ID_TEXT); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT); } static void rna_def_text(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index fde43abe9fb..2595771bece 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -29,7 +29,7 @@ #include "DNA_screen_types.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "BKE_idprop.h" @@ -199,7 +199,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr); /* We have to set default context! Else we get a void string... */ - strcpy(dummypt.translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + strcpy(dummypt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* validate the python class */ if (validate(&dummyptr, data, have_function) != 0) @@ -700,7 +700,7 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr); /* We have to set default context! Else we get a void string... */ - strcpy(dummymt.translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + strcpy(dummymt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* validate the python class */ if (validate(&dummymtr, data, have_function) != 0) @@ -936,7 +936,7 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Panel"); RNA_def_struct_refine_func(srna, "rna_Panel_refine"); RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL); - RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* poll */ func = RNA_def_function(srna, "poll", NULL); @@ -986,7 +986,7 @@ static void rna_def_panel(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); - RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_define_verify_sdna(true); @@ -1206,7 +1206,7 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Menu"); RNA_def_struct_refine_func(srna, "rna_Menu_refine"); RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL); - RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); /* poll */ func = RNA_def_function(srna, "poll", NULL); @@ -1247,7 +1247,7 @@ static void rna_def_menu(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); - RNA_def_property_string_default(prop, BLF_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 395347ce047..81b6a77f683 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -34,7 +34,7 @@ #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -64,13 +64,13 @@ static const char *rna_translate_ui_text(const char *text, const char *text_ctxt int translate) { /* Also return text if UI labels translation is disabled. */ - if (!text || !text[0] || !translate || !BLF_translate_iface()) { + if (!text || !text[0] || !translate || !BLT_translate_iface()) { return text; } /* If a text_ctxt is specified, use it! */ if (text_ctxt && text_ctxt[0]) { - return BLF_pgettext(text_ctxt, text); + return BLT_pgettext(text_ctxt, text); } /* Else, if an RNA type or property is specified, use its context. */ @@ -82,17 +82,17 @@ static const char *rna_translate_ui_text(const char *text, const char *text_ctxt * if default context is not suitable. */ if (prop) { - return BLF_pgettext(RNA_property_translation_context(prop), text); + return BLT_pgettext(RNA_property_translation_context(prop), text); } #else (void)prop; #endif if (type) { - return BLF_pgettext(RNA_struct_translation_context(type), text); + return BLT_pgettext(RNA_struct_translation_context(type), text); } /* Else, default context! */ - return BLF_pgettext(BLF_I18NCONTEXT_DEFAULT, text); + return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text); } static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt, diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 6a1f9650752..7017f0ccc4e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -49,7 +49,7 @@ #include "WM_api.h" #include "WM_types.h" -#include "BLF_translation.h" +#include "BLT_lang.h" #include "GPU_buffers.h" #ifdef WITH_CYCLES @@ -157,7 +157,7 @@ static void rna_userdef_virtual_pixel_update(Main *UNUSED(bmain), Scene *UNUSED( static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { BLF_cache_clear(); - BLF_lang_set(NULL); + BLT_lang_set(NULL); UI_reinit_font(); } @@ -646,6 +646,9 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi #endif #endif + /* may be unused */ + UNUSED_VARS(index, audio_device_items); + RNA_enum_item_end(&item, &totitem); *r_free = true; @@ -656,7 +659,7 @@ static EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C), Poi static EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - return BLF_RNA_lang_enum_properties(); + return BLT_lang_RNA_enum_properties(); } #endif @@ -4319,7 +4322,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "opensubdiv_compute_type"); RNA_def_property_enum_items(prop, opensubdiv_compute_type_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_opensubdiv_compute_type_itemf"); - RNA_def_property_ui_text(prop, "OpenSubdiv Compute Type", "Type of computer backend used with OpenSubdiv"); + RNA_def_property_ui_text(prop, "OpenSubdiv Compute Type", "Type of computer back-end used with OpenSubdiv"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_userdef_opensubdiv_update"); #endif } diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c index 0879f4d355d..e9ba0c78439 100644 --- a/source/blender/makesrna/intern/rna_vfont.c +++ b/source/blender/makesrna/intern/rna_vfont.c @@ -48,9 +48,9 @@ static int rna_VectorFont_filepath_editable(PointerRNA *ptr) { VFont *vfont = ptr->id.data; if (BKE_vfont_is_builtin(vfont)) { - return false; + return 0; } - return true; + return PROP_EDITABLE; } static void rna_VectorFont_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 86c6d432f9d..5091760a7ec 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -33,7 +33,7 @@ #include "BLI_utildefines.h" -#include "BLF_translation.h" +#include "BLT_translation.h" #include "RNA_access.h" #include "RNA_define.h" @@ -615,6 +615,11 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) { wmWindow *win = (wmWindow *)ptr->data; + /* disallow ID-browsing away from temp screens */ + if (win->screen->temp) { + return; + } + if (value.data == NULL) return; @@ -1144,7 +1149,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void * /* clear in case they are left unset */ _operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0'; /* We have to set default op context! */ - strcpy(_operator_ctxt, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + strcpy(_operator_ctxt, BLT_I18NCONTEXT_OPERATOR_DEFAULT); /* validate the python class */ if (validate(&dummyotr, data, have_function) != 0) @@ -1271,7 +1276,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v /* clear in case they are left unset */ _operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0'; /* We have to set default op context! */ - strcpy(_operator_ctxt, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + strcpy(_operator_ctxt, BLT_I18NCONTEXT_OPERATOR_DEFAULT); /* validate the python class */ if (validate(&dummyotr, data, have_function) != 0) @@ -1434,7 +1439,7 @@ static void rna_def_operator(BlenderRNA *brna) #ifdef WITH_PYTHON RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif - RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1483,7 +1488,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); - RNA_def_property_string_default(prop, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ @@ -1528,7 +1533,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance"); #endif - RNA_def_struct_translation_context(srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); @@ -1561,7 +1566,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->translation_context"); RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set"); - RNA_def_property_string_default(prop, BLF_I18NCONTEXT_OPERATOR_DEFAULT); + RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ @@ -1669,6 +1674,7 @@ static void rna_def_event(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Type", ""); @@ -2115,6 +2121,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "type"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf"); RNA_def_property_ui_text(prop, "Type", "Type of event"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); @@ -2172,6 +2179,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "keymodifier"); RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS); RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL); RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); |