diff options
author | Miika Hamalainen <blender@miikah.org> | 2011-10-31 17:18:14 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2011-10-31 17:18:14 +0400 |
commit | cd338a4130011ed9eccc7b131b11e4261b9dc269 (patch) | |
tree | 767bb3edaa08fef0bb6ff039fced376f9a00e9c3 /source | |
parent | 0a37e6ab976344818483df899b4fc44aedb30613 (diff) | |
parent | a664e779ac8be0f926221d4c064394f9b3b6a801 (diff) |
Merge with trunk r41411
Diffstat (limited to 'source')
34 files changed, 162 insertions, 182 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 68dc8940fce..290dce96828 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -324,8 +324,8 @@ if(WITH_OPENMP) add_definitions(-DPARALLEL=1) endif() -if(NOT WITH_MOD_FLUID) - add_definitions(-DDISABLE_ELBEEM) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_MOD_SMOKE) diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript index 512eec4021f..ebb09352a55 100644 --- a/source/blender/blenkernel/SConscript +++ b/source/blender/blenkernel/SConscript @@ -79,8 +79,8 @@ if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_OPENMP']: defs.append('PARALLEL=1') -if env['BF_NO_ELBEEM']: - defs.append('DISABLE_ELBEEM') +if env['WITH_BF_FLUID']: + defs.append('WITH_MOD_FLUID') if env['WITH_BF_LZO']: incs += ' #/extern/lzo/minilzo' diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index a9610023775..83eda860510 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -104,8 +104,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; @@ -123,8 +123,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; @@ -487,25 +487,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 = MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); - if(dv->dw) { + newdw= MEM_callocN(sizeof(MDeformWeight)*(dv->totweight+1), "deformWeight"); + if (dv->dw) { memcpy(newdw, dv->dw, sizeof(MDeformWeight)*dv->totweight); MEM_freeN(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/effect.c b/source/blender/blenkernel/intern/effect.c index c4543df0d16..bb14a1ddeaf 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -91,12 +91,12 @@ #include "RE_shader_ext.h" /* fluid sim particle import */ -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID #include "DNA_object_fluidsim.h" #include "LBM_fluidsim.h" #include <zlib.h> #include <string.h> -#endif // DISABLE_ELBEEM +#endif // WITH_MOD_FLUID //XXX #include "BIF_screen.h" 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 50525c2b9cd..6f66e189dcf 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1317,7 +1317,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned UvVertMap *vmap; UvMapVert *buf; MFace *mf; - MTFace *tf; unsigned int a; int i, totuv, nverts; @@ -1325,8 +1324,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned /* generate UvMapVert array */ mf= mface; - tf= tface; - for(a=0; a<totface; a++, mf++, tf++) + for(a=0; a<totface; a++, mf++) if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) totuv += (mf->v4)? 4: 3; @@ -1346,8 +1344,7 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned } mf= mface; - tf= tface; - for(a=0; a<totface; a++, mf++, tf++) { + for(a=0; a<totface; a++, mf++) { if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) { nverts= (mf->v4)? 4: 3; @@ -1363,7 +1360,6 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned } /* sort individual uvs for each vert */ - tf= tface; for(a=0; a<totvert; a++) { UvMapVert *newvlist= NULL, *vlist=vmap->vert[a]; UvMapVert *iterv, *v, *lastv, *next; @@ -1375,14 +1371,14 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned v->next= newvlist; newvlist= v; - uv= (tf+v->f)->uv[v->tfindex]; + uv= tface[v->f].uv[v->tfindex]; lastv= NULL; iterv= vlist; while(iterv) { next= iterv->next; - uv2= (tf+iterv->f)->uv[iterv->tfindex]; + uv2= tface[iterv->f].uv[iterv->tfindex]; sub_v2_v2v2(uvdiff, uv2, uv); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f904f246b65..ec058b23050 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -95,13 +95,13 @@ #include "RE_shader_ext.h" /* fluid sim particle import */ -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID #include "DNA_object_fluidsim.h" #include "LBM_fluidsim.h" #include <zlib.h> #include <string.h> -#endif // DISABLE_ELBEEM +#endif // WITH_MOD_FLUID /************************************************/ /* Reacting to system events */ @@ -3916,7 +3916,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } /* fluid sim particle import handling, actual loading of particles from file */ - #ifndef DISABLE_ELBEEM + #ifdef WITH_MOD_FLUID { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim); @@ -4009,7 +4009,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) } // fluid sim particles done } - #endif // DISABLE_ELBEEM + #endif // WITH_MOD_FLUID } static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNUSED(cfra)) 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_string.h b/source/blender/blenlib/BLI_string.h index 9a7fa521af1..46389a9259e 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -132,29 +132,6 @@ int BLI_strcasecmp(const char *s1, const char *s2); int BLI_strncasecmp(const char *s1, const char *s2, size_t len); int BLI_natstrcmp(const char *s1, const char *s2); size_t BLI_strnlen(const char *str, size_t maxlen); - - /** - * Split str on the first occurence of delimiter, returns the first - * part as a mallocN'd string, and stores the second part into - * ctx (also mallocN'd). - * If str is NULL, split on ctx instead. - * This allows to iterate over this "generator" function: - * - * char *ctx = NULL; - * char *res = NULL; - * for(res = BLI_strtok_r("a;dummy;csv;line", ";", &ctx); res; res = BLI_strtok_r(NULL, ";", &ctx)) { - * printf(res); - * MEM_freeN(res); - * } - * - * @param str The string to be split. - * @param delimiter The char used to split str apart. - * @param ctx The "context" string. It’s a pointer inside the org passed @str, - * so it has no specific mem management. - * @retval Returns the mallocN'd first element from split str (or ctx). - */ -char *BLI_strtok_r(char *str, const char *delimiter, char **ctx); - void BLI_timestr(double _time, char *str); /* time var is global */ void BLI_ascii_strtolower(char *str, int len); diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index e42e02fb24f..b7fe7ef5efd 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -325,8 +325,7 @@ static int rewrite_path_fixed_dirfile(char path_dir[FILE_MAXDIR], char path_file } if (visit_cb(userdata, path_dst, (const char *)path_src)) { - BLI_split_dirfile(path_dst, path_dir, path_file, - sizeof(path_dir), sizeof(path_file)); + BLI_split_dirfile(path_dst, path_dir, path_file, FILE_MAXDIR, FILE_MAXFILE); return TRUE; } else { diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index bc24415fd3f..bbb62db58f2 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1397,22 +1397,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; } @@ -1844,7 +1873,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/string.c b/source/blender/blenlib/intern/string.c index 3ec84e0b593..3a66425a5de 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -375,35 +375,6 @@ int BLI_natstrcmp(const char *s1, const char *s2) return 0; } -/* As unfortunately strtok_r is not available everywhere... */ -char *BLI_strtok_r(char *str, const char *delimiter, char **ctx) -{ - char *cut = NULL, *ret = NULL; - char *split = str ? str : *ctx; - - if(!split) { - return ret; - } - - cut = strchr(split, *delimiter); - if(cut) { - size_t len_ret = cut - split; - size_t len_ctx = strlen(split) - len_ret - 1; - ret = BLI_strdupn(split, len_ret); - if(len_ctx > 0) { - *ctx = split+len_ret+1; - } - else { - *ctx = NULL; - } - } - else { - ret = BLI_strdup(split); - *ctx = NULL; - } - return ret; -} - void BLI_timestr(double _time, char *str) { /* format 00:00:00.00 (hr:min:sec) string has to be 12 long */ diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index dd1399dda0d..6d7bac9ed44 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2290,7 +2290,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase) static void write_libraries(WriteData *wd, Main *main) { - ListBase *lbarray[30]; + ListBase *lbarray[MAX_LIBARRAY]; ID *id; int a, tot, foundone; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 0391c16a8f7..89b9f74d851 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2068,7 +2068,7 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int return rnaicon; } -static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list) +static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *itemptr, int i, int rnaicon, PointerRNA *activeptr, PropertyRNA *activeprop, const char *prop_list_id) { uiBlock *block= uiLayoutGetBlock(layout); uiBut *but; @@ -2212,8 +2212,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe * … you’ll get a numfield for the integer prop, a check box for the bool prop, and a textfield * for the string prop, after the name of each item of the collection. */ - else if (prop_list) { - PropertyRNA *prop_ctrls; + else if (prop_list_id) { row = uiLayoutRow(sub, 1); uiItemL(row, name, icon); @@ -2222,18 +2221,21 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe * which would obviously produce a sigsev… */ if (itemptr->type) { /* If the special property is set for the item, and it is a collection… */ - prop_ctrls = RNA_struct_find_property(itemptr, prop_list); - if(prop_ctrls) { - if(RNA_property_type(prop_ctrls) == PROP_STRING) { - char *prop_names = RNA_property_string_get_alloc(itemptr, prop_ctrls, NULL, 0, NULL); - char *id = NULL; - char *ctx = NULL; - for(id = BLI_strtok_r(prop_names, ":", &ctx); id; id = BLI_strtok_r(NULL, ":", &ctx)) { - uiItemR(row, itemptr, id, 0, NULL, 0); - MEM_freeN(id); - } - MEM_freeN(prop_names); + PropertyRNA *prop_list= RNA_struct_find_property(itemptr, prop_list_id); + + if(prop_list && RNA_property_type(prop_list) == PROP_STRING) { + int prop_names_len; + char *prop_names = RNA_property_string_get_alloc(itemptr, prop_list, NULL, 0, &prop_names_len); + char *prop_names_end= prop_names + prop_names_len; + char *id= prop_names; + char *id_next; + while (id < prop_names_end) { + if ((id_next= strchr(id, ':'))) *id_next++= '\0'; + else id_next= prop_names_end; + uiItemR(row, itemptr, id, 0, NULL, 0); + id= id_next; } + MEM_freeN(prop_names); } } } diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 279657e71c2..02d20e64bc3 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -346,7 +346,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/physics/CMakeLists.txt b/source/blender/editors/physics/CMakeLists.txt index 3fc05684fc9..4d43c618568 100644 --- a/source/blender/editors/physics/CMakeLists.txt +++ b/source/blender/editors/physics/CMakeLists.txt @@ -46,8 +46,8 @@ set(SRC physics_intern.h ) -if(NOT WITH_MOD_FLUID) - add_definitions(-DDISABLE_ELBEEM) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_OPENMP) diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index f0c327b9279..6e88d477d9c 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -85,7 +85,7 @@ #include "physics_intern.h" // own include /* enable/disable overall compilation */ -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID #include "WM_api.h" @@ -1111,7 +1111,7 @@ void fluidsimFreeBake(Object *UNUSED(ob)) /* not implemented yet */ } -#else /* DISABLE_ELBEEM */ +#else /* WITH_MOD_FLUID */ /* compile dummy functions for disabled fluid sim */ @@ -1135,7 +1135,7 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object return 0; } -#endif /* DISABLE_ELBEEM */ +#endif /* WITH_MOD_FLUID */ /***************************** Operators ******************************/ diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index feeb2fefca7..fa764e6eefc 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -154,7 +154,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) if((scene->r.mode & R_OSA) == 0) { ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); - glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, rr->rectf); + GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf); } else { /* simple accumulation, less hassle then FSAA FBO's */ @@ -167,7 +167,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); - glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_buffer); + GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer); /* skip the first sample */ for(j=1; j < SAMPLES; j++) { @@ -175,7 +175,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) window_translate_m4(winmat_jitter, rv3d->persmat, jit_ofs[j][0] / sizex, jit_ofs[j][1] / sizey); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter); - glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, accum_tmp); + GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp); add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float)); } @@ -278,7 +278,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) sizey= (scene->r.size*scene->r.ysch)/100; /* corrects render size with actual size, not every card supports non-power-of-two dimensions */ - ofs= GPU_offscreen_create(&sizex, &sizey, err_out); + ofs= GPU_offscreen_create(sizex, sizey, err_out); if(!ofs) { BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 20b1df6ef2c..32e553262e2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2379,7 +2379,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in glPushAttrib(GL_LIGHTING_BIT); /* bind */ - ofs= GPU_offscreen_create(&sizex, &sizey, err_out); + ofs= GPU_offscreen_create(sizex, sizey, err_out); if(ofs == NULL) return NULL; @@ -2403,9 +2403,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in ibuf= IMB_allocImBuf(sizex, sizey, 32, flag); if(ibuf->rect_float) - glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float); + GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float); else if(ibuf->rect) - glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect); //if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) // BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4); 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/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 965f317aa50..3fff79390e3 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -136,7 +136,7 @@ int GPU_texture_opengl_bindcode(GPUTexture *tex); GPUFrameBuffer *GPU_framebuffer_create(void); int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err_out[256]); void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex); -void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex); +void GPU_framebuffer_texture_bind(GPUFrameBuffer *fb, GPUTexture *tex, int w, int h); void GPU_framebuffer_texture_unbind(GPUFrameBuffer *fb, GPUTexture *tex); void GPU_framebuffer_free(GPUFrameBuffer *fb); @@ -146,10 +146,11 @@ void GPU_framebuffer_restore(void); - wrapper around framebuffer and texture for simple offscreen drawing - changes size if graphics card can't support it */ -GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256]); +GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256]); void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs); void GPU_offscreen_unbind(GPUOffScreen *ofs); +void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels); /* GPU Shader - only for fragment shaders now diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 6189062a855..e1a89daf7e2 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -790,7 +790,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex) tex->fb = NULL; } -void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex) +void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex, int w, int h) { /* push attributes */ glPushAttrib(GL_ENABLE_BIT); @@ -801,7 +801,7 @@ void GPU_framebuffer_texture_bind(GPUFrameBuffer *UNUSED(fb), GPUTexture *tex) glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tex->fb->object); /* push matrices and set default viewport and matrix */ - glViewport(0, 0, tex->w, tex->h); + glViewport(0, 0, w, h); GG.currentfb = tex->fb->object; glMatrixMode(GL_PROJECTION); @@ -859,13 +859,19 @@ struct GPUOffScreen { GPUFrameBuffer *fb; GPUTexture *color; GPUTexture *depth; + + /* requested width/height, may be smaller than actual texture size due + to missing non-power of two support, so we compensate for that */ + int w, h; }; -GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256]) +GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256]) { GPUOffScreen *ofs; ofs= MEM_callocN(sizeof(GPUOffScreen), "GPUOffScreen"); + ofs->w= width; + ofs->h= height; ofs->fb = GPU_framebuffer_create(); if(!ofs->fb) { @@ -873,24 +879,18 @@ GPUOffScreen *GPU_offscreen_create(int *width, int *height, char err_out[256]) return NULL; } - ofs->depth = GPU_texture_create_depth(*width, *height, err_out); + ofs->depth = GPU_texture_create_depth(width, height, err_out); if(!ofs->depth) { GPU_offscreen_free(ofs); return NULL; } - if(*width!=ofs->depth->w || *height!=ofs->depth->h) { - *width= ofs->depth->w; - *height= ofs->depth->h; - printf("Offscreen size differs from given size!\n"); - } - if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) { GPU_offscreen_free(ofs); return NULL; } - ofs->color = GPU_texture_create_2D(*width, *height, NULL, err_out); + ofs->color = GPU_texture_create_2D(width, height, NULL, err_out); if(!ofs->color) { GPU_offscreen_free(ofs); return NULL; @@ -921,7 +921,7 @@ void GPU_offscreen_free(GPUOffScreen *ofs) void GPU_offscreen_bind(GPUOffScreen *ofs) { glDisable(GL_SCISSOR_TEST); - GPU_framebuffer_texture_bind(ofs->fb, ofs->color); + GPU_framebuffer_texture_bind(ofs->fb, ofs->color, ofs->w, ofs->h); } void GPU_offscreen_unbind(GPUOffScreen *ofs) @@ -931,6 +931,11 @@ void GPU_offscreen_unbind(GPUOffScreen *ofs) glEnable(GL_SCISSOR_TEST); } +void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels) +{ + glReadPixels(0, 0, ofs->w, ofs->h, GL_RGBA, type, pixels); +} + /* GPUShader */ struct GPUShader { diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index d0f834977c8..26c08f6cae5 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1661,7 +1661,8 @@ void GPU_lamp_shadow_buffer_bind(GPULamp *lamp, float viewmat[][4], int *winsize /* opengl */ glDisable(GL_SCISSOR_TEST); - GPU_framebuffer_texture_bind(lamp->fb, lamp->tex); + GPU_framebuffer_texture_bind(lamp->fb, lamp->tex, + GPU_texture_opengl_width(lamp->tex), GPU_texture_opengl_height(lamp->tex)); /* set matrices */ copy_m4_m4(viewmat, lamp->viewmat); diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index d986e9c7a70..012333e5da0 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -196,8 +196,8 @@ if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() -if(NOT WITH_MOD_FLUID) - add_definitions(-DDISABLE_ELBEEM) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_FFTW3) diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c index d2d24e083b1..a7eedf5f062 100644 --- a/source/blender/makesrna/intern/rna_fluidsim.c +++ b/source/blender/makesrna/intern/rna_fluidsim.c @@ -170,7 +170,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 +#ifndef WITH_MOD_FLUID (void)ptr; value[0]= '\0'; #else @@ -183,7 +183,7 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr)) { -#ifdef DISABLE_ELBEEM +#ifndef WITH_MOD_FLUID return 0; #else return 31; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 4862b5224ab..25c673a168f 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/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 735437a0785..e8ecc75ca60 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -112,8 +112,8 @@ if(WITH_MOD_DECIMATE) ) endif() -if(NOT WITH_MOD_FLUID) - add_definitions(-DDISABLE_ELBEEM) +if(WITH_MOD_FLUID) + add_definitions(-DWITH_MOD_FLUID) endif() if(WITH_GAMEENGINE) diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript index 77a2d577fb5..277ed2c3fb3 100644 --- a/source/blender/modifiers/SConscript +++ b/source/blender/modifiers/SConscript @@ -13,12 +13,14 @@ incs += ' ' + env['BF_ZLIB_INC'] defs = [] -# could be made optional -defs += ['WITH_MOD_BOOLEAN'] -defs += ['WITH_MOD_DECIMATE'] +if env ['WITH_BF_BOOLEAN']: + defs.append('WITH_MOD_BOOLEAN') -if env['BF_NO_ELBEEM']: - defs.append('DISABLE_ELBEEM') +if env ['WITH_BF_DECIMATE']: + defs.append('WITH_MOD_DECIMATE') + +if env['WITH_BF_FLUID']: + defs.append('WITH_MOD_FLUID') if env['WITH_BF_GAMEENGINE']: incs += ' #/extern/recastnavigation' diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 0e9b71c3e6d..1baa03d2063 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -62,9 +62,10 @@ // headers for fluidsim bobj meshes #include "LBM_fluidsim.h" + void fluidsim_init(FluidsimModifierData *fluidmd) { -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID if(fluidmd) { FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); @@ -152,7 +153,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd) void fluidsim_free(FluidsimModifierData *fluidmd) { -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID if(fluidmd) { if(fluidmd->fss->meshVelocities) @@ -169,7 +170,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd) return; } -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID /* read .bobj.gz file into a fluidsimDerivedMesh struct */ static DerivedMesh *fluidsim_read_obj(const char *filename) { @@ -534,14 +535,14 @@ static DerivedMesh *fluidsim_read_cache(DerivedMesh *orgdm, FluidsimModifierData return dm; } -#endif // DISABLE_ELBEEM +#endif // WITH_MOD_FLUID DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene, Object *UNUSED(ob), DerivedMesh *dm, int useRenderParams, int UNUSED(isFinalCalc)) { -#ifndef DISABLE_ELBEEM +#ifdef WITH_MOD_FLUID DerivedMesh *result = NULL; int framenr; FluidsimSettings *fss = NULL; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 8d47ad28a86..b8e95ad4c51 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -626,7 +626,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, add_v3_v3(edge_vert_nos[ed->v1], nor); add_v3_v3(edge_vert_nos[ed->v2], nor); #endif - origindex[numFaces * 2 + i]= ORIGINDEX_NONE; + origindex[numFaces * 2 + i]= fidx; } #ifdef SOLIDIFY_SIDE_NORMALS 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/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; } |