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 | |
parent | 30cba27987362054d16b10e73ddf2601af93be68 (diff) | |
parent | 952560dc028516d60a5318eadbcbd5f2c0668335 (diff) |
Merge with trunk r41197
Diffstat (limited to 'source/blender')
262 files changed, 2617 insertions, 1912 deletions
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h index 1c36f3e1504..707cd17e0b3 100644 --- a/source/blender/blenfont/BLF_translation.h +++ b/source/blender/blenfont/BLF_translation.h @@ -60,7 +60,8 @@ void BLF_lang_encoding_name(const char *str); void BLF_lang_encoding(const char *str); -#define _(msgid) BLF_gettext(msgid) +/*#define _(msgid) BLF_gettext(msgid)*/ +/* The "translation-marker" macro. */ #define N_(msgid) msgid #endif /* BLF_TRANSLATION_H */ diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 46be49b37e9..3fe66118cda 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -136,7 +136,7 @@ char *blf_dir_search(const char *file) for(dir=global_font_dir.first; dir; dir= dir->next) { BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file); - if (BLI_exist(full_path)) { + if (BLI_exists(full_path)) { s= BLI_strdup(full_path); break; } @@ -144,7 +144,7 @@ char *blf_dir_search(const char *file) if (!s) { /* check the current directory, why not ? */ - if (BLI_exist(file)) + if (BLI_exists(file)) s= BLI_strdup(file); } @@ -198,13 +198,13 @@ char *blf_dir_metrics_search(const char *filename) s[2]= 'm'; /* first check .afm */ - if (BLI_exist(s)) + if (BLI_exists(s)) return s; /* and now check .pfm */ s[0]= 'p'; - if (BLI_exist(s)) + if (BLI_exists(s)) return s; } MEM_freeN(mfile); diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 851c6542de0..355182fb85f 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -129,7 +129,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font) g= (glyph_ascii_table)[c]; \ i++; \ } \ - else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \ + else if ((c= BLI_str_utf8_as_unicode_step((str), &(i))) != BLI_UTF8_ERR) { \ if ((g= blf_glyph_search((font)->glyph_cache, c)) == NULL) { \ g= blf_glyph_add(font, FT_Get_Char_Index((font)->face, c), c); \ } \ @@ -141,15 +141,20 @@ static void blf_font_ensure_ascii_table(FontBLF *font) const FT_UInt kern_mode= (has_kerning == 0) ? 0 : \ (((_font)->flags & BLF_KERNING_DEFAULT) ? \ ft_kerning_default : FT_KERNING_UNFITTED) \ - \ #define BLF_KERNING_STEP(_font, kern_mode, g_prev, g, delta, pen_x) \ { \ if (g_prev) { \ delta.x= delta.y= 0; \ - if (FT_Get_Kerning((_font)->face, g_prev->idx, g->idx, kern_mode, &delta) == 0) \ + if (FT_Get_Kerning((_font)->face, \ + (g_prev)->idx, \ + (g)->idx, \ + kern_mode, \ + &(delta)) == 0) \ + { \ pen_x += delta.x >> 6; \ + } \ } \ } \ @@ -159,7 +164,7 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= 0, pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; BLF_KERNING_VARS(font, has_kerning, kern_mode); @@ -170,9 +175,9 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); /* do not return this loop if clipped, we want every character tested */ blf_glyph_render(font, g, (float)pen_x, (float)pen_y); @@ -214,10 +219,10 @@ void blf_font_buffer(FontBLF *font, const char *str) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= (int)font->pos[0], pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; - /* buffer spesific vars*/ + /* buffer specific vars*/ const unsigned char b_col_char[4]= {font->b_col[0] * 255, font->b_col[1] * 255, font->b_col[2] * 255, @@ -235,9 +240,9 @@ void blf_font_buffer(FontBLF *font, const char *str) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); chx= pen_x + ((int)g->pos_x); chy= (int)font->pos[1] + g->height; @@ -340,7 +345,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) GlyphBLF *g, *g_prev= NULL; FT_Vector delta; int pen_x= 0, pen_y= 0; - unsigned int i= 0; + size_t i= 0; GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; rctf gbox; @@ -358,9 +363,9 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table); - if (c == 0) break; - if (g == NULL) continue; - if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); + if (c == BLI_UTF8_ERR) break; + if (g == NULL) continue; + if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x); gbox.xmin= pen_x; gbox.xmax= pen_x + g->advance; diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index ba0b9985dd4..df88d0c8fea 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -40,7 +40,6 @@ struct rctf; unsigned int blf_next_p2(unsigned int x); unsigned int blf_hash(unsigned int val); -int blf_utf8_next(unsigned char *buf, unsigned int *iindex); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index ec9501c06a6..87fbbc7b3e5 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -55,6 +55,7 @@ #include "BLI_linklist.h" /* linknode */ #include "BLI_string.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #define DOMAIN_NAME "blender" @@ -103,10 +104,13 @@ void BLF_lang_init(void) BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name)); - if (messagepath) + if (messagepath) { BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath)); - else + } + else { + printf("%s: 'locale' data path for translations not found, continuing\n", __func__); global_messagepath[0]= '\0'; + } } diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c index 8c0a26df4c2..17290c66544 100644 --- a/source/blender/blenfont/intern/blf_translation.c +++ b/source/blender/blenfont/intern/blf_translation.c @@ -38,6 +38,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_path_util.h" @@ -54,11 +55,16 @@ unsigned char *BLF_get_unifont(int *unifont_size_r) { if(unifont_ttf==NULL) { char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts"); - char unifont_path[1024]; + if (fontpath) { + char unifont_path[1024]; - BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename); + BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename); - unifont_ttf= (unsigned char*)BLI_ungzip_to_mem(unifont_path, &unifont_size); + unifont_ttf= (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size); + } + else { + printf("%s: 'fonts' data path not found for international font, continuing\n", __func__); + } } *unifont_size_r= unifont_size; diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c index cfe77887674..d51f9b8af6b 100644 --- a/source/blender/blenfont/intern/blf_util.c +++ b/source/blender/blenfont/intern/blf_util.c @@ -37,6 +37,8 @@ #include "blf_internal.h" +#include "BLI_string_utf8.h" + unsigned int blf_next_p2(unsigned int x) { x -= 1; @@ -62,67 +64,3 @@ unsigned int blf_hash(unsigned int val) key ^= (key >> 17); return key % 257; } - -/* - * This function is from Imlib2 library (font_main.c), a - * library that does image file loading and saving as well - * as rendering, manipulation, arbitrary polygon support, etc. - * - * Copyright (C) 2000 Carsten Haitzler and various contributors - * The original name: imlib_font_utf8_get_next - * more info here: http://docs.enlightenment.org/api/imlib2/html/ - */ -int blf_utf8_next(unsigned char *buf, unsigned int *iindex) -{ - /* Reads UTF8 bytes from 'buf', starting at 'index' and - * returns the code point of the next valid code point. - * 'index' is updated ready for the next call. - * - * Returns 0 to indicate an error (e.g. invalid UTF8) - */ - int index= *iindex, len, r; - unsigned char d, d2, d3, d4; - - d= buf[index++]; - if (!d) - return 0; - - while (buf[index] && ((buf[index] & 0xc0) == 0x80)) - index++; - - len= index - *iindex; - if (len == 1) - r= d; - else if (len == 2) { - /* 2 byte */ - d2= buf[*iindex + 1]; - r= d & 0x1f; /* copy lower 5 */ - r <<= 6; - r |= (d2 & 0x3f); /* copy lower 6 */ - } - else if (len == 3) { - /* 3 byte */ - d2= buf[*iindex + 1]; - d3= buf[*iindex + 2]; - r= d & 0x0f; /* copy lower 4 */ - r <<= 6; - r |= (d2 & 0x3f); - r <<= 6; - r |= (d3 & 0x3f); - } - else { - /* 4 byte */ - d2= buf[*iindex + 1]; - d3= buf[*iindex + 2]; - d4= buf[*iindex + 3]; - r= d & 0x0f; /* copy lower 4 */ - r <<= 6; - r |= (d2 & 0x3f); - r <<= 6; - r |= (d3 & 0x3f); - r <<= 6; - r |= (d4 & 0x3f); - } - *iindex= index; - return r; -} diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index bf619d76e68..cf49c479fe3 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -146,7 +146,7 @@ void BKE_animsys_evaluate_animdata(struct Scene *scene, struct ID *id, struct An void BKE_animsys_evaluate_all_animation(struct Main *main, struct Scene *scene, float ctime); -/* ------------ Specialised API --------------- */ +/* ------------ Specialized API --------------- */ /* There are a few special tools which require these following functions. They are NOT to be used * for standard animation evaluation UNDER ANY CIRCUMSTANCES! * diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index f6910fede8e..0cad398995a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,8 +43,8 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 259 -#define BLENDER_SUBVERSION 4 +#define BLENDER_VERSION 260 +#define BLENDER_SUBVERSION 0 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 @@ -53,7 +53,7 @@ extern "C" { /* can be left blank, otherwise a,b,c... etc with no quotes */ #define BLENDER_VERSION_CHAR /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE rc +#define BLENDER_VERSION_CYCLE alpha struct ListBase; struct MemFile; diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index 8d373da6897..11f5e93809f 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -34,7 +34,6 @@ */ #include "BLI_kdopbvh.h" -#include "BLI_linklist.h" /* * This header encapsulates necessary code to buld a BVH @@ -123,7 +122,7 @@ float nearest_point_in_tri_surface(const float *v0,const float *v1,const float * #define BVHTREE_FROM_VERTICES 1 #define BVHTREE_FROM_EDGES 2 -typedef LinkNode* BVHCache; +typedef struct LinkNode* BVHCache; /* diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index e4e8805164a..214ae03b453 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -85,11 +85,6 @@ struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, str int BKE_font_getselection(struct Object *ob, int *start, int *end); -size_t chtoutf8(const unsigned long c, char o[4]); -void wcs2utf8s(char *dst, const wchar_t *src); -size_t wcsleninu8(wchar_t *src); -size_t utf8towchar(wchar_t *w, const char *c); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 1de3c295f4d..b75a8cb29ec 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -346,9 +346,8 @@ struct bNode *nodeGetActiveID(struct bNodeTree *ntree, short idtype); int nodeSetActiveID(struct bNodeTree *ntree, short idtype, struct ID *id); void nodeClearActiveID(struct bNodeTree *ntree, short idtype); -void NodeTagChanged(struct bNodeTree *ntree, struct bNode *node); -int NodeTagIDChanged(struct bNodeTree *ntree, struct ID *id); -void ntreeClearTags(struct bNodeTree *ntree); +void nodeUpdate(struct bNodeTree *ntree, struct bNode *node); +int nodeUpdateID(struct bNodeTree *ntree, struct ID *id); void nodeFreePreview(struct bNode *node); @@ -601,7 +600,7 @@ void ntreeCompositTagRender(struct Scene *sce); int ntreeCompositTagAnimated(struct bNodeTree *ntree); void ntreeCompositTagGenerators(struct bNodeTree *ntree); void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene); - +void ntreeCompositClearTags(struct bNodeTree *ntree); /* ************** TEXTURE NODES *************** */ diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index 556ff26e621..f1c7356e6b0 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -51,7 +51,7 @@ struct PackedFile *newPackedFileMemory(void *mem, int memlen); void packAll(struct Main *bmain, struct ReportList *reports); /* unpack */ -char *unpackFile(struct ReportList *reports, char *abs_name, char *local_name, struct PackedFile *pf, int how); +char *unpackFile(struct ReportList *reports, const char *abs_name, const char *local_name, struct PackedFile *pf, int how); int unpackVFont(struct ReportList *reports, struct VFont *vfont, int how); int unpackSound(struct Main *bmain, struct ReportList *reports, struct bSound *sound, int how); int unpackImage(struct ReportList *reports, struct Image *ima, int how); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index f8463bab55f..89733f1623c 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -84,7 +84,7 @@ typedef struct SculptSession { int modifiers_active; /* object is deformed with some modifiers */ float (*orig_cos)[3]; /* coords of undeformed mesh */ float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */ - float (*deform_imats)[3][3]; /* crazyspace deformation matricies */ + float (*deform_imats)[3][3]; /* crazyspace deformation matrices */ /* Partial redraw */ int partial_redraw; diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 87684e4895d..f65b937a54b 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -29,7 +29,7 @@ /** \file BKE_utildefines.h * \ingroup bke - * \brief blender format spesific macros + * \brief blender format specific macros * \note generic defines should go in BLI_utildefines.h */ diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 7d7ab56ec3f..512eec4021f 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -41,8 +41,7 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_SDL']: incs += ' ' + env['BF_SDL_INC'] -else: - defs.append('DISABLE_SDL') + defs.append('WITH_SDL') if env['WITH_BF_OPENEXR']: defs.append('WITH_OPENEXR') diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c index 9a3c9462934..8b5cfe1b882 100644 --- a/source/blender/blenkernel/intern/BME_conversions.c +++ b/source/blender/blenkernel/intern/BME_conversions.c @@ -44,6 +44,7 @@ #include "DNA_scene_types.h" #include "BLI_edgehash.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_mesh.h" diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c index 593f50a65e7..bbd439dcb93 100644 --- a/source/blender/blenkernel/intern/BME_eulers.c +++ b/source/blender/blenkernel/intern/BME_eulers.c @@ -38,6 +38,7 @@ #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c index 62a9601da13..e34f2ee1e50 100644 --- a/source/blender/blenkernel/intern/BME_mesh.c +++ b/source/blender/blenkernel/intern/BME_mesh.c @@ -37,7 +37,7 @@ */ - +#include "BLI_listbase.h" #include "MEM_guardedalloc.h" #include "BKE_bmesh.h" #include "bmesh_private.h" diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c index bd5241adb6b..c385ad4fcda 100644 --- a/source/blender/blenkernel/intern/BME_structure.c +++ b/source/blender/blenkernel/intern/BME_structure.c @@ -40,6 +40,7 @@ #include <limits.h> #include "MEM_guardedalloc.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BKE_bmesh.h" /** diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 46b9f1425ad..65aa092ba15 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -50,6 +50,7 @@ #include "BLI_memarena.h" #include "BLI_pbvh.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_cdderivedmesh.h" #include "BKE_displist.h" diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index cd2c272a1c2..da6dd5bd39d 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1430,6 +1430,16 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p VECCOPY(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; + + /* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */ + if((part->draw & PART_DRAW_ROTATE_OB) == 0) { + float xvec[3], q[4]; + xvec[0] = -1.f; + xvec[1] = xvec[2] = 0; + vec_to_quat(q, xvec, ob->trackflag, ob->upflag); + quat_to_mat4(obmat, q); + obmat[3][3]= 1.0f; + } /* Normal particles and cached hair live in global space so we need to * remove the real emitter's transformation before 2nd order duplication. @@ -1448,7 +1458,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p copy_m4_m4(mat, tmat); if(part->draw & PART_DRAW_GLOBAL_OB) - VECADD(mat[3], mat[3], vec); + add_v3_v3v3(mat[3], mat[3], vec); dob= new_dupli_object(lb, ob, mat, ob->lay, counter, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated); copy_m4_m4(dob->omat, oldobmat); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 5358a26e660..b2bcd9aa6aa 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -59,7 +59,6 @@ #include "BLI_blenlib.h" #include "BLI_bpath.h" #include "BLI_dynstr.h" -#include "BLI_path_util.h" #include "BLI_utildefines.h" #include "BLI_callbacks.h" @@ -549,7 +548,7 @@ void BKE_write_undo(bContext *C, const char *name) counter= counter % U.undosteps; BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); - BLI_make_file_string("/", filepath, btempdir, numstr); + BLI_make_file_string("/", filepath, BLI_temporary_dir(), numstr); /* success= */ /* UNUSED */ BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); @@ -719,7 +718,7 @@ void BKE_undo_save_quit(void) /* no undo state to save */ if(undobase.first==undobase.last) return; - BLI_make_file_string("/", str, btempdir, "quit.blend"); + BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend"); file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); if(file == -1) { diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 0f8aad00368..72b456fa9ab 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -40,6 +40,7 @@ #include "BLI_editVert.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_DerivedMesh.h" diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 1ec573c853a..d30476d44f8 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_cdderivedmesh.h" #include "BKE_cloth.h" @@ -974,7 +975,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) * SPRING NETWORK BUILDING IMPLEMENTATION BEGIN ***************************************************************************************/ -// be carefull: implicit solver has to be resettet when using this one! +// be careful: implicit solver has to be resettet when using this one! // --> only for implicit handling of this spring! int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type) { diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 591e0b6a8d2..8eff86d846e 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -41,7 +41,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_editVert.h" #include "BLI_utildefines.h" @@ -1067,7 +1066,7 @@ static void trackto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta cob->matrix[2][2]=size[2]; /* targetmat[2] instead of ownermat[2] is passed to vectomat - * for backwards compatability it seems... (Aligorith) + * for backwards compatibility it seems... (Aligorith) */ sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); vectomat(vec, ct->matrix[2], @@ -2104,7 +2103,7 @@ static void actcon_new_data (void *cdata) { bActionConstraint *data= (bActionConstraint *)cdata; - /* set type to 20 (Loc X), as 0 is Rot X for backwards compatability */ + /* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */ data->type = 20; } @@ -2161,7 +2160,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail); /* determine where in transform range target is */ - /* data->type is mapped as follows for backwards compatability: + /* data->type is mapped as follows for backwards compatibility: * 00,01,02 - rotation (it used to be like this) * 10,11,12 - scaling * 20,21,22 - location @@ -4351,7 +4350,7 @@ short proxylocked_constraints_owner (Object *ob, bPoseChannel *pchan) * constraints either had one or no targets. It used to be called during the main constraint solving * loop, but is now only used for the remaining cases for a few constraints. * - * None of the actual calculations of the matricies should be done here! Also, this function is + * None of the actual calculations of the matrices should be done here! Also, this function is * not to be used by any new constraints, particularly any that have multiple targets. */ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n, short ownertype, void *ownerdata, float mat[][4], float ctime) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 81f57ea12ee..6bd0be3f861 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -47,7 +47,6 @@ #include "DNA_ID.h" #include "BLI_blenlib.h" -#include "BLI_path_util.h" #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_mempool.h" diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 80a40c0a3a3..d3c5942b685 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -38,6 +38,7 @@ #include "BLI_winstuff.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" @@ -1962,7 +1963,7 @@ static void dag_tag_renderlayers(Scene *sce, unsigned int lay) if(node->id==(ID *)sce) { SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1); if(srl && (srl->lay & lay_changed)) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 5ce7b82a45f..e3e769253f1 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -33,7 +33,6 @@ #include <stddef.h> -#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ #include <math.h> #include <stdlib.h> @@ -59,8 +58,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" #include "BLI_jitter.h" -#include "BLI_listbase.h" -#include "BLI_noise.h" #include "BLI_rand.h" #include "BLI_utildefines.h" diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index e2326b005c1..0303f580e67 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -705,7 +705,7 @@ void bezt_add_to_cfra_elem (ListBase *lb, BezTriple *bezt) /* ***************************** Samples Utilities ******************************* */ /* Some utilities for working with FPoints (i.e. 'sampled' animation curve data, such as - * data imported from BVH/Mocap files), which are specialised for use with high density datasets, + * data imported from BVH/Mocap files), which are specialized for use with high density datasets, * which BezTriples/Keyframe data are ill equipped to do. */ diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 1c2f1c8487c..9247646b927 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -33,7 +33,6 @@ #include <stddef.h> -#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ #include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 9c01b35b91a..068e70bbb50 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -64,142 +64,6 @@ static ListBase ttfdata= {NULL, NULL}; -/* UTF-8 <-> wchar transformations */ -size_t chtoutf8(const unsigned long c, char o[4]) -{ - // Variables and initialization -/* memset(o, 0, 4); */ - - // Create the utf-8 string - if (c < 0x80) { - o[0] = (char) c; - return 1; - } - else if (c < 0x800) { - o[0] = (0xC0 | (c>>6)); - o[1] = (0x80 | (c & 0x3f)); - return 2; - } - else if (c < 0x10000) { - o[0] = (0xe0 | (c >> 12)); - o[1] = (0x80 | (c >>6 & 0x3f)); - o[2] = (0x80 | (c & 0x3f)); - return 3; - } - else if (c < 0x200000) { - o[0] = (0xf0 | (c>>18)); - o[1] = (0x80 | (c >>12 & 0x3f)); - o[2] = (0x80 | (c >> 6 & 0x3f)); - o[3] = (0x80 | (c & 0x3f)); - return 4; - } - - /* should we assert here? */ - return 0; -} - -void wcs2utf8s(char *dst, const wchar_t *src) -{ - while(*src) { - dst += chtoutf8(*src++, dst); - } - - *dst= '\0'; -} - -size_t wcsleninu8(wchar_t *src) -{ - char ch_dummy[4]; - size_t len = 0; - - while(*src) { - len += chtoutf8(*src++, ch_dummy); - } - - return len; -} - -static size_t utf8slen(const char *strc) -{ - int len=0; - - while(*strc) { - if ((*strc & 0xe0) == 0xc0) { - if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) - strc++; - } else if ((*strc & 0xf0) == 0xe0) { - if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) - strc += 2; - } else if ((*strc & 0xf8) == 0xf0) { - if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) - strc += 3; - } - - strc++; - len++; - } - - return len; -} - - -/* Converts Unicode to wchar - -According to RFC 3629 "UTF-8, a transformation format of ISO 10646" -(http://tools.ietf.org/html/rfc3629), the valid UTF-8 encoding are: - - Char. number range | UTF-8 octet sequence - (hexadecimal) | (binary) - --------------------+--------------------------------------------- - 0000 0000-0000 007F | 0xxxxxxx - 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - -If the encoding incidated by the first character is incorrect (because the -1 to 3 following characters do not match 10xxxxxx), the output is a '?' and -only a single input character is consumed. - -*/ - -size_t utf8towchar(wchar_t *w, const char *c) -{ - int len=0; - - if(w==NULL || c==NULL) return(0); - - while(*c) { - if ((*c & 0xe0) == 0xc0) { - if((c[1] & 0x80) && (c[1] & 0x40) == 0x00) { - *w=((c[0] &0x1f)<<6) | (c[1]&0x3f); - c++; - } else { - *w = '?'; - } - } else if ((*c & 0xf0) == 0xe0) { - if((c[1] & c[2] & 0x80) && ((c[1] | c[2]) & 0x40) == 0x00) { - *w=((c[0] & 0x0f)<<12) | ((c[1]&0x3f)<<6) | (c[2]&0x3f); - c += 2; - } else { - *w = '?'; - } - } else if ((*c & 0xf8) == 0xf0) { - if((c[1] & c[2] & c[3] & 0x80) && ((c[1] | c[2] | c[3]) & 0x40) == 0x00) { - *w=((c[0] & 0x07)<<18) | ((c[1]&0x1f)<<12) | ((c[2]&0x3f)<<6) | (c[3]&0x3f); - c += 3; - } else { - *w = '?'; - } - } else - *w=(c[0] & 0x7f); - - c++; - w++; - len++; - } - return len; -} - /* The vfont code */ void free_vfont(struct VFont *vf) { @@ -691,10 +555,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if(vfont == NULL) return NULL; // Create unicode string - utf8len = utf8slen(cu->str); + utf8len = BLI_strlen_utf8(cu->str); mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); - utf8towchar(mem, cu->str); + BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1); // Count the wchar_t string length slen = wcslen(mem); diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index cf8f96c143a..37982e7fec9 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -906,8 +906,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_MARKER) { char *name = scene_find_last_marker_name(scene, CFRA); - - if (name) strcpy(text, name); + + if (name) BLI_strncpy(text, name, sizeof(text)); else strcpy(text, "<none>"); BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text); @@ -980,7 +980,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d if (scene->r.stamp & R_STAMP_SEQSTRIP) { Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra); - if (seq) strcpy(text, seq->name+2); + if (seq) BLI_strncpy(text, seq->name+2, sizeof(text)); else strcpy(text, "<none>"); BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text); @@ -1514,7 +1514,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal) Scene *scene; for(scene= G.main->scene.first; scene; scene= scene->id.next) { if(scene->nodetree) { - NodeTagIDChanged(scene->nodetree, &ima->id); + nodeUpdateID(scene->nodetree, &ima->id); } } } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 91f3c7a22ba..609f6cd38f1 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1034,12 +1034,14 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* first bone target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); /* second bone target (name was stored in same var as the first one) */ dtar= &dvar->targets[1]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) // xxx... for safety BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name)); } @@ -1051,6 +1053,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires a single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); @@ -1065,6 +1068,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver) /* only requires single target */ dtar= &dvar->targets[0]; dtar->id= (ID *)idriver->ob; + dtar->idtype= ID_OB; dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode); } } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 9e48e691b87..3baf8e04b90 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1280,9 +1280,9 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int flag= setkeys(ctime, &key->block, k, t, 0); if(flag==0) - do_key(a, a+1, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY); + do_key(a, a+1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY); else - cp_key(a, a+1, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY); + cp_key(a, a+1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY); } } else { @@ -1292,7 +1292,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int for(kb= key->block.first; kb; kb= kb->next) kb->weights= get_weights_array(ob, kb->vgroup); - do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY); + do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY); for(kb= key->block.first; kb; kb= kb->next) { if(kb->weights) MEM_freeN(kb->weights); @@ -1386,7 +1386,7 @@ float *do_ob_key(Scene *scene, Object *ob) if(ELEM(ob->type, OB_MESH, OB_LATTICE)) { float *weights= get_weights_array(ob, kb->vgroup); - cp_key(0, tot, tot, (char*)out, key, actkb, kb, weights, 0); + cp_key(0, tot, tot, out, key, actkb, kb, weights, 0); if(weights) MEM_freeN(weights); } diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 9de75a49998..2056762e627 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -52,6 +52,10 @@ #include "DNA_meshdata_types.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_linklist.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cloth.h" @@ -86,8 +90,8 @@ ModifierData *modifier_new(int type) ModifierTypeInfo *mti = modifierType_getInfo(type); ModifierData *md = MEM_callocN(mti->structSize, mti->structName); - // FIXME: we need to make the name always be unique somehow... - strcpy(md->name, mti->name); + /* note, this name must be made unique later */ + BLI_strncpy(md->name, mti->name, sizeof(md->name)); md->type = type; md->mode = eModifierMode_Realtime diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 97347d85deb..15513675c7a 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -42,6 +42,9 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_anim_types.h" diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index f0be3c99f13..cb1f52a6265 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -184,7 +184,7 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char else if (in_out==SOCK_OUT) BLI_addtail(&node->outputs, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -197,7 +197,7 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, bNodeSo else if (in_out==SOCK_OUT) BLI_insertlinkbefore(&node->outputs, next_sock, sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; return sock; } @@ -221,7 +221,7 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock) MEM_freeN(sock->default_value); MEM_freeN(sock); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) @@ -246,7 +246,7 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) BLI_freelistN(&node->outputs); - ntree->update |= NTREE_UPDATE_NODES; + node->update |= NODE_UPDATE; } /* finds a node based on its name */ @@ -374,7 +374,7 @@ void nodeMakeDynamicType(bNode *node) /*node->typeinfo= MEM_dupallocN(ntype);*/ bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType"); *newtype= *ntype; - strcpy(newtype->name, ntype->name); + BLI_strncpy(newtype->name, ntype->name, sizeof(newtype->name)); node->typeinfo= newtype; } } @@ -823,7 +823,7 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node) if(link->fromnode==node) { lb= &node->outputs; if (link->tonode) - NodeTagChanged(ntree, link->tonode); + link->tonode->update |= NODE_UPDATE; } else if(link->tonode==node) lb= &node->inputs; @@ -1495,18 +1495,19 @@ void ntreeUpdateTree(bNodeTree *ntree) /* update individual nodes */ for (n=0; n < totnodes; ++n) { node = deplist[n]; - if (ntreetype->update_node) - ntreetype->update_node(ntree, node); - else if (node->typeinfo->updatefunc) - node->typeinfo->updatefunc(ntree, node); + + /* node tree update tags override individual node update flags */ + if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) { + if (ntreetype->update_node) + ntreetype->update_node(ntree, node); + else if (node->typeinfo->updatefunc) + node->typeinfo->updatefunc(ntree, node); + } + /* clear update flag */ + node->update = 0; } MEM_freeN(deplist); - - /* ensures only a single output node is enabled, texnode allows multiple though */ - if(ntree->type!=NTREE_TEXTURE) - ntreeSetOutput(ntree); - } /* general tree updates */ @@ -1518,6 +1519,9 @@ void ntreeUpdateTree(bNodeTree *ntree) if (ntreetype->update) ntreetype->update(ntree); else { + /* Trees can be associated with a specific node type (i.e. group nodes), + * in that case a tree update function may be defined by that node type. + */ bNodeType *ntype= node_get_type(ntree, ntree->nodetype); if (ntype && ntype->updatetreefunc) ntype->updatetreefunc(ntree); @@ -1530,24 +1534,24 @@ void ntreeUpdateTree(bNodeTree *ntree) ntree->update = 0; } -void NodeTagChanged(bNodeTree *ntree, bNode *node) +void nodeUpdate(bNodeTree *ntree, bNode *node) { - bNodeTreeType *ntreetype = ntreeGetType(ntree->type); + bNodeTreeType *ntreetype= ntreeGetType(ntree->type); - /* extra null pointer checks here because this is called when unlinking - unknown nodes on file load, so typeinfo pointers may not be set */ - if (ntreetype && ntreetype->update_node) + if (ntreetype->update_node) ntreetype->update_node(ntree, node); - else if (node->typeinfo && node->typeinfo->updatefunc) + else if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } -int NodeTagIDChanged(bNodeTree *ntree, ID *id) +int nodeUpdateID(bNodeTree *ntree, ID *id) { bNodeTreeType *ntreetype; bNode *node; int change = FALSE; - + if(ELEM(NULL, id, ntree)) return change; @@ -1558,6 +1562,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) if(node->id==id) { change = TRUE; ntreetype->update_node(ntree, node); + /* clear update flag */ + node->update = 0; } } } @@ -1567,6 +1573,8 @@ int NodeTagIDChanged(bNodeTree *ntree, ID *id) change = TRUE; if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); + /* clear update flag */ + node->update = 0; } } } diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 2c8975e9cb4..70b0b7727c4 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -182,7 +182,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char // convert relative filenames to absolute filenames - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, basepath); // open the file @@ -192,7 +192,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char if (file <= 0) { BKE_reportf(reports, RPT_ERROR, "Unable to pack file, source path not found: \"%s\"", name); } else { - filelen = BLI_filesize(file); + filelen = BLI_file_descriptor_size(file); if (filelen == 0) { // MEM_mallocN complains about MEM_mallocN(0, "bla"); @@ -240,7 +240,7 @@ void packAll(Main *bmain, ReportList *reports) } -/* +#if 0 // attempt to create a function that generates an unique filename // this will work when all funtions in fileops.c understand relative filenames... @@ -249,6 +249,7 @@ static char *find_new_name(char *name) { char tempname[FILE_MAXDIR + FILE_MAXFILE]; char *newname; + size_t len; if (fop_exists(name)) { for (number = 1; number <= 999; number++) { @@ -258,14 +259,12 @@ static char *find_new_name(char *name) } } } - - newname = mallocN(strlen(tempname) + 1, "find_new_name"); - strcpy(newname, tempname); - - return(newname); + len= strlen(tempname) + 1; + newname = MEM_mallocN(len, "find_new_name"); + memcpy(newname, tempname, len * sizeof(char)); + return newname; } - -*/ +#endif int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, int guimode) { @@ -277,14 +276,14 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i if (guimode) {} //XXX waitcursor(1); - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { - sprintf(tempname, "%s.%03d_", name, number); + BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number); if (! BLI_exists(tempname)) { - if (BLI_copy_fileops(name, tempname) == RET_OK) { + if (BLI_copy(name, tempname) == RET_OK) { remove_tmp = TRUE; } break; @@ -342,7 +341,7 @@ int checkPackedFile(const char *filename, PackedFile *pf) char buf[4096]; char name[FILE_MAXDIR + FILE_MAXFILE]; - strcpy(name, filename); + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, G.main->name); if (stat(name, &st)) { @@ -392,9 +391,10 @@ there was an error or when the user desides to cancel the operation. */ -char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFile *pf, int how) +char *unpackFile(ReportList *reports, const char *abs_name, const char *local_name, PackedFile *pf, int how) { - char *newname = NULL, *temp = NULL; + char *newname = NULL; + const char *temp = NULL; // char newabs[FILE_MAXDIR + FILE_MAXFILE]; // char newlocal[FILE_MAXDIR + FILE_MAXFILE]; @@ -437,12 +437,11 @@ char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFi } if (temp) { - newname = MEM_mallocN(strlen(temp) + 1, "unpack_file newname"); - strcpy(newname, temp); + newname= BLI_strdup(temp); } } - return (newname); + return newname; } @@ -453,17 +452,17 @@ int unpackVFont(ReportList *reports, VFont *vfont, int how) int ret_value = RET_ERROR; if (vfont != NULL) { - strcpy(localname, vfont->name); + BLI_strncpy(localname, vfont->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//fonts/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//fonts/%s", fi); newname = unpackFile(reports, vfont->name, localname, vfont->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(vfont->packedfile); vfont->packedfile = NULL; - strcpy(vfont->name, newname); + BLI_strncpy(vfont->name, newname, sizeof(vfont->name)); MEM_freeN(newname); } } @@ -478,13 +477,13 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) int ret_value = RET_ERROR; if (sound != NULL) { - strcpy(localname, sound->name); + BLI_strncpy(localname, sound->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//sounds/%s", fi); + BLI_snprintf(localname, sizeof(localname), "//sounds/%s", fi); newname = unpackFile(reports, sound->name, localname, sound->packedfile, how); if (newname != NULL) { - strcpy(sound->name, newname); + BLI_strncpy(sound->name, newname, sizeof(sound->name)); MEM_freeN(newname); freePackedFile(sound->packedfile); @@ -506,16 +505,16 @@ int unpackImage(ReportList *reports, Image *ima, int how) int ret_value = RET_ERROR; if (ima != NULL) { - strcpy(localname, ima->name); + BLI_strncpy(localname, ima->name, sizeof(localname)); BLI_splitdirstring(localname, fi); - sprintf(localname, "//textures/%s", fi); - + BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi); + newname = unpackFile(reports, ima->name, localname, ima->packedfile, how); if (newname != NULL) { ret_value = RET_OK; freePackedFile(ima->packedfile); ima->packedfile = NULL; - strcpy(ima->name, newname); + BLI_strncpy(ima->name, newname, sizeof(ima->name)); MEM_freeN(newname); BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 61dd36fc34d..fdaeb8fb2d3 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -55,6 +55,7 @@ #include "BLI_kdtree.h" #include "BLI_rand.h" #include "BLI_threads.h" +#include "BLI_linklist.h" #include "BKE_anim.h" #include "BKE_animsys.h" @@ -4393,33 +4394,50 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0); else psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0); - - copy_m3_m4(nmat, ob->imat); - transpose_m3(nmat); - mul_m3_v3(nmat, nor); - normalize_v3(nor); - - /* make sure that we get a proper side vector */ - if(fabs(dot_v3v3(nor,vec))>0.999999) { - if(fabs(dot_v3v3(nor,xvec))>0.999999) { - nor[0] = 0.0f; - nor[1] = 1.0f; - nor[2] = 0.0f; + + if(psys->part->rotmode == PART_ROT_VEL) { + copy_m3_m4(nmat, ob->imat); + transpose_m3(nmat); + mul_m3_v3(nmat, nor); + normalize_v3(nor); + + /* make sure that we get a proper side vector */ + if(fabs(dot_v3v3(nor,vec))>0.999999) { + if(fabs(dot_v3v3(nor,xvec))>0.999999) { + nor[0] = 0.0f; + nor[1] = 1.0f; + nor[2] = 0.0f; + } + else { + nor[0] = 1.0f; + nor[1] = 0.0f; + nor[2] = 0.0f; + } } - else { - nor[0] = 1.0f; - nor[1] = 0.0f; - nor[2] = 0.0f; + cross_v3_v3v3(side, nor, vec); + normalize_v3(side); + + /* rotate side vector around vec */ + if(psys->part->phasefac != 0) { + float q_phase[4]; + float phasefac = psys->part->phasefac; + if(psys->part->randphasefac != 0.0f) + phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20); + axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI); + + mul_qt_v3(q_phase, side); } - } - cross_v3_v3v3(side, nor, vec); - normalize_v3(side); - cross_v3_v3v3(nor, vec, side); - unit_m4(mat); - VECCOPY(mat[0], vec); - VECCOPY(mat[1], side); - VECCOPY(mat[2], nor); + cross_v3_v3v3(nor, vec, side); + + unit_m4(mat); + VECCOPY(mat[0], vec); + VECCOPY(mat[1], side); + VECCOPY(mat[2], nor); + } + else { + quat_to_mat4(mat, pa->state.rot); + } *scale= len; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6b601ed4b1a..cebefe81495 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -36,7 +36,6 @@ #include <stddef.h> -#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ #include <stdlib.h> #include <math.h> @@ -67,11 +66,9 @@ #include "BLI_blenlib.h" #include "BLI_kdtree.h" #include "BLI_kdopbvh.h" -#include "BLI_listbase.h" #include "BLI_threads.h" -#include "BLI_storage.h" /* For _LARGEFILE64_SOURCE; zlib needs this on some systems */ -#include "BLI_string.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_main.h" #include "BKE_animsys.h" @@ -1607,8 +1604,8 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P } - /* -velocity */ - if(part->randfac != 0.0f){ + /* -velocity (boids need this even if there's no random velocity) */ + if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){ r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f); r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f); r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ab122bb1d0c..4b84654d113 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1039,7 +1039,7 @@ static int ptcache_path(PTCacheID *pid, char *filename) else if (G.relbase_valid || lib) { char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */ - BLI_split_dirfile(blendfilename, NULL, file); + BLI_split_file_part(blendfilename, file, sizeof(file)); i = strlen(file); /* remove .blend */ @@ -1052,8 +1052,8 @@ static int ptcache_path(PTCacheID *pid, char *filename) } /* use the temp path. this is weak but better then not using point cache at all */ - /* btempdir is assumed to exist and ALWAYS has a trailing slash */ - BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); + /* temporary directory is assumed to exist and ALWAYS has a trailing slash */ + BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH"%d", BLI_temporary_dir(), abs(getpid())); return BLI_add_slash(filename); /* new strlen() */ } @@ -2516,7 +2516,7 @@ void BKE_ptcache_remove(void) ptcache_path(NULL, path); - if (BLI_exist(path)) { + if (BLI_exists(path)) { /* The pointcache dir exists? - remove all pointcache */ DIR *dir; @@ -3044,24 +3044,24 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to) char ext[MAX_PTCACHE_PATH]; /* save old name */ - strcpy(old_name, pid->cache->name); + BLI_strncpy(old_name, pid->cache->name, sizeof(old_name)); /* get "from" filename */ - strcpy(pid->cache->name, from); + BLI_strncpy(pid->cache->name, from, sizeof(pid->cache->name)); len = ptcache_filename(pid, old_filename, 0, 0, 0); /* no path */ ptcache_path(pid, path); dir = opendir(path); if(dir==NULL) { - strcpy(pid->cache->name, old_name); + BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name)); return; } BLI_snprintf(ext, sizeof(ext), "_%02u"PTCACHE_EXT, pid->stack_index); /* put new name into cache */ - strcpy(pid->cache->name, to); + BLI_strncpy(pid->cache->name, to, sizeof(pid->cache->name)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -3116,7 +3116,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) if(cache->index >= 0) BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index); else - strcpy(ext, PTCACHE_EXT); + BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext)); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index cdf2e39a4dd..e0e2876f79e 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -166,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) int i= 0; /* strip numbers */ - strcpy(base_name, prop->name); + BLI_strncpy(base_name, prop->name, sizeof(base_name)); for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) { base_name[i]= '\0'; } @@ -178,7 +178,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) strcat(new_name, num); } while(get_property__internal(first, prop, new_name)); - strcpy(prop->name, new_name); + BLI_strncpy(prop->name, new_name, sizeof(prop->name)); } } } @@ -257,7 +257,7 @@ void set_property(bProperty *prop, char *str) *((float *)&prop->data)= (float)atof(str); break; case GPROP_STRING: - strcpy(prop->poin, str); + strcpy(prop->poin, str); /* TODO - check size? */ break; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index d8d6ed6ea6d..943066537d5 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -827,7 +827,7 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y, } } -/* carefull: also used by speed effect! */ +/* careful: also used by speed effect! */ static struct ImBuf* do_cross_effect( SeqRenderData context, Sequence *UNUSED(seq), float UNUSED(cfra), diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 5a2c53f5b9b..cf03a8d3f36 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -61,9 +61,10 @@ #include "BKE_sequencer.h" #include "BKE_fcurve.h" #include "BKE_scene.h" -#include "RNA_access.h" #include "BKE_utildefines.h" +#include "RNA_access.h" + #include "RE_pipeline.h" #include <pthread.h> @@ -866,8 +867,8 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) SeqUniqueInfo sui; char *dot; sui.seq= seq; - strcpy(sui.name_src, seq->name+2); - strcpy(sui.name_dest, seq->name+2); + BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src)); + BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest)); sui.count= 1; sui.match= 1; /* assume the worst to start the loop */ @@ -887,7 +888,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui); } - strcpy(seq->name+2, sui.name_dest); + BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2); } static const char *give_seqname_by_type(int type) @@ -1204,7 +1205,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, sorry folks, please rebuild your proxies... */ if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) { - strcpy(dir, seq->strip->proxy->dir); + BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir)); } else if (seq->type == SEQ_IMAGE) { BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir); } else { @@ -3360,9 +3361,9 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str) SWAP(Sequence, *seq_a, *seq_b); /* swap back names so animation fcurves dont get swapped */ - strcpy(name, seq_a->name+2); - strcpy(seq_a->name+2, seq_b->name+2); - strcpy(seq_b->name+2, name); + BLI_strncpy(name, seq_a->name+2, sizeof(name)); + BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2); + BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2); /* swap back opacity, and overlay mode */ SWAP(int, seq_a->blend_mode, seq_b->blend_mode); @@ -3647,7 +3648,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element to store the filename */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0); @@ -3706,7 +3707,7 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo /* we only need 1 element for MOVIE strips */ strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem"); - BLI_split_dirfile(seq_load->path, strip->dir, se->name); + BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); calc_sequence_disp(scene, seq); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 85140841f15..c1833b39b8b 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -131,15 +131,15 @@ struct Scene; struct DerivedMesh; struct SmokeModifierData; -// forward declerations -static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); -void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); -static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); - #define TRI_UVOFFSET (1./4.) +#ifdef WITH_SMOKE +/* forward declerations */ +static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len); +static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int correct); +static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs); +#else /* WITH_SMOKE */ /* Stubs to use when smoke is disabled */ -#ifndef WITH_SMOKE struct WTURBULENCE *smoke_turbulence_init(int *UNUSED(res), int UNUSED(amplify), int UNUSED(noisetype)) { return NULL; } struct FLUID_3D *smoke_init(int *UNUSED(res), float *UNUSED(p0)) { return NULL; } void smoke_free(struct FLUID_3D *UNUSED(fluid)) {} @@ -148,9 +148,9 @@ void smoke_initWaveletBlenderRNA(struct WTURBULENCE *UNUSED(wt), float *UNUSED(s void smoke_initBlenderRNA(struct FLUID_3D *UNUSED(fluid), float *UNUSED(alpha), float *UNUSED(beta), float *UNUSED(dt_factor), float *UNUSED(vorticity), int *UNUSED(border_colli)) {} long long smoke_get_mem_req(int UNUSED(xres), int UNUSED(yres), int UNUSED(zres), int UNUSED(amplify)) { return 0; } void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Object *UNUSED(ob), DerivedMesh *UNUSED(dm)) {} -#endif // WITH_SMOKE - +#endif /* WITH_SMOKE */ +#ifdef WITH_SMOKE static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm) { if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid) @@ -455,7 +455,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) } /*! init triangle divisions */ -void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) +static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *faces, int numfaces, int numtris, int **tridivs, float cell_len) { // mTriangleDivs1.resize( faces.size() ); // mTriangleDivs2.resize( faces.size() ); @@ -554,6 +554,8 @@ void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFace *fac } } +#endif /* WITH_SMOKE */ + static void smokeModifier_freeDomain(SmokeModifierData *smd) { if(smd->domain) @@ -812,13 +814,12 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData } } +#ifdef WITH_SMOKE // forward decleration static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct); static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct); -#ifdef WITH_SMOKE - static int get_lamp(Scene *scene, float *light) { Base *base_tmp = NULL; @@ -1660,4 +1661,4 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa } } -#endif // WITH_SMOKE +#endif /* WITH_SMOKE */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 88f72c33802..cd147f4dbed 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -68,6 +68,7 @@ variables on the UI for now #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BLI_threads.h" @@ -207,7 +208,7 @@ static float sb_time_scale(Object *ob) } return (1.0f); /* - this would be frames/sec independant timing assuming 25 fps is default + this would be frames/sec independent timing assuming 25 fps is default but does not work very well with NLA return (25.0f/scene->r.frs_sec) */ @@ -2818,7 +2819,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob,timenow); /* finish matrix and solve */ -#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be usefull .. so keep that BM +#if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM if(nl_flags & NLF_SOLVE){ //double sct,sst=PIL_check_seconds_timer(); for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) { @@ -3540,7 +3541,7 @@ static void lattice_to_softbody(Scene *scene, Object *ob) } } - /* create some helper edges to enable SB lattice to be usefull at all */ + /* create some helper edges to enable SB lattice to be useful at all */ if (ob->softflag & OB_SB_EDGES){ makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob); build_bps_springlist(ob); /* link bps to springs */ diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index f2d92154c66..02e381fe9b4 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -63,6 +63,10 @@ #include "BKE_sequencer.h" #include "BKE_scene.h" +// evil quiet NaN definition +static const int NAN_INT = 0x7FC00000; +#define NAN_FLT *((float*)(&NAN_INT)) + #ifdef WITH_AUDASPACE // evil global ;-) static int sound_cfra; @@ -75,9 +79,9 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename) char str[FILE_MAX]; char *path; - int len; + size_t len; - strcpy(str, filename); + BLI_strncpy(str, filename, sizeof(str)); path = /*bmain ? bmain->name :*/ G.main->name; @@ -295,7 +299,10 @@ void sound_cache(struct bSound* sound) AUD_unload(sound->cache); sound->cache = AUD_bufferSound(sound->handle); - sound->playback_handle = sound->cache; + if(sound->cache) + sound->playback_handle = sound->cache; + else + sound->playback_handle = sound->handle; } void sound_cache_notifying(struct Main* main, struct bSound* sound) @@ -332,6 +339,8 @@ void sound_load(struct Main *bmain, struct bSound* sound) sound->playback_handle = NULL; } + sound_free_waveform(sound); + // XXX unused currently #if 0 switch(sound->type) @@ -625,7 +634,7 @@ float sound_sync_scene(struct Scene *scene) else return AUD_getPosition(scene->sound_scene_handle); } - return 0.0f; + return NAN_FLT; } int sound_scene_playing(struct Scene *scene) @@ -782,7 +791,7 @@ static void sound_start_play_scene(struct Scene *UNUSED(scene)) {} void sound_play_scene(struct Scene *UNUSED(scene)) {} void sound_stop_scene(struct Scene *UNUSED(scene)) {} void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {} -float sound_sync_scene(struct Scene *UNUSED(scene)) { return 0.0f; } +float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; } int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; } int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; } void sound_read_waveform(struct bSound* sound) { (void)sound; } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d487875dd55..e39cfafe7b7 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -141,7 +141,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin ccgSubSurf_setUseAgeCounts(ccgSS, 1, 8, 8, 8); } - ccgSubSurf_setCalcVertexNormals(ccgSS, 1, BLI_STRUCT_OFFSET(DMGridData, no)); + ccgSubSurf_setCalcVertexNormals(ccgSS, 1, offsetof(DMGridData, no)); return ccgSS; } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index d344f79bb6c..7d720aed62c 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -992,7 +992,7 @@ void autotexname(Tex *tex) if(tex->type==TEX_IMAGE) { ima= tex->ima; if(ima) { - strcpy(di, ima->name); + BLI_strncpy(di, ima->name, sizeof(di)); BLI_splitdirstring(di, fi); strcpy(di, "I."); strcat(di, fi); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 58a2f45e876..7b414f7746a 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -407,8 +407,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char return; } - prop = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) prop_name); + prop = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, prop_name); if (!prop) { return; } @@ -1025,8 +1024,7 @@ void ffmpeg_property_del(RenderData *rd, void *type, void *prop_) return; } - group = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) type); + group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (group && prop) { IDP_RemFromGroup(group, prop); IDP_FreeProperty(prop); @@ -1057,11 +1055,10 @@ IDProperty *ffmpeg_property_add(RenderData *rd, char * type, int opt_index, int = IDP_New(IDP_GROUP, val, "ffmpeg"); } - group = IDP_GetPropertyFromGroup( - rd->ffcodecdata.properties, (char*) type); + group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); if (!group) { - group = IDP_New(IDP_GROUP, val, (char*) type); + group = IDP_New(IDP_GROUP, val, type); IDP_AddToGroup(rd->ffcodecdata.properties, group); } diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index ba5d04f3021..356709d5ccd 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -64,8 +64,6 @@ struct ListBase; #include <stdlib.h> -extern char btempdir[]; /* creator.c temp dir used instead of U.tempdir, set with BLI_where_is_temp( btempdir, 1 ); */ - #ifdef __cplusplus extern "C" { #endif @@ -74,9 +72,9 @@ extern "C" { #include "BLI_string.h" -#include "BLI_path_util.h" +#include "BLI_string_utf8.h" -#include "BLI_storage.h" +#include "BLI_path_util.h" #include "BLI_fileops.h" @@ -84,13 +82,6 @@ extern "C" { #include "BLI_noise.h" -/** - * @param strct The structure of interest - * @param member The name of a member field of @a strct - * @retval The offset in bytes of @a member within @a strct - */ -#define BLI_STRUCT_OFFSET(strct, member) ((int)(intptr_t) &((strct*) 0)->member) - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index fba13035f02..23ffdbae59b 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -30,7 +30,7 @@ #ifndef BLI_EDGEHASH_H #define BLI_EDGEHASH_H -/** \file BLI_storage.h +/** \file BLI_edgehash.h * \ingroup bli * \author Daniel Dunbar * \brief A general unordered 2-int pair hash table ADT. diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 21d28ca3185..ebe231e2973 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -29,10 +29,7 @@ /** \file BLI_fileops.h * \ingroup bli - * \author Daniel Dunbar - * \brief More low-level fileops from Daniel Dunbar. Two functions were also - * defined in storage.c. These are the old fop_ prefixes. There is - * definitely some redundancy here! + * \brief File and directory operations. * */ #ifndef BLI_FILEOPS_H @@ -42,26 +39,48 @@ extern "C" { #endif -void BLI_recurdir_fileops(const char *dirname); -int BLI_link(const char *file, const char *to); -int BLI_is_writable(const char *filename); +#include "BLI_fileops_types.h" -/** - * @attention Do not confuse with BLI_exist - */ -int BLI_exists(const char *file); -int BLI_copy_fileops(const char *file, const char *to); -int BLI_rename(const char *from, const char *to); -int BLI_gzip(const char *from, const char *to); -char *BLI_ungzip_to_mem(const char *from_file, int *size_r); -int BLI_delete(const char *file, int dir, int recursive); -int BLI_move(const char *file, const char *to); -int BLI_touch(const char *file); - -/* only for the sane unix world: direct calls to system functions :( */ -#ifndef WIN32 -void BLI_setCmdCallBack(int (*f)(char*)); -#endif +/* for size_t (needed on windows) */ +#include <stddef.h> + +/* Common */ + +int BLI_exists(const char *path); +int BLI_copy(const char *path, const char *to); +int BLI_rename(const char *from, const char *to); +int BLI_delete(const char *path, int dir, int recursive); +int BLI_move(const char *path, const char *to); +int BLI_create_symlink(const char *path, const char *to); + +/* Directories */ + +struct direntry; + +int BLI_is_dir(const char *path); +void BLI_dir_create_recursive(const char *dir); +double BLI_dir_free_space(const char *dir); +char *BLI_current_working_dir(char *dir, const int maxlen); + +unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist); + +/* Files */ + +int BLI_file_is_writable(const char *file); +int BLI_file_touch(const char *file); + +int BLI_file_gzip(const char *from, const char *to); +char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r); + +size_t BLI_file_descriptor_size(int file); +size_t BLI_file_size(const char *file); + + /* compare if one was last modified before the other */ +int BLI_file_older(const char *file1, const char *file2); + + /* read ascii file as lines, empty list if reading fails */ +struct LinkNode *BLI_file_read_as_lines(const char *file); +void BLI_file_free_lines(struct LinkNode *lines); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_storage_types.h b/source/blender/blenlib/BLI_fileops_types.h index 07c0ceffeb5..58dcf1a5441 100644 --- a/source/blender/blenlib/BLI_storage_types.h +++ b/source/blender/blenlib/BLI_fileops_types.h @@ -26,10 +26,11 @@ * * ***** END GPL LICENSE BLOCK ***** */ -#ifndef BLI_STORAGE_TYPES_H -#define BLI_STORAGE_TYPES_H -/** \file BLI_storage_types.h +#ifndef BLI_FILEOPS_TYPES_H +#define BLI_FILEOPS_TYPES_H + +/** \file BLI_fileops_types.h * \ingroup bli * \brief Some types for dealing with directories. */ @@ -75,5 +76,5 @@ struct dirlink char *name; }; -#endif /* BLI_STORAGE_TYPES_H */ +#endif /* BLI_FILEOPS_TYPES_H */ diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index e4afc6ad79b..e4ef834822f 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -39,13 +39,6 @@ extern "C" { #endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "BLI_mempool.h" -#include "BLI_blenlib.h" - typedef unsigned int (*GHashHashFP) (const void *key); typedef int (*GHashCmpFP) (const void *a, const void *b); typedef void (*GHashKeyFreeFP) (void *key); diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index 4ea48929efb..56df71b5582 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -29,7 +29,7 @@ #ifndef BLI_MEMPOOL_H #define BLI_MEMPOOL_H -/** \file BLI_storage.h +/** \file BLI_mempool.h * \ingroup bli * \author Geoffrey Bantle * \brief Simple fast memory allocator. diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 81fc8a50db6..82794e08fa0 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -65,10 +65,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #define BLENDER_SYSTEM_PLUGINS 54 #define BLENDER_SYSTEM_PYTHON 54 -#define BLENDER_TEMP 80 - -#define BLENDER_USERFOLDER(id) (id >= BLENDER_USER_CONFIG && id <= BLENDER_USER_PLUGINS) - /* for BLI_get_folder_version only */ #define BLENDER_RESOURCE_PATH_USER 0 #define BLENDER_RESOURCE_PATH_LOCAL 1 @@ -79,17 +75,6 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check); #define BLENDER_HISTORY_FILE "recent-files.txt" #ifdef WIN32 -#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" -#elif defined(__APPLE__) -#define BLENDER_USER_FORMAT "%s/Blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" -#else -#define BLENDER_USER_FORMAT "%s/.blender/%s" -#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" -#endif - -#ifdef WIN32 #define SEP '\\' #define ALTSEP '/' #else @@ -103,7 +88,9 @@ void BLI_setenv_if_new(const char *env, const char* val); void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file); void BLI_make_exist(char *dir); void BLI_make_existing_file(const char *name); -void BLI_split_dirfile(const char *string, char *dir, char *file); +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); +void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen); +void BLI_split_file_part(const char *string, char *file, const size_t filelen); void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); char *BLI_path_basename(char *path); int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir); @@ -179,29 +166,20 @@ void BLI_path_rel(char *file, const char *relfile); */ void BLI_char_switch(char *string, char from, char to); -/** - * Checks if name is a fully qualified filename to an executable. - * If not it searches $PATH for the file. On Windows it also - * adds the correct extension (.com .exe etc) from - * $PATHEXT if necessary. Also on Windows it translates - * the name to its 8.3 version to prevent problems with - * spaces and stuff. Final result is returned in fullname. - * - * @param fullname The full path and full name of the executable - * @param name The name of the executable (usually argv[0]) to be checked - */ -void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name); - - /** - * Gets the temp directory when blender first runs. - * If the default path is not found, use try $TEMP - * - * Also make sure the temp dir has a trailing slash - * - * @param fullname The full path to the temp directory - */ -void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp); - + /* Initialize path to program executable */ +void BLI_init_program_path(const char *argv0); + /* Initialize path to temporary directory. + * NOTE: On Window userdir will be set to the temporary directory! */ +void BLI_init_temporary_dir(char *userdir); + + /* Path to executable */ +const char *BLI_program_path(void); + /* Path to directory of executable */ +const char *BLI_program_dir(void); + /* Path to temporary directory (with trailing slash) */ +const char *BLI_temporary_dir(void); + /* Path to the system temporary directory (with trailing slash) */ +void BLI_system_temporary_dir(char *dir); #ifdef WITH_ICONV void BLI_string_to_utf8(char *original, char *utf_8, const char *code); diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index c5acf7b7f70..3cc6ebcc7da 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -30,7 +30,7 @@ #ifndef BLI_SCANFILL_H #define BLI_SCANFILL_H -/** \file BLI_storage.h +/** \file BLI_scanfill.h * \ingroup bli * \since March 2001 * \author nzc diff --git a/source/blender/blenlib/BLI_storage.h b/source/blender/blenlib/BLI_storage.h deleted file mode 100644 index 017f9877baf..00000000000 --- a/source/blender/blenlib/BLI_storage.h +++ /dev/null @@ -1,82 +0,0 @@ -/* $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef BLI_STORAGE_H -#define BLI_STORAGE_H - -/** \file BLI_storage.h - * \ingroup bli - */ - -#ifdef WIN32 -/* for size_t, only needed on win32 for some reason */ -#include <stddef.h> -#endif - -struct direntry; - - -void BLI_adddirstrings(void); -void BLI_builddir(const char *dirname, const char *relname); -int BLI_compare(struct direntry *entry1, struct direntry *entry2); - -size_t BLI_filesize(int file); -size_t BLI_filepathsize(const char *path); -double BLI_diskfree(const char *dir); -char *BLI_getwdN(char *dir, const int maxncpy); - -unsigned int BLI_getdir(const char *dirname, struct direntry **filelist); -/** - * @attention Do not confuse with BLI_exists - */ -int BLI_exist(const char *name); -/** - * Read a file as ASCII lines. An empty list is - * returned if the file cannot be opened or read. - * - * @attention The returned list should be free'd with - * BLI_free_file_lines. - * - * @param name The name of the file to read. - * @retval A list of strings representing the file lines. - */ - -int BLI_is_dir(const char *file); - -struct LinkNode *BLI_read_file_as_lines(const char *name); - - /** - * Free the list returned by BLI_read_file_as_lines. - */ -void BLI_free_file_lines(struct LinkNode *lines); - - /* Compare if one was last modified before the other */ -int BLI_file_older(const char *file1, const char *file2); - -#endif /* BLI_STORAGE_H */ - diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index c53ce9dced5..958f240e3a8 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -25,9 +25,7 @@ * Contributor(s): none yet. * * ***** END GPL LICENSE BLOCK ***** - * - * $Id$ -*/ + */ #ifndef BLI_STRING_H #define BLI_STRING_H @@ -142,12 +140,6 @@ void BLI_timestr(double _time, char *str); /* time var is global */ void BLI_ascii_strtolower(char *str, int len); void BLI_ascii_strtoupper(char *str, int len); - -/* string_utf8.c - may move these into their own header some day - campbell */ -char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); -int BLI_utf8_invalid_byte(const char *str, int length); -int BLI_utf8_invalid_strip(char *str, int length); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h new file mode 100644 index 00000000000..765ae93828e --- /dev/null +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -0,0 +1,63 @@ +/* + * $Id$ + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef BLI_STRING_UTF8_H +#define BLI_STRING_UTF8_H + +/** \file BLI_string_utf8.h + * \ingroup bli + */ + +#ifdef __cplusplus +extern "C" { +#endif + +char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy); +int BLI_utf8_invalid_byte(const char *str, int length); +int BLI_utf8_invalid_strip(char *str, int length); + + /* copied from glib */ +unsigned int BLI_str_utf8_as_unicode(const char *p); +unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index); +unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index); +size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf); + +char *BLI_str_find_prev_char_utf8(const char *str, const char *p); +char *BLI_str_find_next_char_utf8(const char *p, const char *end); +char *BLI_str_prev_char_utf8(const char *p); + + /* wchar_t functions, copied from blenders own font.c originally */ +size_t BLI_wstrlen_utf8(const wchar_t *src); +size_t BLI_strlen_utf8(const char *strc); +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy); +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst, const char *src, const size_t maxcpy); + +#define BLI_UTF8_MAX 6 +#define BLI_UTF8_ERR ((unsigned int)-1) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 456ee72c4e0..c1eed40de74 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -67,63 +67,113 @@ #define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) ) #define MAX4(x,y,z,a) MAX2( MAX2((x),(y)) , MAX2((z),(a)) ) -#define INIT_MINMAX(min, max) { (min)[0]= (min)[1]= (min)[2]= 1.0e30f; (max)[0]= (max)[1]= (max)[2]= -1.0e30f; } - -#define INIT_MINMAX2(min, max) { (min)[0]= (min)[1]= 1.0e30f; (max)[0]= (max)[1]= -1.0e30f; } - -#define DO_MIN(vec, min) { if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ - if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ - if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; } \ - -#define DO_MAX(vec, max) { if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ - if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \ - if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; } \ - -#define DO_MINMAX(vec, min, max) { if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ - if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ - if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \ - if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ - if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \ - if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; } \ - -#define DO_MINMAX2(vec, min, max) { if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ - if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ - if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ - if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; } +#define INIT_MINMAX(min, max) { \ + (min)[0]= (min)[1]= (min)[2]= 1.0e30f; \ + (max)[0]= (max)[1]= (max)[2]= -1.0e30f; \ + } +#define INIT_MINMAX2(min, max) { \ + (min)[0]= (min)[1]= 1.0e30f; \ + (max)[0]= (max)[1]= -1.0e30f; \ + } +#define DO_MIN(vec, min) { \ + if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ + if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ + if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \ + } +#define DO_MAX(vec, max) { \ + if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ + if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \ + if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \ + } +#define DO_MINMAX(vec, min, max) { \ + if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ + if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ + if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2]; \ + if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ + if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \ + if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2]; \ + } +#define DO_MINMAX2(vec, min, max) { \ + if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0]; \ + if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1]; \ + if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0]; \ + if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1]; \ + } /* some math and copy defines */ #ifndef SWAP -# define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } +# define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; } #endif -#define ABS(a) ( (a)<0 ? (-(a)) : (a) ) - -#define AVG2(x, y) ( 0.5 * ((x) + (y)) ) +#define ABS(a) ( (a)<0 ? (-(a)) : (a) ) #define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f)) #define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f)) -#define F3TOCHAR3(v2,v1) (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])) -#define F3TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ - (v1)[3] = 255; } -#define F4TOCHAR4(v2,v1) { (v1)[0]=FTOCHAR((v2[0])); (v1)[1]=FTOCHAR((v2[1])); (v1)[2]=FTOCHAR((v2[2])); \ - (v1)[3]=FTOCHAR((v2[3])); } - - -#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} -#define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);} -#define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);} -#define LONGCOPY(a, b, c) {int lcpc=c, *lcpa=(int *)a, *lcpb=(int *)b; while(lcpc-->0) *(lcpa++)= *(lcpb++);} - - -#define VECADD(v1,v2,v3) {*(v1)= *(v2) + *(v3); *(v1+1)= *(v2+1) + *(v3+1); *(v1+2)= *(v2+2) + *(v3+2);} -#define VECSUB(v1,v2,v3) {*(v1)= *(v2) - *(v3); *(v1+1)= *(v2+1) - *(v3+1); *(v1+2)= *(v2+2) - *(v3+2);} -#define VECSUB2D(v1,v2,v3) {*(v1)= *(v2) - *(v3); *(v1+1)= *(v2+1) - *(v3+1);} -#define VECADDFAC(v1,v2,v3,fac) {*(v1)= *(v2) + *(v3)*(fac); *(v1+1)= *(v2+1) + *(v3+1)*(fac); *(v1+2)= *(v2+2) + *(v3+2)*(fac);} -#define VECSUBFAC(v1,v2,v3,fac) {*(v1)= *(v2) - *(v3)*(fac); *(v1+1)= *(v2+1) - *(v3+1)*(fac); *(v1+2)= *(v2+2) - *(v3+2)*(fac);} -#define QUATADDFAC(v1,v2,v3,fac) {*(v1)= *(v2) + *(v3)*(fac); *(v1+1)= *(v2+1) + *(v3+1)*(fac); *(v1+2)= *(v2+2) + *(v3+2)*(fac); *(v1+3)= *(v2+3) + *(v3+3)*(fac);} - -#define INPR(v1, v2) ( (v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2] ) +#define F3TOCHAR3(v2, v1) { \ + (v1)[0]= FTOCHAR((v2[0])); \ + (v1)[1]= FTOCHAR((v2[1])); \ + (v1)[2]= FTOCHAR((v2[2])); \ + } +#define F3TOCHAR4(v2, v1) { \ + (v1)[0]= FTOCHAR((v2[0])); \ + (v1)[1]= FTOCHAR((v2[1])); \ + (v1)[2]= FTOCHAR((v2[2])); \ + (v1)[3]= 255; \ + } +#define F4TOCHAR4(v2, v1) { \ + (v1)[0]= FTOCHAR((v2[0])); \ + (v1)[1]= FTOCHAR((v2[1])); \ + (v1)[2]= FTOCHAR((v2[2])); \ + (v1)[3]= FTOCHAR((v2[3])); \ + } +#define VECCOPY(v1, v2) { \ + *(v1)= *(v2); \ + *(v1+1)= *(v2+1); \ + *(v1+2)= *(v2+2); \ + } +#define VECCOPY2D(v1, v2) { \ + *(v1)= *(v2); \ + *(v1+1)= *(v2+1); \ + } +#define QUATCOPY(v1, v2) { \ + *(v1)= *(v2); \ + *(v1+1)= *(v2+1); \ + *(v1+2)= *(v2+2); \ + *(v1+3)= *(v2+3); \ + } +#define VECADD(v1,v2,v3) { \ + *(v1)= *(v2) + *(v3); \ + *(v1+1)= *(v2+1) + *(v3+1); \ + *(v1+2)= *(v2+2) + *(v3+2); \ + } +#define VECSUB(v1,v2,v3) { \ + *(v1)= *(v2) - *(v3); \ + *(v1+1)= *(v2+1) - *(v3+1); \ + *(v1+2)= *(v2+2) - *(v3+2); \ + } +#define VECSUB2D(v1,v2,v3) { \ + *(v1)= *(v2) - *(v3); \ + *(v1+1)= *(v2+1) - *(v3+1); \ + } +#define VECADDFAC(v1,v2,v3,fac) { \ + *(v1)= *(v2) + *(v3)*(fac); \ + *(v1+1)= *(v2+1) + *(v3+1)*(fac); \ + *(v1+2)= *(v2+2) + *(v3+2)*(fac); \ + } +#define VECSUBFAC(v1,v2,v3,fac) { \ + *(v1)= *(v2) - *(v3)*(fac); \ + *(v1+1)= *(v2+1) - *(v3+1)*(fac); \ + *(v1+2)= *(v2+2) - *(v3+2)*(fac); \ + } +#define QUATADDFAC(v1,v2,v3,fac) { \ + *(v1)= *(v2) + *(v3)*(fac); \ + *(v1+1)= *(v2+1) + *(v3+1)*(fac); \ + *(v1+2)= *(v2+2) + *(v3+2)*(fac); \ + *(v1+3)= *(v2+3) + *(v3+3)*(fac); \ + } + +#define INPR(v1, v2) ( (v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2] ) /* some misc stuff.... */ #define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c) @@ -138,28 +188,36 @@ #define IN_RANGE_INCL(a, b, c) ((b < c)? ((b<=a && a<=c)? 1:0) : ((c<=a && a<=b)? 1:0)) /* array helpers */ -#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) (arr_dtype *)((char*)arr_start + (elem_size*(tot - 1))) -#define ARRAY_HAS_ITEM(item, arr_start, arr_dtype, elem_size, tot) ((item >= arr_start) && (item <= ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot))) +#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) \ + (arr_dtype *)((char*)arr_start + (elem_size*(tot - 1))) + +#define ARRAY_HAS_ITEM(item, arr_start, arr_dtype, elem_size, tot) ( \ + (item >= arr_start) && \ + (item <= ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot)) \ + ) /* This one rotates the bytes in an int64, int (32) and short (16) */ -#define SWITCH_INT64(a) { \ - char s_i, *p_i; \ - p_i= (char *)&(a); \ - s_i=p_i[0]; p_i[0]=p_i[7]; p_i[7]=s_i; \ - s_i=p_i[1]; p_i[1]=p_i[6]; p_i[6]=s_i; \ - s_i=p_i[2]; p_i[2]=p_i[5]; p_i[5]=s_i; \ - s_i=p_i[3]; p_i[3]=p_i[4]; p_i[4]=s_i; } - - #define SWITCH_INT(a) { \ - char s_i, *p_i; \ - p_i= (char *)&(a); \ - s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \ - s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; } - -#define SWITCH_SHORT(a) { \ - char s_i, *p_i; \ - p_i= (char *)&(a); \ - s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; } +#define SWITCH_INT64(a) { \ + char s_i, *p_i; \ + p_i= (char *)&(a); \ + s_i= p_i[0]; p_i[0]= p_i[7]; p_i[7]= s_i; \ + s_i= p_i[1]; p_i[1]= p_i[6]; p_i[6]= s_i; \ + s_i= p_i[2]; p_i[2]= p_i[5]; p_i[5]= s_i; \ + s_i= p_i[3]; p_i[3]= p_i[4]; p_i[4]= s_i; \ + } + +#define SWITCH_INT(a) { \ + char s_i, *p_i; \ + p_i= (char *)&(a); \ + s_i= p_i[0]; p_i[0]= p_i[3]; p_i[3]= s_i; \ + s_i= p_i[1]; p_i[1]= p_i[2]; p_i[2]= s_i; \ + } + +#define SWITCH_SHORT(a) { \ + char s_i, *p_i; \ + p_i= (char *)&(a); \ + s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; \ + } /* Warning-free macros for storing ints in pointers. Use these _only_ @@ -221,25 +279,25 @@ # else # define _dummy_abort() (void)0 # endif -# ifdef __GNUC__ /* just want to check if __func__ is available */ -# define BLI_assert(a) \ -do { \ - if (!(a)) { \ - fprintf(stderr, \ - "BLI_assert failed: %s, %s(), %d at \'%s\'\n", \ - __FILE__, __func__, __LINE__, STRINGIFY(a)); \ - _dummy_abort(); \ - } \ +# if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */ +# define BLI_assert(a) \ +do { \ + if (!(a)) { \ + fprintf(stderr, \ + "BLI_assert failed: %s, %s(), %d at \'%s\'\n", \ + __FILE__, __func__, __LINE__, STRINGIFY(a)); \ + _dummy_abort(); \ + } \ } while (0) # else # define BLI_assert(a) \ -do { \ - if (0 == (a)) { \ - fprintf(stderr, \ - "BLI_assert failed: %s, %d at \'%s\'\n", \ - __FILE__, __LINE__, STRINGIFY(a)); \ - _dummy_abort(); \ - } \ +do { \ + if (0 == (a)) { \ + fprintf(stderr, \ + "BLI_assert failed: %s, %d at \'%s\'\n", \ + __FILE__, __LINE__, STRINGIFY(a)); \ + _dummy_abort(); \ + } \ } while (0) # endif #else diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index aa822731474..49d849bdf14 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -99,6 +99,7 @@ set(SRC BLI_edgehash.h BLI_editVert.h BLI_fileops.h + BLI_fileops_types.h BLI_fnmatch.h BLI_ghash.h BLI_graph.h @@ -125,9 +126,8 @@ set(SRC BLI_rand.h BLI_rect.h BLI_scanfill.h - BLI_storage.h - BLI_storage_types.h BLI_string.h + BLI_string_utf8.h BLI_threads.h BLI_utildefines.h BLI_uvproject.h diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h index 82869035d50..36ea43bef2d 100644 --- a/source/blender/blenlib/PIL_time.h +++ b/source/blender/blenlib/PIL_time.h @@ -1,7 +1,5 @@ -/* - * @file PIL_time.h - * - * Platform independant time functions. +/* + * Platform independent time functions. * $Id$ * * ***** BEGIN GPL LICENSE BLOCK ***** @@ -51,7 +49,7 @@ extern double PIL_check_seconds_timer (void); /** - * Platform-independant sleep function. + * Platform-independent sleep function. * @param ms Number of milliseconds to sleep */ void PIL_sleep_ms (int ms); diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c index cf3605a80ff..00903aa42cd 100644 --- a/source/blender/blenlib/intern/BLI_args.c +++ b/source/blender/blenlib/intern/BLI_args.c @@ -35,12 +35,13 @@ #include <ctype.h> /* for tolower */ +#include <string.h> #include "MEM_guardedalloc.h" +#include "BLI_utildefines.h" #include "BLI_listbase.h" #include "BLI_string.h" -#include "BLI_utildefines.h" #include "BLI_args.h" #include "BLI_ghash.h" diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 03e3b7ab560..e34abaf15f9 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -32,11 +32,20 @@ * \ingroup bli */ +#include <string.h> +#include <stdlib.h> + #include "MEM_guardedalloc.h" + + +// #include "BLI_blenlib.h" + +#include "BLI_mempool.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" + #include "BLO_sys_types.h" // for intptr_t support /***/ diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 485b8137a02..293f824c5fd 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -400,7 +400,7 @@ static void seq_setpath(struct BPathIterator *bpi, const char *path) if (SEQ_HAS_PATH(seq)) { if (ELEM3(seq->type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SOUND)) { - BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name); + BLI_split_dirfile(path, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } else { /* simple case */ @@ -903,7 +903,7 @@ void findMissingFiles(Main *bmain, const char *str) //XXX waitcursor( 1 ); - BLI_split_dirfile(str, dirname, NULL); + BLI_split_dir_part(str, dirname, sizeof(dirname)); BLI_bpathIterator_init(&bpi, bmain, bmain->name, 0); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 9ccd7fbe121..fef102d8267 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -65,7 +65,8 @@ return -1 if zlib fails, -2 if the originating file does not exist note: will remove the "from" file */ -int BLI_gzip(const char *from, const char *to) { +int BLI_file_gzip(const char *from, const char *to) +{ char buffer[10240]; int file; int readsize = 0; @@ -109,7 +110,7 @@ int BLI_gzip(const char *from, const char *to) { /* gzip the file in from_file and write it to memery to_mem, at most size bytes. return the unziped size */ -char *BLI_ungzip_to_mem(const char *from_file, int *size_r) +char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r) { gzFile gzfile; int readsize, size, alloc_size=0; @@ -150,7 +151,7 @@ char *BLI_ungzip_to_mem(const char *from_file, int *size_r) /* return 1 when file can be written */ -int BLI_is_writable(const char *filename) +int BLI_file_is_writable(const char *filename) { int file; @@ -178,7 +179,7 @@ int BLI_is_writable(const char *filename) } } -int BLI_touch(const char *file) +int BLI_file_touch(const char *file) { FILE *f = fopen(file,"r+b"); if (f != NULL) { @@ -195,15 +196,12 @@ int BLI_touch(const char *file) return 0; } -int BLI_exists(const char *file) { - return BLI_exist(file); -} - #ifdef WIN32 static char str[MAXPATHLEN+12]; -int BLI_delete(const char *file, int dir, int recursive) { +int BLI_delete(const char *file, int dir, int recursive) +{ int err; if (recursive) { @@ -220,14 +218,15 @@ int BLI_delete(const char *file, int dir, int recursive) { return err; } -int BLI_move(const char *file, const char *to) { +int BLI_move(const char *file, const char *to) +{ int err; // windows doesn't support moveing to a directory // it has to be 'mv filename filename' and not // 'mv filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -245,14 +244,15 @@ int BLI_move(const char *file, const char *to) { } -int BLI_copy_fileops(const char *file, const char *to) { +int BLI_copy(const char *file, const char *to) +{ int err; // windows doesn't support copying to a directory // it has to be 'cp filename filename' and not // 'cp filename destdir' - strcpy(str, to); + BLI_strncpy(str, to, sizeof(str)); // points 'to' to a directory ? if (BLI_last_slash(str) == (str + strlen(str) - 1)) { if (BLI_last_slash(file) != NULL) { @@ -270,14 +270,16 @@ int BLI_copy_fileops(const char *file, const char *to) { return err; } -int BLI_link(const char *file, const char *to) { +int BLI_create_symlink(const char *file, const char *to) +{ callLocalErrorCallBack("Linking files is unsupported on Windows"); (void)file; (void)to; return 1; } -void BLI_recurdir_fileops(const char *dirname) { +void BLI_dir_create_recursive(const char *dirname) +{ char *lslash; char tmp[MAXPATHLEN]; @@ -286,7 +288,7 @@ void BLI_recurdir_fileops(const char *dirname) { // blah1/blah2/ (with slash) after creating // blah1/blah2 (without slash) - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash == tmp + strlen(tmp) - 1) { @@ -299,7 +301,7 @@ void BLI_recurdir_fileops(const char *dirname) { if (lslash) { /* Split about the last slash and recurse */ *lslash = 0; - BLI_recurdir_fileops(tmp); + BLI_dir_create_recursive(tmp); } if(dirname[0]) /* patch, this recursive loop tries to create a nameless directory */ @@ -307,7 +309,8 @@ void BLI_recurdir_fileops(const char *dirname) { callLocalErrorCallBack("Unable to create directory\n"); } -int BLI_rename(const char *from, const char *to) { +int BLI_rename(const char *from, const char *to) +{ if (!BLI_exists(from)) return 0; /* make sure the filenames are different (case insensitive) before removing */ @@ -347,43 +350,48 @@ int BLI_delete(const char *file, int dir, int recursive) return -1; } -int BLI_move(const char *file, const char *to) { +int BLI_move(const char *file, const char *to) +{ BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to); return system(str); } -int BLI_copy_fileops(const char *file, const char *to) { +int BLI_copy(const char *file, const char *to) +{ BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to); return system(str); } -int BLI_link(const char *file, const char *to) { +int BLI_create_symlink(const char *file, const char *to) +{ BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to); return system(str); } -void BLI_recurdir_fileops(const char *dirname) { +void BLI_dir_create_recursive(const char *dirname) +{ char *lslash; char tmp[MAXPATHLEN]; if (BLI_exists(dirname)) return; - strcpy(tmp, dirname); + BLI_strncpy(tmp, dirname, sizeof(tmp)); lslash= BLI_last_slash(tmp); if (lslash) { /* Split about the last slash and recurse */ *lslash = 0; - BLI_recurdir_fileops(tmp); + BLI_dir_create_recursive(tmp); } mkdir(dirname, 0777); } -int BLI_rename(const char *from, const char *to) { +int BLI_rename(const char *from, const char *to) +{ if (!BLI_exists(from)) return 0; if (BLI_exists(to)) if(BLI_delete(to, 0, 0)) return 1; @@ -392,3 +400,4 @@ int BLI_rename(const char *from, const char *to) { } #endif + diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 0fe028eb3c0..7e5d03423e5 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -364,7 +364,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf) // get the name fontname = FT_Get_Postscript_Name(face); - strcpy(vfd->name, (fontname == NULL) ? "" : fontname); + BLI_strncpy(vfd->name, (fontname == NULL) ? "" : fontname, sizeof(vfd->name)); // Extract the first 256 character from TTF lcode= charcode= FT_Get_First_Char(face, &glyph_index); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index ab7d082c432..d9176c5f162 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -41,13 +41,11 @@ #include "MEM_guardedalloc.h" -#include "DNA_userdef_types.h" +#include "DNA_listBase.h" #include "BLI_fileops.h" #include "BLI_path_util.h" #include "BLI_string.h" -#include "BLI_storage.h" -#include "BLI_storage_types.h" #include "BLI_utildefines.h" #include "BKE_utildefines.h" @@ -84,10 +82,24 @@ #endif /* WIN32 */ +/* standard paths */ +#ifdef WIN32 +#define BLENDER_USER_FORMAT "%s\\Blender Foundation\\Blender\\%s" +#define BLENDER_SYSTEM_FORMAT "%s\\Blender Foundation\\Blender\\%s" +#elif defined(__APPLE__) +#define BLENDER_USER_FORMAT "%s/Blender/%s" +#define BLENDER_SYSTEM_FORMAT "%s/Blender/%s" +#else +#define BLENDER_USER_FORMAT "%s/.blender/%s" +#define BLENDER_SYSTEM_FORMAT "%s/blender/%s" +#endif + /* local */ #define UNIQUE_NAME_MAX 128 -extern char bprogname[]; +static char bprogname[FILE_MAX]; /* path to program executable */ +static char bprogdir[FILE_MAX]; /* path in which executable is located */ +static char btempdir[FILE_MAX]; /* temporary directory */ static int add_win32_extension(char *name); static char *blender_version_decimal(const int ver); @@ -726,7 +738,7 @@ int BLI_path_cwd(char *path) if (wasrelative==1) { char cwd[FILE_MAXDIR + FILE_MAXFILE]= ""; - BLI_getwdN(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */ + BLI_current_working_dir(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */ if (cwd[0] == '\0') { printf( "Could not get the current working directory - $PWD for an unknown reason."); @@ -875,7 +887,6 @@ static int test_env_path(char *path, const char *envvar) static int get_path_local(char *targetpath, const char *folder_name, const char *subfolder_name, const int ver) { - char bprogdir[FILE_MAX]; char relfolder[FILE_MAX]; #ifdef PATH_DEBUG2 @@ -892,10 +903,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char else { relfolder[0]= '\0'; } - - /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); - + /* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */ if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder)) return 1; @@ -963,10 +971,6 @@ static int get_path_system(char *targetpath, const char *folder_name, const char * these are only used when running blender from source */ char cwd[FILE_MAX]; char relfolder[FILE_MAX]; - char bprogdir[FILE_MAX]; - - /* use argv[0] (bprogname) to get the path to the executable */ - BLI_split_dirfile(bprogname, bprogdir, NULL); if(folder_name) { if (subfolder_name) { @@ -980,7 +984,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char } /* try CWD/release/folder_name */ - if(BLI_getwdN(cwd, sizeof(cwd))) { + if(BLI_current_working_dir(cwd, sizeof(cwd))) { if(test_path(targetpath, cwd, "release", relfolder)) { return 1; } @@ -1111,7 +1115,7 @@ char *BLI_get_folder_create(int folder_id, const char *subfolder) if (!path) { path = BLI_get_user_folder_notest(folder_id, subfolder); - if (path) BLI_recurdir_fileops(path); + if (path) BLI_dir_create_recursive(path); } return path; @@ -1244,7 +1248,7 @@ void BLI_make_existing_file(const char *name) /* test exist */ if (BLI_exists(di) == 0) { - BLI_recurdir_fileops(di); + BLI_dir_create_recursive(di); } } @@ -1411,24 +1415,35 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext) * - dosnt use CWD, or deal with relative paths. * - Only fill's in *dir and *file when they are non NULL * */ -void BLI_split_dirfile(const char *string, char *dir, char *file) +void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen) { char *lslash_str = BLI_last_slash(string); - int lslash= lslash_str ? (int)(lslash_str - string) + 1 : 0; + size_t lslash= lslash_str ? (size_t)(lslash_str - string) + 1 : 0; if (dir) { if (lslash) { - BLI_strncpy( dir, string, lslash + 1); /* +1 to include the slash and the last char */ - } else { + BLI_strncpy( dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */ + } + else { dir[0] = '\0'; } } if (file) { - strcpy( file, string+lslash); + BLI_strncpy(file, string+lslash, filelen); } } +void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen) +{ + BLI_split_dirfile(string, dir, NULL, dirlen, 0); +} + +void BLI_split_file_part(const char *string, char *file, const size_t filelen) +{ + BLI_split_dirfile(string, NULL, file, 0, filelen); +} + /* simple appending of filename to dir, does not check for valid path! */ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const char *file) { @@ -1515,7 +1530,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const if (rel) rel[0]= 0; - BLI_split_dirfile(base_dir, blend_dir, NULL); + BLI_split_dir_part(base_dir, blend_dir, sizeof(blend_dir)); if (src_dir[0]=='\0') return 0; @@ -1526,7 +1541,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const BLI_path_abs(path, base_dir); /* get the directory part */ - BLI_split_dirfile(path, dir, base); + BLI_split_dirfile(path, dir, base, sizeof(dir), sizeof(base)); len= strlen(blend_dir); @@ -1630,7 +1645,7 @@ static int add_win32_extension(char *name) int retval = 0; int type; - type = BLI_exist(name); + type = BLI_exists(name); if ((type == 0) || S_ISDIR(type)) { #ifdef _WIN32 char filename[FILE_MAXDIR+FILE_MAXFILE]; @@ -1650,7 +1665,7 @@ static int add_win32_extension(char *name) strcat(filename, extensions); } - type = BLI_exist(filename); + type = BLI_exists(filename); if (type && (! S_ISDIR(type))) { retval = 1; strcpy(name, filename); @@ -1666,8 +1681,19 @@ static int add_win32_extension(char *name) return (retval); } -/* filename must be FILE_MAX length minimum */ -void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) +/* +* Checks if name is a fully qualified filename to an executable. +* If not it searches $PATH for the file. On Windows it also +* adds the correct extension (.com .exe etc) from +* $PATHEXT if necessary. Also on Windows it translates +* the name to its 8.3 version to prevent problems with +* spaces and stuff. Final result is returned in fullname. +* +* @param fullname The full path and full name of the executable +* (must be FILE_MAX minimum) +* @param name The name of the executable (usually argv[0]) to be checked +*/ +static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name) { char filename[FILE_MAXDIR+FILE_MAXFILE]; const char *path = NULL, *temp; @@ -1680,7 +1706,7 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) #ifdef WITH_BINRELOC - /* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */ + /* linux uses binreloc since argv[0] is not reliable, call br_init( NULL ) first */ path = br_find_exe( NULL ); if (path) { BLI_strncpy(fullname, path, maxlen); @@ -1704,7 +1730,7 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) BLI_strncpy(fullname, name, maxlen); if (name[0] == '.') { char wdir[FILE_MAX]= ""; - BLI_getwdN(wdir, sizeof(wdir)); /* backup cwd to restore after */ + BLI_current_working_dir(wdir, sizeof(wdir)); /* backup cwd to restore after */ // not needed but avoids annoying /./ in name if(name[1]==SEP) @@ -1747,12 +1773,37 @@ void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name) } } -void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp) +void BLI_init_program_path(const char *argv0) +{ + bli_where_am_i(bprogname, sizeof(bprogname), argv0); + BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir)); +} + +const char *BLI_program_path(void) +{ + return bprogname; +} + +const char *BLI_program_dir(void) +{ + return bprogdir; +} + +/** +* Gets the temp directory when blender first runs. +* If the default path is not found, use try $TEMP +* +* Also make sure the temp dir has a trailing slash +* +* @param fullname The full path to the temp directory +* @param userdir Directory specified in user preferences +*/ +void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) { fullname[0] = '\0'; - if (usertemp && BLI_is_dir(U.tempdir)) { - BLI_strncpy(fullname, U.tempdir, maxlen); + if (userdir && BLI_is_dir(userdir)) { + BLI_strncpy(fullname, userdir, maxlen); } @@ -1786,13 +1837,28 @@ void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp) /* add a trailing slash if needed */ BLI_add_slash(fullname); #ifdef WIN32 - if(U.tempdir != fullname) { - BLI_strncpy(U.tempdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ + if(userdir != fullname) { + BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ } #endif } } +void BLI_init_temporary_dir(char *userdir) +{ + BLI_where_is_temp(btempdir, FILE_MAX, userdir); +} + +const char *BLI_temporary_dir(void) +{ + return btempdir; +} + +void BLI_system_temporary_dir(char *dir) +{ + BLI_where_is_temp(dir, FILE_MAX, NULL); +} + #ifdef WITH_ICONV void BLI_string_to_utf8(char *original, char *utf_8, const char *code) diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index e336b914ffa..b3caeb71822 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -88,10 +88,9 @@ #include "DNA_listBase.h" +#include "BLI_fileops.h" #include "BLI_listbase.h" #include "BLI_linklist.h" -#include "BLI_storage.h" -#include "BLI_storage_types.h" #include "BLI_string.h" #include "BKE_utildefines.h" @@ -104,7 +103,7 @@ static struct ListBase dirbase_={NULL, NULL}; static struct ListBase *dirbase = &dirbase_; /* can return NULL when the size is not big enough */ -char *BLI_getwdN(char *dir, const int maxncpy) +char *BLI_current_working_dir(char *dir, const int maxncpy) { const char *pwd= getenv("PWD"); if (pwd){ @@ -116,7 +115,7 @@ char *BLI_getwdN(char *dir, const int maxncpy) } -int BLI_compare(struct direntry *entry1, struct direntry *entry2) +static int bli_compare(struct direntry *entry1, struct direntry *entry2) { /* type is equal to stat.st_mode */ @@ -143,7 +142,7 @@ int BLI_compare(struct direntry *entry1, struct direntry *entry2) } -double BLI_diskfree(const char *dir) +double BLI_dir_free_space(const char *dir) { #ifdef WIN32 DWORD sectorspc, bytesps, freec, clusters; @@ -198,7 +197,7 @@ double BLI_diskfree(const char *dir) #endif } -void BLI_builddir(const char *dirname, const char *relname) +static void bli_builddir(const char *dirname, const char *relname) { struct dirent *fname; struct dirlink *dlink; @@ -273,7 +272,7 @@ void BLI_builddir(const char *dirname, const char *relname) } BLI_freelist(dirbase); - if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))BLI_compare); + if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare); } else { printf("%s empty directory\n",dirname); } @@ -284,7 +283,7 @@ void BLI_builddir(const char *dirname, const char *relname) } } -void BLI_adddirstrings(void) +static void bli_adddirstrings(void) { char datum[100]; char buf[512]; @@ -304,15 +303,15 @@ void BLI_adddirstrings(void) for(num=0, file= files; num<actnum; num++, file++){ #ifdef WIN32 mode = 0; - strcpy(file->mode1, types[0]); - strcpy(file->mode2, types[0]); - strcpy(file->mode3, types[0]); + BLI_strncpy(file->mode1, types[0], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[0], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[0], sizeof(file->mode3)); #else mode = file->s.st_mode; - strcpy(file->mode1, types[(mode & 0700) >> 6]); - strcpy(file->mode2, types[(mode & 0070) >> 3]); - strcpy(file->mode3, types[(mode & 0007)]); + BLI_strncpy(file->mode1, types[(mode & 0700) >> 6], sizeof(file->mode1)); + BLI_strncpy(file->mode2, types[(mode & 0070) >> 3], sizeof(file->mode2)); + BLI_strncpy(file->mode3, types[(mode & 0007)], sizeof(file->mode3)); if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l'; @@ -392,7 +391,7 @@ void BLI_adddirstrings(void) } } -unsigned int BLI_getdir(const char *dirname, struct direntry **filelist) +unsigned int BLI_dir_contents(const char *dirname, struct direntry **filelist) { // reset global variables // memory stored in files is free()'d in @@ -401,8 +400,8 @@ unsigned int BLI_getdir(const char *dirname, struct direntry **filelist) actnum = totnum = 0; files = NULL; - BLI_builddir(dirname,""); - BLI_adddirstrings(); + bli_builddir(dirname,""); + bli_adddirstrings(); if (files) { *(filelist) = files; @@ -416,7 +415,7 @@ unsigned int BLI_getdir(const char *dirname, struct direntry **filelist) } -size_t BLI_filesize(int file) +size_t BLI_file_descriptor_size(int file) { struct stat buf; @@ -425,20 +424,20 @@ size_t BLI_filesize(int file) return (buf.st_size); } -size_t BLI_filepathsize(const char *path) +size_t BLI_file_size(const char *path) { int size, file = open(path, O_BINARY|O_RDONLY); if (file == -1) return -1; - size = BLI_filesize(file); + size = BLI_file_descriptor_size(file); close(file); return size; } -int BLI_exist(const char *name) +int BLI_exists(const char *name) { #if defined(WIN32) && !defined(__MINGW32__) struct _stat64i32 st; @@ -471,10 +470,10 @@ int BLI_exist(const char *name) /* would be better in fileops.c except that it needs stat.h so add here */ int BLI_is_dir(const char *file) { - return S_ISDIR(BLI_exist(file)); + return S_ISDIR(BLI_exists(file)); } -LinkNode *BLI_read_file_as_lines(const char *name) +LinkNode *BLI_file_read_as_lines(const char *name) { FILE *fp= fopen(name, "r"); LinkNode *lines= NULL; @@ -515,7 +514,7 @@ LinkNode *BLI_read_file_as_lines(const char *name) return lines; } -void BLI_free_file_lines(LinkNode *lines) +void BLI_file_free_lines(LinkNode *lines) { BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN); } diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 961a41690f7..b1ad04eb70d 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -18,6 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2011 Blender Foundation. + * Code from gutf8.c Copyright (C) 1999 Tom Tromey + * Copyright (C) 2000 Red Hat, Inc. * All rights reserved. * * Contributor(s): Campbell Barton. @@ -31,8 +33,10 @@ */ #include <string.h> +#include <wchar.h> +#include <wctype.h> -#include "BLI_string.h" +#include "BLI_string_utf8.h" /* from libswish3, originally called u8_isvalid(), * modified to return the index of the bad character (byte index not utf). @@ -183,3 +187,352 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } + +/* --------------------------------------------------------------------------*/ +/* wchar_t / utf8 functions */ + +size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy) +{ + size_t len = 0; + while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */ + len += BLI_str_utf8_from_unicode(*src++, dst+len); + } + + dst[len]= '\0'; + + return len; +} + +/* wchar len in utf8 */ +size_t BLI_wstrlen_utf8(const wchar_t *src) +{ + size_t len = 0; + + while(*src) { + len += BLI_str_utf8_from_unicode(*src++, NULL); + } + + return len; +} + +// utf8slen +size_t BLI_strlen_utf8(const char *strc) +{ + int len=0; + + while(*strc) { + if ((*strc & 0xe0) == 0xc0) { + if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) + strc++; + } else if ((*strc & 0xf0) == 0xe0) { + if((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) + strc += 2; + } else if ((*strc & 0xf8) == 0xf0) { + if((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) + strc += 3; + } + + strc++; + len++; + } + + return len; +} + +size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxcpy) +{ + int len=0; + + if(dst_w==NULL || src_c==NULL) return(0); + + while(*src_c && len < maxcpy) { + size_t step= 0; + unsigned int unicode= BLI_str_utf8_as_unicode_and_size(src_c, &step); + if (unicode != BLI_UTF8_ERR) { + *dst_w= (wchar_t)unicode; + src_c += step; + } + else { + *dst_w = '?'; + src_c= BLI_str_find_next_char_utf8(src_c, NULL); + } + dst_w++; + len++; + } + return len; +} + +/* end wchar_t / utf8 functions */ +/* --------------------------------------------------------------------------*/ + +/* copied from glib's gutf8.c */ + +/* note, glib uses unsigned int for unicode, best we do the same, + * though we dont typedef it - campbell */ + +#define UTF8_COMPUTE(Char, Mask, Len) \ + if (Char < 128) { \ + Len = 1; \ + Mask = 0x7f; \ + } \ + else if ((Char & 0xe0) == 0xc0) { \ + Len = 2; \ + Mask = 0x1f; \ + } \ + else if ((Char & 0xf0) == 0xe0) { \ + Len = 3; \ + Mask = 0x0f; \ + } \ + else if ((Char & 0xf8) == 0xf0) { \ + Len = 4; \ + Mask = 0x07; \ + } \ + else if ((Char & 0xfc) == 0xf8) { \ + Len = 5; \ + Mask = 0x03; \ + } \ + else if ((Char & 0xfe) == 0xfc) { \ + Len = 6; \ + Mask = 0x01; \ + } \ + else { \ + Len = -1; \ + } + +/* same as glib define but added an 'Err' arg */ +#define UTF8_GET(Result, Chars, Count, Mask, Len, Err) \ + (Result) = (Chars)[0] & (Mask); \ + for ((Count) = 1; (Count) < (Len); ++(Count)) { \ + if (((Chars)[(Count)] & 0xc0) != 0x80) { \ + (Result) = Err; \ + break; \ + } \ + (Result) <<= 6; \ + (Result) |= ((Chars)[(Count)] & 0x3f); \ + } + + +/* was g_utf8_get_char */ +/** + * BLI_str_utf8_as_unicode: + * @p: a pointer to Unicode character encoded as UTF-8 + * + * Converts a sequence of bytes encoded as UTF-8 to a Unicode character. + * If @p does not point to a valid UTF-8 encoded character, results are + * undefined. If you are not sure that the bytes are complete + * valid Unicode characters, you should use g_utf8_get_char_validated() + * instead. + * + * Return value: the resulting character + **/ +unsigned int BLI_str_utf8_as_unicode(const char *p) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) + return BLI_UTF8_ERR; + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + + return result; +} + +/* varient that increments the length */ +unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c = (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) + return BLI_UTF8_ERR; + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + *index += len; + return result; +} + +/* another varient that steps over the index, + * note, currently this also falls back to latin1 for text drawing. */ +unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index) +{ + int i, mask = 0, len; + unsigned int result; + unsigned char c; + + p += *index; + c= (unsigned char) *p; + + UTF8_COMPUTE (c, mask, len); + if (len == -1) { + /* when called with NULL end, result will never be NULL, + * checks for a NULL character */ + char *p_next= BLI_str_find_next_char_utf8(p, NULL); + /* will never return the same pointer unless '\0', + * eternal loop is prevented */ + *index += (size_t)(p_next - p); + return BLI_UTF8_ERR; + } + + /* this is tricky since there are a few ways we can bail out of bad unicode + * values, 3 possible solutions. */ +#if 0 + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); +#elif 1 + /* WARNING: this is NOT part of glib, or supported by similar functions. + * this is added for text drawing because some filepaths can have latin1 + * characters */ + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + if(result == BLI_UTF8_ERR) { + len= 1; + result= *p; + } + /* end warning! */ +#else + /* without a fallback like '?', text drawing will stop on this value */ + UTF8_GET (result, p, i, mask, len, '?'); +#endif + + *index += len; + return result; +} + +/* was g_unichar_to_utf8 */ +/** + * BLI_str_utf8_from_unicode: + * @c: a Unicode character code + * @outbuf: output buffer, must have at least 6 bytes of space. + * If %NULL, the length will be computed and returned + * and nothing will be written to @outbuf. + * + * Converts a single character to UTF-8. + * + * Return value: number of bytes written + **/ +size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf) +{ + /* If this gets modified, also update the copy in g_string_insert_unichar() */ + unsigned int len = 0; + int first; + int i; + + if (c < 0x80) { + first = 0; + len = 1; + } + else if (c < 0x800) { + first = 0xc0; + len = 2; + } + else if (c < 0x10000) { + first = 0xe0; + len = 3; + } + else if (c < 0x200000) { + first = 0xf0; + len = 4; + } + else if (c < 0x4000000) { + first = 0xf8; + len = 5; + } + else { + first = 0xfc; + len = 6; + } + + if (outbuf) { + for (i = len - 1; i > 0; --i) { + outbuf[i] = (c & 0x3f) | 0x80; + c >>= 6; + } + outbuf[0] = c | first; + } + + return len; +} + +/* was g_utf8_find_prev_char */ +/** + * BLI_str_find_prev_char_utf8: + * @str: pointer to the beginning of a UTF-8 encoded string + * @p: pointer to some position within @str + * + * Given a position @p with a UTF-8 encoded string @str, find the start + * of the previous UTF-8 character starting before @p. Returns %NULL if no + * UTF-8 characters are present in @str before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL. + **/ +char * BLI_str_find_prev_char_utf8(const char *str, const char *p) +{ + for (--p; p >= str; --p) { + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } + return NULL; +} + +/* was g_utf8_find_next_char */ +/** + * BLI_str_find_next_char_utf8: + * @p: a pointer to a position within a UTF-8 encoded string + * @end: a pointer to the byte following the end of the string, + * or %NULL to indicate that the string is nul-terminated. + * + * Finds the start of the next UTF-8 character in the string after @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. + * + * Return value: a pointer to the found character or %NULL + **/ +char *BLI_str_find_next_char_utf8(const char *p, const char *end) +{ + if (*p) { + if (end) { + for (++p; p < end && (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + else { + for (++p; (*p & 0xc0) == 0x80; ++p) { + /* do nothing */ + } + } + } + return (p == end) ? NULL : (char *)p; +} + +/* was g_utf8_prev_char */ +/** + * BLI_str_prev_char_utf8: + * @p: a pointer to a position within a UTF-8 encoded string + * + * Finds the previous UTF-8 character in the string before @p. + * + * @p does not have to be at the beginning of a UTF-8 character. No check + * is made to see if the character found is actually valid other than + * it starts with an appropriate byte. If @p might be the first + * character of the string, you must use g_utf8_find_prev_char() instead. + * + * Return value: a pointer to the found character. + **/ +char *BLI_str_prev_char_utf8(const char *p) +{ + while (1) { + p--; + if ((*p & 0xc0) != 0x80) { + return (char *)p; + } + } +} +/* end glib copy */ diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index 3b14abb0bee..21ad0ff7253 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -53,11 +53,10 @@ int BLI_getInstallationDir( char * str ) { char dir[FILE_MAXDIR]; - char file[FILE_MAXFILE]; int a; GetModuleFileName(NULL,str,FILE_MAXDIR+FILE_MAXFILE); - BLI_split_dirfile(str,dir,file); /* shouldn't be relative */ + BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); if(dir[a-1] == '\\') dir[a-1]=0; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 47931477728..2799b2165f0 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -204,7 +204,7 @@ BLO_blendhandle_close( #define GROUP_MAX 32 -int BLO_has_bfile_extension(char *str); +int BLO_has_bfile_extension(const char *str); /* return ok when a blenderfile, in dir is the filename, * in group the type of libdata @@ -252,7 +252,7 @@ void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendH void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); -BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports); +BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h index 920b14e92fa..0a3ceeefa78 100644 --- a/source/blender/blenloader/BLO_runtime.h +++ b/source/blender/blenloader/BLO_runtime.h @@ -42,8 +42,8 @@ extern "C" { struct BlendFileData; struct ReportList; -int BLO_is_a_runtime(char *file); -struct BlendFileData *BLO_read_runtime(char *file, struct ReportList *reports); +int BLO_is_a_runtime(const char *file); +struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *reports); #ifdef __cplusplus } diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 0e93e5fa8c0..09e6dcd7bf9 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -34,7 +34,6 @@ #include <stddef.h> -#include "BLI_storage.h" /* _LARGEFILE_SOURCE */ #include <stdlib.h> #include <string.h> @@ -43,9 +42,12 @@ #include "MEM_guardedalloc.h" -#include "BLI_utildefines.h" +#include "BLI_fileops.h" #include "BLI_ghash.h" #include "BLI_linklist.h" +#include "BLI_listbase.h" +#include "BLI_string.h" +#include "BLI_utildefines.h" #include "DNA_genfile.h" #include "DNA_sdna_types.h" @@ -288,7 +290,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil fd = blo_openblendermemfile(memfile, reports); if (fd) { fd->reports= reports; - strcpy(fd->relabase, filename); + BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); /* clear ob->proxy_from pointers in old main */ blo_clear_proxy_pointers_from_lib(oldmain); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 70d6ffd0936..eadf9cd0cdb 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1049,7 +1049,7 @@ void blo_freefiledata(FileData *fd) /* ************ DIV ****************** */ -int BLO_has_bfile_extension(char *str) +int BLO_has_bfile_extension(const char *str) { return (BLI_testextensie(str, ".ble") || BLI_testextensie(str, ".blend") || BLI_testextensie(str, ".blend.gz")); } @@ -3113,7 +3113,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) pm->data[i] = newdataadr(fd, pm->data[i]); /* the cache saves non-struct data without DNA */ - if(pm->data[i] && strcmp(ptcache_data_struct[i], "")==0 && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { + if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */ int *poin= pm->data[i]; @@ -8697,7 +8697,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (wo = main->world.first; wo; wo= wo->id.next) { /* Migrate to Bullet for games, except for the NaN versions */ - /* People can still explicitely choose for Sumo (after 2.42 is out) */ + /* People can still explicitly choose for Sumo (after 2.42 is out) */ if(main->versionfile > 225) wo->physicsEngine = WOPHY_BULLET; if(WO_AODIST == wo->aomode) @@ -9311,7 +9311,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) simasel->prv_h = 96; simasel->prv_w = 96; simasel->flag = 7; /* ??? elubie */ - strcpy (simasel->dir, U.textudir); /* TON */ + BLI_strncpy (simasel->dir, U.textudir, sizeof(simasel->dir)); /* TON */ simasel->file[0]= '\0'; simasel->returnfunc = NULL; @@ -9534,7 +9534,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -9564,7 +9564,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget"); ct->tar = data->tar; - strcpy(ct->subtarget, data->subtarget); + BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget)); ct->space = con->tarspace; BLI_addtail(&data->targets, ct); @@ -10251,8 +10251,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) { if(scene->ed && scene->ed->seqbasep) { - for(seq = scene->ed->seqbasep->first; seq; seq = seq->next) - { + SEQ_BEGIN(scene->ed, seq) { if(seq->type == SEQ_HD_SOUND) { char str[FILE_MAX]; @@ -10272,6 +10271,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) seq->strip->dir); } } + SEQ_END } } @@ -12044,8 +12044,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main) aa->flag = ia->flag; aa->sta = ia->sta; aa->end = ia->end; - strcpy(aa->name, ia->name); - strcpy(aa->frameProp, ia->frameProp); + BLI_strncpy(aa->name, ia->name, sizeof(aa->name)); + BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp)); if (ob->adt) aa->act = ob->adt->action; @@ -12212,6 +12212,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) do_versions_nodetree_image_default_alpha_output(ntree); } + + { + /* support old particle dupliobject rotation settings */ + ParticleSettings *part; + + for (part=main->particle.first; part; part=part->id.next) { + if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) { + part->draw |= PART_DRAW_ROTATE_OB; + + if(part->rotmode == 0) + part->rotmode = PART_ROT_VEL; + } + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ @@ -13325,7 +13339,7 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const if( ob->id.flag & LIB_INDIRECT ) { /* IF below is quite confusing! - if we are appending, but this object wasnt just added allong with a group, + if we are appending, but this object wasnt just added along with a group, then this is already used indirectly in the scene somewhere else and we didnt just append it. (ob->id.flag & LIB_PRE_EXISTING)==0 means that this is a newly appended object - Campbell */ @@ -13673,8 +13687,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) printf(" enter a new path:\n"); if(scanf("%s", newlib_path) > 0) { - strcpy(mainptr->curlib->name, newlib_path); - strcpy(mainptr->curlib->filepath, newlib_path); + BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name)); + BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath)); cleanup_path(G.main->name, mainptr->curlib->filepath); fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); @@ -13790,7 +13804,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) /* reading runtime */ -BlendFileData *blo_read_blendafterruntime(int file, char *name, int actualsize, ReportList *reports) +BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd = filedata_new(); diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index f5308b5ea5c..57cdce94b17 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -68,7 +68,7 @@ static int handle_read_msb_int(int handle) return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0); } -int BLO_is_a_runtime(char *path) +int BLO_is_a_runtime(const char *path) { int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0); int datastart; @@ -97,7 +97,7 @@ cleanup: return res; } -BlendFileData *BLO_read_runtime(char *path, ReportList *reports) +BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) { BlendFileData *bfd= NULL; size_t actualsize; @@ -111,7 +111,7 @@ BlendFileData *BLO_read_runtime(char *path, ReportList *reports) goto cleanup; } - actualsize= BLI_filesize(fd); + actualsize= BLI_file_descriptor_size(fd); lseek(fd, -12, SEEK_END); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 382f4866694..ea2abcdf4c3 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -873,7 +873,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches) for(i=0; i<BPHYS_TOT_DATA; i++) { if(pm->data[i] && pm->data_types & (1<<i)) { - if(strcmp(ptcache_data_struct[i], "")==0) + if(ptcache_data_struct[i][0]=='\0') writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]); else writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]); @@ -881,7 +881,7 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches) } for(; extra; extra=extra->next) { - if(strcmp(ptcache_extra_struct[extra->type], "")==0) + if(ptcache_extra_struct[extra->type][0]=='\0') continue; writestruct(wd, DATA, "PTCacheExtra", 1, extra); writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data); @@ -2704,8 +2704,8 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(filepath, dir1, NULL); - BLI_split_dirfile(mainvar->name, dir2, NULL); + BLI_split_dir_part(filepath, dir1, sizeof(dir1)); + BLI_split_dir_part(mainvar->name, dir2, sizeof(dir2)); /* just incase there is some subtle difference */ BLI_cleanup_dir(mainvar->name, dir1); @@ -2725,6 +2725,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL } } + userfilename[0]= '\0'; /* ensure its initialized */ BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); write_user_block= (BLI_path_cmp(filepath, userfilename) == 0); @@ -2759,7 +2760,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL /* first write compressed to separate @.gz */ BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath); - ret = BLI_gzip(tempname, gzname); + ret = BLI_file_gzip(tempname, gzname); if(0==ret) { /* now rename to real file name, and delete temp @ file too */ diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 61f1b1dfa08..dec93c0ff63 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -691,7 +691,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); newcu[i]->totvert = frames.size(); } @@ -962,30 +962,32 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node , for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); - const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - COLLADAFW::EffectCommon *efc = commonEffects[0]; - if((animType->material & MATERIAL_SHININESS) != 0){ - const COLLADAFW::FloatOrParam *shin = &(efc->getShininess()); - const COLLADAFW::UniqueId& listid = shin->getAnimationList(); - Assign_float_animations( listid, AnimCurves , "specular_hardness" ); - } + if (ef != NULL) { /* can be NULL [#28909] */ + const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); + COLLADAFW::EffectCommon *efc = commonEffects[0]; + if((animType->material & MATERIAL_SHININESS) != 0){ + const COLLADAFW::FloatOrParam *shin = &(efc->getShininess()); + const COLLADAFW::UniqueId& listid = shin->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "specular_hardness" ); + } - if((animType->material & MATERIAL_IOR) != 0){ - const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); - const COLLADAFW::UniqueId& listid = ior->getAnimationList(); - Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); - } + if((animType->material & MATERIAL_IOR) != 0){ + const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction()); + const COLLADAFW::UniqueId& listid = ior->getAnimationList(); + Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" ); + } - if((animType->material & MATERIAL_SPEC_COLOR) != 0){ - const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); - const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); - Assign_color_animations( listid, AnimCurves , "specular_color" ); - } + if((animType->material & MATERIAL_SPEC_COLOR) != 0){ + const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular()); + const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); + Assign_color_animations( listid, AnimCurves , "specular_color" ); + } - if((animType->material & MATERIAL_DIFF_COLOR) != 0){ - const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); - const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); - Assign_color_animations( listid, AnimCurves , "diffuse_color" ); + if((animType->material & MATERIAL_DIFF_COLOR) != 0){ + const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse()); + const COLLADAFW::UniqueId& listid = cot->getColor().getAnimationList(); + Assign_color_animations( listid, AnimCurves , "diffuse_color" ); + } } } } @@ -1051,14 +1053,16 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId & matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]); - const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); - if(!commonEffects.empty()) { - COLLADAFW::EffectCommon *efc = commonEffects[0]; - types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); - types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); - types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); - // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); - types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + if (ef != NULL) { /* can be NULL [#28909] */ + const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects(); + if(!commonEffects.empty()) { + COLLADAFW::EffectCommon *efc = commonEffects[0]; + types->material = setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS); + types->material = setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR); + types->material = setAnimType(&(efc->getDiffuse().getColor()),(types->material), MATERIAL_DIFF_COLOR); + // types->material = setAnimType(&(efc->get()),(types->material), MATERIAL_TRANSPARENCY); + types->material = setAnimType(&(efc->getIndexOfRefraction()),(types->material), MATERIAL_IOR); + } } } } @@ -1067,10 +1071,10 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD int AnimationImporter::setAnimType ( const COLLADAFW::Animatable * prop , int types, int addition) { - const COLLADAFW::UniqueId& listid = prop->getAnimationList(); - if (animlist_map.find(listid) != animlist_map.end()) - return types|addition; - else return types; + const COLLADAFW::UniqueId& listid = prop->getAnimationList(); + if (animlist_map.find(listid) != animlist_map.end()) + return types|addition; + else return types; } // Is not used anymore. @@ -1242,7 +1246,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, if (is_joint) BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str); else - strcpy(rna_path, tm_str); + BLI_strncpy(rna_path, tm_str, sizeof(rna_path)); newcu[i] = create_fcurve(axis, rna_path); #ifdef ARMATURE_TEST diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index e98f551a097..c06867ca107 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -884,7 +884,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) char dir[FILE_MAX]; char full_path[FILE_MAX]; - BLI_split_dirfile(filename, dir, NULL); + BLI_split_dir_part(filename, dir, sizeof(dir)); BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); Image *ima = BKE_add_image_file(full_path); if (!ima) { diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp index 747f3c783d7..ec3cc0fc984 100644 --- a/source/blender/collada/ImageExporter.cpp +++ b/source/blender/collada/ImageExporter.cpp @@ -97,7 +97,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob) char src[FILE_MAX]; char dir[FILE_MAX]; - BLI_split_dirfile(this->export_settings->filepath, dir, NULL); + BLI_split_dir_part(this->export_settings->filepath, dir, sizeof(dir)); BKE_rebase_path(abs, sizeof(abs), rel, sizeof(rel), G.main->name, image->name, dir); @@ -110,7 +110,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob) // make dest directory if it doesn't exist BLI_make_existing_file(abs); - if (BLI_copy_fileops(src, abs) != 0) { + if (BLI_copy(src, abs) != 0) { fprintf(stderr, "Cannot copy image to file's directory. \n"); } } diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp index 8059b1cf3ff..a0b3d0051b4 100644 --- a/source/blender/collada/collada.cpp +++ b/source/blender/collada/collada.cpp @@ -40,9 +40,8 @@ extern "C" #include "BKE_context.h" /* make dummy file */ -#include "BLI_storage.h" -#include "BLI_path_util.h" #include "BLI_fileops.h" +#include "BLI_path_util.h" int collada_import(bContext *C, const char *filepath) { @@ -60,9 +59,9 @@ extern "C" export_settings.filepath = (char *)filepath; /* annoying, collada crashes if file cant be created! [#27162] */ - if(!BLI_exist(filepath)) { + if(!BLI_exists(filepath)) { BLI_make_existing_file(filepath); /* makes the dir if its not there */ - if(BLI_touch(filepath) == 0) { + if(BLI_file_touch(filepath) == 0) { return 0; } } 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 */ diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 43168b97b88..05ba4b0d05f 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -67,9 +67,6 @@ # include <dirent.h> #endif -#include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail - BLI_countlist BLI_stringdec */ - #include "imbuf.h" #include "AVI_avi.h" diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index bd5a455df98..08fa51966f2 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -37,7 +37,7 @@ #include "IMB_anim.h" /* - seperate animation index files to solve the following problems: + separate animation index files to solve the following problems: a) different timecodes within one file (like DTS/PTS, Timecode-Track, "implicit" timecodes within DV-files and HDV-files etc.) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index c1ef8c4792b..34c39b1083a 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1175,7 +1175,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { case ANIM_SEQUENCE: ibuf = IMB_loadiffname(anim->name, anim->ib_flags); if (ibuf) { - strcpy(anim->first, anim->name); + BLI_strncpy(anim->first, anim->name, sizeof(anim->first)); anim->duration = 1; } break; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 635813d856e..e4abd8b329d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -29,10 +29,11 @@ #include "AVI_avi.h" #include "imbuf.h" #include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math_base.h" -#include "BLI_string.h" + #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" #include "BKE_global.h" diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index e064d7f760d..1084355dd74 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -546,7 +546,7 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig { ExrHandle *data= (ExrHandle *)handle; - if(BLI_exists(filename) && BLI_filepathsize(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ + if(BLI_exists(filename) && BLI_file_size(filename)>32) { /* 32 is arbitrary, but zero length files crashes exr */ data->ifile = new InputFile(filename); if(data->ifile) { Box2i dw = data->ifile->header().dataWindow(); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 849b3ff0ce2..1c1e681bb30 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -88,7 +88,7 @@ ImBuf *IMB_loadifffile(int file, int flags) if(file == -1) return NULL; - size= BLI_filesize(file); + size= BLI_file_descriptor_size(file); mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); if(mem==(unsigned char*)-1) { @@ -175,7 +175,7 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int if(file == -1) return; - size= BLI_filesize(file); + size= BLI_file_descriptor_size(file); mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0); if(mem==(unsigned char*)-1) { diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 2ab7e55d1f8..d2bf7f75615 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -237,10 +237,10 @@ void IMB_thumb_makedirs(void) { char tpath[FILE_MAX]; if (get_thumb_dir(tpath, THB_NORMAL)) { - BLI_recurdir_fileops(tpath); + BLI_dir_create_recursive(tpath); } if (get_thumb_dir(tpath, THB_FAIL)) { - BLI_recurdir_fileops(tpath); + BLI_dir_create_recursive(tpath); } } @@ -277,7 +277,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im /* exception, skip images over 100mb */ if(source == THB_SOURCE_IMAGE) { - const size_t size= BLI_filepathsize(path); + const size_t size= BLI_file_size(path); if(size != -1 && size > THUMB_SIZE_MAX) { // printf("file too big: %d, skipping %s\n", (int)size, path); return NULL; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 492dd34caa6..db574160771 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -340,8 +340,8 @@ typedef struct bPose { void *ikdata; /* temporary IK data, depends on the IK solver. Not saved in file */ void *ikparam; /* IK solver parameters, structure depends on iksolver */ - bAnimVizSettings avs; /* settings for visualisation of bone animation */ - char proxy_act_bone[32]; /*proxy active bone name*/ + bAnimVizSettings avs; /* settings for visualization of bone animation */ + char proxy_act_bone[32]; /* proxy active bone name*/ } bPose; @@ -423,6 +423,8 @@ typedef enum eItasc_Solver { * This is also exploited for bone-groups. Bone-Groups are stored per bPose, and are used * primarily to color bones in the 3d-view. There are other benefits too, but those are mostly related * to Action-Groups. + * + * Note that these two uses each have their own RNA 'ActionGroup' and 'BoneGroup'. */ typedef struct bActionGroup { struct bActionGroup *next, *prev; @@ -651,7 +653,7 @@ typedef enum eAnimEdit_AutoSnap { * Constraint Channels in certain situations. * * Action-Channels can only belong to one group at a time, but they still live the Action's - * list of achans (to preserve backwards compatability, and also minimise the code + * list of achans (to preserve backwards compatibility, and also minimize the code * that would need to be recoded). Grouped achans are stored at the start of the list, according * to the position of the group in the list, and their position within the group. */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index e04bdd4ec45..00f6f2433af 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -228,7 +228,7 @@ typedef struct bMinMaxConstraint { int minmaxflag; float offset; int flag; - short sticky, stuck, pad1, pad2; /* for backward compatability */ + short sticky, stuck, pad1, pad2; /* for backward compatibility */ float cache[3]; char subtarget[32]; } bMinMaxConstraint; diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 8fe8b3bcf70..201ea8994ca 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -30,7 +30,7 @@ * \deprecated * The contents of this file are now officially depreceated. They were used for the 'old' animation system, * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, - * etc. are only still maintained to provide backwards compatability for old files. + * etc. are only still maintained to provide backwards compatibility for old files. */ #ifndef DNA_IPO_TYPES_H diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4cfd0b56b70..f03cc200a56 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -154,7 +154,9 @@ typedef struct bNode { float locx, locy; /* root offset for drawing */ float width, height; /* node custom width and height */ float miniwidth; /* node width if hidden */ - int pad; + + int update; /* update flags */ + char label[32]; /* custom user-defined label */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; @@ -192,6 +194,13 @@ typedef struct bNode { /* automatic flag for nodes included in transforms */ #define NODE_TRANSFORM (1<<13) +/* node->update */ +/* XXX NODE_UPDATE is a generic update flag. More fine-grained updates + * might be used in the future, but currently all work the same way. + */ +#define NODE_UPDATE 0xFFFF /* generic update flag (includes all others) */ +#define NODE_UPDATE_ID 1 /* associated id data block has changed */ + typedef struct bNodeLink { struct bNodeLink *next, *prev; diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f0c7cf8cc45..6faf86b74a5 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -412,14 +412,14 @@ typedef struct DupliObject { #define OB_EMPTY_IMAGE 8 /* boundtype */ -#define OB_BOUND_BOX 0 -#define OB_BOUND_SPHERE 1 -#define OB_BOUND_CYLINDER 2 -#define OB_BOUND_CONE 3 -#define OB_BOUND_POLYH 4 -#define OB_BOUND_POLYT 5 +#define OB_BOUND_BOX 0 +#define OB_BOUND_SPHERE 1 +#define OB_BOUND_CYLINDER 2 +#define OB_BOUND_CONE 3 +#define OB_BOUND_TRIANGLE_MESH 4 +#define OB_BOUND_CONVEX_HULL 5 /* #define OB_BOUND_DYN_MESH 6 */ /*UNUSED*/ -#define OB_BOUND_CAPSULE 7 +#define OB_BOUND_CAPSULE 7 /* **************** BASE ********************* */ diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 9fec5207dbb..da2fce4da82 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -386,7 +386,8 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in #define PART_DRAW_HEALTH 16 #define PART_ABS_PATH_TIME 32 #define PART_DRAW_COUNT_GR 64 -#define PART_DRAW_BB_LOCK 128 +#define PART_DRAW_BB_LOCK 128 /* used with billboards */ +#define PART_DRAW_ROTATE_OB 128 /* used with dupliobjects/groups */ #define PART_DRAW_PARENT 256 #define PART_DRAW_NUM 512 #define PART_DRAW_RAND_GR 1024 diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index e1ff19533d4..c5cd8bcce2e 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -434,7 +434,8 @@ typedef struct SpaceLogic { struct bGPdata *gpd; /* grease-pencil data */ } SpaceLogic; - +/* note, this entire struct isnt used anymore!, + * may remove some day - campbell */ typedef struct SpaceImaSel { SpaceLink *next, *prev; ListBase regionbase; /* storage of regions for inactive spaces */ diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index dc08e95acb3..283eada81fd 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -652,7 +652,7 @@ PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifi FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier); const struct ListBase *RNA_struct_type_functions(StructRNA *srna); -char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen); +char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len); /* Properties * @@ -759,7 +759,7 @@ void RNA_property_float_get_default_array(PointerRNA *ptr, PropertyRNA *prop, fl float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value); -char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen); +char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen, int *r_len); void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value); int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_string_get_default(PointerRNA *ptr, PropertyRNA *prop, char *value); @@ -827,20 +827,6 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, char *RNA_path_from_ID_to_struct(PointerRNA *ptr); char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop); -#if 0 -/* Dependency - * - * Experimental code that will generate callbacks for each dependency - * between ID types. This may end up being useful for UI - * and evaluation code that needs to know such dependencies for correct - * redraws and re-evaluations. */ - -typedef void (*PropDependencyCallback)(void *udata, PointerRNA *from, PointerRNA *to); -void RNA_test_dependencies_cb(void *udata, PointerRNA *from, PointerRNA *to); - -void RNA_generate_dependencies(PointerRNA *mainptr, void *udata, PropDependencyCallback cb); -#endif - /* Quick name based property access * * These are just an easier way to access property values without having to diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index df31e09da7f..8c6214952ae 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -544,9 +544,9 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; rna_print_data_get(f, dp); if(dp->dnapointerlevel == 0) - fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (char*)pprop->type, dp->dnaname); + fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname); else - fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (char*)pprop->type, dp->dnaname); + fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname); } fprintf(f, "}\n\n"); break; @@ -560,7 +560,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 || strcmp(manualfunc, "rna_iterator_array_get") == 0 || strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0) - fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (char*)cprop->item_type: "UnknownType", manualfunc); + fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (const char*)cprop->item_type: "UnknownType", manualfunc); else fprintf(f, " return %s(iter);\n", manualfunc); } @@ -707,7 +707,7 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array) fprintf(f, "value;\n"); } -static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func; @@ -771,7 +771,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; - StructRNA *type= rna_find_struct((char*)pprop->type); + StructRNA *type= rna_find_struct((const char*)pprop->type); if(type && (type->flag & STRUCT_ID)) { fprintf(f, " if(value.data)\n"); fprintf(f, " id_lib_extern((ID*)value.data);\n\n"); @@ -883,7 +883,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr return func; } -static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func= NULL; @@ -941,7 +941,7 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA return func; } -static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func, *getfunc; @@ -999,7 +999,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * return func; } -static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc, char *nextfunc) +static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc) { /* note on indices, this is for external functions and ignores skipped values. * so the the index can only be checked against the length when there is no 'skip' funcion. */ @@ -1078,7 +1078,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property #if 0 rna_print_data_get(f, dp); - item_type= (cprop->item_type)? (char*)cprop->item_type: "UnknownType"; + item_type= (cprop->item_type)? (const char*)cprop->item_type: "UnknownType"; if(dp->dnalengthname || dp->dnalengthfixed) { if(dp->dnalengthname) @@ -1099,7 +1099,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property return func; } -static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func, *getfunc; @@ -1125,7 +1125,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p return func; } -static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc) +static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc) { char *func; @@ -1193,12 +1193,12 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!bprop->get && !bprop->set && !dp->booleanbit) rna_set_raw_property(dp, prop); - bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->get); - bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->set); + bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->get); + bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->set); } else { - bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->getarray); - bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->setarray); + bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->getarray); + bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->setarray); } break; } @@ -1209,15 +1209,15 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!iprop->get && !iprop->set) rna_set_raw_property(dp, prop); - iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->get); - iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->set); + iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->get); + iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->set); } else { if(!iprop->getarray && !iprop->setarray) rna_set_raw_property(dp, prop); - iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->getarray); - iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->setarray); + iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->getarray); + iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->setarray); } break; } @@ -1228,38 +1228,38 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) if(!fprop->get && !fprop->set) rna_set_raw_property(dp, prop); - fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->get); - fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->set); + fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->get); + fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->set); } else { if(!fprop->getarray && !fprop->setarray) rna_set_raw_property(dp, prop); - fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->getarray); - fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->setarray); + fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->getarray); + fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->setarray); } break; } case PROP_ENUM: { EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop; - eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)eprop->get); - eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)eprop->set); + eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)eprop->get); + eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)eprop->set); break; } case PROP_STRING: { StringPropertyRNA *sprop= (StringPropertyRNA*)prop; - sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)sprop->get); - sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)sprop->length); - sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)sprop->set); + sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)sprop->get); + sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)sprop->length); + sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)sprop->set); break; } case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; - pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)pprop->get); - pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)pprop->set); + pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)pprop->get); + pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)pprop->set); if(!pprop->type) { fprintf(stderr, "rna_def_property_funcs: %s.%s, pointer must have a struct type.\n", srna->identifier, prop->identifier); DefRNA.error= 1; @@ -1268,24 +1268,24 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp) } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; - char *nextfunc= (char*)cprop->next; + const char *nextfunc= (const char*)cprop->next; if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0); else if(dp->dnalengthname || dp->dnalengthfixed) - cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)cprop->length); + cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)cprop->length); /* test if we can allow raw array access, if it is using our standard * array get/next function, we can be sure it is an actual array */ if(cprop->next && cprop->get) - if(strcmp((char*)cprop->next, "rna_iterator_array_next") == 0 && - strcmp((char*)cprop->get, "rna_iterator_array_get") == 0) + if(strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 && + strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0) prop->flag |= PROP_RAW_ARRAY; - cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)cprop->get); - cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (char*)cprop->begin); - cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (char*)cprop->next); - cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (char*)cprop->end); - cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (char*)cprop->lookupint, nextfunc); + cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get); + cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin); + cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next); + cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (const char*)cprop->end); + cprop->lookupint= (void*)rna_def_property_lookup_int_func(f, srna, prop, dp, (const char*)cprop->lookupint, nextfunc); if(!(prop->flag & PROP_IDPROPERTY)) { if(!cprop->begin) { @@ -1414,7 +1414,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN)) return; - if(prop->name && prop->description && strcmp(prop->description, "") != 0) + if(prop->name && prop->description && prop->description[0] != '\0') fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description); else if(prop->name) fprintf(f, "\t/* %s */\n", prop->name); @@ -1468,7 +1468,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\tinline %s %s(void);", (char*)pprop->type, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline %s %s(void);", (const char*)pprop->type, rna_safe_id(prop->identifier)); else fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier)); break; @@ -1477,7 +1477,7 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; if(cprop->item_type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier)); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier)); else fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; @@ -1531,7 +1531,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop; if(pprop->type) - fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); + fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier)); else fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier)); break; @@ -1540,7 +1540,7 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe /*CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop; if(cprop->type) - fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (char*)cprop->type, srna->identifier, prop->identifier); + fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier); else fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);*/ break; @@ -1763,7 +1763,7 @@ static void rna_auto_types(void) pprop->type= (StructRNA*)rna_find_type(dp->dnatype); if(pprop->type) { - type= rna_find_struct((char*)pprop->type); + type= rna_find_struct((const char*)pprop->type); if(type && (type->flag & STRUCT_ID_REFCOUNT)) pprop->property.flag |= PROP_ID_REFCOUNT; } @@ -2214,7 +2214,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr else fprintf(f, "\t0, -1"); /* our own type - collections/arrays only */ - if(prop->srna) fprintf(f, ", &RNA_%s", (char*)prop->srna); + if(prop->srna) fprintf(f, ", &RNA_%s", (const char*)prop->srna); else fprintf(f, ", NULL"); fprintf(f, "},\n"); @@ -2273,14 +2273,14 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr case PROP_POINTER: { PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll)); - if(pprop->type) fprintf(f, "&RNA_%s\n", (char*)pprop->type); + if(pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type); else fprintf(f, "NULL\n"); break; } case PROP_COLLECTION: { CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint)); - if(cprop->item_type) fprintf(f, "&RNA_%s\n", (char*)cprop->item_type); + if(cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type); else fprintf(f, "NULL\n"); break; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 8047b2df226..c1c22afcf75 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -748,12 +748,12 @@ void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type) srna->blender_type= blender_type; } -char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen) +char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len) { PropertyRNA *nameprop; if(ptr->data && (nameprop = RNA_struct_name_property(ptr->type))) - return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen); + return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len); return NULL; } @@ -1614,7 +1614,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -1693,7 +1693,7 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -1811,7 +1811,7 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -1927,7 +1927,7 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len); } @@ -2047,7 +2047,7 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_FLOAT, val, prop->identifier)); } } @@ -2181,7 +2181,7 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa group= RNA_struct_idprops(ptr, 1); if(group) { - idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier); + idprop= IDP_New(IDP_ARRAY, val, prop->identifier); IDP_AddToGroup(group, idprop); memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len); } @@ -2276,7 +2276,8 @@ void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value) strcpy(value, sprop->defaultvalue); } -char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen) +char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, + char *fixedbuf, int fixedlen, int *r_len) { char *buf; int length; @@ -2301,6 +2302,10 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fi BLI_assert(buf[length] == '\0'); #endif + if (r_len) { + *r_len= length; + } + return buf; } @@ -2328,7 +2333,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val BLI_assert(RNA_property_type(prop) == PROP_STRING); if((idprop=rna_idproperty_check(&prop, ptr))) - IDP_AssignString(idprop, (char*)value, RNA_property_string_maxlength(prop) - 1); + IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1); else if(sprop->set) sprop->set(ptr, value); /* set function needs to clamp its self */ else if(prop->flag & PROP_EDITABLE) { @@ -2336,7 +2341,7 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_NewString((char*)value, (char*)prop->identifier, RNA_property_string_maxlength(prop) - 1)); + IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop) - 1)); } } @@ -2413,7 +2418,7 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_INT, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_INT, val, prop->identifier)); } } @@ -2509,7 +2514,7 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) group= RNA_struct_idprops(ptr, 1); if(group) - IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, (char*)prop->identifier)); + IDP_AddToGroup(group, IDP_New(IDP_GROUP, val, prop->identifier)); } else printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier); @@ -2836,15 +2841,17 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co PropertyRNA *nameprop; char name[256], *nameptr; int found= 0; + int keylen= strlen(key); + int namelen; RNA_property_collection_begin(ptr, prop, &iter); for(; iter.valid; RNA_property_collection_next(&iter)) { if(iter.ptr.data && iter.ptr.type->nameproperty) { nameprop= iter.ptr.type->nameproperty; - nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name)); + nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen); - if(strcmp(nameptr, key) == 0) { + if((keylen == namelen) && (strcmp(nameptr, key) == 0)) { *r_ptr= iter.ptr; found= 1; } @@ -2885,7 +2892,7 @@ int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, Pointer BLI_assert(RNA_property_type(prop) == PROP_COLLECTION); *r_ptr= *ptr; - return ((r_ptr->type = prop->srna) ? 1:0); + return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1:0); } int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array) @@ -4254,7 +4261,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in PropertyRNA *prop= RNA_struct_find_property(ptr, name); if(prop) { - return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen); + return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen, NULL); /* TODO, pass length */ } else { printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); @@ -5442,7 +5449,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i } case PROP_STRING: { - char *value= RNA_property_string_get_alloc(fromptr, prop, NULL, 0); + char *value= RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL); RNA_property_string_set(ptr, prop, value); MEM_freeN(value); return 1; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 44c37f93b5e..f2d1578388d 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -132,7 +132,7 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve * } } -static TimeMarker *rna_Action_pose_markers_new(bAction *act, ReportList *reports, const char name[]) +static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[]) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= 1; @@ -550,7 +550,6 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop) func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new"); RNA_def_function_ui_description(func, "Add a pose marker to the action"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)"); RNA_def_property_flag(parm, PROP_REQUIRED); diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c index d828139a6d5..2859a7bb89b 100644 --- a/source/blender/makesrna/intern/rna_actuator.c +++ b/source/blender/makesrna/intern/rna_actuator.c @@ -450,7 +450,7 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property return item; } -static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { bActuator *act= (bActuator *)ptr->data; bArmatureActuator *aa = act->data; diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index ebf8990adf3..21e99d312d6 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -80,6 +80,8 @@ static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value) /* wrapper for poll callback */ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) { + extern FunctionRNA rna_KeyingSetInfo_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -87,7 +89,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) int ok; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -108,12 +110,14 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) /* wrapper for iterator callback */ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks) { + extern FunctionRNA rna_KeyingSetInfo_iterator_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "iterator"); + func= &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ @@ -129,12 +133,14 @@ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks /* wrapper for generator callback */ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data) { + extern FunctionRNA rna_KeyingSetInfo_generate_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr); - func= RNA_struct_find_function(&ptr, "generate"); + func= &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); /* hook up arguments */ diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c index b65122835f1..fa079486b95 100644 --- a/source/blender/makesrna/intern/rna_armature_api.c +++ b/source/blender/makesrna/intern/rna_armature_api.c @@ -40,7 +40,6 @@ #include <stddef.h> -#include "BLI_blenlib.h" #include "BKE_armature.h" void rna_EditBone_align_roll(EditBone *ebo, float no[3]) diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 357f613f65f..e21f6aeb26f 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -76,7 +76,7 @@ EnumPropertyItem boidruleset_type_items[] ={ #include "BKE_depsgraph.h" #include "BKE_particle.h" -static void rna_Boids_reset(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { if(ptr->type==&RNA_ParticleSystem) { ParticleSystem *psys = (ParticleSystem*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index edae977f3f6..8bdbdcefc61 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -292,7 +292,7 @@ static void rna_Curve_dimension_set(PointerRNA *ptr, int value) } } -static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free) +static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Curve *cu= (Curve*)ptr->id.data; @@ -483,7 +483,7 @@ void rna_Curve_body_set(PointerRNA *ptr, const char *value) cu->str = MEM_callocN(len + sizeof(wchar_t), "str"); cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */ - //wcs2utf8s(cu->str, value); // value is not wchar_t + //BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); // value is not wchar_t BLI_strncpy(cu->str, value, len+1); } @@ -722,7 +722,7 @@ static void rna_def_bpoint(BlenderRNA *brna) prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vec[3]"); - RNA_def_property_ui_text(prop, "Weight", "Nurbs weight"); + RNA_def_property_ui_text(prop, "Weight", "NURBS weight"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); /* Number values */ @@ -1446,7 +1446,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) srna= RNA_def_struct(brna, "Spline", NULL); RNA_def_struct_sdna(srna, "Nurb"); - RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either Nurbs, Bezier or Polyline or a character with text objects"); + RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects"); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); @@ -1496,13 +1496,13 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderu"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order U", "Nurbs order in the U direction (For splines and surfaces), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order U", "NURBS order in the U direction (for splines and surfaces, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u"); prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "orderv"); RNA_def_property_range(prop, 2, 6); - RNA_def_property_ui_text(prop, "Order V", "Nurbs order in the V direction (For surfaces only), Higher values let points influence a greater area"); + RNA_def_property_ui_text(prop, "Order V", "NURBS order in the V direction (for surfaces only, higher values let points influence a greater area)"); RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index ab469c19e15..06571a454be 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -39,7 +39,6 @@ #include "DNA_genfile.h" #include "DNA_sdna_types.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 43812ad4a01..08a71e0cd4f 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -1368,13 +1368,14 @@ static void rna_def_fkeyframe(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "ipo"); RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items); RNA_def_property_ui_text(prop, "Interpolation", - "Interpolation method to use for segment of the curve from this Keyframe until the next Keyframe"); + "Interpolation method to use for segment of the F-Curve from " + "this Keyframe until the next Keyframe"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "hide"); RNA_def_property_enum_items(prop, beztriple_keyframe_type_items); - RNA_def_property_ui_text(prop, "Type", "The type of keyframe (for visual purposes only"); + RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)"); RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL); /* Vector values */ diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index a1b84f5bcfe..50698757ecb 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -42,8 +42,6 @@ #include <stddef.h> -#include "BLI_blenlib.h" - #include "BKE_animsys.h" #include "BKE_fcurve.h" diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index ba90aca47a3..13e9c88bfe3 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -96,7 +96,7 @@ static int fluidsim_find_lastframe(FluidsimSettings *fss) do { BLI_strncpy(targetFile, targetDir, sizeof(targetFile)); BLI_path_frame(targetFile, curFrame++, 0); - } while(BLI_exist(targetFile)); + } while(BLI_exists(targetFile)); return curFrame - 1; } @@ -173,6 +173,7 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value) { #ifdef DISABLE_ELBEEM + (void)ptr; value[0]= '\0'; #else Object *ob= (Object*)ptr->id.data; @@ -182,7 +183,7 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v #endif } -static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr) +static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr)) { #ifdef DISABLE_ELBEEM return 0; diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 371c387e871..eacd814c926 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -40,8 +40,6 @@ #ifdef RNA_RUNTIME -#include "BLI_path_util.h" - static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr) { bGPDlayer *gpl= (bGPDlayer *)ptr->data; diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index eac4932ac43..66bcc5951cd 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -369,25 +369,25 @@ static void rna_def_imageuser(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fie_ima"); RNA_def_property_range(prop, 1, 200); - RNA_def_property_ui_text(prop, "Fields per Frame", "The number of fields per rendered frame (2 fields is 1 image)"); + RNA_def_property_ui_text(prop, "Fields per Frame", "Number of fields per rendered frame (2 fields is 1 image)"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); prop= RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 50ce816d7a1..473278440e6 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -157,7 +157,7 @@ static void rna_Image_unpack(Image *image, ReportList *reports, int method) return; } else { - /* reports its own error on failier */ + /* reports its own error on failure */ unpackImage (reports, image, method); } } diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 2a81c4f0a2c..f30fea659ae 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -179,10 +179,11 @@ static void rna_Lattice_points_w_set(PointerRNA *ptr, int value) static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value) { Lattice *lt= ptr->data; - strcpy(lt->vgroup, value); + BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup)); - if(lt->editlatt) - strcpy(lt->editlatt->latt->vgroup, value); + if(lt->editlatt) { + BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup)); + } } /* annoying, but is a consequence of RNA structures... */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index d35b7ad38fb..c4f33f9cf10 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1383,20 +1383,20 @@ static void rna_def_mtface(BlenderRNA *brna) prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set"); - RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing"); + RNA_def_property_ui_text(prop, "Active", "Set the layer as active for display and editing"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get", "rna_MeshTextureFaceLayer_active_render_set"); - RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering"); + RNA_def_property_ui_text(prop, "Active Render", "Set the layer as active for rendering"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0); RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set"); - RNA_def_property_ui_text(prop, "Active Clone", "Sets the layer as active for cloning"); + RNA_def_property_ui_text(prop, "Active Clone", "Set the layer as active for cloning"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); @@ -1835,7 +1835,8 @@ static void rna_def_mesh(BlenderRNA *brna) /* UV textures */ prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, "rna_Mesh_uv_textures_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL, + "rna_Mesh_uv_textures_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshTextureFaceLayer"); RNA_def_property_ui_text(prop, "UV Textures", ""); rna_def_uv_textures(brna, prop); @@ -1865,26 +1866,30 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL, + "rna_Mesh_vertex_colors_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshColorLayer"); RNA_def_property_ui_text(prop, "Vertex Colors", ""); rna_def_vertex_colors(brna, prop); prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, "rna_Mesh_float_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL, + "rna_Mesh_float_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer"); RNA_def_property_ui_text(prop, "Float Property Layers", ""); prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, "rna_Mesh_int_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL, + "rna_Mesh_int_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshIntPropertyLayer"); RNA_def_property_ui_text(prop, "Int Property Layers", ""); prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer"); - RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, "rna_Mesh_string_layers_length", NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL, + "rna_Mesh_string_layers_length", NULL, NULL, NULL); RNA_def_property_struct_type(prop, "MeshStringPropertyLayer"); RNA_def_property_ui_text(prop, "String Property Layers", ""); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index b82cbafc3c5..81cf1bc4c37 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -56,6 +56,11 @@ #include "WM_types.h" EnumPropertyItem modifier_type_items[] ={ + {0, "", 0, "Modify", ""}, + {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, + {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, + {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, + {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Generate", ""}, {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""}, {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""}, @@ -69,11 +74,6 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, - {0, "", 0, "Modify", ""}, - {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, - {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, - {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, - {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""}, {0, "", 0, "Deform", ""}, {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""}, {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""}, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 813375a3549..0677b848fee 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -568,7 +568,7 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor } else { ntreeUpdateTree(ntree); /* update group node socket links*/ - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); WM_main_add_notifier(NC_NODE|NA_EDITED, ntree); if (group) @@ -651,7 +651,7 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b ret= nodeAddLink(ntree, fromnode, in, tonode, out); if(ret) { - NodeTagChanged(ntree, tonode); + nodeUpdate(ntree, tonode); ntreeUpdateTree(ntree); @@ -1403,19 +1403,19 @@ static void def_cmp_image(StructRNA *srna) prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "frames"); RNA_def_property_range(prop, 0, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Frames", "Sets the number of images of a movie to use"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sfra"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Start Frame", "Sets the global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); - RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation"); /* copied from the rna_image.c */ + RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); /* copied from the rna_image.c */ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE); @@ -1871,7 +1871,7 @@ static void def_cmp_id_mask(StructRNA *srna) prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "custom1"); - RNA_def_property_range(prop, 0, 10000); + RNA_def_property_range(prop, 0, 32767); RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha"); RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update"); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 428599af977..e329df8470d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -83,8 +83,8 @@ static EnumPropertyItem collision_bounds_items[] = { {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", ""}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""}, {OB_BOUND_CONE, "CONE", 0, "Cone", ""}, - {OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""}, - {OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""}, + {OB_BOUND_CONVEX_HULL, "CONVEX_HULL", 0, "Convex Hull", ""}, + {OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""}, {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""}, //{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, {0, NULL, 0, NULL, NULL}}; @@ -430,8 +430,8 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), EnumPropertyItem *item= NULL; int totitem= 0; - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYH); - RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_POLYT); + RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH); + RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL); if(ob->body_type!=OB_BODY_TYPE_SOFT) { RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE); @@ -934,9 +934,9 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH); /* assume triangle mesh, if no bounds chosen for soft body */ - if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_POLYH)) + if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_TRIANGLE_MESH)) { - ob->boundtype=OB_BOUND_POLYH; + ob->boundtype= OB_BOUND_TRIANGLE_MESH; } /* create a BulletSoftBody structure if not already existing */ if (!ob->bsoft) @@ -1397,7 +1397,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Controller"); RNA_def_property_ui_text(prop, "Controllers", - "Game engine controllers to process events, connecting sensor to actuators"); + "Game engine controllers to process events, connecting sensors to actuators"); prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE); RNA_def_property_struct_type(prop, "Actuator"); @@ -1426,7 +1426,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "body_type"); RNA_def_property_enum_items(prop, body_type_items); RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL); - RNA_def_property_ui_text(prop, "Physics Type", "Selects the type of physical representation"); + RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation"); RNA_def_property_update(prop, NC_LOGIC, NULL); prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE); @@ -1488,20 +1488,20 @@ static void rna_def_object_game_settings(BlenderRNA *brna) /* lock rotation */ prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); + RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis"); prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); + RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis"); prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); /* is this used anywhere ? */ prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING); - RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); + RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis"); prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE); @@ -1526,7 +1526,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction"); RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_text(prop, "Friction Coefficients", - "Relative friction coefficient in the in the X, Y and Z directions, " + "Relative friction coefficients in the in the X, Y and Z directions, " "when anisotropic friction is enabled"); prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE); @@ -1537,7 +1537,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "boundtype"); RNA_def_property_enum_items(prop, collision_bounds_items); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf"); - RNA_def_property_ui_text(prop, "Collision Bounds", "Selects the collision type"); + RNA_def_property_ui_text(prop, "Collision Bounds", "Select the collision type"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE); @@ -1804,7 +1804,7 @@ static void rna_def_object(BlenderRNA *brna) {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Draw bounds as sphere"}, {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Draw bounds as cylinder"}, {OB_BOUND_CONE, "CONE", 0, "Cone", "Draw bounds as cone"}, - {OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, + {OB_BOUND_TRIANGLE_MESH, "POLYHEDRON", 0, "Polyhedron", "Draw bounds as polyhedron"}, {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Draw bounds as capsule"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 72bc440f4ac..1a6fdb2da5c 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -53,7 +53,7 @@ static EnumPropertyItem effector_shape_items[] = { #ifdef RNA_RUNTIME -/* type spesific return values only used from functions */ +/* type specific return values only used from functions */ static EnumPropertyItem curve_shape_items[] = { {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""}, {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""}, @@ -98,8 +98,6 @@ static EnumPropertyItem empty_vortex_shape_items[] = { #include "BKE_pointcache.h" #include "BKE_depsgraph.h" -#include "BLI_blenlib.h" - #include "ED_object.h" static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -193,7 +191,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P pid2 = pid; else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) { /*TODO: report "name exists" to user */ - strcpy(cache->name, cache->prev_name); + BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); new_name = 0; } } @@ -203,13 +201,13 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P char old_name[80]; char new_name[80]; - strcpy(old_name, cache->prev_name); - strcpy(new_name, cache->name); + BLI_strncpy(old_name, cache->prev_name, sizeof(old_name)); + BLI_strncpy(new_name, cache->name, sizeof(new_name)); BKE_ptcache_disk_cache_rename(pid2, old_name, new_name); } - strcpy(cache->prev_name, cache->name); + BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name)); } } @@ -695,7 +693,8 @@ static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point } -static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr, + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Object *ob= NULL; @@ -741,7 +740,8 @@ static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches"); prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); - RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range"); + RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", + "rna_Cache_active_point_cache_index_range"); RNA_def_property_ui_text(prop, "Active Point Cache Index", ""); RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change"); } @@ -843,7 +843,8 @@ static void rna_def_pointcache(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); + RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", + "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list"); rna_def_ptcache_point_caches(brna, prop); @@ -930,7 +931,8 @@ static void rna_def_collision(BlenderRNA *brna) prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2); - RNA_def_property_ui_text(prop, "Absorption", "How much of effector force gets lost during collision with this object (in percent)"); + RNA_def_property_ui_text(prop, "Absorption", + "How much of effector force gets lost during collision with this object (in percent)"); RNA_def_property_update(prop, 0, "rna_CollisionSettings_update"); } @@ -1144,7 +1146,9 @@ static void rna_def_field(BlenderRNA *brna) prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "tex_mode"); RNA_def_property_enum_items(prop, texture_items); - RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)"); + RNA_def_property_ui_text(prop, "Texture Mode", + "How the texture effect is calculated (RGB & Curl need a RGB texture, " + "else Gradient will be used instead)"); RNA_def_property_update(prop, 0, "rna_FieldSettings_update"); prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE); @@ -1439,7 +1443,10 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "welding"); RNA_def_property_range(prop, 0.0f, 0.01f); - RNA_def_property_ui_text(prop, "Welding", "Welding threshold: distance between nearby vertices to be considered equal => set to 0.0 to disable welding test and speed up scene loading (ok if the mesh has no duplicates)"); + RNA_def_property_ui_text(prop, "Welding", + "Welding threshold: distance between nearby vertices to be considered equal " + "=> set to 0.0 to disable welding test and speed up scene loading " + "(ok if the mesh has no duplicates)"); /* Integers */ @@ -1451,7 +1458,7 @@ static void rna_def_game_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "numclusteriterations"); RNA_def_property_range(prop, 1, 128); - RNA_def_property_ui_text(prop, "Cluster Iterations", "Specify the number of cluster iterations"); + RNA_def_property_ui_text(prop, "Cluster Iterations", "Number of cluster iterations"); /* Booleans */ @@ -1535,7 +1542,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "vertgroup"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */ - RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set"); + RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", + "rna_SoftBodySettings_goal_vgroup_set"); RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values"); prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE); @@ -1657,7 +1665,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "rklimit"); RNA_def_property_range(prop, 0.001f, 10.0f); - RNA_def_property_ui_text(prop, "Error Limit", "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); + RNA_def_property_ui_text(prop, "Error Limit", + "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE); @@ -1681,7 +1690,8 @@ static void rna_def_softbody(BlenderRNA *brna) prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "fuzzyness"); RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text(prop, "Fuzzy", "Fuzziness while on collision, high values make collision handling faster but less stable"); + RNA_def_property_ui_text(prop, "Fuzzy", + "Fuzziness while on collision, high values make collision handling faster but less stable"); RNA_def_property_update(prop, 0, "rna_softbody_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f0f782fede2..4b27e025fa3 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -120,7 +120,6 @@ EnumPropertyItem part_hair_ren_as_items[] = { #ifdef RNA_RUNTIME #include "BLI_math.h" -#include "BLI_listbase.h" #include "BKE_context.h" #include "BKE_cloth.h" @@ -505,6 +504,17 @@ static int rna_PartSettings_is_fluid_get(PointerRNA *ptr) return part->type == PART_FLUID; } +void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + ParticleSystem *part= (ParticleSystem*)ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(part->name, value, sizeof(part->name)); + + BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name)); +} + static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr) { ParticleSystem *psys= (ParticleSystem*)ptr->data; @@ -809,7 +819,7 @@ static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int i psys->vgroup[index]= 0; } else { - int vgroup_num = defgroup_name_index(ob, (char*)value); + int vgroup_num = defgroup_name_index(ob, value); if(vgroup_num == -1) return; @@ -1467,7 +1477,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem rot_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_ROT_NOR, "NOR", 0, "Normal", ""}, - {PART_ROT_VEL, "VEL", 0, "Velocity", ""}, + {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""}, {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""}, {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""}, {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""}, @@ -1722,7 +1732,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "rotmode"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_enum_items(prop, rot_mode_items); - RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation"); + RNA_def_property_ui_text(prop, "Rotation", "Particle rotation axis"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE); @@ -1787,7 +1797,12 @@ static void rna_def_particle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB); - RNA_def_property_ui_text(prop, "Use Global", "Use object's global coordinates for duplication"); + RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); + + prop= RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB); + RNA_def_property_ui_text(prop, "Rotation", "Use object's rotation for duplication (global x-axis is aligned particle rotation axis)"); RNA_def_property_update(prop, 0, "rna_Particle_redo"); prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE); @@ -2617,6 +2632,7 @@ static void rna_def_particle_system(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", "Particle system name"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set"); RNA_def_struct_name_property(srna, prop); /* access to particle settings is redirected through functions */ diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b61495edc94..d224bd0d4e5 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -48,13 +48,14 @@ // XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable EnumPropertyItem posebone_rotmode_items[] = { {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"}, - {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order. Prone to Gimbal Lock"}, - {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", "Axis Angle (W+XYZ). Defines a rotation around some axis defined by 3D-Vector"}, + {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order (prone to Gimbal Lock)"}, + {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle", + "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"}, {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -139,6 +140,17 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value) } } +void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value) +{ + Object *ob= ptr->id.data; + bActionGroup *agrp= ptr->data; + + /* copy the new name into the name slot */ + BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name)); + + BLI_uniquename(&ob->pose->agroups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name)); +} + static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create) { bPoseChannel *pchan= ptr->data; @@ -657,6 +669,7 @@ static void rna_def_bone_group(BlenderRNA *brna) /* name */ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set"); RNA_def_struct_name_property(srna, prop); // TODO: add some runtime-collections stuff to access grouped bones @@ -705,7 +718,8 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro /* Collection active property */ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Constraint"); - RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", "rna_PoseChannel_active_constraint_set", NULL, NULL); + RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get", + "rna_PoseChannel_active_constraint_set", NULL, NULL); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint"); @@ -808,7 +822,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) */ prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE); RNA_def_property_array(prop, 4); - RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", "rna_PoseChannel_rotation_axis_angle_set", NULL); + RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get", + "rna_PoseChannel_rotation_axis_angle_set", NULL); RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable"); RNA_def_property_float_array_default(prop, default_axisAngle); RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation"); @@ -841,7 +856,7 @@ static void rna_def_pose_channel(BlenderRNA *brna) prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX); RNA_def_property_multi_array(prop, 2, matrix_dimsize); RNA_def_property_ui_text(prop, "Basis Matrix", - "Provides an alternative access to loc/scale/rotation relative to the parent and own rest bone"); + "Alternative access to location/scale/rotation relative to the parent and own rest bone"); RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1027,7 +1042,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "agrp_index"); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", "rna_PoseChannel_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set", + "rna_PoseChannel_bone_group_index_range"); RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1060,7 +1076,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this! prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW); - RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", "Lock editing of 'angle' component of four-component rotations in the interface"); + RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)", + "Lock editing of 'angle' component of four-component rotations in the interface"); RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1068,7 +1085,8 @@ static void rna_def_pose_channel(BlenderRNA *brna) // XXX this needs a better name prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D); - RNA_def_property_ui_text(prop, "Lock Rotations (4D)", "Lock editing of four component rotations by components (instead of as Eulers)"); + RNA_def_property_ui_text(prop, "Lock Rotations (4D)", + "Lock editing of four component rotations by components (instead of as Eulers)"); RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); @@ -1086,13 +1104,17 @@ static void rna_def_pose_channel(BlenderRNA *brna) static void rna_def_pose_itasc(BlenderRNA *brna) { static const EnumPropertyItem prop_itasc_mode_items[]= { - {0, "ANIMATION", 0, "Animation", "Stateless solver computing pose starting from current action and non-IK constraints"}, - {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, + {0, "ANIMATION", 0, "Animation", + "Stateless solver computing pose starting from current action and non-IK constraints"}, + {ITASC_SIMULATION, "SIMULATION", 0, "Simulation", + "Statefull solver running in real-time context and ignoring actions and non-IK constraints"}, {0, NULL, 0, NULL, NULL}}; static const EnumPropertyItem prop_itasc_reiteration_items[]= { {0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"}, - {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", "The solver reiterates (converges) on the first frame but not on subsequent frame"}, - {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", "The solver reiterates (converges) on all frames"}, + {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial", + "The solver reiterates (converges) on the first frame but not on subsequent frame"}, + {ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always", + "The solver reiterates (converges) on all frames"}, {0, NULL, 0, NULL, NULL}}; StructRNA *srna; @@ -1129,12 +1151,15 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, prop_itasc_reiteration_items); - RNA_def_property_ui_text(prop, "Reiteration", "Defines if the solver is allowed to reiterate (converges until precision is met) on none, first or all frames"); + RNA_def_property_ui_text(prop, "Reiteration", + "Defines if the solver is allowed to reiterate (converges until " + "precision is met) on none, first or all frames"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP); - RNA_def_property_ui_text(prop, "Auto step", "Automatically determine the optimal number of steps for best performance/accuracy trade off"); + RNA_def_property_ui_text(prop, "Auto step", + "Automatically determine the optimal number of steps for best performance/accuracy trade off"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE); @@ -1152,7 +1177,8 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "feedback"); RNA_def_property_range(prop, 0.0f,100.0f); - RNA_def_property_ui_text(prop, "Feedback", "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); + RNA_def_property_ui_text(prop, "Feedback", + "Feedback coefficient for error correction. Average response time=1/feedback. Default=20"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE); @@ -1170,13 +1196,17 @@ static void rna_def_pose_itasc(BlenderRNA *brna) prop= RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampmax"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Damp", "Maximum damping coefficient when singular value is nearly 0. Higher values=more stability, less reactivity. Default=0.5"); + RNA_def_property_ui_text(prop, "Damp", + "Maximum damping coefficient when singular value is nearly 0 " + "(higher values=more stability, less reactivity - default=0.5)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); prop= RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dampeps"); RNA_def_property_range(prop, 0.0f,1.0f); - RNA_def_property_ui_text(prop, "Epsilon", "Singular value under which damping is progressively applied. Higher values=more stability, less reactivity. Default=0.1"); + RNA_def_property_ui_text(prop, "Epsilon", + "Singular value under which damping is progressively applied " + "(higher values=more stability, less reactivity - default=0.1)"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update"); } @@ -1220,7 +1250,8 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "active_group"); - RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range"); + RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", + "rna_Pose_active_bone_group_index_range"); RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update"); } @@ -1253,7 +1284,8 @@ static void rna_def_pose(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "iksolver"); RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL); RNA_def_property_enum_items(prop, prop_iksolver_items); - RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); + RNA_def_property_ui_text(prop, "IK Solver", + "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC"); RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_ik_solver_update"); prop= RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index f5fab9d2f33..a2e68668856 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -88,12 +88,14 @@ void RE_engines_exit(void) static void engine_render(RenderEngine *engine, struct Scene *scene) { + extern FunctionRNA rna_RenderEngine_render_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr); - func= RNA_struct_find_function(&ptr, "render"); + func= &rna_RenderEngine_render_func; /* RNA_struct_find_function(&ptr, "render"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "scene", &scene); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 376b0c529d0..31c872f43f8 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -167,7 +167,7 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data) return 0; } -static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { PropertyRNA *prop= (PropertyRNA*)data; @@ -176,7 +176,7 @@ static int rna_property_builtin(CollectionPropertyIterator *iter, void *data) return (prop->flag & PROP_BUILTIN); } -static int rna_function_builtin(CollectionPropertyIterator *iter, void *data) +static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data) { FunctionRNA *func= (FunctionRNA*)data; @@ -775,7 +775,7 @@ static int rna_EnumProperty_default_get(PointerRNA *ptr) return ((EnumPropertyRNA*)prop)->defaultvalue; } -static int rna_enum_check_separator(CollectionPropertyIterator *iter, void *data) +static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data) { EnumPropertyItem *item= (EnumPropertyItem*)data; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 0eaacc62f33..8b41c85e313 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -175,7 +175,6 @@ EnumPropertyItem image_color_mode_items[] ={ #include "BLI_threads.h" #include "BLI_editVert.h" -#include "BLI_blenlib.h" #include "BKE_context.h" #include "BKE_global.h" @@ -812,8 +811,8 @@ static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) { Scene *scene= (Scene*)ptr->id.data; SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; - BLI_strncpy_utf8(rl->name, value, sizeof(rl->name)); + BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name)); if(scene->nodetree) { bNode *node; @@ -1054,7 +1053,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons * is not for general use and only for the few cases where changing scene * settings and NOT for general purpose updates, possibly this should be * given its own notifier. */ -static void rna_Scene_update_active_object_data(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { Object *ob= OBACT; if(ob) { @@ -1755,13 +1754,13 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop= RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionminsize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size. Smaller regions will be deleted"); + RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "regionmergesize"); RNA_def_property_ui_range(prop, 0, 150, 1, 2); - RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size. Smaller regions will be merged"); + RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE); @@ -1977,7 +1976,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); RNA_def_property_ui_text(prop, "Occlusion Resolution", - "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); + "Size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE); @@ -1985,7 +1984,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 60, 1, 1); RNA_def_property_range(prop, 1, 250); RNA_def_property_ui_text(prop, "Frames Per Second", - "The nominal number of game frames per second " + "Nominal number of game frames per second " "(physics fixed timestep = 1/fps, independently of actual frame rate)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1994,7 +1993,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Logic Steps", - "Sets the maximum number of logic frame per game frame if graphics slows down the game, " + "Maximum number of logic frame per game frame if graphics slows down the game, " "higher value allows better synchronization with physics"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2003,7 +2002,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Max Physics Steps", - "Sets the maximum number of physics step per game frame if graphics slows down the game, " + "Maximum number of physics step per game frame if graphics slows down the game, " "higher value allows physics to keep up with realtime"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2012,7 +2011,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_range(prop, 1, 5, 1, 1); RNA_def_property_range(prop, 1, 5); RNA_def_property_ui_text(prop, "Physics Sub Steps", - "Sets the number of simulation substep per physic timestep, " + "Number of simulation substep per physic timestep, " "higher value give better physics precision"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -2066,7 +2065,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD); - RNA_def_property_ui_text(prop, "Record Animation", "Record animation to fcurves"); + RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves"); prop= RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set"); @@ -2075,8 +2074,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES); RNA_def_property_ui_text(prop, "Restrict Animation Updates", - "Restrict the number of animation updates to the animation FPS. This is " - "better for performance, but can cause issues with smooth playback"); + "Restrict the number of animation updates to the animation FPS (this is " + "better for performance, but can cause issues with smooth playback)"); /* materials */ prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 28b96f3b08b..d169ee5079b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -127,7 +127,8 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) pset->brushtype = value; } -static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free)) +static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), int *UNUSED(free)) { Scene *scene= CTX_data_scene(C); Object *ob= (scene->basact)? scene->basact->object: NULL; @@ -275,7 +276,8 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER); - RNA_def_property_ui_text(prop, "Symmetry Feathering", "Reduce the strength of the brush where it overlaps symmetrical daubs"); + RNA_def_property_ui_text(prop, "Symmetry Feathering", + "Reduce the strength of the brush where it overlaps symmetrical daubs"); prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP); @@ -283,7 +285,9 @@ static void rna_def_sculpt(BlenderRNA *brna) prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM); - RNA_def_property_ui_text(prop, "Use Deform Only", "Use only deformation modifiers (temporary disable all constructive modifiers except multi-resolution)"); + RNA_def_property_ui_text(prop, "Use Deform Only", + "Use only deformation modifiers (temporary disable all " + "constructive modifiers except multi-resolution)"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update"); } @@ -345,7 +349,8 @@ static void rna_def_image_paint(BlenderRNA *brna) prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); - RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); + RNA_def_property_ui_text(prop, "Clone Layer", + "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); /* integers */ @@ -357,7 +362,8 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_range(prop, 0, 90); RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle"); - prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", "Size to capture the image for re-projecting", 0, 0); + prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", + "Size to capture the image for re-projecting", 0, 0); RNA_def_property_range(prop, 512, 16384); } @@ -518,7 +524,8 @@ static void rna_def_particle_edit(BlenderRNA *brna) prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME); - RNA_def_property_ui_text(prop, "Puff Volume", "Apply puff to unselected end-points, (helps maintain hair volume when puffing root)"); + RNA_def_property_ui_text(prop, "Puff Volume", + "Apply puff to unselected end-points (helps maintain hair volume when puffing root)"); prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "invert"); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index a75166c3e99..3c2b771ae86 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -443,7 +443,6 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator * static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; if(seq->type == SEQ_SOUND && seq->sound) { /* for sound strips we need to update the sound as well. @@ -453,11 +452,11 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value) PointerRNA id_ptr; RNA_id_pointer_create((ID *)seq->sound, &id_ptr); RNA_string_set(&id_ptr, "filepath", value); + sound_load(G.main, seq->sound); + sound_update_scene_sound(seq->scene_sound, seq->sound); } - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) @@ -479,11 +478,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value) { StripProxy *proxy= (StripProxy*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(proxy->dir, dir, sizeof(proxy->dir)); - BLI_strncpy(proxy->file, name, sizeof(proxy->file)); + BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file)); } static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) @@ -539,20 +534,13 @@ static int rna_Sequence_input_count_get(PointerRNA *ptr) /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value) { Sequence *seq= (Sequence*)(ptr->data); - char dir[FILE_MAX], name[FILE_MAX]; - - BLI_split_dirfile(value, dir, name); - BLI_strncpy(seq->strip->dir, dir, sizeof(seq->strip->dir)); - BLI_strncpy(seq->strip->stripdata->name, name, sizeof(seq->strip->stripdata->name)); + BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name)); } static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value) { StripElem *elem= (StripElem*)(ptr->data); - char name[FILE_MAX]; - - BLI_split_dirfile(value, NULL, name); - BLI_strncpy(elem->name, name, sizeof(elem->name)); + BLI_split_file_part(value, elem->name, sizeof(elem->name)); }*/ static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) @@ -1202,7 +1190,7 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Overlay Offset", ""); RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL); - RNA_def_property_ui_text(prop, "Active Strip", "Sequencers active strip"); + RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip"); } static void rna_def_filter_video(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 217d68860f2..c40548ade6b 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -177,14 +177,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "alpha"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Density", "How much density effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Density", "How much density affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "beta"); RNA_def_property_range(prop, -5.0, 5.0); RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5); - RNA_def_property_ui_text(prop, "Heat", "How much heat effects smoke motion, higher value results in faster rising smoke"); + RNA_def_property_ui_text(prop, "Heat", "How much heat affects smoke motion (higher value results in faster rising smoke)"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE); @@ -245,7 +245,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "border_collisions"); RNA_def_property_enum_items(prop, smoke_domain_colli_items); - RNA_def_property_ui_text(prop, "Border Collisions", "Selects which domain border will be treated as collision object"); + RNA_def_property_ui_text(prop, "Border Collisions", "Select which domain border will be treated as collision object"); RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE); @@ -289,12 +289,14 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1); RNA_def_property_ui_range(prop, 0.001, 1.0, 1.0, 4); RNA_def_property_ui_text(prop, "Density", ""); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "temp"); RNA_def_property_range(prop, -10, 10); RNA_def_property_ui_range(prop, -10, 10, 1, 1); RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "psys"); @@ -306,20 +308,24 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_outflow", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "type", MOD_SMOKE_FLOW_TYPE_OUTFLOW); RNA_def_property_ui_text(prop, "Outflow", "Delete smoke from simulation"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE); RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY); - RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits it's velocity from the emitter particle"); + RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke inherits its velocity from the emitter particle"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -2.0, 2.0); RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5); RNA_def_property_ui_text(prop, "Multiplier", "Multiplier to adjust velocity passed to smoke"); + RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset"); } static void rna_def_smoke_coll_settings(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index bbebe52cd3d..18e95bb0eb7 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -860,7 +860,7 @@ static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value) return (ntree->nodetype==0 && ntree->type == snode->treetype); } -static void rna_SpaceNodeEditor_node_tree_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_SpaceNodeEditor_node_tree_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { SpaceNode *snode= (SpaceNode*)ptr->data; diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b5e8acb76e5..1babf5e61a1 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -133,7 +133,7 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr) } } -static void rna_Texture_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -162,7 +162,7 @@ static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, Pointe /* Used for Texture Properties, used (also) for/in Nodes */ -static void rna_Texture_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { Tex *tex= ptr->id.data; @@ -177,7 +177,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) tex_set_type(tex, value); } -void rna_TextureSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr) +void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) { ID *id= ptr->id.data; @@ -388,12 +388,12 @@ static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value) pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1; } -static char *rna_PointDensity_path(PointerRNA *ptr) +static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("point_density"); } -static char *rna_VoxelData_path(PointerRNA *ptr) +static char *rna_VoxelData_path(PointerRNA *UNUSED(ptr)) { return BLI_sprintfN("voxel_data"); } @@ -698,7 +698,7 @@ static EnumPropertyItem prop_noise_basis_items[] = { {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle", "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"}, {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise", - "Noise algorithm - Cell Noise: Square cell tessallation"}, + "Noise algorithm - Cell Noise: Square cell tessellation"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem prop_noise_type[] = { @@ -1525,13 +1525,13 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna) prop= RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space"); RNA_def_property_enum_items(prop, particle_cache_items); - RNA_def_property_ui_text(prop, "Particle Cache", "Co-ordinate system to cache particles in"); + RNA_def_property_ui_text(prop, "Particle Cache", "Coordinate system to cache particles in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space"); RNA_def_property_enum_items(prop, vertice_cache_items); - RNA_def_property_ui_text(prop, "Vertices Cache", "Co-ordinate system to cache vertices in"); + RNA_def_property_ui_text(prop, "Vertices Cache", "Coordinate system to cache vertices in"); RNA_def_property_update(prop, 0, "rna_Texture_update"); prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE); @@ -1657,9 +1657,9 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem voxeldata_extension[] = { - {TEX_EXTEND, "EXTEND", 0, "Extend", "Extends by repeating edge pixels of the image"}, - {TEX_CLIP, "CLIP", 0, "Clip", "Clips to image size and sets exterior pixels as transparent"}, - {TEX_REPEAT, "REPEAT", 0, "Repeat", "Causes the image to repeat horizontally and vertically"}, + {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"}, + {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"}, + {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem smoked_type_items[] = { diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 2c2bc4704bf..2a62a39ef33 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -95,6 +95,8 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re static int panel_poll(const bContext *C, PanelType *pt) { + extern FunctionRNA rna_Panel_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -102,7 +104,7 @@ static int panel_poll(const bContext *C, PanelType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -118,12 +120,14 @@ static int panel_poll(const bContext *C, PanelType *pt) static void panel_draw(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw"); + func= &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -134,12 +138,14 @@ static void panel_draw(const bContext *C, Panel *pnl) static void panel_draw_header(const bContext *C, Panel *pnl) { + extern FunctionRNA rna_Panel_draw_header_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr); - func= RNA_struct_find_function(&ptr, "draw_header"); + func= &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -249,12 +255,14 @@ static StructRNA* rna_Panel_refine(PointerRNA *ptr) static void header_draw(const bContext *C, Header *hdr) { + extern FunctionRNA rna_Header_draw_func; + PointerRNA htr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr); - func= RNA_struct_find_function(&htr, "draw"); + func= &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */ RNA_parameter_list_create(&list, &htr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -347,6 +355,8 @@ static StructRNA* rna_Header_refine(PointerRNA *htr) static int menu_poll(const bContext *C, MenuType *pt) { + extern FunctionRNA rna_Menu_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -354,7 +364,7 @@ static int menu_poll(const bContext *C, MenuType *pt) int visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -370,12 +380,14 @@ static int menu_poll(const bContext *C, MenuType *pt) static void menu_draw(const bContext *C, Menu *hdr) { + extern FunctionRNA rna_Menu_draw_func; + PointerRNA mtr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr); - func= RNA_struct_find_function(&mtr, "draw"); + func= &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */ RNA_parameter_list_create(&list, &mtr, func); RNA_parameter_set_lookup(&list, "context", &C); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 11157e67741..c6a76cf42b9 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -72,7 +72,7 @@ static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe WM_main_add_notifier(NC_WINDOW, NULL); } -static void rna_userdef_dpi_update(Main *bmain, Scene *scene, PointerRNA *ptr) +static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { U.widget_unit = (U.dpi * 20 + 36)/72; WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */ @@ -295,8 +295,7 @@ static void rna_userdef_addon_remove(bAddon *bext) static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - extern char btempdir[]; - BLI_where_is_temp(btempdir, FILE_MAX, 1); + BLI_init_temporary_dir(U.tempdir); } static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -813,25 +812,25 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb prop= RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active U-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active U-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Nurb active V-lines", ""); + RNA_def_property_ui_text(prop, "NURBS active V-lines", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop= RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -1984,19 +1983,19 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 3); RNA_def_property_float_array_default(prop, default_dir); - RNA_def_property_ui_text(prop, "Direction", "The direction that the OpenGL light is shining"); + RNA_def_property_ui_text(prop, "Direction", "Direction that the OpenGL light is shining"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "col"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Diffuse Color", "The diffuse color of the OpenGL light"); + RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the OpenGL light"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "spec"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Specular Color", "The color of the lights specular highlight"); + RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); } @@ -2511,35 +2510,37 @@ static void rna_def_userdef_system(BlenderRNA *brna) /* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */ /* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */ static EnumPropertyItem language_items[] = { - {0, "DEFAULT", 0, N_("Default (Default)"), ""}, - {1, "ENGLISH", 0, N_("English (English)"), "en_US"}, - {2, "JAPANESE", 0, N_("Japanese (日本語)"), "ja_JP"}, - {3, "DUTCH", 0, N_("Dutch (Nederlandse taal)"), "nl_NL"}, - {4, "ITALIAN", 0, N_("Italian (Italiano)"), "it_IT"}, - {5, "GERMAN", 0, N_("German (Deutsch)"), "de_DE"}, - {6, "FINNISH", 0, N_("Finnish (Suomi)"), "fi_FI"}, - {7, "SWEDISH", 0, N_("Swedish (Svenska)"), "sv_SE"}, - {8, "FRENCH", 0, N_("French (Française)"), "fr_FR"}, - {9, "SPANISH", 0, N_("Spanish (Español)"), "es_ES"}, - {10, "CATALAN", 0, N_("Catalan (Català)"), "ca_AD"}, - {11, "CZECH", 0, N_("Czech (Český)"), "cs_CZ"}, - {12, "BRAZILIAN_PORTUGUESE", 0, N_("Brazilian Portuguese (Português do Brasil)"), "pt_BR"}, - {13, "SIMPLIFIED_CHINESE", 0, N_("Simplified Chinese (简体中文)"), "zh_CN"}, - {14, "TRADITIONAL_CHINESE", 0, N_("Traditional Chinese (繁體中文)"), "zh_TW"}, - {15, "RUSSIAN", 0, N_("Russian (Русский)"), "ru_RU"}, - {16, "CROATIAN", 0, N_("Croatian (Hrvatski)"), "hr_HR"}, - {17, "SERBIAN", 0, N_("Serbian (Српском језику)"), "sr_RS"}, - {18, "UKRAINIAN", 0, N_("Ukrainian (Український)"), "uk_UA"}, - {19, "POLISH", 0, N_("Polish (Polski)"), "pl_PL"}, - {20, "ROMANIAN", 0, N_("Romanian (Român)"), "ro_RO"}, + {0, "", 0, "Nearly done", ""}, + {0, "DEFAULT", 0, "Default (Default)", ""}, + {1, "ENGLISH", 0, "English (English)", "en_US"}, + {8, "FRENCH", 0, "French (Français)", "fr_FR"}, + {9, "SPANISH", 0, "Spanish (Español)", "es_ES"}, + {13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"}, + {0, "", 0, "In progress", ""}, + {2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"}, + {3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"}, + {4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"}, + {5, "GERMAN", 0, "German (Deutsch)", "de_DE"}, + {6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"}, + {7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"}, + {10, "CATALAN", 0, "Catalan (Català)", "ca_AD"}, + {11, "CZECH", 0, "Czech (Český)", "cs_CZ"}, + {12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"}, + {14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"}, + {15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"}, + {16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"}, + {17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"}, + {18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"}, + {19, "POLISH", 0, "Polish (Polski)", "pl_PL"}, + {20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"}, /* using the utf8 flipped form of Arabic (العربية) */ - {21, "ARABIC", 0, N_("Arabic (ﺔﻴﺑﺮﻌﻟﺍ)"), "ar_EG"}, - {22, "BULGARIAN", 0, N_("Bulgarian (Български)"), "bg_BG"}, - {23, "GREEK", 0, N_("Greek (Ελληνικά)"), "el_GR"}, - {24, "KOREAN", 0, N_("Korean (한국 언어)"), "ko_KR"}, - /*{25, "NEPALI", 0, N_("Nepali (नेपाली)"), "ne_NP"},*/ + {21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"}, + {22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"}, + {23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"}, + {24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"}, + /*{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},*/ /* using the utf8 flipped form of Persian (فارسی) */ - {26, "PERSIAN", 0, N_("Persian (ﺱﺭﺎﻓ)"), "fa_PE"}, + {26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index e9df79acd4a..676fe1e092d 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -762,6 +762,8 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type) static int operator_poll(bContext *C, wmOperatorType *ot) { + extern FunctionRNA rna_Operator_poll_func; + PointerRNA ptr; ParameterList list; FunctionRNA *func; @@ -769,7 +771,7 @@ static int operator_poll(bContext *C, wmOperatorType *ot) int visible; RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ - func= RNA_struct_find_function(&ptr, "poll"); + func= &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -785,6 +787,8 @@ static int operator_poll(bContext *C, wmOperatorType *ot) static int operator_execute(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_execute_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -792,7 +796,7 @@ static int operator_execute(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "execute"); + func= &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -809,6 +813,8 @@ static int operator_execute(bContext *C, wmOperator *op) /* same as execute() but no return value */ static int operator_check(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_check_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -816,7 +822,7 @@ static int operator_check(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "check"); + func= &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -832,6 +838,8 @@ static int operator_check(bContext *C, wmOperator *op) static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_invoke_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -839,7 +847,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "invoke"); + func= &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -857,6 +865,8 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event) /* same as invoke */ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) { + extern FunctionRNA rna_Operator_modal_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -864,7 +874,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "modal"); + func= &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -881,12 +891,14 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event) static void operator_draw(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_draw_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "draw"); + func= &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -898,6 +910,8 @@ static void operator_draw(bContext *C, wmOperator *op) /* same as exec(), but call cancel */ static int operator_cancel(bContext *C, wmOperator *op) { + extern FunctionRNA rna_Operator_cancel_func; + PointerRNA opr; ParameterList list; FunctionRNA *func; @@ -905,7 +919,7 @@ static int operator_cancel(bContext *C, wmOperator *op) int result; RNA_pointer_create(&CTX_wm_screen(C)->id, op->type->ext.srna, op, &opr); - func= RNA_struct_find_function(&opr, "cancel"); + func= &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */ RNA_parameter_list_create(&list, &opr, func); RNA_parameter_set_lookup(&list, "context", &C); @@ -1689,7 +1703,7 @@ static void rna_def_keyconfig(BlenderRNA *brna) prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "id", "ID of the item"); + RNA_def_property_ui_text(prop, "ID", "ID of the item"); RNA_def_property_update(prop, 0, "rna_KeyMapItem_update"); prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 11ec327c306..62975763874 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -409,7 +409,7 @@ static void rna_def_world_mist(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "mistdist"); RNA_def_property_range(prop, 0, FLT_MAX); RNA_def_property_ui_range(prop, 0, 10000, 10, 2); - RNA_def_property_ui_text(prop, "Depth", "The distance over which the mist effect fades in"); + RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in"); RNA_def_property_update(prop, 0, "rna_World_draw_mist_update"); prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE); @@ -433,7 +433,7 @@ static void rna_def_world_stars(BlenderRNA *brna) srna= RNA_def_struct(brna, "WorldStarsSettings", NULL); RNA_def_struct_sdna(srna, "World"); RNA_def_struct_nested(brna, srna, "World"); - RNA_def_struct_ui_text(srna, "World Stars", "Stars setting for a World data-block"); + RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block"); prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS); diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index ae17ade36d7..ca610eeb024 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3.1 +#! /usr/bin/env python3 """ This script is used to help cleaning RNA api. @@ -8,7 +8,7 @@ Typical line in the input file (elements in [] are optional). [comment *] ToolSettings.snap_align_rotation -> use_snap_align_rotation: boolean [Align rotation with the snapping target] Geterate output format from blender run this: - ./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt + ./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt """ diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py index 8d2fe07b774..89d95b5a627 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner_merge.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python3.1 +#! /usr/bin/env python3 import sys diff --git a/source/blender/makesrna/rna_cleanup/rna_update.sh b/source/blender/makesrna/rna_cleanup/rna_update.sh index a4d686cc482..e3119191cb2 100755 --- a/source/blender/makesrna/rna_cleanup/rna_update.sh +++ b/source/blender/makesrna/rna_cleanup/rna_update.sh @@ -1,5 +1,5 @@ cd ../../../../ -./blender.bin --background --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt +./blender.bin --background -noaudio --python ./release/scripts/modules/rna_info.py 2> source/blender/makesrna/rna_cleanup/out.txt cd ./source/blender/makesrna/rna_cleanup/ ./rna_cleaner.py out.txt ./rna_cleaner.py rna_properties.txt diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 197e6a24342..3397dad2460 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -37,6 +37,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_bmesh.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 9d83e351b2b..01245ca4e01 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -43,6 +43,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" #include "BLI_ghash.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index db491742265..e9a341896e6 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -47,6 +47,7 @@ #include "BLI_edgehash.h" #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_linklist.h" #include "BKE_cdderivedmesh.h" diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 277f0852f90..a2f62d55d69 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -105,7 +105,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) /* elubie: changed this to default to the same dir as the render output to prevent saving to C:\ on Windows */ - BLI_strncpy(fss->surfdataPath, btempdir, FILE_MAX); + BLI_strncpy(fss->surfdataPath, BLI_temporary_dir(), FILE_MAX); // first init of bounding box // no bounding box needed diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index b7cdac9e246..ad1e0806327 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -38,6 +38,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" +#include "BLI_listbase.h" +#include "BLI_string.h" #include "BLI_ghash.h" #include "DNA_armature_types.h" diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 486c98f82a0..663faf0ed19 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -357,7 +357,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (!totedge) { for (i=0; i < totvert; i++, mv_orig++, mv_new++) { copy_v3_v3(mv_new->co, mv_orig->co); - normalize_v3_v3(vc->no, mv_new->co); /* no edges- this is realy a dummy normal */ + normalize_v3_v3(vc->no, mv_new->co); /* no edges- this is really a dummy normal */ } } else { diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index b2e3c9532b6..7c852527c3d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -326,7 +326,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); - /* we implement requiredDataMask but thats not really usefull since + /* we implement requiredDataMask but thats not really useful since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) dm= get_dm(ob, NULL, dm, NULL, 0); @@ -346,7 +346,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); - /* we implement requiredDataMask but thats not really usefull since + /* we implement requiredDataMask but thats not really useful since mesh_calc_modifiers pass a NULL derivedData */ if(dataMask) dm= get_dm(ob, editData, dm, NULL, 0); diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 757da28e4b5..f2e3a0d016a 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -40,6 +40,7 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" @@ -183,7 +184,7 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->crease_outer = smd->crease_outer; tsmd->crease_rim = smd->crease_rim; tsmd->flag = smd->flag; - strcpy(tsmd->defgrp_name, smd->defgrp_name); + BLI_strncpy(tsmd->defgrp_name, smd->defgrp_name, sizeof(tsmd->defgrp_name)); } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 5c58070be9d..6f4939ecbdd 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -183,6 +183,11 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Composite = { /* type */ NTREE_COMPOSIT, /* idname */ "NTCompositing Nodetree", @@ -195,7 +200,7 @@ bNodeTreeType ntreeType_Composite = { /* localize */ localize, /* local_sync */ local_sync, /* local_merge */ local_merge, - /* update */ NULL, + /* update */ update, /* update_node */ update_node }; @@ -716,9 +721,9 @@ void ntreeCompositTagRender(Scene *curscene) for(node= sce->nodetree->nodes.first; node; node= node->next) { if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE) - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ - NodeTagChanged(sce->nodetree, node); + nodeUpdate(sce->nodetree, node); } } } @@ -745,7 +750,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) for (index=0; index<len; index++) { if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } } @@ -763,7 +768,7 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node) for (index=0; index<len; index++) { if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } } @@ -789,18 +794,18 @@ int ntreeCompositTagAnimated(bNodeTree *ntree) if(node->type==CMP_NODE_IMAGE) { Image *ima= (Image *)node->id; if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } } else if(node->type==CMP_NODE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); tagged= 1; } /* here was tag render layer, but this is called after a render, so re-composites fail */ else if(node->type==NODE_GROUP) { if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } } @@ -818,12 +823,12 @@ void ntreeCompositTagGenerators(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE)) - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); } } /* XXX after render animation system gets a refresh, this call allows composite to end clean */ -void ntreeClearTags(bNodeTree *ntree) +void ntreeCompositClearTags(bNodeTree *ntree) { bNode *node; @@ -832,6 +837,6 @@ void ntreeClearTags(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { node->need_exec= 0; if(node->type==NODE_GROUP) - ntreeClearTags((bNodeTree *)node->id); + ntreeCompositClearTags((bNodeTree *)node->id); } } diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 78f97c5289e..2047a9089f4 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -1320,7 +1320,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) if ((xy < 1) || (xy > 3)) xy = 3; - // XXX The YVV macro defined below explicitely expects sources of at least 3x3 pixels, + // XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels, // so just skiping blur along faulty direction if src's def is below that limit! if (src->x < 3) xy &= ~(int) 1; if (src->y < 3) xy &= ~(int) 2; @@ -1346,7 +1346,7 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy) // it seems to work, not entirely sure if it is actually totally correct, // Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark), // found one other implementation by Cristoph Lampert, - // but neither seem to be quite the same, result seems to be ok sofar anyway. + // but neither seem to be quite the same, result seems to be ok so far anyway. // Extra scale factor here to not have to do it in filter, // though maybe this had something to with the precision errors sc = cf[0]/((1.0 + cf[1] - cf[2] + cf[3])*(1.0 - cf[1] - cf[2] - cf[3])*(1.0 + cf[2] + (cf[1] - cf[3])*cf[3])); diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 1a5e3150f53..34815fcb24c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -86,8 +86,9 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, getpix(tmp, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, col); /* mix img and transformed tmp */ - for(j= 0; j < 4; ++j) - img->rect[p + j]= AVG2(img->rect[p + j], col[j]); + for(j= 0; j < 4; ++j) { + img->rect[p + j]= 0.5f * (img->rect[p + j] + col[j]); + } } } diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 56f80840112..6214f39dc0a 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -239,9 +239,11 @@ bNode *node_group_make_from_selected(bNodeTree *ntree) } } + /* update of the group tree */ ngroup->update |= NTREE_UPDATE; ntreeUpdateTree(ngroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + /* update of the tree containing the group instance node */ + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return gnode; @@ -559,7 +561,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) /* free the group tree (takes care of user count) */ free_libblock(&G.main->nodetree, wgroup); - ntree->update |= NTREE_UPDATE_NODES|NTREE_UPDATE_LINKS; + ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); return 1; @@ -716,7 +718,7 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o if(sock) { sock->groupsock = gsock; - strcpy(sock->name, gsock->name); + BLI_strncpy(sock->name, gsock->name, sizeof(sock->name)); sock->type= gsock->type; /* XXX hack: group socket input/output roles are inverted internally, @@ -901,7 +903,7 @@ static void loop_sync(bNodeTree *ntree, int sync_in_out) if (mirror->own_index == GET_INT_FROM_POINTER(sock->storage)) break; /* make sure the name is the same (only for identification by user, no deeper meaning) */ - strcpy(mirror->name, sock->name); + BLI_strncpy(mirror->name, sock->name, sizeof(mirror->name)); /* fix the socket order if necessary */ if (mirror != sync) { BLI_remlink(sync_lb, mirror); diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index 53bbb27f9b0..154f7613223 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -180,7 +180,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* prepare group tree inputs */ for (sock=ntree->inputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } /* prepare all internal nodes for execution */ for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) { @@ -198,7 +198,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree) /* tag all outputs */ for (sock=node->outputs.first; sock; sock=sock->next) { - ns = setup_stack(exec->stack, sock); + /* ns = */ setup_stack(exec->stack, sock); } if(node->typeinfo->initexecfunc) diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index aabaf5b86de..74f15af88a2 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -128,6 +128,21 @@ static bNodeSocketType node_socket_type_boolean = { /* buttonfunc */ NULL, }; +/****************** SHADER ******************/ + +static bNodeSocketType node_socket_type_shader = { + /* type */ SOCK_SHADER, + /* ui_name */ "Shader", + /* ui_description */ "Shader", + /* ui_icon */ 0, + /* ui_color */ {100,200,100,255}, + + /* value_structname */ NULL, + /* value_structsize */ 0, + + /* buttonfunc */ NULL, +}; + /****************** MESH ******************/ static bNodeSocketType node_socket_type_mesh = { @@ -153,6 +168,7 @@ void node_socket_type_init(bNodeSocketType *types[]) INIT_TYPE(rgba); INIT_TYPE(int); INIT_TYPE(boolean); + INIT_TYPE(shader); INIT_TYPE(mesh); #undef INIT_TYPE @@ -241,6 +257,17 @@ struct bNodeSocket *nodeAddOutputRGBA(struct bNodeTree *ntree, struct bNode *nod return sock; } +struct bNodeSocket *nodeAddInputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_SHADER); + return sock; +} +struct bNodeSocket *nodeAddOutputShader(struct bNodeTree *ntree, struct bNode *node, const char *name) +{ + bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_OUT, name, SOCK_SHADER); + return sock; +} + struct bNodeSocket *nodeAddInputMesh(struct bNodeTree *ntree, struct bNode *node, const char *name) { bNodeSocket *sock= nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_MESH); @@ -271,6 +298,9 @@ struct bNodeSocket *node_add_input_from_template(struct bNodeTree *ntree, struct case SOCK_RGBA: sock = nodeAddInputRGBA(ntree, node, stemp->name, stemp->val1, stemp->val2, stemp->val3, stemp->val4); break; + case SOCK_SHADER: + sock = nodeAddInputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddInputMesh(ntree, node, stemp->name); break; @@ -299,6 +329,9 @@ struct bNodeSocket *node_add_output_from_template(struct bNodeTree *ntree, struc case SOCK_RGBA: sock = nodeAddOutputRGBA(ntree, node, stemp->name); break; + case SOCK_SHADER: + sock = nodeAddOutputShader(ntree, node, stemp->name); + break; case SOCK_MESH: sock = nodeAddOutputMesh(ntree, node, stemp->name); break; @@ -372,15 +405,15 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_out, ListBase *socklist, bNodeSocketTemplate *stemp_first) { - bNodeSocket *sock; + bNodeSocket *sock, *nextsock; bNodeSocketTemplate *stemp; /* no inputs anymore? */ if(stemp_first==NULL) { - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } } else { @@ -391,10 +424,10 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou stemp++; } /* leftovers are removed */ - while(socklist->first) { - sock = (bNodeSocket*)socklist->first; + for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) { + nextsock = sock->next; if (!(sock->flag & SOCK_DYNAMIC)) - nodeRemoveSocket(ntree, node, socklist->first); + nodeRemoveSocket(ntree, node, sock); } /* and we put back the verified sockets */ diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 28f0f983454..9f3e7ce3c73 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -85,6 +85,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree) } } +static void update(bNodeTree *ntree) +{ + ntreeSetOutput(ntree); +} + bNodeTreeType ntreeType_Shader = { /* type */ NTREE_SHADER, /* id_name */ "NTShader Nodetree", @@ -97,7 +102,7 @@ bNodeTreeType ntreeType_Shader = { /* localize */ NULL, /* local_sync */ local_sync, /* local_merge */ NULL, - /* update */ NULL, + /* update */ update, /* update_node */ NULL }; diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 603aa7ceb77..2b016177820 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -108,7 +108,7 @@ int ntreeTexTagAnimated(bNodeTree *ntree) for(node= ntree->nodes.first; node; node= node->next) { if(node->type==TEX_NODE_CURVE_TIME) { - NodeTagChanged(ntree, node); + nodeUpdate(ntree, node); return 1; } else if(node->type==NODE_GROUP) { diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index cd5c8e53ef7..ae82dac7f14 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -36,8 +36,6 @@ #ifndef BPY_EXTERN_H #define BPY_EXTERN_H -extern char bprogname[]; /* holds a copy of argv[0], from creator.c */ - struct Text; /* defined in DNA_text_types.h */ struct ID; /* DNA_ID.h */ struct Object; /* DNA_object_types.h */ diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 1524812086b..541008ebaa5 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -67,9 +67,9 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) switch ( prop->type ) { case IDP_STRING: #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByte(IDP_Array(prop)); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len); #else - return PyUnicode_FromString(IDP_Array(prop)); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len); #endif case IDP_INT: return PyLong_FromLong( (long)prop->data.val ); @@ -485,9 +485,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) switch (prop->type) { case IDP_STRING: #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByte(IDP_Array(prop)); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len); #else - return PyUnicode_FromString(IDP_Array(prop)); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len); #endif break; case IDP_FLOAT: diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 1bccc8a24c4..587ac69071e 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -30,7 +30,7 @@ #include "py_capi_utils.h" -#include "BKE_font.h" /* only for utf8towchar, should replace with py funcs but too late in release now */ +#include "BLI_string_utf8.h" /* only for BLI_strncpy_wchar_from_utf8, should replace with py funcs but too late in release now */ #ifdef _WIN32 /* BLI_setenv */ #include "BLI_path_util.h" @@ -184,6 +184,15 @@ void PyC_FileAndNum(const char **filename, int *lineno) } } +void PyC_FileAndNum_Safe(const char **filename, int *lineno) +{ + if(!PYC_INTERPRETER_ACTIVE) { + return; + } + + PyC_FileAndNum(filename, lineno); +} + /* Would be nice if python had this built in */ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...) { @@ -377,9 +386,9 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) } } -PyObject *PyC_UnicodeFromByte(const char *str) +PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size) { - PyObject *result= PyUnicode_FromString(str); + PyObject *result= PyUnicode_FromStringAndSize(str, size); if (result) { /* 99% of the time this is enough but we better support non unicode * chars since blender doesnt limit this */ @@ -388,11 +397,16 @@ PyObject *PyC_UnicodeFromByte(const char *str) else { PyErr_Clear(); /* this means paths will always be accessible once converted, on all OS's */ - result= PyUnicode_DecodeFSDefault(str); + result= PyUnicode_DecodeFSDefaultAndSize(str, size); return result; } } +PyObject *PyC_UnicodeFromByte(const char *str) +{ + return PyC_UnicodeFromByteAndSize(str, strlen(str)); +} + /***************************************************************************** * Description: This function creates a new Python dictionary object. * note: dict is owned by sys.modules["__main__"] module, reference is borrowed @@ -469,7 +483,7 @@ void PyC_SetHomePath(const char *py_path_bundle) /* cant use this, on linux gives bug: #23018, TODO: try LANG="en_US.UTF-8" /usr/bin/blender, suggested 22008 */ /* mbstowcs(py_path_bundle_wchar, py_path_bundle, FILE_MAXDIR); */ - utf8towchar(py_path_bundle_wchar, py_path_bundle); + BLI_strncpy_wchar_from_utf8(py_path_bundle_wchar, py_path_bundle, sizeof(py_path_bundle_wchar) / sizeof(wchar_t)); Py_SetPythonHome(py_path_bundle_wchar); // printf("found python (wchar_t) '%ls'\n", py_path_bundle_wchar); diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index 03a8637710e..ccd001aabd4 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -36,11 +36,13 @@ PyObject * PyC_ExceptionBuffer(void); PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...); PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...); void PyC_FileAndNum(const char **filename, int *lineno); +void PyC_FileAndNum_Safe(const char **filename, int *lineno); /* checks python is running */ int PyC_AsArray(void *array, PyObject *value, const int length, const PyTypeObject *type, const short is_double, const char *error_prefix); /* follow http://www.python.org/dev/peps/pep-0383/ */ -PyObject * PyC_UnicodeFromByte(const char *str); -const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */ +PyObject * PyC_UnicodeFromByte(const char *str); +PyObject * PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size); +const char * PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */ /* name namespace function for bpy & bge */ PyObject * PyC_DefaultNameSpace(const char *filename); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index bd7be8dd9c5..c3d60bc353d 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -93,8 +93,6 @@ static PyStructSequence_Desc app_info_desc= { static PyObject *make_app_info(void) { - extern char bprogname[]; /* argv[0] from creator.c */ - PyObject *app_info; int pos= 0; @@ -118,7 +116,7 @@ static PyObject *make_app_info(void) SetStrItem(""); #endif SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE)); - SetStrItem(bprogname); + SetStrItem(BLI_program_path()); SetObjItem(PyBool_FromLong(G.background)); /* build info */ @@ -200,8 +198,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - extern char btempdir[]; - return PyC_UnicodeFromByte(btempdir); + return PyC_UnicodeFromByte(BLI_temporary_dir()); } static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure)) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index aaa813137c6..cfd8d9f433b 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -52,12 +52,12 @@ #include "BLI_path_util.h" #include "BLI_math_base.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" -#include "BKE_font.h" /* only for utf8towchar */ #include "BKE_main.h" #include "BKE_global.h" /* only for script checking */ @@ -193,9 +193,9 @@ void BPY_python_start(int argc, const char **argv) PyThreadState *py_tstate= NULL; /* not essential but nice to set our name */ - static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ - utf8towchar(bprogname_wchar, bprogname); - Py_SetProgramName(bprogname_wchar); + static wchar_t program_path_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ + BLI_strncpy_wchar_from_utf8(program_path_wchar, BLI_program_path(), sizeof(program_path_wchar) / sizeof(wchar_t)); + Py_SetProgramName(program_path_wchar); /* must run before python initializes */ PyImport_ExtendInittab(bpy_internal_modules); @@ -203,9 +203,9 @@ void BPY_python_start(int argc, const char **argv) /* allow to use our own included python */ PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL)); - /* Python 3.2 now looks for '2.58/python/include/python3.2d/pyconfig.h' to parse - * from the 'sysconfig' module which is used by 'site', so for now disable site. - * alternatively we could copy the file. */ + /* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to + * parse from the 'sysconfig' module which is used by 'site', + * so for now disable site. alternatively we could copy the file. */ Py_NoSiteFlag= 1; Py_Initialize(); @@ -215,8 +215,11 @@ void BPY_python_start(int argc, const char **argv) { int i; PyObject *py_argv= PyList_New(argc); - for (i=0; i<argc; i++) - PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i])); /* should fix bug #20021 - utf path name problems, by replacing PyUnicode_FromString */ + for (i=0; i<argc; i++) { + /* should fix bug #20021 - utf path name problems, by replacing + * PyUnicode_FromString, with this one */ + PyList_SET_ITEM(py_argv, i, PyC_UnicodeFromByte(argv[i])); + } PySys_SetObject("argv", py_argv); Py_DECREF(py_argv); @@ -671,7 +674,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * #ifdef WITH_PYTHON_MODULE -#include "BLI_storage.h" +#include "BLI_fileops.h" /* TODO, reloading the module isnt functional at the moment. */ static void bpy_module_free(void *mod); diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 603bb0ed0ac..3b0c6a9ff25 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -58,7 +58,7 @@ typedef struct { PyObject_HEAD /* required python macro */ - /* collection iterator spesific parts */ + /* collection iterator specific parts */ char relpath[FILE_MAX]; char abspath[FILE_MAX]; /* absolute path */ BlendHandle *blo_handle; diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index b5fd7851458..7e8b9b7b6df 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -44,6 +44,7 @@ #include "../generic/bpy_internal_import.h" #include "BLI_utildefines.h" +#include "BLI_string.h" #include "RNA_access.h" #include "RNA_enum_types.h" diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index d3963458298..5a78ac8e094 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -359,7 +359,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier) #endif -/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna allong +/* Function that sets RNA, NOTE - self is NULL when called from python, but being abused from C so we can pass the srna along * This isnt incorrect since its a python object - but be careful */ PyDoc_STRVAR(BPy_BoolProperty_doc, ".. function:: BoolProperty(name=\"\", description=\"\", default=False, options={'ANIMATABLE'}, subtype='NONE', update=None)\n" diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 76dcf9729ca..70e7ba051f0 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -810,7 +810,7 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self) } /* print name if available */ - name= RNA_struct_name_get_alloc(&self->ptr, NULL, FALSE); + name= RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL); if (name) { ret= PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>", RNA_struct_identifier(self->ptr.type), @@ -901,7 +901,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self) /* if a pointer, try to print name of pointer target too */ if (RNA_property_type(self->prop) == PROP_POINTER) { ptr= RNA_property_pointer_get(&self->ptr, self->prop); - name= RNA_struct_name_get_alloc(&ptr, NULL, FALSE); + name= RNA_struct_name_get_alloc(&ptr, NULL, 0, NULL); if (name) { ret= PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>", @@ -1257,14 +1257,22 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val) ret= PyUnicode_FromString(enum_item->identifier); } else { - const char *ptr_name= RNA_struct_name_get_alloc(ptr, NULL, FALSE); + const char *ptr_name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL); /* prefer not fail silently incase of api errors, maybe disable it later */ - printf("RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'\n", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); + printf("RNA Warning: Current value \"%d\" " + "matches no enum in '%s', '%s', '%s'\n", + val, RNA_struct_identifier(ptr->type), + ptr_name, RNA_property_identifier(prop)); #if 0 // gives python decoding errors while generating docs :( char error_str[256]; - BLI_snprintf(error_str, sizeof(error_str), "RNA Warning: Current value \"%d\" matches no enum in '%s', '%s', '%s'", val, RNA_struct_identifier(ptr->type), ptr_name, RNA_property_identifier(prop)); + BLI_snprintf(error_str, sizeof(error_str), + "RNA Warning: Current value \"%d\" " + "matches no enum in '%s', '%s', '%s'", + val, RNA_struct_identifier(ptr->type), + ptr_name, RNA_property_identifier(prop)); + PyErr_Warn(PyExc_RuntimeWarning, error_str); #endif @@ -1311,19 +1319,20 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop) { int subtype= RNA_property_subtype(prop); const char *buf; + int buf_len; char buf_fixed[32]; - buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed)); + buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len); #ifdef USE_STRING_COERCE /* only file paths get special treatment, they may contain non utf-8 chars */ if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { - ret= PyC_UnicodeFromByte(buf); + ret= PyC_UnicodeFromByteAndSize(buf, buf_len); } else { - ret= PyUnicode_FromString(buf); + ret= PyUnicode_FromStringAndSize(buf, buf_len); } #else // USE_STRING_COERCE - ret= PyUnicode_FromString(buf); + ret= PyUnicode_FromStringAndSize(buf, buf_len); #endif // USE_STRING_COERCE if (buf_fixed != buf) { MEM_freeN((void *)buf); @@ -1534,7 +1543,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb param= _PyUnicode_AsString(value); #ifdef WITH_INTERNATIONAL if (subtype == PROP_TRANSLATE) { - param= UI_translate_do_iface(param); + param= IFACE_(param); } #endif // WITH_INTERNATIONAL @@ -2218,7 +2227,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject } /* generic check to see if a PyObject is compatible with a collection - * -1 on failier, 0 on success, sets the error */ + * -1 on failure, 0 on success, sets the error */ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *value) { StructRNA *prop_srna; @@ -3127,14 +3136,15 @@ static void pyrna_dir_members_rna(PyObject *list, PointerRNA *ptr) * Collect RNA attributes */ char name[256], *nameptr; + int namelen; iterprop= RNA_struct_iterator_property(ptr->type); RNA_PROP_BEGIN(ptr, itemptr, iterprop) { - nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); + nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen); if (nameptr) { - pystring= PyUnicode_FromString(nameptr); + pystring= PyUnicode_FromStringAndSize(nameptr, namelen); PyList_Append(list, pystring); Py_DECREF(pystring); @@ -3716,13 +3726,14 @@ static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self) PyObject *ret= PyList_New(0); PyObject *item; char name[256], *nameptr; + int namelen; RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) { - nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); + nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen); if (nameptr) { /* add to python list */ - item= PyUnicode_FromString(nameptr); + item= PyUnicode_FromStringAndSize(nameptr, namelen); PyList_Append(ret, item); Py_DECREF(item); /* done */ @@ -3751,15 +3762,16 @@ static PyObject *pyrna_prop_collection_items(BPy_PropertyRNA *self) PyObject *ret= PyList_New(0); PyObject *item; char name[256], *nameptr; + int namelen; int i= 0; RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) { if (itemptr.data) { /* add to python list */ item= PyTuple_New(2); - nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name)); + nameptr= RNA_struct_name_get_alloc(&itemptr, name, sizeof(name), &namelen); if (nameptr) { - PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(nameptr)); + PyTuple_SET_ITEM(item, 0, PyUnicode_FromStringAndSize(nameptr, namelen)); if (name != nameptr) MEM_freeN(nameptr); } @@ -3800,7 +3812,7 @@ PyDoc_STRVAR(pyrna_struct_get_doc, " Returns the value of the custom property assigned to key or default\n" " when not found (matches pythons dictionary function of the same name).\n" "\n" -" :arg key: The key assosiated with the custom property.\n" +" :arg key: The key associated with the custom property.\n" " :type key: string\n" " :arg default: Optional argument for the value to return if\n" " *key* is not found.\n" diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 502fa25c872..98afad38abe 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -149,7 +149,7 @@ typedef struct { PyObject *in_weakreflist; #endif - /* collection iterator spesific parts */ + /* collection iterator specific parts */ CollectionPropertyIterator iter; } BPy_PropertyCollectionIterRNA; diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index d9f741d841a..c6be461a227 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -75,7 +75,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return newEulerObject(eul, order, Py_NEW, type); } -/* internal use, assuem read callback is done */ +/* internal use, assume read callback is done */ static const char *euler_order_str(EulerObject *self) { static const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"}; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index b1700aa53c6..7570b5642ef 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1089,7 +1089,7 @@ static PyObject *Matrix_decompose(MatrixObject *self) PyDoc_STRVAR(Matrix_lerp_doc, ".. function:: lerp(other, factor)\n" "\n" -" Returns the interpolation of two matricies.\n" +" Returns the interpolation of two matrices.\n" "\n" " :arg other: value to interpolate with.\n" " :type other: :class:`Matrix`\n" @@ -1669,7 +1669,7 @@ static PyObject *Matrix_subscript(MatrixObject* self, PyObject* item) } else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return NULL; } } @@ -1701,7 +1701,7 @@ static int Matrix_ass_subscript(MatrixObject* self, PyObject* item, PyObject* va return Matrix_ass_slice(self, start, stop, value); else { PyErr_SetString(PyExc_IndexError, - "slice steps not supported with matricies"); + "slice steps not supported with matrices"); return -1; } } diff --git a/source/blender/render/intern/include/raycounter.h b/source/blender/render/intern/include/raycounter.h index 4d4952cb6c3..7acef6d3c67 100644 --- a/source/blender/render/intern/include/raycounter.h +++ b/source/blender/render/intern/include/raycounter.h @@ -35,7 +35,7 @@ #ifndef RE_RAYCOUNTER_H #define RE_RAYCOUNTER_H -//#define RE_RAYCOUNTER /* enable counters per ray, usefull for measuring raytrace structures performance */ +//#define RE_RAYCOUNTER /* enable counters per ray, useful for measuring raytrace structures performance */ #ifdef __cplusplus extern "C" { diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h index 3ba5bbc624e..c7a1b002d61 100644 --- a/source/blender/render/intern/raytrace/bvh.h +++ b/source/blender/render/intern/raytrace/bvh.h @@ -167,7 +167,7 @@ static inline void bvh_node_merge_bb(Node *node, float *min, float *max) /* - * recursivly transverse a BVH looking for a rayhit using a local stack + * recursively transverse a BVH looking for a rayhit using a local stack */ template<class Node> static inline void bvh_node_push_childs(Node *node, Isect *isec, Node **stack, int &stack_pos); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7835ae6dcd3..5ca0983ffd0 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -478,7 +478,7 @@ static void scene_unique_exr_name(Scene *scene, char *str, int sample) else BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample); - BLI_make_file_string("/", str, btempdir, name); + BLI_make_file_string("/", str, BLI_temporary_dir(), name); } static void render_unique_exr_name(Render *re, char *str, int sample) @@ -2261,7 +2261,7 @@ static void ntree_render_scenes(Render *re) restore_scene= (scene != re->scene); node->id->flag &= ~LIB_DOIT; - NodeTagChanged(re->scene->nodetree, node); + nodeUpdate(re->scene->nodetree, node); } } } @@ -2468,7 +2468,7 @@ static void do_render_composite_fields_blur_3d(Render *re) ntreeCompositTagAnimated(ntree); } - if(ntree && re->r.scemode & R_DOCOMP) { + if(ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) { /* checks if there are render-result nodes that need scene */ if((re->r.scemode & R_SINGLE_LAYER)==0) ntree_render_scenes(re); @@ -2753,7 +2753,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r scene_unique_exr_name(scene, str, 0); - if (BLI_is_writable(str)==0) { + if (BLI_file_is_writable(str)==0) { BKE_report(reports, RPT_ERROR, "Can not save render buffers, check the temp default path"); return 0; } @@ -3146,13 +3146,13 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH)) BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE); - if(scene->r.mode & R_NO_OVERWRITE && BLI_exist(name)) { + if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) { printf("skipping existing frame \"%s\"\n", name); continue; } - if(scene->r.mode & R_TOUCH && !BLI_exist(name)) { + if(scene->r.mode & R_TOUCH && !BLI_exists(name)) { BLI_make_existing_file(name); /* makes the dir if its not there */ - BLI_touch(name); + BLI_file_touch(name); } } @@ -3175,7 +3175,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if(G.afbreek==1) { /* remove touched file */ if(BKE_imtype_is_movie(scene->r.imtype) == 0) { - if (scene->r.mode & R_TOUCH && BLI_exist(name) && BLI_filepathsize(name) == 0) { + if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) { BLI_delete(name, 0, 0); } } diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 7a39342ac8d..a73bf93841d 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -481,12 +481,12 @@ void RE_set_customdata_names(ObjectRen *obr, CustomData *data) layer= &data->layers[i]; if (layer->type == CD_MTFACE) { - strcpy(obr->mtface[mtfn++], layer->name); + BLI_strncpy(obr->mtface[mtfn++], layer->name, sizeof(layer->name)); obr->actmtface= CLAMPIS(layer->active_rnd, 0, numtf); obr->bakemtface= layer->active; } else if (layer->type == CD_MCOL) { - strcpy(obr->mcol[mcn++], layer->name); + BLI_strncpy(obr->mcol[mcn++], layer->name, sizeof(layer->name)); obr->actmcol= CLAMPIS(layer->active_rnd, 0, numcol); } } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9e19a057175..34f59ce047d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -267,6 +267,9 @@ void WM_gestures_remove(struct bContext *C); /* fileselecting support */ void WM_event_add_fileselect(struct bContext *C, struct wmOperator *op); void WM_event_fileselect_event(struct bContext *C, void *ophandle, int eventval); +#ifndef NDEBUG +void WM_event_print(struct wmEvent *event); +#endif /* drag and drop */ struct wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index fec59e97194..5048166c8b7 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -98,6 +98,11 @@ enum { #define KM_ALT2 64 #define KM_OSKEY2 128 +/* KM_MOD_ flags for wmKeyMapItem and wmEvent.alt/shift/oskey/ctrl */ +/* note that KM_ANY and FALSE are used with these defines too */ +#define KM_MOD_FIRST 1 +#define KM_MOD_SECOND 2 + /* type: defined in wm_event_types.c */ #define KM_TEXTINPUT -2 @@ -341,8 +346,8 @@ typedef struct wmEvent { short val; /* press, release, scrollvalue */ int x, y; /* mouse pointer position, screen coord */ int mval[2]; /* region mouse position, name convention pre 2.5 :) */ - short unicode; /* future, ghost? */ - char ascii; /* from ghost */ + char utf8_buf[6]; /* from, ghost if utf8 is enabled for the platform */ + char ascii; /* from ghost, fallback if utf8 isnt set */ char pad; /* previous state */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index cafee6b49ca..c798b284c7b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -33,7 +33,6 @@ #include <stdlib.h> #include <string.h> -#include <math.h> #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -47,6 +46,7 @@ #include "BLI_blenlib.h" #include "BLI_utildefines.h" +#include "BLI_math.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -79,6 +79,10 @@ #include "wm_event_types.h" #include "wm_draw.h" +#ifndef NDEBUG +# include "RNA_enum_types.h" +#endif + static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only); /* ************ event management ************** */ @@ -435,6 +439,35 @@ static void wm_operator_print(bContext *C, wmOperator *op) MEM_freeN(buf); } +/* for debugging only, getting inspecting events manually is tedious */ +#ifndef NDEBUG + +void WM_event_print(wmEvent *event) +{ + if(event) { + const char *unknown= "UNKNOWN"; + const char *type_id= unknown; + const char *val_id= unknown; + + RNA_enum_identifier(event_type_items, event->type, &type_id); + RNA_enum_identifier(event_value_items, event->val, &val_id); + + printf("wmEvent - type:%d/%s, val:%d/%s, " + "shift:%d, ctrl:%d, alt:%d, oskey:%d, keymodifier:%d, " + "mouse:(%d,%d), ascii:'%c', utf8:'%.6s', " + "keymap_idname:%s, pointer:%p\n", + event->type, type_id, event->val, val_id, + event->shift, event->ctrl, event->alt, event->oskey, event->keymodifier, + event->x, event->y, event->ascii, event->utf8_buf, + event->keymap_idname, (void *)event); + } + else { + printf("wmEvent - NULL\n"); + } +} + +#endif /* NDEBUG */ + static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int popup) { if(popup) { @@ -1146,7 +1179,7 @@ static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi) /* the matching rules */ if(kmitype==KM_TEXTINPUT) - if(ISTEXTINPUT(winevent->type) && winevent->ascii) return 1; + if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1; if(kmitype!=KM_ANY) if(winevent->type!=kmitype) return 0; @@ -1790,11 +1823,14 @@ void wm_event_do_handlers(bContext *C) } if(playing == 0) { - int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; - if(ncfra != scene->r.cfra) { - scene->r.cfra = ncfra; - ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1); - WM_event_add_notifier(C, NC_WINDOW, NULL); + float time = sound_sync_scene(scene); + if(finite(time)) { + int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; + if(ncfra != scene->r.cfra) { + scene->r.cfra = ncfra; + ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1); + WM_event_add_notifier(C, NC_WINDOW, NULL); + } } } @@ -2575,38 +2611,43 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U GHOST_TEventKeyData *kd= customdata; event.type= convert_key(kd->key); event.ascii= kd->ascii; + memcpy(event.utf8_buf, kd->utf8_buf,sizeof(event.utf8_buf));/* might be not null terminated*/ event.val= (type==GHOST_kEventKeyDown)?KM_PRESS:KM_RELEASE; /* exclude arrow keys, esc, etc from text input */ - if(type==GHOST_kEventKeyUp || (event.ascii<32 && event.ascii>0)) - event.ascii= '\0'; - - /* modifiers */ - if (event.type==LEFTSHIFTKEY || event.type==RIGHTSHIFTKEY) { - event.shift= evt->shift= (event.val==KM_PRESS); - if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->oskey)) - event.shift= evt->shift = 3; // define? - } - else if (event.type==LEFTCTRLKEY || event.type==RIGHTCTRLKEY) { - event.ctrl= evt->ctrl= (event.val==KM_PRESS); - if(event.val==KM_PRESS && (evt->shift || evt->alt || evt->oskey)) - event.ctrl= evt->ctrl = 3; // define? - } - else if (event.type==LEFTALTKEY || event.type==RIGHTALTKEY) { - event.alt= evt->alt= (event.val==KM_PRESS); - if(event.val==KM_PRESS && (evt->ctrl || evt->shift || evt->oskey)) - event.alt= evt->alt = 3; // define? - } - else if (event.type==OSKEY) { - event.oskey= evt->oskey= (event.val==KM_PRESS); - if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift)) - event.oskey= evt->oskey = 3; // define? + if(type==GHOST_kEventKeyUp) { + if (event.ascii<32 && event.ascii > 0) { + event.ascii= '\0'; + } + + /* ghost should do this already for key up */ + if (event.utf8_buf[0]) { + printf("%s: ghost on you're platform is misbehaving, utf8 events on key up!\n", __func__); + } + event.utf8_buf[0]= '\0'; } - else { + + /* modifiers */ + /* assigning both first and second is strange - campbell */ + switch(event.type) { + case LEFTSHIFTKEY: case RIGHTSHIFTKEY: + event.shift= evt->shift= (event.val==KM_PRESS) ? ((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE; + break; + case LEFTCTRLKEY: case RIGHTCTRLKEY: + event.ctrl= evt->ctrl= (event.val==KM_PRESS) ? ((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE; + break; + case LEFTALTKEY: case RIGHTALTKEY: + event.alt= evt->alt= (event.val==KM_PRESS) ? ((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE; + break; + case OSKEY: + event.oskey= evt->oskey= (event.val==KM_PRESS) ? ((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) : FALSE; + break; + default: if(event.val==KM_PRESS && event.keymodifier==0) evt->keymodifier= event.type; /* only set in eventstate, for next event */ else if(event.val==KM_RELEASE && event.keymodifier==event.type) event.keymodifier= evt->keymodifier= 0; + break; } /* this case happens on some systems that on holding a key pressed, @@ -2692,4 +2733,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U } } + + /* Handy when debugging checking events */ + /* WM_event_print(&event); */ + } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index bf5b60d691f..823df35fc6e 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -289,8 +289,9 @@ static void wm_init_userdef(bContext *C) if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; else G.f &= ~G_SCRIPT_AUTOEXEC; } + /* update tempdir from user preferences */ - BLI_where_is_temp(btempdir, FILE_MAX, 1); + BLI_init_temporary_dir(U.tempdir); } @@ -437,17 +438,17 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Can't read file: \"%s\", %s.")), filepath, - errno ? strerror(errno) : UI_translate_do_iface(N_("Unable to open the file"))); + BKE_reportf(reports, RPT_ERROR, IFACE_("Can't read file: \"%s\", %s."), filepath, + errno ? strerror(errno) : IFACE_("Unable to open the file")); } else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File format is not supported in file: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath); } else if(retval == BKE_READ_EXOTIC_FAIL_PATH) { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("File path invalid: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("File path invalid: \"%s\"."), filepath); } else { - BKE_reportf(reports, RPT_ERROR, UI_translate_do_iface(N_("Unknown error loading: \"%s\".")), filepath); + BKE_reportf(reports, RPT_ERROR, IFACE_("Unknown error loading: \"%s\"."), filepath); BLI_assert(!"invalid 'retval'"); } @@ -573,7 +574,7 @@ void WM_read_history(void) BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE); - lines= BLI_read_file_as_lines(name); + lines= BLI_file_read_as_lines(name); G.recent_files.first = G.recent_files.last = NULL; @@ -588,7 +589,7 @@ void WM_read_history(void) } } - BLI_free_file_lines(lines); + BLI_file_free_lines(lines); } @@ -856,14 +857,14 @@ void wm_autosave_location(char *filepath) * BLI_make_file_string will create string that has it most likely on C:\ * through get_default_root(). * If there is no C:\tmp autosave fails. */ - if (!BLI_exists(btempdir)) { + if (!BLI_exists(BLI_temporary_dir())) { savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL); BLI_make_file_string("/", filepath, savedir, pidstr); return; } #endif - BLI_make_file_string("/", filepath, btempdir, pidstr); + BLI_make_file_string("/", filepath, BLI_temporary_dir(), pidstr); } void WM_autosave_init(wmWindowManager *wm) @@ -921,7 +922,7 @@ void wm_autosave_delete(void) if(BLI_exists(filename)) { char str[FILE_MAXDIR+FILE_MAXFILE]; - BLI_make_file_string("/", str, btempdir, "quit.blend"); + BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend"); /* if global undo; remove tempsave, otherwise rename */ if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 854fa688ea4..99bd83ef8c1 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -310,31 +310,15 @@ static void keymap_event_set(wmKeyMapItem *kmi, short type, short val, int modif kmi->type= type; kmi->val= val; kmi->keymodifier= keymodifier; - + if(modifier == KM_ANY) { kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY; } else { - - kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= 0; - - /* defines? */ - if(modifier & KM_SHIFT) - kmi->shift= 1; - else if(modifier & KM_SHIFT2) - kmi->shift= 2; - if(modifier & KM_CTRL) - kmi->ctrl= 1; - else if(modifier & KM_CTRL2) - kmi->ctrl= 2; - if(modifier & KM_ALT) - kmi->alt= 1; - else if(modifier & KM_ALT2) - kmi->alt= 2; - if(modifier & KM_OSKEY) - kmi->oskey= 1; - else if(modifier & KM_OSKEY2) - kmi->oskey= 2; + kmi->shift= (modifier & KM_SHIFT) ? KM_MOD_FIRST : ((modifier & KM_SHIFT2) ? KM_MOD_SECOND : FALSE); + kmi->ctrl= (modifier & KM_CTRL) ? KM_MOD_FIRST : ((modifier & KM_CTRL2) ? KM_MOD_SECOND : FALSE); + kmi->alt= (modifier & KM_ALT) ? KM_MOD_FIRST : ((modifier & KM_ALT2) ? KM_MOD_SECOND : FALSE); + kmi->oskey= (modifier & KM_OSKEY) ? KM_MOD_FIRST : ((modifier & KM_OSKEY2) ? KM_MOD_SECOND : FALSE); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 07bab06e52f..5fee5fb2a57 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -56,7 +56,6 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ #include "BLI_math.h" -#include "BLI_string.h" #include "BLI_utildefines.h" #include "BLI_ghash.h" @@ -105,6 +104,11 @@ static GHash *global_ops_hash= NULL; +#ifdef WITH_PYTHON_UI_INFO +# include "DNA_text_types.h" +# include "BKE_text.h" +#endif + /* ************ operator API, exported ********** */ @@ -152,10 +156,10 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType*)) if(ot->name==NULL) { fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname); - ot->name= UI_translate_do_iface(N_("Dummy Name")); + ot->name= IFACE_("Dummy Name"); } - RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)"))); // XXX All ops should have a description but for now allow them not to. + RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); // XXX All ops should have a description but for now allow them not to. RNA_def_struct_identifier(ot->srna, ot->idname); BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot); @@ -168,7 +172,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *us ot= MEM_callocN(sizeof(wmOperatorType), "operatortype"); ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); opfunc(ot, userdata); - RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:UI_translate_do_iface(N_("(undocumented operator)"))); + RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); RNA_def_struct_identifier(ot->srna, ot->idname); BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot); @@ -362,7 +366,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam ot->poll= NULL; if(!ot->description) - ot->description= UI_translate_do_iface(N_("(undocumented operator)")); + ot->description= IFACE_("(undocumented operator)"); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to. RNA_def_struct_identifier(ot->srna, ot->idname); @@ -387,7 +391,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo ot->poll= NULL; if(!ot->description) - ot->description= UI_translate_do_iface(N_("(undocumented operator)")); + ot->description= IFACE_("(undocumented operator)"); opfunc(ot, userdata); @@ -674,7 +678,7 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) else { pup= uiPupMenuBegin(C, op->type->name, ICON_NONE); layout= uiPupMenuLayout(pup); - uiItemsFullEnumO(layout, op->type->idname, (char*)RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); + uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); } @@ -784,7 +788,7 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message else properties= NULL; - pup= uiPupMenuBegin(C, UI_translate_do_iface(N_("OK?")), ICON_QUESTION); + pup= uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION); layout= uiPupMenuLayout(pup); uiItemFullO(layout, op->type->idname, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0); uiPupMenuEnd(C, pup); @@ -866,10 +870,10 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, void WM_operator_properties_select_all(wmOperatorType *ot) { static EnumPropertyItem select_all_actions[] = { - {SEL_TOGGLE, "TOGGLE", 0, N_("Toggle"), "Toggle selection for all elements"}, - {SEL_SELECT, "SELECT", 0, N_("Select"), "Select all elements"}, - {SEL_DESELECT, "DESELECT", 0, N_("Deselect"), "Deselect all elements"}, - {SEL_INVERT, "INVERT", 0, N_("Invert"), "Invert selection of all elements"}, + {SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"}, + {SEL_SELECT, "SELECT", 0, "Select", "Select all elements"}, + {SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"}, + {SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"}, {0, NULL, 0, NULL, NULL} }; @@ -878,25 +882,25 @@ void WM_operator_properties_select_all(wmOperatorType *ot) void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend) { - RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, N_("Gesture Mode"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, N_("X Min"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, N_("X Max"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, N_("Y Min"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, N_("Y Max"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX); if(extend) - RNA_def_boolean(ot->srna, "extend", 1, _("Extend"), _("Extend selection instead of deselecting everything first")); + RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first"); } void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) { - RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, N_("X Start"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, N_("X End"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, N_("Y Start"), "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, N_("Y End"), "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX); + RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX); if(cursor) - RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, N_("Cursor"), N_("Mouse cursor style to use during the modal operator"), 0, INT_MAX); + RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX); } @@ -1027,7 +1031,7 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) col= uiLayoutColumn(layout, FALSE); col_block= uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ - btn= uiDefBut(col_block, BUT, 0, UI_translate_do_iface(N_("OK")), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + btn= uiDefBut(col_block, BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); uiButSetFunc(btn, dialog_exec_cb, data, col_block); } @@ -1278,19 +1282,19 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar split = uiLayoutSplit(layout, 0, 0); col = uiLayoutColumn(split, 0); uiItemL(col, "Links", ICON_NONE); - uiItemStringO(col, UI_translate_do_iface(N_("Donations")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); - uiItemStringO(col, UI_translate_do_iface(N_("Credits")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); - uiItemStringO(col, UI_translate_do_iface(N_("Release Log")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260"); - uiItemStringO(col, UI_translate_do_iface(N_("Manual")), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); - uiItemStringO(col, UI_translate_do_iface(N_("Blender Website")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); - uiItemStringO(col, UI_translate_do_iface(N_("User Community")), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); + uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment"); + uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/credits"); + uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-260"); + uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); + uiItemStringO(col, IFACE_("Blender Website"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org"); + uiItemStringO(col, IFACE_("User Community"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community"); if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100); } else { BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION); } - uiItemStringO(col, UI_translate_do_iface(N_("Python API Reference")), ICON_URL, "WM_OT_url_open", "url", url); + uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url); uiItemL(col, "", ICON_NONE); col = uiLayoutColumn(split, 0); @@ -1300,7 +1304,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar uiItemS(col); } - uiItemL(col, UI_translate_do_iface(N_("Recent")), ICON_NONE); + uiItemL(col, IFACE_("Recent"), ICON_NONE); for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) { uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath); } @@ -1803,7 +1807,7 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_WINDOW, NULL); /* load file */ - BLI_make_file_string("/", filename, btempdir, "quit.blend"); + BLI_make_file_string("/", filename, BLI_temporary_dir(), "quit.blend"); WM_read_file(C, filename, op->reports); G.fileflags &= ~G_FILE_RECOVER; @@ -3315,13 +3319,13 @@ static void redraw_timer_window_swap(bContext *C) } static EnumPropertyItem redraw_timer_type_items[] = { - {0, "DRAW", 0, N_("Draw Region"), N_("Draw Region")}, - {1, "DRAW_SWAP", 0, N_("Draw Region + Swap"), N_("Draw Region and Swap")}, - {2, "DRAW_WIN", 0, N_("Draw Window"), N_("Draw Window")}, - {3, "DRAW_WIN_SWAP", 0, N_("Draw Window + Swap"), N_("Draw Window and Swap")}, - {4, "ANIM_STEP", 0, N_("Anim Step"), N_("Animation Steps")}, - {5, "ANIM_PLAY", 0, N_("Anim Play"), N_("Animation Playback")}, - {6, "UNDO", 0, N_("Undo/Redo"), N_("Undo/Redo")}, + {0, "DRAW", 0, "Draw Region", "Draw Region"}, + {1, "DRAW_SWAP", 0, "Draw Region + Swap", "Draw Region and Swap"}, + {2, "DRAW_WIN", 0, "Draw Window", "Draw Window"}, + {3, "DRAW_WIN_SWAP", 0, "Draw Window + Swap", "Draw Window and Swap"}, + {4, "ANIM_STEP", 0, "Anim Step", "Animation Steps"}, + {5, "ANIM_PLAY", 0, "Anim Play", "Animation Playback"}, + {6, "UNDO", 0, "Undo/Redo", "Undo/Redo"}, {0, NULL, 0, NULL, NULL}}; static int redraw_timer_exec(bContext *C, wmOperator *op) @@ -3505,6 +3509,79 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot) MEM_freeN(ot); } +#ifdef WITH_PYTHON_UI_INFO + +static ScrArea *biggest_text_view(bContext *C) +{ + bScreen *sc= CTX_wm_screen(C); + ScrArea *sa, *big= NULL; + int size, maxsize= 0; + + for(sa= sc->areabase.first; sa; sa= sa->next) { + if(sa->spacetype==SPACE_TEXT) { + size= sa->winx * sa->winy; + if(size > maxsize) { + maxsize= size; + big= sa; + } + } + } + return big; +} + +static int wm_text_edit_exec(bContext *C, wmOperator *op) +{ + Main *bmain= CTX_data_main(C); + Text *text; + + char filepath[240]; + int line= RNA_int_get(op->ptr, "line"); + RNA_string_get(op->ptr, "filepath", filepath); + + for (text=bmain->text.first; text; text=text->id.next) { + if (text->name && BLI_path_cmp(text->name, filepath) == 0) { + break; + } + } + + if (text == NULL) { + text= add_text(filepath, bmain->name); + } + + if (text == NULL) { + BKE_reportf(op->reports, RPT_WARNING, "file: '%s' can't be opened", filepath); + return OPERATOR_CANCELLED; + } + else { + /* naughty!, find text area to set, not good behavior + * but since this is a dev tool lets allow it - campbell */ + ScrArea *sa= biggest_text_view(C); + if(sa) { + SpaceText *st= sa->spacedata.first; + st->text= text; + } + + txt_move_toline(text, line - 1, FALSE); + WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); + } + + return OPERATOR_FINISHED; +} + +static void WM_OT_text_edit(wmOperatorType *ot) +{ + ot->name= "Edit Text File"; + ot->idname= "WM_OT_text_edit"; + + ot->exec= wm_text_edit_exec; + + RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", ""); + RNA_def_int(ot->srna, "line", 0, INT_MIN, INT_MAX, "Line", "", 0, INT_MAX); +} + +#endif /* WITH_PYTHON_UI_INFO */ + + /* ******************************************************* */ /* called on initialize WM_exit() */ void wm_operatortype_free(void) @@ -3548,20 +3625,24 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_collada_import); #endif +#ifdef WITH_PYTHON_UI_INFO + WM_operatortype_append(WM_OT_text_edit); +#endif + } /* circleselect-like modal operators */ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, N_("Confirm"), ""}, - {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, N_("Add"), ""}, - {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, N_("Subtract"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""}, + {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""}, - {GESTURE_MODAL_NOP,"NOP", 0, N_("No Operation"), ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""}, + {GESTURE_MODAL_NOP,"NOP", 0, "No Operation", ""}, {0, NULL, 0, NULL, NULL}}; @@ -3586,8 +3667,8 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_DESELECT); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_SHIFT, 0, GESTURE_MODAL_NOP); #else - WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); // defailt 2.4x - WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); // defailt 2.4x + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_DESELECT); // default 2.4x + WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); // default 2.4x #endif WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_NOP); @@ -3607,9 +3688,9 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf) static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Straight Line"); @@ -3635,10 +3716,10 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf) static void gesture_border_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_SELECT, "SELECT", 0, N_("Select"), ""}, - {GESTURE_MODAL_DESELECT,"DESELECT", 0, N_("DeSelect"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""}, + {GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Border"); @@ -3690,10 +3771,10 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { - {GESTURE_MODAL_CANCEL, "CANCEL", 0, N_("Cancel"), ""}, - {GESTURE_MODAL_IN, "IN", 0, N_("In"), ""}, - {GESTURE_MODAL_OUT, "OUT", 0, N_("Out"), ""}, - {GESTURE_MODAL_BEGIN, "BEGIN", 0, N_("Begin"), ""}, + {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""}, + {GESTURE_MODAL_IN, "IN", 0, "In", ""}, + {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""}, + {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""}, {0, NULL, 0, NULL, NULL}}; wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Zoom Border"); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 405960d0795..38ff02b46c5 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -506,11 +506,11 @@ void WM_window_open_temp(bContext *C, rcti *position, int type) ED_screen_set(C, win->screen); if(sa->spacetype==SPACE_IMAGE) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender Render"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render")); else if(ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF)) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender User Preferences"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences")); else if(sa->spacetype==SPACE_FILE) - GHOST_SetTitle(win->ghostwin, UI_translate_do_iface(N_("Blender File View"))); + GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View")); else GHOST_SetTitle(win->ghostwin, "Blender"); } |