diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 14:43:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 14:43:25 +0400 |
commit | 460cde345bd7779f7dc011b7154c7497be46d799 (patch) | |
tree | 36e29196b072abba9027327ac87cf881b03faa32 /source/blender/makesrna | |
parent | d92b5ea04ac8b661bb8caa7a1ca813e8f33a5a1c (diff) | |
parent | f0aac81466bb5b3a935d74d3a35b545002b0451b (diff) |
svn merge ^/trunk/blender -r40394:40395
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 10 | ||||
-rw-r--r-- | source/blender/makesrna/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 72 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 72 |
6 files changed, 125 insertions, 39 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index bfcf8f44613..2314a939e2a 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -49,7 +49,10 @@ struct Scene; extern BlenderRNA BLENDER_RNA; extern StructRNA RNA_Action; extern StructRNA RNA_ActionConstraint; +extern StructRNA RNA_ActionFCurves; extern StructRNA RNA_ActionGroup; +extern StructRNA RNA_ActionGroups; +extern StructRNA RNA_ActionPoseMarkers; extern StructRNA RNA_Actuator; extern StructRNA RNA_ActuatorSensor; extern StructRNA RNA_Addon; @@ -190,6 +193,7 @@ extern StructRNA RNA_DelaySensor; extern StructRNA RNA_DisplaceModifier; extern StructRNA RNA_DistortedNoiseTexture; extern StructRNA RNA_DomainFluidSettings; +extern StructRNA RNA_DopeSheet; extern StructRNA RNA_Driver; extern StructRNA RNA_DriverTarget; extern StructRNA RNA_DriverVariable; @@ -260,11 +264,13 @@ extern StructRNA RNA_Key; extern StructRNA RNA_KeyConfig; extern StructRNA RNA_KeyMap; extern StructRNA RNA_KeyMapItem; +extern StructRNA RNA_KeyMapItems; extern StructRNA RNA_KeyboardSensor; extern StructRNA RNA_Keyframe; extern StructRNA RNA_KeyingSet; extern StructRNA RNA_KeyingSetInfo; extern StructRNA RNA_KeyingSetPath; +extern StructRNA RNA_KeyingSetsAll; extern StructRNA RNA_KinematicConstraint; extern StructRNA RNA_Lamp; extern StructRNA RNA_LampSkySettings; @@ -554,6 +560,7 @@ extern StructRNA RNA_UnknownType; extern StructRNA RNA_UserPreferences; extern StructRNA RNA_UserPreferencesEdit; extern StructRNA RNA_UserPreferencesFilePaths; +extern StructRNA RNA_UserPreferencesInput; extern StructRNA RNA_UserPreferencesSystem; extern StructRNA RNA_UserPreferencesView; extern StructRNA RNA_UserSolidLight; @@ -575,13 +582,13 @@ extern StructRNA RNA_WipeSequence; extern StructRNA RNA_WoodTexture; extern StructRNA RNA_World; extern StructRNA RNA_WorldAmbientOcclusion; +extern StructRNA RNA_WorldLighting; extern StructRNA RNA_WorldMistSettings; extern StructRNA RNA_WorldStarsSettings; extern StructRNA RNA_WorldTextureSlot; extern StructRNA RNA_XnorController; extern StructRNA RNA_XorController; - /* Pointer * * These functions will fill in RNA pointers, this can be done in three ways: @@ -691,6 +698,7 @@ int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name); int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description); void RNA_property_enum_items(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free); +void RNA_property_enum_items_gettexted(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free); int RNA_property_enum_value(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value); int RNA_property_enum_identifier(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); int RNA_property_enum_name(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index 88ef8635afd..17c2c5c1bd6 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -62,4 +62,7 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] +if env['WITH_BF_INTERNATIONAL']: + defs.append('INTERNATIONAL') + env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 470d4b6ad58..f429b84d477 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -219,6 +219,10 @@ if(WITH_OPENCOLLADA) add_definitions(-DWITH_COLLADA) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DINTERNATIONAL) +endif() + # Build makesrna executable blender_include_dirs( . diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index e1aaab262ac..83149a5308a 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -98,6 +98,9 @@ if env['OURPLATFORM'] == 'linux': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] +if env['WITH_BF_INTERNATIONAL']: + defs.append('INTERNATIONAL') + makesrna_tool.Append(CPPDEFINES=defs) makesrna_tool.Append (CPPPATH = Split(incs)) diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 5dad7112eb9..b7709416a75 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -43,6 +43,9 @@ #include "BLI_dynstr.h" #include "BLI_ghash.h" +#include "BLF_api.h" +#include "BLF_translation.h" + #include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_idprop.h" @@ -449,8 +452,10 @@ static const char *rna_ensure_property_identifier(PropertyRNA *prop) static const char *rna_ensure_property_description(PropertyRNA *prop) { + const char *description= NULL; + if(prop->magic == RNA_MAGIC) - return prop->description; + description= prop->description; else { /* attempt to get the local ID values */ IDProperty *idp_ui= rna_idproperty_ui(prop); @@ -458,19 +463,36 @@ static const char *rna_ensure_property_description(PropertyRNA *prop) if(idp_ui) { IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING); if(item) - return IDP_String(item); + description= IDP_String(item); } - return ((IDProperty*)prop)->name; /* XXX - not correct */ + if(description == NULL) + description= ((IDProperty*)prop)->name; /* XXX - not correct */ } + +#ifdef INTERNATIONAL + if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS)) + description= BLF_gettext(description); +#endif + + return description; } static const char *rna_ensure_property_name(PropertyRNA *prop) { + const char *name; + if(prop->magic == RNA_MAGIC) - return prop->name; + name= prop->name; else - return ((IDProperty*)prop)->name; + name= ((IDProperty*)prop)->name; + +#ifdef INTERNATIONAL + if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) + name= BLF_gettext(name); +#endif + + return name; } /* Structs */ @@ -1125,6 +1147,7 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En *totitem= tot; } + } else { *item= eprop->item; @@ -1133,6 +1156,45 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En } } +void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free) +{ + RNA_property_enum_items(C, ptr, prop, item, totitem, free); + +#ifdef INTERNATIONAL + if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) { + int i; + EnumPropertyItem *nitem; + + if(*free) { + nitem= *item; + } else { + int totitem= 0; + + /* count */ + for(i=0; (*item)[i].identifier; i++) + totitem++; + + nitem= MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted"); + + for(i=0; (*item)[i].identifier; i++) + nitem[i]= (*item)[i]; + + *free= 1; + } + + for(i=0; nitem[i].identifier; i++) { + if( nitem[i].name ) + nitem[i].name = BLF_gettext(nitem[i].name); + if( nitem[i].description ) + nitem[i].description = BLF_gettext(nitem[i].description); + } + + *item= nitem; + } +#endif +} + + int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value) { EnumPropertyItem *item, *item_array; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7a5899afd73..b9a53acd6f4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -44,6 +44,7 @@ #include "WM_types.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" #include "BKE_sound.h" @@ -76,6 +77,11 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL); /* refresh region sizes */ } +static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + BLF_lang_set(NULL); +} + static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, PointerRNA *ptr) { UserDef *userdef = (UserDef *)ptr->data; @@ -2463,30 +2469,35 @@ static void rna_def_userdef_system(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; /* hardcoded here, could become dynamic somehow */ + /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */ + /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ static EnumPropertyItem language_items[] = { - {0, "ENGLISH", 0, "English", ""}, - {1, "JAPANESE", 0, "Japanese", ""}, - {2, "DUTCH", 0, "Dutch", ""}, - {3, "ITALIAN", 0, "Italian", ""}, - {4, "GERMAN", 0, "German", ""}, - {5, "FINNISH", 0, "Finnish", ""}, - {6, "SWEDISH", 0, "Swedish", ""}, - {7, "FRENCH", 0, "French", ""}, - {8, "SPANISH", 0, "Spanish", ""}, - {9, "CATALAN", 0, "Catalan", ""}, - {10, "CZECH", 0, "Czech", ""}, - {11, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese", ""}, - {12, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese", ""}, - {13, "RUSSIAN", 0, "Russian", ""}, - {14, "CROATIAN", 0, "Croatian", ""}, - {15, "SERBIAN", 0, "Serbian", ""}, - {16, "UKRAINIAN", 0, "Ukrainian", ""}, - {17, "POLISH", 0, "Polish", ""}, - {18, "ROMANIAN", 0, "Romanian", ""}, - {19, "ARABIC", 0, "Arabic", ""}, - {20, "BULGARIAN", 0, "Bulgarian", ""}, - {21, "GREEK", 0, "Greek", ""}, - {22, "KOREAN", 0, "Korean", ""}, + {0, "DEFAULT", 0, N_("Default (Default)"), ""}, + {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, + {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"}, + {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"}, + {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"}, + {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"}, + {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"}, + {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"}, + {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, + {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, + {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"}, + {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"}, + {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"}, + {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, + {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"}, + {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"}, + {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"}, + {17, "SERBIAN", 0, N_("Serbian (Српском језику)"), "sr_RS"}, + {18, "UKRAINIAN", 0, N_("Ukrainian (Український)"), "uk_UA"}, + {19, "POLISH", 0, N_("Polish (Polski)"), "pl_PL"}, + {20, "ROMANIAN", 0, N_("Romanian (Român)"), "ro_RO"}, + {21, "ARABIC", 0, N_("Arabic (العربية)"), "ar_EG"}, + {22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"}, + {23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"}, + {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"}, + /*{25, "Nepali", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/ {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); @@ -2499,7 +2510,7 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE); RNA_def_property_ui_text(prop, "International Fonts", "Use international fonts"); - RNA_def_property_update(prop, 0, "rna_userdef_update"); + RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update"); prop= RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "dpi"); @@ -2522,21 +2533,16 @@ static void rna_def_userdef_system(BlenderRNA *brna) prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, language_items); RNA_def_property_ui_text(prop, "Language", "Language use for translation"); - RNA_def_property_update(prop, 0, "rna_userdef_update"); + RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update"); prop= RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS); RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate Tooltips"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop= RNA_def_property(srna, "use_translate_buttons", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_BUTTONS); - RNA_def_property_ui_text(prop, "Translate Buttons", "Translate button labels"); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop= RNA_def_property(srna, "use_translate_toolbox", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_MENUS); - RNA_def_property_ui_text(prop, "Translate Toolbox", "Translate toolbox menu"); + prop= RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE); + RNA_def_property_ui_text(prop, "Translate Interface", "Translate Interface"); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE); |