diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-10-22 20:43:23 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-10-22 20:43:23 +0400 |
commit | d4541fd891a246f851f647c3259fc26648fc926d (patch) | |
tree | 5397c3a85424b8c08854fa4f9711db4344a790b7 /source/blender/editors | |
parent | 30cba27987362054d16b10e73ddf2601af93be68 (diff) | |
parent | 952560dc028516d60a5318eadbcbd5f2c0668335 (diff) |
Merge with trunk r41197
Diffstat (limited to 'source/blender/editors')
85 files changed, 588 insertions, 507 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 7f05a7c2b1a..b4a86e5d74c 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2447,7 +2447,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); WM_keymap_add_item(keymap, "ANIM_OT_channels_setting_disable", WKEY, KM_PRESS, KM_ALT, 0); - /* settings - specialised hotkeys */ + /* settings - specialized hotkeys */ WM_keymap_add_item(keymap, "ANIM_OT_channels_editable_toggle", TABKEY, KM_PRESS, 0, 0); /* expand/collapse */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index c982a1d7f86..fe6aed77462 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -361,7 +361,8 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac) _doSubChannels=2; \ else {\ filter_mode |= ANIMFILTER_TMP_PEEK; \ - } + } \ + (void) _doSubChannels; /* ... standard sub-channel filtering can go on here now ... */ #define END_ANIMFILTER_SUBCHANNELS \ filter_mode = _filter; \ diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 383e0bac796..d18a3c320f7 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -118,7 +118,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) PropertyRNA *nameprop= RNA_struct_name_property(ptr.type); if (nameprop) { /* this gets a string which will need to be freed */ - structname= RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0); + structname= RNA_property_string_get_alloc(&ptr, nameprop, NULL, 0, NULL); free_structname= 1; } else diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 20368bbf57b..11fd932eed6 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -824,7 +824,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -871,7 +871,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } else if (strcmp(ct->subtarget, pchan->name)==0) { ct->tar = tarArm; - strcpy(ct->subtarget, curbone->name); + BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget)); } } } @@ -2503,7 +2503,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj */ if (oldtarget->temp) { newtarget = (EditBone *) oldtarget->temp; - strcpy(ct->subtarget, newtarget->name); + BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget)); } } } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index bf2e17c4e87..8e9f5c7543c 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -409,15 +409,15 @@ static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); /* add new (adds to the first unoccupied frame) */ - uiItemIntO(layout, UI_translate_do_iface(N_("Add New")), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); + uiItemIntO(layout, IFACE_("Add New"), ICON_NONE, "POSELIB_OT_pose_add", "frame", poselib_get_free_index(ob->poselib)); /* check if we have any choices to add a new pose in any other way */ if ((ob->poselib) && (ob->poselib->markers.first)) { /* add new (on current frame) */ - uiItemIntO(layout, UI_translate_do_iface(N_("Add New (Current Frame)")), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); + uiItemIntO(layout, IFACE_("Add New (Current Frame)"), ICON_NONE, "POSELIB_OT_pose_add", "frame", CFRA); /* replace existing - submenu */ - uiItemMenuF(layout, UI_translate_do_iface(N_("Replace Existing...")), 0, poselib_add_menu_invoke__replacemenu, NULL); + uiItemMenuF(layout, IFACE_("Replace Existing..."), 0, poselib_add_menu_invoke__replacemenu, NULL); } uiPupMenuEnd(C, pup); @@ -997,11 +997,8 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) } /* get marker name */ - if (pld->marker) - strcpy(markern, pld->marker->name); - else - strcpy(markern, "No Matches"); - + BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern)); + sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern); ED_area_headerprint(pld->sa, pld->headerstr); } @@ -1186,7 +1183,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm /* backup stuff that needs to occur before every operation * - make a copy of searchstr, so that we know if cache needs to be rebuilt */ - strcpy(pld->searchold, pld->searchstr); + BLI_strncpy(pld->searchold, pld->searchstr, sizeof(pld->searchold)); /* if we're currently showing the original pose, only certain events are handled */ if (pld->flag & PL_PREVIEW_SHOWORIGINAL) { diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 61935aa72ca..a978f327993 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1197,7 +1197,7 @@ void POSE_OT_paste (wmOperatorType *ot) /* identifiers */ ot->name= "Paste Pose"; ot->idname= "POSE_OT_paste"; - ot->description= "Pastes the stored pose on to the current pose"; + ot->description= "Paste the stored pose on to the current pose"; /* api callbacks */ ot->exec= pose_paste_exec; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 1f2ef79e091..c80f5c85c25 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -221,13 +221,13 @@ static void update_string(Curve *cu) MEM_freeN(cu->str); // Calculate the actual string length in UTF-8 variable characters - len = wcsleninu8(ef->textbuf); + len = BLI_wstrlen_utf8(ef->textbuf); // Alloc memory for UTF-8 variable char length string cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); // Copy the wchar to UTF-8 - wcs2utf8s(cu->str, ef->textbuf); + BLI_strncpy_wchar_as_utf8(cu->str, ef->textbuf, len + 1); } static int insert_into_textbuf(Object *obedit, uintptr_t c) @@ -373,7 +373,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename) if(cu->len+filelen<MAXTEXT) { int tmplen; wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary"); - tmplen = utf8towchar(mem, strp); + tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1); wcscat(ef->textbuf, mem); MEM_freeN(mem); cu->len += tmplen; @@ -1046,7 +1046,7 @@ void FONT_OT_change_spacing(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increasing character spacing with", -20, 20); + RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20); } /************************* change character **********************/ @@ -1241,10 +1241,10 @@ static int insert_text_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0); - len= strlen(inserted_utf8); + len= BLI_strlen_utf8(inserted_utf8); inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text"); - utf8towchar(inserted_text, inserted_utf8); + BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1); for(a=0; a<len; a++) insert_into_textbuf(obedit, inserted_text[a]); @@ -1289,10 +1289,22 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) else if(event==BACKSPACEKEY) ascii= 0; - if(val && ascii) { + if(val && (ascii || evt->utf8_buf[0])) { /* handle case like TAB (== 9) */ - if((ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || (ascii==10) || (ascii==8)) { - if(accentcode) { + if( (ascii > 31 && ascii < 254 && ascii != 127) || + (ascii==13) || + (ascii==10) || + (ascii==8) || + (evt->utf8_buf[0])) + { + + if (evt->utf8_buf[0]) { + BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1); + ascii= inserted_text[0]; + insert_into_textbuf(obedit, ascii); + accentcode= 0; + } + else if(accentcode) { if(cu->pos>0) { inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii); ef->textbuf[cu->pos-1]= inserted_text[0]; @@ -1348,7 +1360,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt) /* store as utf8 in RNA string */ char inserted_utf8[8] = {0}; - wcs2utf8s(inserted_utf8, inserted_text); + BLI_strncpy_wchar_as_utf8(inserted_utf8, inserted_text, sizeof(inserted_utf8)); RNA_string_set(op->ptr, "text", inserted_utf8); } @@ -1478,7 +1490,7 @@ void make_editText(Object *obedit) } // Convert the original text to wchar_t - utf8towchar(ef->textbuf, cu->str); + BLI_strncpy_wchar_from_utf8(ef->textbuf, cu->str, MAXTEXT+4); /* length is bogus */ wcscpy(ef->oldstr, ef->textbuf); cu->len= wcslen(ef->textbuf); diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 937d24eed04..56210864593 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -259,7 +259,7 @@ void duplicate_gplayer_frames (bGPDlayer *gpl) /* Copy and Paste Tools */ /* - The copy/paste buffer currently stores a set of GP_Layers, with temporary * GP_Frames with the necessary strokes - * - Unless there is only one element in the buffer, names are also tested to check for compatability. + * - Unless there is only one element in the buffer, names are also tested to check for compatibility. * - All pasted frames are offset by the same amount. This is calculated as the difference in the times of * the current frame and the 'first keyframe' (i.e. the earliest one in all channels). * - The earliest frame is calculated per copy operation. @@ -311,7 +311,7 @@ void copy_gpdata () gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer"); gpln->frames.first= gpln->frames.last= NULL; - strcpy(gpln->info, gpls->info); + BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info)); BLI_addtail(&gpcopybuf, gpln); diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 3c810f7da2d..0ac5a9e46ce 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -123,7 +123,7 @@ typedef struct bAnimListElem { /* Some types for easier type-testing - * NOTE: need to keep the order of these synchronised with the channels define code + * NOTE: need to keep the order of these synchronized with the channels define code * which is used for drawing and handling channel lists for */ typedef enum eAnim_ChannelType { diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 1eedd7ec782..df4113ca07a 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -106,7 +106,7 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile); void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile); -int ED_file_extension_icon(char *relname); +int ED_file_extension_icon(const char *relname); #endif /* ED_FILES_H */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index a06497889d9..43f6b36f5eb 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -813,5 +813,9 @@ int UI_translate_tooltips(void); const char *UI_translate_do_iface(const char *msgid); const char *UI_translate_do_tooltip(const char *msgid); +/* Those macros should be used everywhere in UI code. */ +#define IFACE_(msgid) UI_translate_do_iface(msgid) +#define TIP_(msgid) UI_translate_do_tooltip(msgid) + #endif /* UI_INTERFACE_H */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a816c1612a1..b7b572e7217 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -575,7 +575,7 @@ static void ui_draw_links(uiBlock *block) /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ static int ui_but_equals_old(uiBut *but, uiBut *oldbut) { - /* various properties are being compared here, hopfully sufficient + /* various properties are being compared here, hopefully sufficient * to catch all cases, but it is simple to add more checks later */ if(but->retval != oldbut->retval) return 0; if(but->rnapoin.data != oldbut->rnapoin.data) return 0; @@ -640,7 +640,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut // but->flag= oldbut->flag; #else /* exception! redalert flag can't be update from old button. - * perhaps it should only copy spesific flags rather than all. */ + * perhaps it should only copy specific flags rather than all. */ // but->flag= (oldbut->flag & ~UI_BUT_REDALERT) | (but->flag & UI_BUT_REDALERT); #endif // but->active= oldbut->active; @@ -748,7 +748,7 @@ static int ui_but_is_rna_undo(uiBut *but) if(but->rnapoin.id.data) { /* avoid undo push for buttons who's ID are screen or wm level * we could disable undo for buttons with no ID too but may have - * unforseen conciquences, so best check for ID's we _know_ are not + * unforeseen consequences, so best check for ID's we _know_ are not * handled by undo - campbell */ ID *id= but->rnapoin.id.data; if(ID_CHECK_UNDO(id) == FALSE) { @@ -865,7 +865,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) /* inherit flags from 'old' buttons that was drawn here previous, based * on matching buttons, we need this to make button event handling non - * blocking, while still alowing buttons to be remade each redraw as it + * blocking, while still allowing buttons to be remade each redraw as it * is expected by blender code */ for(but=block->buttons.first; but; but=but->next) { if(ui_but_update_from_old_block(C, block, &but)) @@ -1211,7 +1211,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but) * an edit override pointer while dragging for example */ /* for buttons pointing to color for example */ -void ui_get_but_vectorf(uiBut *but, float *vec) +void ui_get_but_vectorf(uiBut *but, float vec[3]) { PropertyRNA *prop; int a, tot; @@ -1249,27 +1249,34 @@ void ui_get_but_vectorf(uiBut *but, float *vec) vec[0]= vec[1]= vec[2]= 0.0f; } } + + if (but->type == BUT_NORMAL) { + normalize_v3(vec); + } } /* for buttons pointing to color for example */ -void ui_set_but_vectorf(uiBut *but, float *vec) +void ui_set_but_vectorf(uiBut *but, const float vec[3]) { PropertyRNA *prop; - int a, tot; if(but->editvec) { - VECCOPY(but->editvec, vec); + copy_v3_v3(but->editvec, vec); } if(but->rnaprop) { prop= but->rnaprop; if(RNA_property_type(prop) == PROP_FLOAT) { + int tot; + int a; + tot= RNA_property_array_length(&but->rnapoin, prop); tot= MIN2(tot, 3); - for(a=0; a<tot; a++) + for (a=0; a<tot; a++) { RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]); + } } } else if(but->pointype == CHA) { @@ -1280,7 +1287,7 @@ void ui_set_but_vectorf(uiBut *but, float *vec) } else if(but->pointype == FLO) { float *fp= (float *)but->poin; - VECCOPY(fp, vec); + copy_v3_v3(fp, vec); } } @@ -1586,17 +1593,18 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen) if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) { PropertyType type; char *buf= NULL; + int buf_len; type= RNA_property_type(but->rnaprop); if(type == PROP_STRING) { /* RNA string */ - buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen); + buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len); } else if(type == PROP_POINTER) { /* RNA pointer */ PointerRNA ptr= RNA_property_pointer_get(&but->rnapoin, but->rnaprop); - buf= RNA_struct_name_get_alloc(&ptr, str, maxlen); + buf= RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len); } if(!buf) { @@ -1604,7 +1612,7 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen) } else if(buf && buf != str) { /* string was too long, we have to truncate */ - BLI_strncpy(str, buf, maxlen); + memcpy(str, buf, MIN2(maxlen, buf_len+1)); MEM_freeN(buf); } } @@ -1740,7 +1748,9 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) } else if(but->type == TEX) { /* string */ - BLI_strncpy(but->poin, str, but->hardmax); + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax); + else BLI_strncpy(but->poin, str, but->hardmax); + return 1; } else if(but->type == SEARCH_MENU) { @@ -2552,6 +2562,24 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, if(block->curlayout) ui_layout_add_but(block->curlayout, but); +#ifdef WITH_PYTHON_UI_INFO + { + extern void PyC_FileAndNum_Safe(const char **filename, int *lineno); + + const char *fn; + int lineno= -1; + PyC_FileAndNum_Safe(&fn, &lineno); + if (lineno != -1) { + BLI_strncpy(but->py_dbg_fn, fn, sizeof(but->py_dbg_fn)); + but->py_dbg_ln= lineno; + } + else { + but->py_dbg_fn[0]= '\0'; + but->py_dbg_ln= -1; + } + } +#endif /* WITH_PYTHON_UI_INFO */ + return but; } @@ -2746,10 +2774,7 @@ static uiBut *ui_def_but_operator(uiBlock *block, int type, const char *opname, if ((!tip || tip[0]=='\0') && ot && ot->description) { tip= ot->description; -#ifdef WITH_INTERNATIONAL - if(UI_translate_tooltips()) - tip= BLF_gettext(tip); -#endif + tip = TIP_(tip); } but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip); diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index c35996701ee..aeb8ad99dd2 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -38,6 +38,7 @@ #include "BLI_listbase.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -115,7 +116,7 @@ int ui_but_anim_expression_set(uiBut *but, const char *str) driver= fcu->driver; if(driver && driver->type == DRIVER_TYPE_PYTHON) { - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); driver->flag |= DRIVER_FLAG_RECOMPILE; WM_event_add_notifier(but->block->evil_C, NC_ANIMATION|ND_KEYFRAME, NULL); return 1; @@ -164,7 +165,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) /* set the expression */ // TODO: need some way of identifying variables used - BLI_strncpy(driver->expression, str, sizeof(driver->expression)); + BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression)); /* FIXME: for now, assume that * - for expressions, users are likely to be using "frame" -> current frame" as a variable @@ -179,6 +180,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) dtar = &dvar->targets[0]; dtar->id = (ID *)CTX_data_scene(C); // XXX: should we check that C is valid first? + dtar->idtype= ID_SCE; dtar->rna_path = BLI_sprintfN("frame_current"); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index a40900fb39b..aefe773fdad 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -600,13 +600,13 @@ static void ui_draw_but_CHARTAB(uiBut *but) wstr[0] = cs; if(strcmp(G.selfont->name, FO_BUILTIN_NAME)) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { if(G.ui_international == TRUE) { - wcs2utf8s((char *)ustr, (wchar_t *)wstr); + BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr)); } else { diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9af9b2f55ad..32c4ec21e13 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -107,6 +107,12 @@ typedef enum uiHandleButtonState { BUTTON_STATE_EXIT } uiHandleButtonState; +typedef enum uiButtonJumpType { + BUTTON_EDIT_JUMP_NONE, + BUTTON_EDIT_JUMP_DELIM, + BUTTON_EDIT_JUMP_ALL +} uiButtonJumpType; + typedef struct uiHandleButtonData { wmWindowManager *wm; wmWindow *window; @@ -260,7 +266,7 @@ static int ui_is_a_warp_but(uiBut *but) } /* file selectors are exempt from utf-8 checks */ -static int ui_is_utf8_but(uiBut *but) +int ui_is_but_utf8(uiBut *but) { if (but->rnaprop) { const int subtype= RNA_property_subtype(but->rnaprop); @@ -1163,7 +1169,10 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, } else { button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); - BLI_strncpy(active_data->str, buf, active_data->maxlen); + + if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen); + else BLI_strncpy(active_data->str, buf, active_data->maxlen); + if(but->type == SEARCH_MENU) { /* else uiSearchboxData.active member is not updated [#26856] */ ui_searchbox_update(C, data->searchbox, but, 1); @@ -1252,6 +1261,86 @@ static short test_special_char(char ch) return 0; } +static int ui_textedit_step_next_utf8(const char *str, size_t maxlen, short *pos) +{ + const char *str_end= str + (maxlen + 1); + const char *str_pos= str + (*pos); + const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end); + if (str_next) { + (*pos) += (str_next - str_pos); + if((*pos) > maxlen) (*pos)= maxlen; + return TRUE; + } + + return FALSE; +} + +static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short *pos) +{ + if((*pos) > 0) { + const char *str_pos= str + (*pos); + const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos); + if (str_prev) { + (*pos) -= (str_pos - str_prev); + return TRUE; + } + } + + return FALSE; +} + +static void ui_textedit_step_utf8(const char *str, size_t maxlen, + short *pos, const char direction, + uiButtonJumpType jump) +{ + const short pos_prev= *pos; + + if(direction) { /* right*/ + if(jump != BUTTON_EDIT_JUMP_NONE) { + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while((*pos) < maxlen) { + if (ui_textedit_step_next_utf8(str, maxlen, pos)) { + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; + } + else { + break; /* unlikely but just incase */ + } + } + } + else { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { /* left */ + if(jump != BUTTON_EDIT_JUMP_NONE) { + /* left only: compensate for index/change in direction */ + ui_textedit_step_prev_utf8(str, maxlen, pos); + + /* jump between special characters (/,\,_,-, etc.), + * look at function test_special_char() for complete + * list of special character, ctr -> */ + while ((*pos) > 0) { + if (ui_textedit_step_prev_utf8(str, maxlen, pos)) { + if((jump != BUTTON_EDIT_JUMP_ALL) && test_special_char(str[(*pos)])) break; + } + else { + break; + } + } + + /* left only: compensate for index/change in direction */ + if(((*pos) != 0) && ABS(pos_prev - (*pos)) > 1) { + ui_textedit_step_next_utf8(str, maxlen, pos); + } + } + else { + ui_textedit_step_prev_utf8(str, maxlen, pos); + } + } +} + static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data) { char *str= data->str; @@ -1294,13 +1383,17 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* mouse dragged outside the widget to the left */ if (x < startx && but->ofs > 0) { - int i= but->ofs; + short i= but->ofs; origstr[but->ofs] = 0; while (i > 0) { - i--; - if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &i)) { + if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break; // 0.25 == scale factor for less sensitivity + } + else { + break; /* unlikely but possible */ + } } but->ofs = i; but->pos = but->ofs; @@ -1314,9 +1407,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* XXX does not take zoom level into account */ while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) { if (but->pos <= 0) break; - but->pos--; - origstr[but->pos+but->ofs] = 0; - } + if (ui_textedit_step_prev_utf8(origstr, but->ofs, &but->pos)) { + origstr[but->pos+but->ofs] = 0; + } + else { + break; /* unlikely but possible */ + } + } but->pos += but->ofs; if(but->pos<0) but->pos= 0; } @@ -1340,27 +1437,28 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, ui_check_but(but); } -static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) +/* note: utf8 & ascii funcs should be merged */ +static int ui_textedit_type_utf8(uiBut *but, uiHandleButtonData *data, const char utf8_buf[6]) { char *str; - int len, x, changed= 0; + int len, changed= 0; str= data->str; len= strlen(str); if(len-(but->selend - but->selsta)+1 <= data->maxlen) { + int step= BLI_strnlen(utf8_buf, sizeof(utf8_buf)); + /* type over the current selection */ - if ((but->selend - but->selsta) > 0) + if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); + len= strlen(str); + } - len= strlen(str); - if(len+1 < data->maxlen) { - for(x= data->maxlen; x>but->pos; x--) - str[x]= str[x-1]; - str[but->pos]= ascii; - str[len+1]= '\0'; - - but->pos++; + if(len + step < data->maxlen) { + memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos); + memcpy(&str[but->pos], utf8_buf, step * sizeof(char)); + but->pos += step; changed= 1; } } @@ -1368,7 +1466,13 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc return changed; } -static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump, int jump_all) +static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii) +{ + char utf8_buf[6]= {ascii, '\0'}; + return ui_textedit_type_utf8(but, data, utf8_buf); +} + +static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, uiButtonJumpType jump) { const char *str= data->str; const int len= strlen(str); @@ -1377,7 +1481,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction /* special case, quit selection and set cursor */ if (has_sel && !select) { - if (jump_all) { + if (jump == BUTTON_EDIT_JUMP_ALL) { but->selsta = but->selend= but->pos = direction ? len : 0; } else { @@ -1391,48 +1495,7 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction data->selextend = 0; } else { - if(direction) { /* right*/ - if(jump) { - /* jump between special characters (/,\,_,-, etc.), - * look at function test_special_char() for complete - * list of special character, ctr -> */ - while(but->pos < len) { - but->pos++; - if(!jump_all && test_special_char(str[but->pos])) break; - } - } - else { - but->pos++; - if(but->pos > len) but->pos= len; - } - } - else { /* left */ - if(jump) { - - /* left only: compensate for index/change in direction */ - if(but->pos > 0) { - but->pos--; - } - - /* jump between special characters (/,\,_,-, etc.), - * look at function test_special_char() for complete - * list of special character, ctr -> */ - while(but->pos > 0){ - but->pos--; - if(!jump_all && test_special_char(str[but->pos])) break; - } - - /* left only: compensate for index/change in direction */ - if((but->pos != 0) && ABS(pos_prev - but->pos) > 1) { - but->pos++; - } - - } - else { - if(but->pos>0) but->pos--; - } - } - + ui_textedit_step_utf8(str, len, &but->pos, direction, jump); if(select) { /* existing selection */ @@ -1481,69 +1544,43 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction } } -static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, const int all, const int jump) +static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, uiButtonJumpType jump) { char *str= data->str; const int len= strlen(str); - int x, changed= 0; + int changed= 0; - if(all) { + if(jump == BUTTON_EDIT_JUMP_ALL) { if(len) changed=1; - str[0]= 0; + str[0]= '\0'; but->pos= 0; } else if(direction) { /* delete */ if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } - else if(but->pos>=0 && but->pos<len) { + else if (but->pos>=0 && but->pos<len) { + short pos= but->pos; int step; - - if (jump) { - x = but->pos; - step= 0; - while(x < len) { - x++; - step++; - if(test_special_char(str[x])) break; - } - } - else { - step= 1; - } - - for(x=but->pos; x<len; x++) - str[x]= str[x+step]; - str[len-step]='\0'; + ui_textedit_step_utf8(str, len, &pos, direction, jump); + step= pos - but->pos; + memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos); changed= 1; } } else { /* backspace */ - if(len!=0) { + if (len != 0) { if ((but->selend - but->selsta) > 0) { changed= ui_textedit_delete_selection(but, data); } else if(but->pos>0) { + short pos= but->pos; int step; - if (jump) { - x = but->pos; - step= 0; - while(x > 0) { - x--; - step++; - if((step > 1) && test_special_char(str[x])) break; - } - } - else { - step= 1; - } - - for(x=but->pos; x<len; x++) - str[x-step]= str[x]; - str[len-step]='\0'; - + ui_textedit_step_utf8(str, len, &pos, direction, jump); + step= but->pos - pos; + memmove(&str[but->pos - step], &str[but->pos], (len + 1) - but->pos); but->pos -= step; changed= 1; } @@ -1653,19 +1690,9 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) ui_get_but_string(but, data->str, data->maxlen); if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { - /* XXX: we dont have utf editing yet so for numbers its best to strip out utf chars - * this is so the deg' synbol isnt included in number editing fields: bug 22274 */ - int i; - for(i=0; data->str[i]; i++) { - if(!isascii(data->str[i])) { - /* no stripping actually: just convert to alt name */ - ui_convert_to_unit_alt_name(but, data->str, data->maxlen); - break; - } - } + ui_convert_to_unit_alt_name(but, data->str, data->maxlen); } - - + data->origstr= BLI_strdup(data->str); data->selextend= 0; data->selstartx= 0; @@ -1690,7 +1717,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { - if(ui_is_utf8_but(but)) { + if(ui_is_but_utf8(but)) { int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if(strip) { @@ -1842,11 +1869,11 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } break; case RIGHTARROWKEY: - ui_textedit_move(but, data, 1, event->shift, event->ctrl, FALSE); + ui_textedit_move(but, data, 1, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case LEFTARROWKEY: - ui_textedit_move(but, data, 0, event->shift, event->ctrl, FALSE); + ui_textedit_move(but, data, 0, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case DOWNARROWKEY: @@ -1856,7 +1883,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case ENDKEY: - ui_textedit_move(but, data, 1, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 1, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case UPARROWKEY: @@ -1866,7 +1893,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle } /* pass on purposedly */ case HOMEKEY: - ui_textedit_move(but, data, 0, event->shift, TRUE, TRUE); + ui_textedit_move(but, data, 0, event->shift, BUTTON_EDIT_JUMP_ALL); retval= WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -1875,12 +1902,12 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle retval= WM_UI_HANDLER_BREAK; break; case DELKEY: - changed= ui_textedit_delete(but, data, 1, 0, event->ctrl); + changed= ui_textedit_delete(but, data, 1, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE); retval= WM_UI_HANDLER_BREAK; break; case BACKSPACEKEY: - changed= ui_textedit_delete(but, data, 0, event->shift, event->ctrl); + changed= ui_textedit_delete(but, data, 0, event->shift ? BUTTON_EDIT_JUMP_ALL : (event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE)); retval= WM_UI_HANDLER_BREAK; break; @@ -1903,7 +1930,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle break; } - if(event->ascii && (retval == WM_UI_HANDLER_CONTINUE)) { + if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) { char ascii = event->ascii; /* exception that's useful for number buttons, some keyboard @@ -1912,7 +1939,16 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->type == PADPERIOD && ascii == ',') ascii = '.'; - changed= ui_textedit_type_ascii(but, data, ascii); + if(event->utf8_buf[0]) { + /* keep this printf until utf8 is well tested */ + printf("%s: utf8 char '%s'\n", __func__, event->utf8_buf); + // strcpy(event->utf8_buf, "12345"); + changed= ui_textedit_type_utf8(but, data, event->utf8_buf); + } + else { + changed= ui_textedit_type_ascii(but, data, ascii); + } + retval= WM_UI_HANDLER_BREAK; } @@ -1966,8 +2002,6 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) { - float softrange, softmin, softmax; - if(but->type == BUT_CURVE) { but->editcumap= (CurveMapping*)but->poin; } @@ -1977,10 +2011,12 @@ static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) } else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) { ui_get_but_vectorf(but, data->origvec); - VECCOPY(data->vec, data->origvec); + copy_v3_v3(data->vec, data->origvec); but->editvec= data->vec; } else { + float softrange, softmin, softmax; + data->startvalue= ui_get_but_val(but); data->origvalue= data->startvalue; data->value= data->origvalue; @@ -2163,15 +2199,11 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data /* always set */ but->modifier_key = 0; - if(event->shift) - but->modifier_key |= KM_SHIFT; - if(event->alt) - but->modifier_key |= KM_ALT; - if(event->ctrl) - but->modifier_key |= KM_CTRL; - if(event->oskey) - but->modifier_key |= KM_OSKEY; - + if(event->shift) but->modifier_key |= KM_SHIFT; + if(event->alt) but->modifier_key |= KM_ALT; + if(event->ctrl) but->modifier_key |= KM_CTRL; + if(event->oskey) but->modifier_key |= KM_OSKEY; + ui_check_but(but); ED_region_tag_redraw(data->region); @@ -3004,6 +3036,9 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i /* button is presumed square */ /* if mouse moves outside of sphere, it does negative normal */ + /* note that both data->vec and data->origvec should be normalized + * else we'll get a hamrless but annoying jump when first clicking */ + fp= data->origvec; rad= (but->x2 - but->x1); radsq= rad*rad; @@ -3634,7 +3669,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt if(sel!= -1) { /* ok, we move a point */ /* deselect all if this one is deselect. except if we hold shift */ - if(event->shift==0) { + if(event->shift == FALSE) { for(a=0; a<cuma->totpoint; a++) cmp[a].flag &= ~SELECT; cmp[sel].flag |= SELECT; @@ -3673,7 +3708,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt if(!data->dragchange) { /* deselect all, select one */ - if(event->shift==0) { + if(event->shift == FALSE) { for(a=0; a<cuma->totpoint; a++) cmp[a].flag &= ~SELECT; cmp[data->dragsel].flag |= SELECT; @@ -4408,6 +4443,17 @@ static int ui_but_menu(bContext *C, uiBut *but) } } +#ifdef WITH_PYTHON_UI_INFO + if (but->py_dbg_ln != -1) { + PointerRNA ptr_props; + + WM_operator_properties_create(&ptr_props, "WM_OT_text_edit"); + RNA_string_set(&ptr_props, "filepath", but->py_dbg_fn); + RNA_int_set(&ptr_props, "line", but->py_dbg_ln); + uiItemFullO(layout, "WM_OT_text_edit", "Edit Source", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0); + } +#endif /* WITH_PYTHON_UI_INFO */ + uiPupMenuEnd(C, pup); return 1; @@ -4441,7 +4487,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) ui_but_drop (C, event, but, data); } /* handle keyframing */ - else if(event->type == IKEY && !ELEM3(1, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { + else if(event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { if(event->alt) ui_but_anim_delete_keyframe(C); else @@ -4452,7 +4498,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) return WM_UI_HANDLER_BREAK; } /* handle drivers */ - else if(event->type == DKEY && !ELEM3(1, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { + else if(event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { if(event->alt) ui_but_anim_remove_driver(C); else @@ -4463,7 +4509,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event) return WM_UI_HANDLER_BREAK; } /* handle keyingsets */ - else if(event->type == KKEY && !ELEM3(1, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { + else if(event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) { if(event->alt) ui_but_anim_remove_keyingset(C); else @@ -5933,9 +5979,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle case ZKEY: { if( (event->val == KM_PRESS) && - (event->shift == FALSE) && - (event->ctrl == FALSE) && - (event->oskey == FALSE) + (event->shift == FALSE) && + (event->ctrl == FALSE) && + (event->oskey == FALSE) ) { for(but= block->buttons.first; but; but= but->next) { diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 24434465f5f..f987aa9c4e6 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -47,7 +47,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "DNA_brush_types.h" @@ -525,6 +524,9 @@ static void init_internal_icons(void) bbuf= NULL; } } + else { + printf("%s: 'icons' data path not found, continuing\n", __func__); + } } if(bbuf==NULL) bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect); @@ -606,11 +608,11 @@ static void init_iconfile_list(struct ListBase *list) if(icondir==NULL) return; - /* since BLI_getdir changes the current working directory, restore it + /* since BLI_dir_contents changes the current working directory, restore it back to old value afterwards */ - if(!BLI_getwdN(olddir, sizeof(olddir))) + if(!BLI_current_working_dir(olddir, sizeof(olddir))) restoredir = 0; - totfile = BLI_getdir(icondir, &dir); + totfile = BLI_dir_contents(icondir, &dir); if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */ for(i=0; i<totfile; i++) { @@ -659,7 +661,7 @@ static void init_iconfile_list(struct ListBase *list) } } - /* free temporary direntry structure that's been created by BLI_getdir() */ + /* free temporary direntry structure that's been created by BLI_dir_contents() */ i= totfile-1; for(; i>=0; i--){ diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 6fb7677da6e..b7a2227f98a 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -252,6 +252,11 @@ struct uiBut { /* pointer back */ uiBlock *block; + +#ifdef WITH_PYTHON_UI_INFO + char py_dbg_fn[240]; + int py_dbg_ln; +#endif }; struct uiBlock { @@ -350,8 +355,8 @@ extern void ui_window_to_region(const ARegion *ar, int *x, int *y); extern double ui_get_but_val(uiBut *but); extern void ui_set_but_val(uiBut *but, double value); extern void ui_set_but_hsv(uiBut *but); -extern void ui_get_but_vectorf(uiBut *but, float *vec); -extern void ui_set_but_vectorf(uiBut *but, float *vec); +extern void ui_get_but_vectorf(uiBut *but, float vec[3]); +extern void ui_set_but_vectorf(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my); @@ -368,6 +373,7 @@ extern void ui_check_but(uiBut *but); extern int ui_is_but_float(uiBut *but); extern int ui_is_but_unit(uiBut *but); extern int ui_is_but_rna_valid(uiBut *but); +extern int ui_is_but_utf8(uiBut *but); extern void ui_bounds_block(uiBlock *block); extern void ui_block_translate(uiBlock *block, int x, int y); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ba612fc8727..be6c89eb37d 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -637,11 +637,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i } if(!name) { - name= ot->name; - -#ifdef WITH_INTERNATIONAL - name= UI_translate_do_iface(name); -#endif + name= IFACE_(ot->name); } if(layout->root->type == UI_LAYOUT_MENU && !icon) @@ -1225,7 +1221,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s iconid= ui_id_icon_get((bContext*)C, id, 1); } else { - name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */ iconid = 0; } @@ -1430,11 +1426,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const } if(!name) { - name= mt->label; - -#ifdef WITH_INTERNATIONAL - name= UI_translate_do_iface(name); -#endif + name= IFACE_(mt->label); } if(layout->root->type == UI_LAYOUT_MENU && !icon) @@ -2808,7 +2800,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0; if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) { - uiItemL(layout, UI_translate_do_iface(N_("No Properties")), ICON_NONE); + uiItemL(layout, IFACE_("No Properties"), ICON_NONE); } } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index c25e7f23c04..546f4f0b639 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -442,11 +442,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r Panel *panel= block->panel; rcti hrect; int pnl_icons; - const char *activename= panel->drawname[0]?panel->drawname:panel->panelname; - -#ifdef WITH_INTERNATIONAL - activename= UI_translate_do_iface(activename); -#endif + const char *activename= IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname); /* + 0.001f to avoid flirting with float inaccuracy */ if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f; @@ -1046,7 +1042,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event) inside= 1; if(inside && event->val==KM_PRESS) { - if(event->type == AKEY && !ELEM4(1, event->ctrl, event->oskey, event->shift, event->alt)) { + if(event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) { if(pa->flag & PNL_CLOSEDY) { if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 622d50752fa..4791d2652dc 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -349,7 +349,6 @@ static void ui_tooltip_region_free_cb(ARegion *ar) ar->regiondata= NULL; } -#define TIP_(msgid) UI_translate_do_tooltip(msgid) ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) { uiStyle *style= UI_GetStyle(); @@ -368,7 +367,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - /* special case, enum rna buttons only have enum item description, use general enum description too before the spesific one */ + /* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */ if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { const char *descr= RNA_property_description(but->rnaprop); if(descr && descr[0]) { @@ -410,7 +409,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) prop= (but->opptr)? but->opptr->data: NULL; if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, buf, sizeof(buf))) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Shortcut: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -420,7 +419,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* full string */ ui_get_but_string(but, buf, sizeof(buf)); if(buf[0]) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Value: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -432,7 +431,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (unit_type == PROP_UNIT_ROTATION) { if (RNA_property_type(but->rnaprop) == PROP_FLOAT) { float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop); - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Radians: %f")), value); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value); data->color[data->totline]= 0x888888; data->totline++; } @@ -441,7 +440,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(but->flag & UI_BUT_DRIVEN) { if(ui_but_anim_expression_get(but, buf, sizeof(buf))) { /* expression */ - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Expression: %s")), buf); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf); data->color[data->totline]= 0x888888; data->totline++; } @@ -449,7 +448,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* rna info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s.%s")), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s.%s"), RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop)); data->color[data->totline]= 0x888888; data->totline++; } @@ -457,7 +456,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if(but->rnapoin.id.data) { ID *id= but->rnapoin.id.data; if(id->lib && id->lib->name) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Library: %s")), id->lib->name); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name); data->color[data->totline]= 0x888888; data->totline++; } @@ -472,7 +471,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* operator info */ if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), str); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), str); data->color[data->totline]= 0x888888; data->totline++; } @@ -486,7 +485,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) WM_operator_poll_context(C, but->optype, but->opcontext); poll_msg= CTX_wm_operator_poll_msg_get(C); if(poll_msg) { - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Disabled: %s")), poll_msg); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg); data->color[data->totline]= 0x6666ff; /* alert */ data->totline++; } @@ -496,7 +495,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) { if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) { MenuType *mt= (MenuType *)but->poin; - BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_(N_("Python: %s")), mt->idname); + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname); data->color[data->totline]= 0x888888; data->totline++; } @@ -615,7 +614,6 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) return ar; } -#undef TIP_ void ui_tooltip_free(bContext *C, ARegion *ar) { @@ -2372,7 +2370,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) pup->block= uiBeginBlock(C, NULL, "uiPupMenuBegin", UI_EMBOSSP); pup->block->flag |= UI_BLOCK_POPUP_MEMORY; - pup->block->puphash= ui_popup_menu_hash((char*)title); + pup->block->puphash= ui_popup_menu_hash(title); pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style); uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 104ed068200..7d1d0508e15 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -39,8 +39,8 @@ #include "DNA_scene_types.h" #include "DNA_userdef_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "BKE_animsys.h" @@ -359,7 +359,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(flag & UI_ID_PREVIEWS) { but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, - UI_translate_do_tooltip(template_id_browse_tip(type))); + TIP_(template_id_browse_tip(type))); if(type) { but->icon= RNA_struct_ui_icon(type); if (id) but->icon = ui_id_icon_get(C, id, 1); @@ -372,7 +372,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else if(flag & UI_ID_BROWSE) { but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y, - UI_translate_do_tooltip(template_id_browse_tip(type))); + TIP_(template_id_browse_tip(type))); if(type) { but->icon= RNA_struct_ui_icon(type); /* default dragging of icon for id browse buttons */ @@ -398,12 +398,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if(id->lib) { if(id->flag & LIB_INDIRECT) { but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Indirect library datablock, cannot change"))); + TIP_("Indirect library datablock, cannot change")); uiButSetFlag(but, UI_BUT_DISABLED); } else { but= uiDefIconBut(block, BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0,0,UI_UNIT_X,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Direct linked library datablock, click to make local"))); + TIP_("Direct linked library datablock, click to make local")); if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib)) uiButSetFlag(but, UI_BUT_DISABLED); } @@ -417,7 +417,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str BLI_snprintf(str, sizeof(str), "%d", id->us); but= uiDefBut(block, BUT, 0, str, 0,0,UI_UNIT_X + ((id->us < 10) ? 0:10), UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(_("Display number of users of this data (click to make a single-user copy)"))); + TIP_("Display number of users of this data (click to make a single-user copy)")); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ALONE)); if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable) @@ -435,11 +435,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6; if(newop) { - but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": UI_translate_do_iface(N_("New")), 0, 0, w, UI_UNIT_Y, NULL); + but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } else { - but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": _("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but= uiDefIconTextBut(block, BUT, 0, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } @@ -451,11 +451,11 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6; if(openop) { - but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL); + but= uiDefIconTextButO(block, BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } else { - but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": UI_translate_do_iface(N_("Open")), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); + but= uiDefIconTextBut(block, BUT, 0, ICON_FILESEL, (id)? "": IFACE_("Open"), 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_OPEN)); } @@ -472,7 +472,7 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str } else { but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved"))); + TIP_("Unlink datablock. Shift + Click to set users to zero, data will then not be saved")); uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE)); if(RNA_property_flag(template->prop) & PROP_NEVER_NULL) @@ -729,8 +729,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif BLI_snprintf(str, sizeof(str), "%s parent deform", md->name); uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); - but = uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Make Real")), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Convert virtual modifier to a real modifier"))); + but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, + TIP_("Convert virtual modifier to a real modifier")); uiButSetFunc(but, modifiers_convertToReal, ob, md); } else { @@ -761,24 +761,34 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif if (mti->flags & eModifierTypeFlag_SupportsEditmode) uiItemR(row, &ptr, "show_in_editmode", 0, "", ICON_NONE); } - if ((ob->type==OB_MESH) && modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) - { - /* -- convert to rna ? */ - but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("Apply modifier to editing cage during Editmode"))); - if (index < cageIndex) - uiButSetFlag(but, UI_BUT_DISABLED); - uiButSetFunc(but, modifiers_setOnCage, ob, md); - } - /* tesselation point for curve-typed objects */ - if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { + if (ob->type==OB_MESH) { + if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) + { + /* -- convert to rna ? */ + but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, + TIP_("Apply modifier to editing cage during Editmode")); + if (index < cageIndex) + uiButSetFlag(but, UI_BUT_DISABLED); + uiButSetFunc(but, modifiers_setOnCage, ob, md); + } + else { + uiBlockEndAlign(block); + + /* place holder button */ + uiBlockSetEmboss(block, UI_EMBOSSN); + but= uiDefIconBut(block, BUT, 0, ICON_NONE, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, NULL); + uiButSetFlag(but, UI_BUT_DISABLED); + uiBlockSetEmboss(block, UI_EMBOSS); + } + } /* tesselation point for curve-typed objects */ + else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { /* some modifiers could work with pre-tesselated curves only */ if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tesselated button, so users could have message for this modifiers */ but = uiDefIconButBitI(block, TOG, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, UI_UNIT_X-2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - UI_translate_do_tooltip(N_("This modifier could be applied on splines' points only"))); + TIP_("This modifier could be applied on splines' points only")); uiButSetFlag(but, UI_BUT_DISABLED); } else if (mti->type != eModifierTypeType_Constructive) { /* constructive modifiers tesselates curve before applying */ @@ -828,17 +838,17 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif } else { uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); - uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply")), 0, "apply_as", MODIFIER_APPLY_DATA); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply"), 0, "apply_as", MODIFIER_APPLY_DATA); if (modifier_sameTopology(md)) - uiItemEnumO(row, "OBJECT_OT_modifier_apply", UI_translate_do_iface(N_("Apply as Shape")), 0, "apply_as", MODIFIER_APPLY_SHAPE); + uiItemEnumO(row, "OBJECT_OT_modifier_apply", IFACE_("Apply as Shape"), 0, "apply_as", MODIFIER_APPLY_SHAPE); } uiBlockClearButLock(block); uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE); if (!ELEM5(md->type, eModifierType_Fluidsim, eModifierType_Softbody, eModifierType_ParticleSystem, eModifierType_Cloth, eModifierType_Smoke)) - uiItemO(row, UI_translate_do_tooltip(N_("Copy")), ICON_NONE, "OBJECT_OT_modifier_copy"); + uiItemO(row, TIP_("Copy"), ICON_NONE, "OBJECT_OT_modifier_copy"); } /* result is the layout block inside the box, that we return so that modifier settings can be drawn */ @@ -1012,8 +1022,8 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) uiBlockSetEmboss(block, UI_EMBOSSN); /* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */ - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected"))); - uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Proxy Protected"))); + uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_GHOST, xco+244, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); + uiDefIconBut(block, BUT, B_CONSTRAINT_TEST, ICON_LOCKED, xco+262, yco, 19, 19, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Proxy Protected")); uiBlockSetEmboss(block, UI_EMBOSS); } @@ -1199,14 +1209,14 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr); uiLayoutRow(layout, 1); - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Texture")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Texture"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_TEXTURE, 0, 0, ""); if(GS(parent->name) == ID_MA) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Material")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Material"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); else if(GS(parent->name) == ID_LA) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Lamp")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Lamp"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); else if(GS(parent->name) == ID_WO) - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("World")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); - uiDefButS(block, ROW, B_MATPRV, UI_translate_do_iface(N_("Both")), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("World"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_OTHER, 0, 0, ""); + uiDefButS(block, ROW, B_MATPRV, IFACE_("Both"), 0, 0,UI_UNIT_X*10,UI_UNIT_Y, pr_texture, 10, TEX_PR_BOTH, 0, 0, ""); /* Alpha buton for texture preview */ if(*pr_texture!=TEX_PR_OTHER) { @@ -1297,23 +1307,23 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand if(coba==NULL) return; - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Add a new color stop to the colorband"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Add"), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Add a new color stop to the colorband")); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Delete the active position"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Delete"), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Delete the active position")); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); /* XXX, todo for later - convert to operator - campbell */ - bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip colorband"))); + bt= uiDefBut(block, BUT, 0, "F", 95+xoffs,line1_y,20,UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip colorband")); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); - uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, UI_translate_do_tooltip(N_("Choose active color stop"))); + uiDefButS(block, NUM, 0, "", 120+xoffs,line1_y,80, UI_UNIT_Y, &coba->cur, 0.0, (float)(MAX2(0, coba->tot-1)), 0, 0, TIP_("Choose active color stop")); - bt= uiDefButS(block, MENU, 0, UI_translate_do_iface(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")), - 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, UI_translate_do_tooltip(N_("Set interpolation between color stops"))); + bt= uiDefButS(block, MENU, 0, IFACE_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), + 210+xoffs, line1_y, 90, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); uiBlockEndAlign(block); @@ -1342,13 +1352,13 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand float xs= butr->xmin; uiBlockBeginAlign(block); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Add")), xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Add a new color stop to the colorband"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Add"), xs,butr->ymin+UI_UNIT_Y,2.0f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Add a new color stop to the colorband")); uiButSetNFunc(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Delete")), xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, - UI_translate_do_tooltip(N_("Delete the active position"))); + bt= uiDefBut(block, BUT, 0, IFACE_("Delete"), xs+2.0f*unit,butr->ymin+UI_UNIT_Y,1.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Delete the active position")); uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba); - bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, UI_translate_do_tooltip(N_("Flip the color ramp"))); + bt= uiDefBut(block, BUT, 0, "F", xs+3.5f*unit,butr->ymin+UI_UNIT_Y,0.5f*unit,UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); uiButSetNFunc(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); uiBlockEndAlign(block); @@ -1359,9 +1369,9 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand uiItemR(layout, &ptr, "color", 0, "", ICON_NONE); } - bt= uiDefButS(block, MENU, 0, UI_translate_do_tooltip(N_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4")), + bt= uiDefButS(block, MENU, 0, TIP_("Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4"), xs+10.0f*unit, butr->ymin+UI_UNIT_Y, unit*4, UI_UNIT_Y, &coba->ipotype, 0.0, 0.0, 0, 0, - UI_translate_do_tooltip(N_("Set interpolation between color stops"))); + TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); bt= uiDefBut(block, BUT_COLORBAND, 0, "", xs,butr->ymin,butr->xmax-butr->xmin,UI_UNIT_Y, coba, 0, 0, 0, 0, ""); @@ -1612,10 +1622,10 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu uiButSetFunc(bt, curvemap_buttons_setclip, cumap, NULL); uiBlockBeginAlign(block); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min X ")), 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Min Y ")), 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max X ")), 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, ""); - uiDefButF(block, NUM, 0, UI_translate_do_iface(N_("Max Y ")), 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Min X "), 0,4*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmin, -100.0, cumap->clipr.xmax, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Min Y "), 0,3*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymin, -100.0, cumap->clipr.ymax, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Max X "), 0,2*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.xmax, cumap->clipr.xmin, 100.0, 10, 0, ""); + uiDefButF(block, NUM, 0, IFACE_("Max Y "), 0,UI_UNIT_Y,width,UI_UNIT_Y, &cumap->clipr.ymax, cumap->clipr.ymin, 100.0, 10, 0, ""); uiBlockSetDirection(block, UI_RIGHT); @@ -1664,12 +1674,12 @@ static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS); uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Horizontal")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Extend Extrapolated")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Horizontal"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 4, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Extend Extrapolated"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 5, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 50); @@ -1686,10 +1696,10 @@ static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void block= uiBeginBlock(C, ar, "curvemap_tools_func", UI_EMBOSS); uiBlockSetButmFunc(block, curvemap_tools_dofunc, cumap_v); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset View")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Vector Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Auto Handle")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, UI_translate_do_iface(N_("Reset Curve")), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset View"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 1, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Vector Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 2, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Auto Handle"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 3, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, IFACE_("Reset Curve"), 0, yco-=UI_UNIT_Y, menuwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiBlockSetDirection(block, UI_RIGHT); uiTextBoundsBlock(block, 50); @@ -1806,24 +1816,24 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiBlockSetEmboss(block, UI_EMBOSSN); - bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom in"))); + bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in")); uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL); - bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Zoom out"))); + bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out")); uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL); if(brush) - bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools"))); + bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); else - bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Tools"))); + bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT; - bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, UI_translate_do_tooltip(N_("Clipping Options"))); + bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, UI_translate_do_tooltip(N_("Delete points"))); + bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points")); uiButSetNFunc(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap); uiBlockSetEmboss(block, UI_EMBOSS); @@ -1842,8 +1852,8 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE); uiLayoutRow(layout, 0); - bt=uiDefBut(block, BUT, 0, UI_translate_do_iface(N_("Reset")), 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Reset Black/White point and curves"))); + bt=uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Reset Black/White point and curves")); uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap); } @@ -2084,7 +2094,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe if(icon == ICON_NONE || icon == ICON_DOT) icon= 0; - namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0); + namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0, NULL); name= (namebuf)? namebuf: ""; /* hardcoded types */ @@ -2287,7 +2297,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * if(found) { /* create button */ - name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); icon= list_item_icon_get(C, &itemptr, rnaicon, 0); uiItemL(row, (name)? name: "", icon); @@ -2487,18 +2497,18 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C) (void)ui_abs; // UNUSED uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE, - 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, UI_translate_do_tooltip(N_("Stop this job"))); + 0, UI_UNIT_Y*0.1, UI_UNIT_X*0.8, UI_UNIT_Y*0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job")); uiDefBut(block, PROGRESSBAR, 0, WM_jobs_name(wm, owner), - UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, UI_translate_do_tooltip(N_("Progress"))); + UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress")); uiLayoutRow(layout, 0); } if(WM_jobs_test(wm, screen)) - uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, UI_translate_do_iface(N_("Capture")), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Stop screencast"))); + uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0,0,85,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Stop screencast")); if(screen->animtimer) - uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, UI_translate_do_tooltip(N_("Anim Player")), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, - UI_translate_do_tooltip(N_("Stop animation playback"))); + uiDefIconTextBut(block, BUT, B_STOPANIM, ICON_CANCEL, TIP_("Anim Player"), 0,0,100,UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, + TIP_("Stop animation playback")); } /************************* Reports for Last Operator Template **************************/ @@ -2560,7 +2570,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBlockSetEmboss(block, UI_EMBOSSN); if (reports->list.first != reports->list.last) - uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, UI_translate_do_tooltip(N_("Click to see rest of reports in textblock: 'Recent Reports'"))); + uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see rest of reports in textblock: 'Recent Reports'")); else uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 206ecbad1d0..23d5e77b78d 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -117,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind } case PROP_COLLECTION: { char text[256]; - BLI_snprintf(text, sizeof(text), UI_translate_do_iface(N_("%d items")), RNA_property_collection_length(ptr, prop)); + BLI_snprintf(text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop)); but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL); uiButSetFlag(but, UI_BUT_DISABLED); break; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 9b9237f70cf..61936fba931 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1127,7 +1127,7 @@ void init_userdef_do_versions(void) } if(U.mixbufsize==0) U.mixbufsize= 2048; if (strcmp(U.tempdir, "/") == 0) { - BLI_where_is_temp(U.tempdir, sizeof(U.tempdir), FALSE); + BLI_system_temporary_dir(U.tempdir); } if (U.autokey_mode == 0) { /* 'add/replace' but not on */ @@ -1151,7 +1151,7 @@ void init_userdef_do_versions(void) vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL); if (bmain->versionfile <= 191) { - strcpy(U.plugtexdir, U.textudir); + BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir)); strcpy(U.sounddir, "/"); } diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c index 02b5250f67a..8945cac428b 100644 --- a/source/blender/editors/mesh/editmesh_lib.c +++ b/source/blender/editors/mesh/editmesh_lib.c @@ -337,7 +337,7 @@ void EM_editselection_normal(float *normal, EditSelection *ese) } /* Calculate a plane that is rightangles to the edge/vert/faces normal -also make the plane run allong an axis that is related to the geometry, +also make the plane run along an axis that is related to the geometry, because this is used for the manipulators Y axis.*/ void EM_editselection_plane(float *plane, EditSelection *ese) { @@ -345,7 +345,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese) EditVert *eve= ese->data; float vec[3]={0,0,0}; - if (ese->prev) { /*use previously selected data to make a usefull vertex plane */ + if (ese->prev) { /*use previously selected data to make a useful vertex plane */ EM_editselection_center(vec, ese->prev); sub_v3_v3v3(plane, vec, eve->co); } else { @@ -361,7 +361,7 @@ void EM_editselection_plane(float *plane, EditSelection *ese) } else if (ese->type==EDITEDGE) { EditEdge *eed= ese->data; - /*the plane is simple, it runs allong the edge + /*the plane is simple, it runs along the edge however selecting different edges can swap the direction of the y axis. this makes it less likely for the y axis of the manipulator (running along the edge).. to flip less often. diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index b8ace26991e..84943ecc777 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -53,6 +53,7 @@ #include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BLI_math_vector.h" +#include "BLI_linklist.h" #include "ED_object.h" #include "ED_mesh.h" diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 526bf177ab7..e6836d7d5aa 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -957,7 +957,7 @@ long mesh_mirrtopo_table(Object *ob, char mode) } } else { for(a=0, medge=me->medge; a<me->totedge; a++, medge++) { - /* This can make realy big numbers, wrapping around here is fine */ + /* This can make really big numbers, wrapping around here is fine */ MirrTopoHash[medge->v1] += MirrTopoHash_Prev[medge->v2]; MirrTopoHash[medge->v2] += MirrTopoHash_Prev[medge->v1]; } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 6c553289052..ec7c6cc6108 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -245,7 +245,7 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c for (ct=targets.first, i=0; ct; ct= ct->next, i++) { if (i == index) { ct->tar= target; - strcpy(ct->subtarget, subtarget); + BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget)); break; } } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 76cbfdc88e7..0ad11d1a997 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -585,7 +585,7 @@ void OBJECT_OT_posemode_toggle(wmOperatorType *ot) /* identifiers */ ot->name= "Toggle Pose Mode"; ot->idname= "OBJECT_OT_posemode_toggle"; - ot->description= "Enables or disables posing/selecting bones"; + ot->description= "Enable or disable posing/selecting bones"; /* api callbacks */ ot->exec= posemode_exec; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index ce01bef34f6..9f1ad8e4c3c 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -837,7 +837,7 @@ void OBJECT_OT_hook_select(wmOperatorType *ot) /* identifiers */ ot->name= "Select Hook"; - ot->description= "Selects effected vertices on mesh"; + ot->description= "Select affected vertices on mesh"; ot->idname= "OBJECT_OT_hook_select"; /* callbacks */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 389c0941cc2..49a71018719 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -334,11 +334,9 @@ static int make_proxy_exec (bContext *C, wmOperator *op) /* Add new object for the proxy */ newob= add_object(scene, OB_EMPTY); - if (gob) - strcpy(name, gob->id.name+2); - else - strcpy(name, ob->id.name+2); - strcat(name, "_proxy"); + + BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name); + rename_id(&newob->id, name); /* set layers OK */ @@ -605,7 +603,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) /* handle types */ if (pchan) - strcpy(ob->parsubstr, pchan->name); + BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr)); else ob->parsubstr[0]= 0; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 7b4db347315..c1b21865504 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -669,7 +669,7 @@ static void vgroup_duplicate(Object *ob) } cdg = defgroup_duplicate(dg); - strcpy(cdg->name, name); + BLI_strncpy(cdg->name, name, sizeof(cdg->name)); defgroup_unique_name(cdg, ob); BLI_addtail(&ob->defbase, cdg); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 019d6df9b73..c0b81efe18c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -2970,7 +2970,7 @@ static void brush_puff(PEData *data, int point_index) VECSUB(dco, lastco, co); mul_mat3_m4_v3(imat, dco); /* into particle space */ - /* move the point allong a vector perpendicular to the + /* move the point along a vector perpendicular to the * hairs direction, reduces odd kinks, */ cross_v3_v3v3(c1, ofs, dco); cross_v3_v3v3(c2, c1, dco); @@ -3700,7 +3700,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event) RNA_collection_add(op->ptr, "stroke", &itemptr); RNA_float_set_array(&itemptr, "mouse", mouse); - RNA_boolean_set(&itemptr, "pen_flip", event->shift != 0); // XXX hardcoded + RNA_boolean_set(&itemptr, "pen_flip", event->shift != FALSE); // XXX hardcoded /* apply */ brush_edit_apply(C, op, &itemptr); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 918adcac138..188bab9dced 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -50,7 +50,6 @@ #include "DNA_object_fluidsim.h" #include "BLI_blenlib.h" -#include "BLI_fileops.h" #include "BLI_threads.h" #include "BLI_math.h" #include "BLI_utildefines.h" @@ -833,7 +832,7 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss) curFrame++; - if((exists = BLI_exist(targetFile))) + if((exists = BLI_exists(targetFile))) { BLI_delete(targetFile, 0, 0); BLI_delete(targetFileVel, 0, 0); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 0b350e3afd0..d80f3fef125 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -398,13 +398,13 @@ static void render_endjob(void *rjv) ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1); /* XXX above function sets all tags in nodes */ - ntreeClearTags(rj->scene->nodetree); + ntreeCompositClearTags(rj->scene->nodetree); /* potentially set by caller */ rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE; if(rj->srl) { - NodeTagIDChanged(rj->scene->nodetree, &rj->scene->id); + nodeUpdateID(rj->scene->nodetree, &rj->scene->id); WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene); } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 70709a22d3d..697cddfcee0 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -261,7 +261,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre sce->r.alphamode= R_ADDSKY; sce->r.cfra= scene->r.cfra; - strcpy(sce->r.engine, scene->r.engine); + BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); if(id_type==ID_MA) { Material *mat= NULL, *origmat= (Material *)id; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index faf0baa1aca..582a8596dd1 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -47,7 +47,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_editVert.h" -#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_animsys.h" diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 28f486117b7..2b007f55706 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1388,7 +1388,7 @@ static const char *editortype_pup(void) "|Python Console %x18" ); - return UI_translate_do_iface(types); + return IFACE_(types); } static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)) @@ -1410,7 +1410,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco) but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y, &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, - UI_translate_do_tooltip(N_("Displays current editor type. Click for menu of available types"))); + TIP_("Displays current editor type. Click for menu of available types")); uiButSetFunc(but, spacefunc, NULL, NULL); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index a2be1e8fa6f..bae6fa9d6b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -649,7 +649,7 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot) ot->flag= OPTYPE_BLOCKING; - RNA_def_int(ot->srna, "modifier", 0, 0, 2, "modifier", "modifier state", 0, 2); + RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2); } /* ************** swap area operator *********************************** */ diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 3010adafe20..27c311aa04f 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -157,7 +157,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); - strcpy(G.ima, path); + BLI_strncpy(G.ima, path, sizeof(G.ima)); BLI_path_abs(path, G.main->name); /* BKE_add_image_extension() checks for if extension was already set */ diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1c53be15a0f..b6b22c391b8 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -401,7 +401,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect); tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile"); - strcpy(tile->idname, ima->id.name); + BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname)); tile->x= x_tile; tile->y= y_tile; @@ -409,7 +409,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char); tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect"); - strcpy(tile->ibufname, ibuf->name); + BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname)); tile->gen_type= ima->gen_type; tile->source= ima->source; @@ -3387,7 +3387,7 @@ static void project_paint_end(ProjPaintState *ps) } /* This is a BIT ODD, but overwrite the undo tiles image info with this pixels original color - * because allocating the tiles allong the way slows down painting */ + * because allocating the tiles along the way slows down painting */ if (is_float) { float *rgba_fp = (float *)tilerect + (((projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE)) * 4; @@ -3966,7 +3966,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f copy_v2_v2(handles[a].mval, pos); copy_v2_v2(handles[a].prevmval, lastpos); - /* thread spesific */ + /* thread specific */ handles[a].thread_index = a; handles[a].projImages = (ProjPaintImage *)BLI_memarena_alloc(ps->arena_mt[a], ps->image_tot * sizeof(ProjPaintImage)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index cf90c43f3e1..87411b97061 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1619,7 +1619,7 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } } - /* important to normalize after mirror, otherwise mirror gets wight + /* important to normalize after mirror, otherwise mirror gets weight * which has already been scaled down in relation to other weights, * then scales a second time [#26193]. Tricky multi-paint code doesn't * suffer from this problem - campbell */ diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 13b6fef3004..7656e51d241 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -39,6 +39,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_string.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" @@ -262,7 +264,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node) } unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode"); - strcpy(unode->idname, ob->id.name); + BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname)); unode->node= node; BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 11ac756bfb5..9316b96d8fb 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -935,7 +935,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) if(ptr->data) { icon= RNA_struct_ui_icon(ptr->type); - name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf)); + name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); if(name) { if(!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene) diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index b18b5373240..dfbb2a543cb 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -125,7 +125,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) #define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \ if(sbuts->pathflag & (1<<_ctx)) { \ - but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, UI_translate_do_tooltip(_tip)); \ + but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \ uiButClearFlag(but, UI_BUT_UNDO); \ } \ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 75b3eb950a5..5dbcfbba5be 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -39,7 +39,6 @@ #include "BLI_fileops.h" #include "BLI_path_util.h" -#include "BLI_storage.h" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -169,7 +168,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event) if(!prop) return OPERATOR_CANCELLED; - str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0); + str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL); /* useful yet irritating feature, Shift+Click to open the file * Alt+Click to browse a folder in the OS's browser */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 611bf79603e..8a7e4ce3ec1 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -37,7 +37,6 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" #include "BLI_dynstr.h" -#include "BLI_storage_types.h" #ifdef WIN32 #include "BLI_winstuff.h" #endif @@ -181,16 +180,16 @@ void file_draw_buttons(const bContext *C, ARegion *ar) but = uiDefButTextO(block, TEX, "FILE_OT_directory", 0, "", min_x, line1_y, line1_w-chan_offs, btn_h, - params->dir, 0.0, (float)FILE_MAX-1, 0, 0, - UI_translate_do_tooltip(N_("File path"))); + params->dir, 0.0, (float)FILE_MAX, 0, 0, + TIP_("File path")); uiButSetCompleteFunc(but, autocomplete_directory, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); if((params->flag & FILE_DIRSEL_ONLY) == 0) { but = uiDefBut(block, TEX, B_FS_FILENAME, "", min_x, line2_y, line2_w-chan_offs, btn_h, - params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, - UI_translate_do_tooltip(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); + params->file, 0.0, (float)FILE_MAXFILE, 0, 0, + TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name"))); uiButSetCompleteFunc(but, autocomplete_file, NULL); uiButSetFlag(but, UI_BUT_NO_UTF8); @@ -208,15 +207,15 @@ void file_draw_buttons(const bContext *C, ARegion *ar) if (fnumbuttons && (params->flag & FILE_DIRSEL_ONLY) == 0) { uiBlockBeginAlign(block); but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMOUT, - min_x + line2_w + separator - chan_offs, line2_y, - btn_fn_w, btn_h, - UI_translate_do_tooltip(N_("Decrement the filename number"))); + min_x + line2_w + separator - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Decrement the filename number")); RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", -1); - but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, - min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, - btn_fn_w, btn_h, - UI_translate_do_tooltip(N_("Increment the filename number"))); + but = uiDefIconButO(block, BUT, "FILE_OT_filenum", 0, ICON_ZOOMIN, + min_x + line2_w + separator + btn_fn_w - chan_offs, line2_y, + btn_fn_w, btn_h, + TIP_("Increment the filename number")); RNA_int_set(uiButGetOperatorPtrRNA(but), "increment", 1); uiBlockEndAlign(block); } @@ -227,9 +226,9 @@ void file_draw_buttons(const bContext *C, ARegion *ar) uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title, max_x - loadbutton, line1_y, loadbutton, btn_h, params->title); - uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, UI_translate_do_iface(N_("Cancel")), + uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"), max_x - loadbutton, line2_y, loadbutton, btn_h, - UI_translate_do_tooltip(N_("Cancel"))); + TIP_("Cancel")); } uiEndBlock(C, block); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0955d264ca8..079b1c96d24 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -39,7 +39,6 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" -#include "BLI_storage_types.h" #ifdef WIN32 #include "BLI_winstuff.h" #endif @@ -666,7 +665,7 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op) if((prop= RNA_struct_find_property(op->ptr, "filepath"))) { char filepath[FILE_MAX]; RNA_property_string_get(op->ptr, prop, filepath); - BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } else { if((prop= RNA_struct_find_property(op->ptr, "filename"))) { @@ -749,7 +748,7 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); - if (BLI_exist(sfile->params->dir)) + if (BLI_exists(sfile->params->dir)) fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir, 0, 1); BLI_make_file_string(G.main->name, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); @@ -1042,7 +1041,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op) } /* create the file */ - BLI_recurdir_fileops(path); + BLI_dir_create_recursive(path); if (!BLI_exists(path)) { BKE_report(op->reports,RPT_ERROR, "Couldn't create new folder"); @@ -1136,14 +1135,14 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused)) file_expand_directory(C); if (!BLI_exists(sfile->params->dir)) { - BLI_recurdir_fileops(sfile->params->dir); + BLI_dir_create_recursive(sfile->params->dir); } /* special case, user may have pasted a fulepath into the directory */ if(BLI_exists(sfile->params->dir) && BLI_is_dir(sfile->params->dir) == 0) { char path[sizeof(sfile->params->dir)]; BLI_strncpy(path, sfile->params->dir, sizeof(path)); - BLI_split_dirfile(path, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } BLI_cleanup_dir(G.main->name, sfile->params->dir); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 37dce293d77..fae10c0d84e 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -146,7 +146,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa) if(sfile) { row= uiLayoutRow(pa->layout, 0); - uiItemO(row, UI_translate_do_iface(N_("Add")), ICON_ZOOMIN, "file.bookmark_add"); + uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add"); uiItemL(row, NULL, ICON_NONE); file_panel_category(C, pa, FS_CATEGORY_BOOKMARKS, &sfile->bookmarknr, ICON_BOOKMARKS, 1, 0); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index c2e45c5ad8a..89a34c62200 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -48,7 +48,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" -#include "BLI_storage_types.h" #include "BLI_threads.h" #include "BLI_utildefines.h" @@ -736,7 +735,7 @@ static int file_is_blend_backup(const char *str) } -static int file_extension_type(char *relname) +static int file_extension_type(const char *relname) { if(BLO_has_bfile_extension(relname)) { return BLENDERFILE; @@ -769,7 +768,7 @@ static int file_extension_type(char *relname) return 0; } -int ED_file_extension_icon(char *relname) +int ED_file_extension_icon(const char *relname) { int type= file_extension_type(relname); @@ -825,10 +824,10 @@ static void filelist_read_dir(struct FileList* filelist) filelist->fidx = NULL; filelist->filelist = NULL; - BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */ + BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */ BLI_cleanup_dir(G.main->name, filelist->dir); - filelist->numfiles = BLI_getdir(filelist->dir, &(filelist->filelist)); + filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist)); if(!chdir(wdir)) {} /* fix warning about not checking return value */ filelist_setfiletypes(filelist); diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 6cc42b2a751..29d8242e26d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -64,8 +64,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" -#include "BLI_path_util.h" -#include "BLI_storage_types.h" #include "BLI_dynstr.h" #include "BLI_utildefines.h" @@ -113,7 +111,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) if (!sfile->params) { sfile->params= MEM_callocN(sizeof(FileSelectParams), "fileselparams"); /* set path to most recently opened .blend */ - BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(G.main->name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); sfile->params->filter_glob[0] = '\0'; } @@ -142,7 +140,7 @@ short ED_fileselect_set_params(SpaceFile *sfile) sfile->params->file[0]= '\0'; } else { - BLI_split_dirfile(name, sfile->params->dir, sfile->params->file); + BLI_split_dirfile(name, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file)); } } else { @@ -613,7 +611,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) DIR *dir; struct dirent *de; - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dir_part(str, dirname, sizeof(dirname)); dir = opendir(dirname); diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index aa2ea124fe0..a843129c4d9 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_dynstr.h" -#include "BLI_string.h" #ifdef WIN32 #include <windows.h> /* need to include windows.h so _WIN32_IE is defined */ @@ -279,7 +278,7 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename) if (line[len-1] == '\n') { line[len-1] = '\0'; } - if (BLI_exist(line)) { + if (BLI_exists(line)) { fsmenu_insert_entry(fsmenu, category, line, 0, 1); } } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 7a70ed9c0a0..726a2a80be1 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -46,7 +46,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_rand.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f1593105d5b..51a24044deb 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -754,8 +754,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa) block= uiLayoutGetBlock(row); // XXX for now, this will be a operator button which calls a 'add modifier' operator - uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20, - UI_translate_do_tooltip(N_("Adds a new F-Curve Modifier for the active F-Curve"))); + uiDefButO(block, BUT, "GRAPH_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + TIP_("Adds a new F-Curve Modifier for the active F-Curve")); /* copy/paste (as sub-row)*/ row= uiLayoutRow(row, 1); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index dc5e71f0406..37e6c0b73c9 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -340,7 +340,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu) int sel, b; /* a single call to GL_LINES here around these calls should be sufficient to still - * get separate line segments, but which aren't wrapped with GL_LINE_STRIP everytime we + * get separate line segments, but which aren't wrapped with GL_LINE_STRIP every time we * want a single line */ glBegin(GL_LINES); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 71d9dd3adcb..beeb5e3532f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -704,8 +704,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char sprintf(str, "(%d) Frames:", iuser->framenr); else strcpy(str, "Frames:"); uiBlockBeginAlign(block); - uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Sets the number of images of a movie to use"); - uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Sets the global starting frame of the movie"); + uiDefButI(block, NUM, imagechanged, str, 10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use"); + uiDefButI(block, NUM, imagechanged, "StartFr:", 160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie"); } #endif } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 725b5f5c02d..dba60586b29 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -143,7 +143,7 @@ static int space_image_file_exists_poll(bContext *C) if(ibuf) { BLI_strncpy(name, ibuf->name, FILE_MAX); BLI_path_abs(name, bmain->name); - poll= (BLI_exists(name) && BLI_is_writable(name)); + poll= (BLI_exists(name) && BLI_file_is_writable(name)); } ED_space_image_release_buffer(sima, lock); @@ -1223,7 +1223,7 @@ static int save_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; save_image_options_from_op(&simopts, op); - if (BLI_exists(simopts.filepath) && BLI_is_writable(simopts.filepath)) { + if (BLI_exists(simopts.filepath) && BLI_file_is_writable(simopts.filepath)) { save_image_doit(C, sima, op, &simopts, FALSE); } else { diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index d0a80cddf56..52930626964 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -160,7 +160,7 @@ void INFO_OT_select_pick(wmOperatorType *ot) /* ot->flag= OPTYPE_REGISTER; */ /* properties */ - RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "The index of the report", 0, INT_MAX); + RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX); } diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 9157df6960f..bafcf36e646 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -280,7 +280,7 @@ static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu) uiItemStringO(layout, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } } else { - uiItemL(layout, UI_translate_do_iface(N_("No Recent Files")), ICON_NONE); + uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE); } } @@ -290,7 +290,7 @@ static void recent_files_menu_register(void) mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); - strcpy(mt->label, _("Open Recent...")); + strcpy(mt->label, N_("Open Recent...")); mt->draw= recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c index b7f9af09348..b1c0dd02e4b 100644 --- a/source/blender/editors/space_logic/logic_ops.c +++ b/source/blender/editors/space_logic/logic_ops.c @@ -478,7 +478,7 @@ static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e static void LOGIC_OT_actuator_remove(wmOperatorType *ot) { ot->name= "Remove Actuator"; - ot->description= "Remove a actuator from the active object"; + ot->description= "Remove an actuator from the active object"; ot->idname= "LOGIC_OT_actuator_remove"; ot->invoke= actuator_remove_invoke; @@ -533,7 +533,7 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot) /* identifiers */ ot->name= "Add Actuator"; - ot->description = "Add a actuator to the active object"; + ot->description = "Add an actuator to the active object"; ot->idname= "LOGIC_OT_actuator_add"; /* api callbacks */ diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 5e1f2745559..7ba33e7e57e 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -448,8 +448,8 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa) // XXX for now, this will be a operator button which calls a temporary 'add modifier' operator // FIXME: we need to set the only-active property so that this will only add modifiers for the active strip (not all selected) - uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, UI_translate_do_iface(N_("Add Modifier")), 10, 0, 150, 20, - UI_translate_do_tooltip(N_("Adds a new F-Modifier for the active NLA Strip"))); + uiDefButO(block, BUT, "NLA_OT_fmodifier_add", WM_OP_INVOKE_REGION_WIN, IFACE_("Add Modifier"), 10, 0, 150, 20, + TIP_("Adds a new F-Modifier for the active NLA Strip")); /* copy/paste (as sub-row)*/ row= uiLayoutRow(row, 1); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index e713ed5a678..baa47d4147e 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -102,12 +102,12 @@ void ED_node_changed_update(ID *id, bNode *node) WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id); } else if(treetype==NTREE_COMPOSIT) { - NodeTagChanged(edittree, node); + nodeUpdate(edittree, node); /* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */ node= node_tree_get_editgroup(nodetree); if(node) - NodeTagIDChanged(nodetree, node->id); + nodeUpdateID(nodetree, node->id); WM_main_add_notifier(NC_SCENE|ND_NODES, id); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index baa755ef841..59e62c9b0e4 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -49,7 +49,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -66,11 +65,6 @@ #include "BKE_texture.h" #include "BKE_report.h" - -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_storage_types.h" - #include "RE_pipeline.h" #include "IMB_imbuf_types.h" @@ -496,17 +490,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene) node_tree_from_ID(snode->id, &snode->nodetree, &snode->edittree, NULL); } -static void snode_tag_changed(SpaceNode *snode, bNode *node) +static void snode_update(SpaceNode *snode, bNode *node) { bNode *gnode; if (node) - NodeTagChanged(snode->edittree, node); + nodeUpdate(snode->edittree, node); /* if inside group, tag entire group */ gnode= node_tree_get_editgroup(snode->nodetree); if(gnode) - NodeTagIDChanged(snode->nodetree, gnode->id); + nodeUpdateID(snode->nodetree, gnode->id); } static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) @@ -1775,7 +1769,7 @@ static void node_link_viewer(SpaceNode *snode, bNode *tonode) link->fromsock= sock; } ntreeUpdateTree(snode->edittree); - snode_tag_changed(snode, node); + snode_update(snode, node); } } } @@ -2127,7 +2121,7 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace) continue; } - snode_tag_changed(snode, node_to); + snode_update(snode, node_to); ++numlinks; break; } @@ -2175,7 +2169,7 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate if(node->id) id_us_plus(node->id); - snode_tag_changed(snode, node); + snode_update(snode, node); } if(snode->nodetree->type==NTREE_TEXTURE) { @@ -2412,7 +2406,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: if(link->tosock && link->fromsock) { /* send changed events for original tonode and new */ - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); /* we might need to remove a link */ if(in_out==SOCK_OUT) @@ -2495,7 +2489,7 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag) if(link) { /* send changed event to original tonode */ if(link->tonode) - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nldrag->node= link->fromnode; nldrag->sock= link->fromsock; @@ -2663,7 +2657,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) next= link->next; if(cut_links_intersect(link, mcoords, i)) { - snode_tag_changed(snode, link->tonode); + snode_update(snode, link->tonode); nodeRemLink(snode->edittree, link); } } @@ -2794,7 +2788,7 @@ void ED_node_link_insert(ScrArea *sa) nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto); ntreeUpdateTree(snode->edittree); /* needed for pointers */ - snode_tag_changed(snode, select); + snode_update(snode, select); ED_node_changed_update(snode->id, select); } } @@ -3198,7 +3192,7 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op)) /* Be able to mute in-/output nodes as well. - DingTo if(node->inputs.first && node->outputs.first) { */ node->flag ^= NODE_MUTED; - snode_tag_changed(snode, node); + snode_update(snode, node); } } diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 205dd6bb639..b64685e3984 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -218,7 +218,6 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass) } } -#define IFACE_(msgid) UI_translate_do_iface(msgid) static void node_menu_add(const bContext *C, Menu *menu) { SpaceNode *snode= CTX_wm_space_node(C); @@ -228,40 +227,39 @@ static void node_menu_add(const bContext *C, Menu *menu) uiLayoutSetActive(layout, 0); if(snode->treetype==NTREE_SHADER) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - uiItemMenuF(layout, IFACE_(N_("Dynamic")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + uiItemMenuF(layout, IFACE_("Dynamic"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_DYNAMIC)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } else if(snode->treetype==NTREE_COMPOSIT) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Vector")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); - uiItemMenuF(layout, IFACE_(N_("Filter")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Matte")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE)); - uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Vector"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_VECTOR)); + uiItemMenuF(layout, IFACE_("Filter"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_FILTER)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Matte"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_MATTE)); + uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } else if(snode->treetype==NTREE_TEXTURE) { - uiItemMenuF(layout, IFACE_(N_("Input")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); - uiItemMenuF(layout, IFACE_(N_("Output")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); - uiItemMenuF(layout, IFACE_(N_("Color")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); - uiItemMenuF(layout, IFACE_(N_("Patterns")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN)); - uiItemMenuF(layout, IFACE_(N_("Textures")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); - uiItemMenuF(layout, IFACE_(N_("Convertor")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); - uiItemMenuF(layout, IFACE_(N_("Distort")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); - uiItemMenuF(layout, IFACE_(N_("Group")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); - uiItemMenuF(layout, IFACE_(N_("Layout")), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); + uiItemMenuF(layout, IFACE_("Input"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_INPUT)); + uiItemMenuF(layout, IFACE_("Output"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OUTPUT)); + uiItemMenuF(layout, IFACE_("Color"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_OP_COLOR)); + uiItemMenuF(layout, IFACE_("Patterns"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_PATTERN)); + uiItemMenuF(layout, IFACE_("Textures"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_TEXTURE)); + uiItemMenuF(layout, IFACE_("Convertor"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_CONVERTOR)); + uiItemMenuF(layout, IFACE_("Distort"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_DISTORT)); + uiItemMenuF(layout, IFACE_("Group"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_GROUP)); + uiItemMenuF(layout, IFACE_("Layout"), 0, node_add_menu, SET_INT_IN_POINTER(NODE_CLASS_LAYOUT)); } } -#undef IFACE_ void node_menus_register(void) { diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 9c4581a43da..1d9723f598b 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -214,6 +214,12 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_refresh(sa); } break; + case NC_OBJECT: + if(type==NTREE_SHADER) { + if(wmn->data==ND_OB_SHADING) + ED_area_tag_refresh(sa); + } + break; case NC_TEXT: /* pynodes */ if(wmn->data==ND_SHADING) @@ -244,10 +250,10 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn) if(type==NTREE_COMPOSIT) { Scene *scene= wmn->window->screen->scene; - /* note that NodeTagIDChanged is already called by BKE_image_signal() on all + /* note that nodeUpdateID is already called by BKE_image_signal() on all * scenes so really this is just to know if the images is used in the compo else * painting on images could become very slow when the compositor is open. */ - if(NodeTagIDChanged(scene->nodetree, wmn->reference)) + if(nodeUpdateID(scene->nodetree, wmn->reference)) ED_area_tag_refresh(sa); } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 6bfe370d105..30a7abd3c0b 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -947,7 +947,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot) /* ANIMATO OPERATIONS */ /* KeyingSet and Driver Creation - Helper functions */ -/* specialised poll callback for these operators to work in Datablocks view only */ +/* specialized poll callback for these operators to work in Datablocks view only */ static int ed_operator_outliner_datablocks_active(bContext *C) { ScrArea *sa= CTX_wm_area(C); @@ -1021,7 +1021,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle /* tsenext= TREESTORE(temnext); */ /* UNUSED */ nextptr= &temnext->rnaptr; - name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf)); + name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL); if(name) { /* if possible, use name as a key in the path */ diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index dda103b971b..925c4571a66 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -972,7 +972,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i } else if(type == TSE_RNA_STRUCT) { /* struct */ - te->name= RNA_struct_name_get_alloc(ptr, NULL, 0); + te->name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); if(te->name) te->flag |= TE_FREE_NAME; diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 1c4b0130897..2f57bc2d93b 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -44,7 +44,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "DNA_scene_types.h" @@ -235,7 +234,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); - strcpy(seq->name+2, sce_seq->id.name+2); + BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2); seqbase_unique_name_recursive(&ed->seqbase, seq); seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0); @@ -321,7 +320,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad char dir_only[FILE_MAX]; char file_only[FILE_MAX]; - BLI_split_dirfile(seq_load.path, dir_only, NULL); + BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only)); RNA_BEGIN(op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", file_only); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 8f1ea6fe254..13e54c9a4c0 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -192,6 +192,9 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x waveform = seq->sound->waveform; + if(!waveform) + return; + startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND); samplestep = (endsample-startsample) * stepsize / (x2-x1); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index da785430d43..a20ab260379 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -45,7 +45,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BLI_threads.h" @@ -883,7 +882,7 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene) if(seq->type==SEQ_MOVIE) { if(seq->strip && seq->strip->stripdata) { BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name); - BLI_touch(seq->name); + BLI_file_touch(seq->name); } } @@ -929,11 +928,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene) if(last_seq==NULL) return; - BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); + BLI_strncpy(from, last_seq->strip->dir, sizeof(from)); // XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: ")) // return; - strcpy(to, from); + BLI_strncpy(to, from, sizeof(to)); // XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) // return; @@ -2977,7 +2976,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "directory", directory); if (is_relative_path) { - /* TODO, shouldnt this already be relative from the filesel? + /* TODO, shouldn't this already be relative from the filesel? * (as the 'filepath' is) for now just make relative here, * but look into changing after 2.60 - campbell */ BLI_path_rel(directory, bmain->name); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 7e718dc176a..53a520a355d 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -530,7 +530,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot) -/* run recursivly to select linked */ +/* run recursively to select linked */ static int select_more_less_seq__internal(Scene *scene, int sel, int linked) { Editing *ed= seq_give_editing(scene, FALSE); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 5c2013ee863..9468603be7f 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -40,7 +40,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_path_util.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -362,7 +361,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop) PointerRNA itemptr; char dir[FILE_MAX], file[FILE_MAX]; - BLI_split_dirfile(drag->path, dir, file); + BLI_split_dirfile(drag->path, dir, file, sizeof(dir), sizeof(file)); RNA_string_set(drop->ptr, "directory", dir); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 47f051e1ec4..51f4f1e579c 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -136,7 +136,12 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn) switch(wmn->data) { case ND_DISPLAY: + ED_area_tag_redraw(sa); + break; case ND_CURSOR: + if(st->text && st->text == wmn->reference) + text_scroll_to_cursor(st, sa); + ED_area_tag_redraw(sa); break; } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 8d40550961f..242bccd2376 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2583,6 +2583,9 @@ static int set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event) SpaceText *st= CTX_wm_space_text(C); SetSelection *ssel; + if(event->mval[0]>=st->txtbar.xmin) + return OPERATOR_PASS_THROUGH; + op->customdata= MEM_callocN(sizeof(SetSelection), "SetCursor"); ssel= op->customdata; ssel->selecting= RNA_boolean_get(op->ptr, "select"); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index 83a695ba72a..eed86467eaa 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1839,7 +1839,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* wire draw over solid only in posemode */ - if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || (arm->drawtype==ARM_LINE)) { + if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* draw line check first. we do selection indices */ if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) { if (arm->flag & ARM_POSEMODE) @@ -2512,7 +2512,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 1; - if(dt>OB_WIRE && arm->drawtype!=ARM_LINE) { + if(dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) { /* we use color for solid lighting */ glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); glEnable(GL_COLOR_MATERIAL); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4db8563d7e5..b39ef4b462b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -766,7 +766,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa else glDepthMask(0); for(vos= strings->first; vos; vos= vos->next) { -#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we cn use the zbuffer while in pixel space - campbell +#if 0 // too slow, reading opengl info while drawing is very bad, better to see if we can use the zbuffer while in pixel space - campbell if(v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) { gluProject(vos->vec[0], vos->vec[1], vos->vec[2], mats.modelview, mats.projection, (GLint *)mats.viewport, &ux, &uy, &uz); glReadPixels(ar->winrct.xmin+vos->mval[0]+vos->xoffs, ar->winrct.ymin+vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); @@ -6772,7 +6772,10 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec } else { Mesh *me= ob->data; - if(me->editflag & ME_EDIT_VERT_SEL) { + if( (me->editflag & ME_EDIT_VERT_SEL) && + /* currently vertex select only supports weight paint */ + (ob->mode & OB_MODE_WEIGHT_PAINT)) + { DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); glColor3ub(0, 0, 0); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 0854f9f3685..115b3756029 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -450,7 +450,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event) sub_v3_v3v3(my_pivot, rv3d->ofs, upvec); negate_v3(my_pivot); /* ofs is flipped */ - /* find a new ofs value that is allong the view axis (rather than the mouse location) */ + /* find a new ofs value that is along the view axis (rather than the mouse location) */ closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin); vod->dist0 = rv3d->dist = len_v3v3(my_pivot, dvec); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 02a6cee5140..b66440738b2 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -179,7 +179,7 @@ typedef struct FlyInfo { /* fly state state */ float speed; /* the speed the view is moving per redraw */ - short axis; /* Axis index to move allong by default Z to move allong the view */ + short axis; /* Axis index to move along by default Z to move along the view */ short pan_view; /* when true, pan the view instead of rotating */ /* relative view axis locking - xlock, zlock @@ -725,7 +725,7 @@ static int flyApply(bContext *C, FlyInfo *fly) RegionView3D *rv3d= fly->rv3d; ARegion *ar = fly->ar; - float mat[3][3], /* 3x3 copy of the view matrix so we can move allong the view axis */ + float mat[3][3], /* 3x3 copy of the view matrix so we can move along the view axis */ dvec[3]={0,0,0}, /* this is the direction thast added to the view offset per redraw */ /* Camera Uprighting variables */ diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index fd27dc65a0e..55f49654f32 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -275,22 +275,16 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon) { static char formatstr[] = "|%s %%x%d %%i%d"; - if(UI_translate_iface()) - return sprintf(str, formatstr, BLF_gettext(title), id, icon); - else - return sprintf(str, formatstr, title, id, icon); + return sprintf(str, formatstr, IFACE_(title), id, icon); } static char *view3d_modeselect_pup(Scene *scene) { Object *ob= OBACT; static char string[256]; - const char *title= N_("Mode: %t"); + const char *title= IFACE_("Mode: %t"); char *str = string; - if(U.transopts&USER_TR_IFACE) - title= BLF_gettext(title); - BLI_strncpy(str, title, sizeof(string)); str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA); @@ -470,7 +464,6 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) } } -#define TIP_(msgid) UI_translate_do_tooltip(msgid) void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { bScreen *screen= CTX_wm_screen(C); @@ -504,7 +497,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiBlockBeginAlign(block); uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , - 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_(N_("Mode"))); + 0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode")); uiBlockEndAlign(block); /* Draw type */ @@ -543,11 +536,11 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) block= uiLayoutGetBlock(row); if(v3d->twflag & V3D_USE_MANIPULATOR) { - but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Translate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Rotate manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ - but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_(N_("Scale manipulator mode"))); + but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ } @@ -555,8 +548,8 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) v3d->twmode = 0; } - str_menu = BIF_menustringTransformOrientation(C, N_("Orientation")); - but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_(N_("Transform Orientation"))); + str_menu = BIF_menustringTransformOrientation(C, "Orientation"); + but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation")); uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ MEM_freeN((void *)str_menu); } @@ -576,4 +569,3 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiTemplateEditModeSelection(layout, C); } -#undef TIP_ diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index ddea89e1cdb..58058722a82 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -82,7 +82,7 @@ static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa) wmOperator *op= WM_operator_last_redo(C); if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname)); - else BLI_strncpy(pa->drawname, N_("Operator"), sizeof(pa->drawname)); + else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname)); } static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 73acd1f9000..e3eb14e2fe6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1543,10 +1543,11 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int { if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) { - if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || - (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || - (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || - (kmi->type == OSKEY && event->oskey)) { + if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) || + (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) || + (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) || + ((kmi->type == OSKEY) && event->oskey) ) + { t->modifiers |= MOD_SNAP_INVERT; } break; @@ -1922,7 +1923,7 @@ static void protectedQuaternionBits(short protectflag, float *quat, float *oldqu quat[3]= oldquat[3]; } else { - /* quaternions get limited with euler... (compatability mode) */ + /* quaternions get limited with euler... (compatibility mode) */ float eul[3], oldeul[3], nquat[4], noldquat[4]; float qlen; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 2f177239f44..7fccbcb0097 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -152,7 +152,7 @@ typedef struct TransData2D { float loc[3]; /* Location of data used to transform (x,y,0) */ float *loc2d; /* Pointer to real 2d location of data */ - float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independantly*/ + float *h1, *h2; /* Pointer to handle locations, if handles aren't being moved independently */ float ih1[2], ih2[2]; } TransData2D; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index c4295b15858..879dc425091 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2947,7 +2947,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC TransData2D *td2d = *td2dv; int i; - if (fcu == NULL) + if (ELEM(NULL, fcu, fcu->bezt)) return td; for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index cd4cbc77c49..3a7fad24d6b 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -410,18 +410,15 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) } const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) { - const char* menu = N_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); + const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int i = V3D_MANIP_CUSTOM; char *str_menu, *p; - if(UI_translate_iface()) { - title= BLF_gettext(title); - menu= BLF_gettext(menu); - } - - str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), UI_translate_do_tooltip(N_("UserTransSpace from matrix"))); + title = IFACE_(title); + + str_menu = MEM_callocN(strlen(menu) + strlen(title) + 1 + 40 * BIF_countTransformOrientation(C), TIP_("UserTransSpace from matrix")); p = str_menu; p += sprintf(str_menu, "%s", title); diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index 9560924941d..53ccd37952d 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -384,7 +384,7 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3 int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos); if(totleft) { - /* there are deformation modifier which doesn't support deformation matricies + /* there are deformation modifier which doesn't support deformation matrices calculation. Need additional crazyspace correction */ float (*deformedVerts)[3]= *deformcos; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index ae4718d8f56..7f6394e822b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -464,7 +464,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot) /* identifiers */ ot->name= "Minimize Stretch"; ot->idname= "UV_OT_minimize_stretch"; - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING; ot->description="Reduce UV stretching by relaxing angles"; /* api callbacks */ |