diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-01 06:01:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-01 06:01:09 +0400 |
commit | e08c4a00d230d3a09a8f3ab25256100113db36b7 (patch) | |
tree | 3edb6f5efc008c3f8f623d430a9884846651115b /source | |
parent | 1a2188af41b272506e3b58129f178db2172d053f (diff) | |
parent | a5959e767e1fce78fa1876e8791667a377ac51f1 (diff) |
svn merge -r41371:41420 ^/trunk/blender
Diffstat (limited to 'source')
20 files changed, 136 insertions, 66 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 429848f3dcb..0ac806f68a9 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -107,8 +107,8 @@ void defvert_sync (MDeformVert *dvert_r, const MDeformVert *dvert, int use_verif MDeformWeight *dw; for(i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) { MDeformWeight *dw_r; - if(use_verify) dw_r= defvert_find_index(dvert_r, dw->def_nr); - else dw_r= defvert_verify_index(dvert_r, dw->def_nr); + if(use_verify) dw_r= defvert_verify_index(dvert_r, dw->def_nr); + else dw_r= defvert_find_index(dvert_r, dw->def_nr); if(dw_r) { dw_r->weight= dw->weight; @@ -126,8 +126,8 @@ void defvert_sync_mapped (MDeformVert *dvert_r, const MDeformVert *dvert, const for (i=0, dw=dvert->dw; i < dvert->totweight; i++, dw++) { if (dw->def_nr < flip_map_len) { MDeformWeight *dw_r; - if(use_verify) dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]); - else dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]); + if(use_verify) dw_r= defvert_verify_index(dvert_r, flip_map[dw->def_nr]); + else dw_r= defvert_find_index(dvert_r, flip_map[dw->def_nr]); if(dw_r) { dw_r->weight= dw->weight; @@ -490,25 +490,25 @@ MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup) MDeformWeight *newdw; /* do this check always, this function is used to check for it */ - if(!dv || defgroup<0) + if(!dv || defgroup < 0) return NULL; - newdw = defvert_find_index(dv, defgroup); + newdw= defvert_find_index(dv, defgroup); if(newdw) return newdw; - newdw = BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); + newdw= BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); if(dv->dw) { memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight); BLI_cellalloc_free(dv->dw); } - dv->dw=newdw; - - dv->dw[dv->totweight].weight=0.0f; - dv->dw[dv->totweight].def_nr=defgroup; + dv->dw= newdw; + newdw += dv->totweight; + newdw->weight= 0.0f; + newdw->def_nr= defgroup; /* Group index */ dv->totweight++; - return dv->dw+(dv->totweight-1); + return newdw; } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 8bce7515695..9aeacb9d7fa 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -981,7 +981,7 @@ int BKE_add_image_extension(char *string, int imtype) || (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) { return BLI_replace_extension(string, FILE_MAX, extension); } else { - strcat(string, extension); + return BLI_ensure_extension(string, FILE_MAX, extension); return TRUE; } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 7c5db6cedfa..77ef0b809ac 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -541,7 +541,7 @@ Mesh *copy_mesh(Mesh *me) id_lib_extern((ID*)tface->tpage); } } - + for(i=0; i<me->pdata.totlayer; i++) { if(me->pdata.layers[i].type == CD_MTEXPOLY) { txface= (MTexPoly*)me->pdata.layers[i].data; @@ -2004,7 +2004,7 @@ UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLo if(totuv==0) return NULL; - + vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap"); if (!vmap) return NULL; diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index dd4bc868ab0..68bb1a7280d 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -102,6 +102,7 @@ int BLI_testextensie(const char *str, const char *ext); int BLI_testextensie_array(const char *str, const char **ext_array); int BLI_testextensie_glob(const char *str, const char *ext_fnmatch); int BLI_replace_extension(char *path, size_t maxlen, const char *ext); +int BLI_ensure_extension(char *path, size_t maxlen, const char *ext); void BLI_uniquename(struct ListBase *list, void *vlink, const char defname[], char delim, short name_offs, short len); int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, const char defname[], char delim, char *name, short name_len); void BLI_newname(char * name, int add); diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 973bb57bb42..bd911adeba2 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -70,7 +70,8 @@ int BLI_system_thread_count(void); /* gets the number of threads the system can #define LOCK_CUSTOM1 3 #define LOCK_RCACHE 4 #define LOCK_OPENGL 5 -#define LOCK_SCANFILL 6 +#define LOCK_NODES 6 +#define LOCK_SCANFILL 7 void BLI_lock_thread(int type); void BLI_unlock_thread(int type); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 4fa2bcd2cb8..ab3de94d77c 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1398,22 +1398,51 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch) int BLI_replace_extension(char *path, size_t maxlen, const char *ext) { + size_t path_len= strlen(path); + size_t ext_len= strlen(ext); size_t a; - for(a=strlen(path); a>0; a--) { - if(path[a-1] == '.' || path[a-1] == '/' || path[a-1] == '\\') { - a--; + for(a= path_len - 1; a >= 0; a--) { + if (ELEM3(path[a], '.', '/', '\\')) { break; } } - - if(path[a] != '.') - a= strlen(path); - if(a + strlen(ext) >= maxlen) + if(a + ext_len >= maxlen) + return 0; + + memcpy(path+a, ext, ext_len + 1); + return 1; +} + +/* strip's trailing '.'s and adds the extension only when needed */ +int BLI_ensure_extension(char *path, size_t maxlen, const char *ext) +{ + size_t path_len= strlen(path); + size_t ext_len= strlen(ext); + size_t a; + + /* first check the extension is alread there */ + if ( (ext_len <= path_len) && + (strcmp(path + (path_len - ext_len), ext) == 0)) + { + return 1; + } + + for(a= path_len - 1; a >= 0; a--) { + if (path[a] == '.') { + path[a]= '\0'; + } + else { + break; + } + } + a++; + + if(a + ext_len >= maxlen) return 0; - strcpy(path+a, ext); + memcpy(path+a, ext, ext_len + 1); return 1; } @@ -1845,7 +1874,7 @@ void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir) /* add a trailing slash if needed */ BLI_add_slash(fullname); #ifdef WIN32 - if(userdir != fullname) { + if(userdir && userdir != fullname) { BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */ } #endif diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 37f37887688..f80458682e1 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -113,6 +113,7 @@ static pthread_mutex_t _viewer_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _custom1_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _opengl_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t _nodes_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _scanfill_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t mainid; static int thread_levels= 0; /* threads can be invoked inside threads */ @@ -348,6 +349,8 @@ void BLI_lock_thread(int type) pthread_mutex_lock(&_rcache_lock); else if (type==LOCK_OPENGL) pthread_mutex_lock(&_opengl_lock); + else if (type==LOCK_NODES) + pthread_mutex_lock(&_nodes_lock); else if (type == LOCK_SCANFILL) pthread_mutex_lock(&_scanfill_lock); } @@ -366,6 +369,8 @@ void BLI_unlock_thread(int type) pthread_mutex_unlock(&_rcache_lock); else if(type==LOCK_OPENGL) pthread_mutex_unlock(&_opengl_lock); + else if(type==LOCK_NODES) + pthread_mutex_unlock(&_nodes_lock); else if(type == LOCK_SCANFILL) pthread_mutex_unlock(&_scanfill_lock); } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5b27fe88b4b..a6316dc0e9e 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -962,6 +962,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block) ARegion *ar; uiBut *but; rcti rect; + int multisample_enabled; /* get menu region or area region */ ar= CTX_wm_menu(C); @@ -971,6 +972,11 @@ void uiDrawBlock(const bContext *C, uiBlock *block) if(!block->endblock) uiEndBlock(C, block); + /* disable AA, makes widgets too blurry */ + multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB); + if(multisample_enabled) + glDisable(GL_MULTISAMPLE_ARB); + /* we set this only once */ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1015,6 +1021,9 @@ void uiDrawBlock(const bContext *C, uiBlock *block) glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); + + if(multisample_enabled) + glEnable(GL_MULTISAMPLE_ARB); ui_draw_links(block); } diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 3226f88cc42..7a782d5f128 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -360,7 +360,6 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2] paintface_flush_flags(ob); } -/* note: caller needs to run paintface_flush_flags(ob) after this */ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) { Mesh *me; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 32e553262e2..6b5e7792e85 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1226,6 +1226,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) { RegionView3D *rv3d= ar->regiondata; struct Base *base = scene->basact; + int multisample_enabled; rcti winrct; BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); @@ -1252,8 +1253,13 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE; + /* dithering and AA break color coding, so disable */ glDisable(GL_DITHER); + multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB); + if(multisample_enabled) + glDisable(GL_MULTISAMPLE_ARB); + region_scissor_winrct(ar, &winrct); glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin); @@ -1272,9 +1278,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) G.f |= G_BACKBUFSEL; - if(base && (base->lay & v3d->lay)) { + if(base && (base->lay & v3d->lay)) draw_object_backbufsel(scene, v3d, rv3d, base->object); - } v3d->flag &= ~V3D_INVALID_BACKBUF; ar->swap= 0; /* mark invalid backbuf for wm draw */ @@ -1283,6 +1288,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) v3d->zbuf= FALSE; glDisable(GL_DEPTH_TEST); glEnable(GL_DITHER); + if(multisample_enabled) + glEnable(GL_MULTISAMPLE_ARB); if(rv3d->rflag & RV3D_CLIPPING) view3d_clr_clipping(); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 99f11554aa6..ea8db17daf0 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2946,6 +2946,7 @@ static BGpic *background_image_add(bContext *C) bgpic->iuser.fie_ima= 2; bgpic->iuser.ok= 1; bgpic->view= 0; /* 0 for all */ + bgpic->flag |= V3D_BGPIC_EXPANDED; BLI_addtail(&v3d->bgpicbase, bgpic); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 5478c9b3b6b..7e111fba621 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -410,7 +410,7 @@ void RNA_api_ui_layout(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm= RNA_def_string(func, "prop_list", "", 0, "", "Identifier of a string property in each data member, specifying which " - "of its properties should have a widget displayed in its row."); + "of its properties should have a widget displayed in its row"); RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Number of rows to display", 0, INT_MAX); RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX); RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use"); diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index f78211ac807..781ac58b32c 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -611,9 +611,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (ed->v2 == mloop[mpoly[fidx].loopstart+k1].v) { k2 = (k1 + mp->totloop - 1)%mp->totloop; SWAP(int, k1, k2); - } else if (ed->v1 == mloop[mpoly[fidx].loopstart+k1].v) { + } + else if (ed->v1 == mloop[mpoly[fidx].loopstart+k1].v) { k2 = (k1+1)%mp->totloop; - } else { + } + else { fprintf(stderr, "%s: solidify bad edge/vert\n", __func__); k2 = k1; } @@ -664,7 +666,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } if(crease_outer) { /* crease += crease_outer; without wrapping */ - unsigned char *cr= (unsigned char *)&(medge[eidx].crease); + unsigned char *cr= (unsigned char *)&(ed->crease); int tcr= *cr + crease_outer; *cr= tcr > 255 ? 255 : tcr; } @@ -684,7 +686,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, #endif if (origindex) { - origindex[numFaces * 2 + i]= ORIGINDEX_NONE; + origindex[numFaces * 2 + i]= fidx; } } @@ -722,7 +724,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* must recalculate normals with vgroups since they can displace unevenly [#26888] */ if(dvert) { CDDM_calc_normals(result); - } else { + } + else { CDDM_recalc_tesselation(result, 1); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c index 6732803f19c..0f5a2b61b87 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c +++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c @@ -33,9 +33,9 @@ /* **************** MIX RGB ******************** */ static bNodeSocketTemplate cmp_node_mix_rgb_in[]= { - { SOCK_FLOAT, 1, "Fac", 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f}, + { SOCK_FLOAT, 1, "Fac", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, + { SOCK_RGBA, 1, "Image", 1.0f, 1.0f, 1.0f, 1.0f}, { -1, 0, "" } }; static bNodeSocketTemplate cmp_node_mix_rgb_out[]= { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index cc8e1619570..a83b32097df 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -212,8 +212,15 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr) /* each material node has own local shaderesult, with optional copying */ memset(shr, 0, sizeof(ShadeResult)); - if (!exec) - exec = ntree->execdata = ntreeShaderBeginExecTree(ntree, 1); + /* ensure execdata is only initialized once */ + if (!exec) { + BLI_lock_thread(LOCK_NODES); + if(!ntree->execdata) + ntree->execdata = ntreeShaderBeginExecTree(ntree, 1); + BLI_unlock_thread(LOCK_NODES); + + exec = ntree->execdata; + } nts= ntreeGetThreadStack(exec, shi->thread); ntreeExecThreadNodes(exec, nts, &scd, shi->thread); diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 78792956684..5e5d44540dc 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -232,8 +232,15 @@ int ntreeTexExecTree( data.mtex= mtex; data.shi= shi; - if (!exec) - exec = ntreeTexBeginExecTree(nodes, 1); + /* ensure execdata is only initialized once */ + if (!exec) { + BLI_lock_thread(LOCK_NODES); + if(!nodes->execdata) + ntreeTexBeginExecTree(nodes, 1); + BLI_unlock_thread(LOCK_NODES); + + exec= nodes->execdata; + } nts= ntreeGetThreadStack(exec, thread); ntreeExecThreadNodes(exec, nts, &data, thread); diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c index 2d543470342..1b8eb3aabc6 100644 --- a/source/blender/nodes/texture/nodes/node_texture_texture.c +++ b/source/blender/nodes/texture/nodes/node_texture_texture.c @@ -54,8 +54,14 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor float co[3], dxt[3], dyt[3]; copy_v3_v3(co, p->co); - copy_v3_v3(dxt, p->dxt); - copy_v3_v3(dyt, p->dyt); + if (p->osatex) { + copy_v3_v3(dxt, p->dxt); + copy_v3_v3(dyt, p->dyt); + } + else { + zero_v3(dxt); + zero_v3(dyt); + } if(node->custom2 || node->need_exec==0) { /* this node refers to its own texture tree! */ diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index c43a2520bb8..d8ddcd593a8 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -20,7 +20,10 @@ * * The Original Code was in: source/blender/bpython/include/BPY_extern.h * - * Contributor(s): Michel Selten, Willian P. Germano, Chris Keith + * Contributor(s): Michel Selten, + * Willian P. Germano, + * Chris Keith, + * Campbell Barton * * ***** END GPL LICENSE BLOCK ***** */ @@ -39,14 +42,10 @@ struct ID; /* DNA_ID.h */ struct Object; /* DNA_object_types.h */ struct ChannelDriver; /* DNA_anim_types.h */ struct ListBase; /* DNA_listBase.h */ -struct SpaceText; /* DNA_space_types.h */ -struct ScrArea; /* DNA_screen_types.h */ -struct bScreen; /* DNA_screen_types.h */ struct bConstraint; /* DNA_constraint_types.h */ struct bPythonConstraint; /* DNA_constraint_types.h */ struct bConstraintOb; /* DNA_constraint_types.h */ struct bConstraintTarget; /* DNA_constraint_types.h*/ -struct BPyMenu; struct bContext; struct bContextDataResult; struct ReportList; @@ -61,16 +60,9 @@ void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTa void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con); int BPY_is_pyconstraint(struct Text *text); // void BPY_free_pyconstraint_links(struct Text *text); -// + void BPY_python_start(int argc, const char **argv); void BPY_python_end(void); -// void init_syspath(int first_time); -// void syspath_append(char *dir); -// void BPY_rebuild_syspath(void); -// int BPY_path_update(void); -// -// int BPY_Err_getLinenumber(void); -// const char *BPY_Err_getFilename(void); /* 2.5 UI Scripts */ int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports); diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 7aa5ed61203..076b4811d07 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -65,9 +65,9 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop ) switch ( prop->type ) { case IDP_STRING: #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); #else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); #endif case IDP_INT: return PyLong_FromLong( (long)prop->data.val ); @@ -483,9 +483,9 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop) switch (prop->type) { case IDP_STRING: #ifdef USE_STRING_COERCE - return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len); + return PyC_UnicodeFromByteAndSize(IDP_Array(prop), prop->len - 1); #else - return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len); + return PyUnicode_FromStringAndSize(IDP_Array(prop), prop->len - 1); #endif break; case IDP_FLOAT: @@ -625,11 +625,11 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self) } /* utility function */ -static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len) +static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len, const char *func) { int j; - printf("ID Property Error found and corrected in BPy_IDGroup_GetKeys/Values/Items!\n"); + printf("%s: ID Property Error found and corrected!\n", func); /*fill rest of list with valid references to None*/ for (j=len; j<prop->len; j++) { @@ -654,7 +654,7 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop) for (; loop; loop=loop->next, i++) {} if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */ - BPy_IDGroup_CorrectListLen(prop, seq, i); + BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); Py_DECREF(seq); /*free the list*/ /*call self again*/ return BPy_Wrap_GetKeys(prop); @@ -674,7 +674,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop) } if (i != prop->len) { - BPy_IDGroup_CorrectListLen(prop, seq, i); + BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); Py_DECREF(seq); /*free the list*/ /*call self again*/ return BPy_Wrap_GetValues(id, prop); @@ -697,7 +697,7 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop) } if (i != prop->len) { - BPy_IDGroup_CorrectListLen(prop, seq, i); + BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); Py_DECREF(seq); /*free the list*/ /*call self again*/ return BPy_Wrap_GetItems(id, prop); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 32d4ba857e6..acd5df79982 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1949,7 +1949,10 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - if(BLI_replace_extension(filepath, sizeof(filepath), ".blend")) { + if(!BLO_has_bfile_extension(filepath)) { + /* some users would prefer BLI_replace_extension(), + * we keep getting knit-picking bug reports about this - campbell */ + BLI_ensure_extension(filepath, FILE_MAX, ".blend"); RNA_string_set(op->ptr, "filepath", filepath); return TRUE; } |