From 34ea1cf0b23977ab76b23b06f6ceb1fda5631f88 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Nov 2010 06:03:30 +0000 Subject: minor changes to the python api. - pep8 script was giving an error on non utf8 scons source files. - use PyList_SET_ITEM macro when list type is ensured. - all mathutils types use subtypes to create new types when available. - use defines MAT3_UNITY, MAT4_UNITY to initialize unit matrices. --- source/blender/blenkernel/intern/armature.c | 9 +++------ source/blender/blenkernel/intern/constraint.c | 11 +++++------ source/blender/blenkernel/intern/particle.c | 2 +- 3 files changed, 9 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d2861a8942c..b4bdb516ab3 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -590,7 +590,7 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info Mat4 *b_bone_rest= b_bone_spline_setup(pchan, 1); Mat4 *b_bone_mats; DualQuat *b_bone_dual_quats= NULL; - float tmat[4][4]; + float tmat[4][4]= MAT4_UNITY; int a; /* allocate b_bone matrices and dual quats */ @@ -611,7 +611,6 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info - translate over the curve to the bbone mat space - transform with b_bone matrix - transform back into global space */ - unit_m4(tmat); for(a=0; asegments; a++) { invert_m4_m4(tmat, b_bone_rest[a].mat); @@ -1104,11 +1103,10 @@ void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) */ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc) { - float xLocMat[4][4]; + float xLocMat[4][4]= MAT4_UNITY; float nLocMat[4][4]; /* build matrix for location */ - unit_m4(xLocMat); VECCOPY(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ @@ -1184,11 +1182,10 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm */ void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) { - float xLocMat[4][4]; + float xLocMat[4][4]= MAT4_UNITY; float nLocMat[4][4]; /* build matrix for location */ - unit_m4(xLocMat); VECCOPY(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 076dae41e6a..f15e0bc3144 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -1202,12 +1202,11 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr if (VALID_CONS_TARGET(ct)) { Curve *cu= ct->tar->data; float vec[4], dir[3], radius; - float totmat[4][4]; + float totmat[4][4]= MAT4_UNITY; float curvetime; - - unit_m4(totmat); + unit_m4(ct->matrix); - + /* note: when creating constraints that follow path, the curve gets the CU_PATH set now, * currently for paths to work it needs to go through the bevlist/displist system (ton) */ @@ -3106,11 +3105,11 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta /* only evaluate if there is a target and it is a curve */ if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { Curve *cu= data->tar->data; - float obmat[4][4], targetMatrix[4][4], ownLoc[3]; + float obmat[4][4], ownLoc[3]; float curveMin[3], curveMax[3]; + float targetMatrix[4][4]= MAT4_UNITY; copy_m4_m4(obmat, cob->matrix); - unit_m4(targetMatrix); copy_v3_v3(ownLoc, obmat[3]); INIT_MINMAX(curveMin, curveMax) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 2eff81b96a6..9c2efe395dc 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4359,7 +4359,7 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa normalize_v3(side); cross_v3_v3v3(nor, vec, side); - unit_m4(mat); + unit_m4(mat); VECCOPY(mat[0], vec); VECCOPY(mat[1], side); VECCOPY(mat[2], nor); -- cgit v1.2.3 From b7d0715284e1177ab8c31a998358d23b5d0b11dd Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 28 Nov 2010 16:36:36 +0000 Subject: Bugfix #24953 Compositor: If scene render size changed, a Texture node didn't get tagged to re-render, using previous size instead. --- source/blender/blenkernel/intern/node.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 7b25c38648d..4c88cbfaa55 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2907,6 +2907,8 @@ 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); + else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */ + NodeTagChanged(sce->nodetree, node); } } } -- cgit v1.2.3 From 510920a299478cdd50ce8ce4ff43d14eb4e2c2e4 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 28 Nov 2010 18:23:21 +0000 Subject: == Sequencer == This fixes Orig Dimension display (mostly). * orx, ory both didn't get calculated, if dimension already matched * putting them into Strip instead of StripData ment, that using images of different dimensions in one strip could lead to incorrect results Still TODO: on file open, timeline display happens before preview display which means: orig_width and height are calculated after the first draw of N-keys dialog. You have to hit refresh (or scrub one frame) to get the right values displayed. --- source/blender/blenkernel/intern/sequencer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b98976729c4..9eafb3fb3e3 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1558,9 +1558,6 @@ static ImBuf * input_preprocess( { float mul; - seq->strip->orx= ibuf->x; - seq->strip->ory= ibuf->y; - if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) { IMB_filtery(ibuf); } @@ -2054,6 +2051,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr IMB_convert_profile(ibuf, IB_PROFILE_NONE); copy_to_ibuf_still(context, seq, nr, ibuf); + + s_elem->orig_width = ibuf->x; + s_elem->orig_height = ibuf->y; } break; } @@ -2073,7 +2073,10 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr /* we don't need both (speed reasons)! */ if (ibuf && ibuf->rect_float && ibuf->rect) imb_freerectImBuf(ibuf); - + if (ibuf) { + seq->strip->stripdata->orig_width = ibuf->x; + seq->strip->stripdata->orig_height = ibuf->y; + } } copy_to_ibuf_still(context, seq, nr, ibuf); break; -- cgit v1.2.3 From 04d374194756516c8b7a15fff99bfa72a2239f75 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Mon, 29 Nov 2010 07:37:20 +0000 Subject: Fix [#24964] HISTOGRAM: Inconsistency in spaces --- source/blender/blenkernel/intern/colortools.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 86d7cbf0133..1be1b9b9ad0 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -956,13 +956,11 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size) DO_INLINE int get_bin_float(float f) { - int bin= (int)(f*255); + int bin= (int)((f*255) + 0.5); /* 0.5 to prevent quantisation differences */ /* note: clamp integer instead of float to avoid problems with NaN */ CLAMP(bin, 0, 255); - - //return (int) (((f + 0.25) / 1.5) * 255); - + return bin; } -- cgit v1.2.3 From 17cd5811e767df5bc7247648e3cbe52e39575f56 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Tue, 30 Nov 2010 21:31:18 +0000 Subject: Smoke now uses only one point cache where both normal and high resolution smoke are stored together: * Separate caches were causing quite a lot of problems both in principle and practice. * For example it doesn't really make sense to have different frame ranges for normal and high resolution smoke, but this was fully possible before. * Also to fully bake the smoke you had to do a "Bake All Dynamics", which completely defeats the whole point of the feature! * As a result of this change the smoke cache usage is much much simpler and less error prone. * This is quite a big change, but hopefully there should be less rather than more problems as a result :) Some other related changes: * Changing the cache name now works for disk caches properly too, it now just renames the cache files so should be faster too! * Smoke is now always forced to disk cache with step 1 on file load as there were some strange cases where smoke was trying to use memory cache. * Disabled smoke debug prints from console. * Disabled changing smoke parameters when smoke is baked. Note to users: The unfortunate side effect of this is that old high resolution simulations have to be baked again, but in return you get much better and more logical functionality. Sorry none the less! --- source/blender/blenkernel/intern/pointcache.c | 175 ++++++++++++++------------ source/blender/blenkernel/intern/smoke.c | 102 ++++----------- 2 files changed, 123 insertions(+), 154 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 4d22b22ae31..440a3136108 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -725,6 +725,7 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; + int ret = 0; if(sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; @@ -755,16 +756,9 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) MEM_freeN(out); - return 1; + ret = 1; } - return 0; -} -static int ptcache_write_smoke_turbulence(PTCacheFile *pf, void *smoke_v) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - if(sds->wt) { int res_big_array[3]; int res_big; @@ -796,11 +790,13 @@ static int ptcache_write_smoke_turbulence(PTCacheFile *pf, void *smoke_v) ptcache_compress_write(pf, (unsigned char *)tcw, in_len, out, mode); MEM_freeN(out); - return 1; + ret = 1; } - return 0; + + return ret; } + // forward decleration static int ptcache_file_read(PTCacheFile *pf, void *f, size_t tot, int size); @@ -877,33 +873,27 @@ static void ptcache_read_smoke(PTCacheFile *pf, void *smoke_v) ptcache_compress_read(pf, (unsigned char*)obstacles, (unsigned int)res); ptcache_file_read(pf, &dt, 1, sizeof(float)); ptcache_file_read(pf, &dx, 1, sizeof(float)); - } -} -static void ptcache_read_smoke_turbulence(PTCacheFile *pf, void *smoke_v) -{ - SmokeModifierData *smd= (SmokeModifierData *)smoke_v; - SmokeDomainSettings *sds = smd->domain; - - if(sds->fluid) { - int res = sds->res[0]*sds->res[1]*sds->res[2]; - int res_big, res_big_array[3]; - float *dens, *densold, *tcu, *tcv, *tcw; - unsigned int out_len = sizeof(float)*(unsigned int)res; - unsigned int out_len_big; + if(pf->data_types & (1<wt) { + int res = sds->res[0]*sds->res[1]*sds->res[2]; + int res_big, res_big_array[3]; + float *dens, *densold, *tcu, *tcv, *tcw; + unsigned int out_len = sizeof(float)*(unsigned int)res; + unsigned int out_len_big; - smoke_turbulence_get_res(sds->wt, res_big_array); - res_big = res_big_array[0]*res_big_array[1]*res_big_array[2]; - out_len_big = sizeof(float) * (unsigned int)res_big; + smoke_turbulence_get_res(sds->wt, res_big_array); + res_big = res_big_array[0]*res_big_array[1]*res_big_array[2]; + out_len_big = sizeof(float) * (unsigned int)res_big; - smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw); + smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw); - ptcache_compress_read(pf, (unsigned char*)dens, out_len_big); - ptcache_compress_read(pf, (unsigned char*)densold, out_len_big); + ptcache_compress_read(pf, (unsigned char*)dens, out_len_big); + ptcache_compress_read(pf, (unsigned char*)densold, out_len_big); - ptcache_compress_read(pf, (unsigned char*)tcu, out_len); - ptcache_compress_read(pf, (unsigned char*)tcv, out_len); - ptcache_compress_read(pf, (unsigned char*)tcw, out_len); + ptcache_compress_read(pf, (unsigned char*)tcu, out_len); + ptcache_compress_read(pf, (unsigned char*)tcv, out_len); + ptcache_compress_read(pf, (unsigned char*)tcw, out_len); + } } } @@ -936,41 +926,13 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo pid->write_header= ptcache_write_basic_header; pid->read_header= ptcache_read_basic_header; - pid->data_types= (1<data_types= 0; pid->info_types= 0; -} -void BKE_ptcache_id_from_smoke_turbulence(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd) -{ - SmokeDomainSettings *sds = smd->domain; - - memset(pid, 0, sizeof(PTCacheID)); - - pid->ob= ob; - pid->calldata= smd; - - pid->type= PTCACHE_TYPE_SMOKE_HIGHRES; - pid->stack_index= sds->point_cache[1]->index; - - pid->cache= sds->point_cache[1]; - pid->cache_ptr= &sds->point_cache[1]; - pid->ptcaches= &sds->ptcaches[1]; - - pid->totpoint= pid->totwrite= ptcache_totpoint_smoke_turbulence; - - pid->write_elem= NULL; - pid->read_elem= NULL; - - pid->read_stream = ptcache_read_smoke_turbulence; - pid->write_stream = ptcache_write_smoke_turbulence; - - pid->interpolate_elem= NULL; - - pid->write_header= ptcache_write_basic_header; - pid->read_header= ptcache_read_basic_header; - - pid->data_types= (1<info_types= 0; + if(sds->fluid) + pid->data_types |= (1<wt) + pid->data_types |= (1<cache->name); + + /* get "from" filename */ + strcpy(pid->cache->name, from); + + len = BKE_ptcache_id_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); + return; + } + + snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, pid->stack_index); + + /* put new name into cache */ + strcpy(pid->cache->name, to); + + while ((de = readdir(dir)) != NULL) { + if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ + if (strncmp(old_filename, de->d_name, len ) == 0) { /* do we have the right prefix */ + /* read the number of the file */ + int frame, len2 = (int)strlen(de->d_name); + char num[7]; + + if (len2 > 15) { /* could crash if trying to copy a string out of this range*/ + BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num)); + frame = atoi(num); + + BLI_join_dirfile(old_path_full, path, de->d_name); + BKE_ptcache_id_filename(pid, new_path_full, frame, 1, 1); + BLI_rename(old_path_full, new_path_full); + } + } + } + } + + strcpy(pid->cache->name, old_name); +} + void BKE_ptcache_load_external(PTCacheID *pid) { /*todo*/ @@ -2965,14 +2975,25 @@ void BKE_ptcache_update_info(PTCacheID *pid) } if(cache->flag & PTCACHE_DISK_CACHE) { - int cfra = cache->startframe; + if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN) + { + int totpoint = pid->totpoint(pid->calldata, 0); - for(; cfra<=cache->endframe; cfra++) { - if(BKE_ptcache_id_exist(pid, cfra)) - totframes++; + if(cache->totpoint > totpoint) + sprintf(mem_info, "%i cells + High Resolution cached", totpoint); + else + sprintf(mem_info, "%i cells cached"); } + else { + int cfra = cache->startframe; - sprintf(mem_info, "%i frames on disk", totframes); + for(; cfra<=cache->endframe; cfra++) { + if(BKE_ptcache_id_exist(pid, cfra)) + totframes++; + } + + sprintf(mem_info, "%i frames on disk", totframes); + } } else { PTCacheMem *pm = cache->mem_cache.first; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 8822d0cb4c9..8fd9c48cc61 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -554,8 +554,6 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd) BKE_ptcache_free_list(&(smd->domain->ptcaches[0])); smd->domain->point_cache[0] = NULL; - BKE_ptcache_free_list(&(smd->domain->ptcaches[1])); - smd->domain->point_cache[1] = NULL; MEM_freeN(smd->domain); smd->domain = NULL; @@ -695,10 +693,9 @@ void smokeModifier_createType(struct SmokeModifierData *smd) smd->domain->point_cache[0]->flag |= PTCACHE_DISK_CACHE; smd->domain->point_cache[0]->step = 1; - smd->domain->point_cache[1] = BKE_ptcache_add(&(smd->domain->ptcaches[1])); - smd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE; - smd->domain->point_cache[1]->step = 1; - + /* Deprecated */ + smd->domain->point_cache[1] = NULL; + smd->domain->ptcaches[1].first = smd->domain->ptcaches[1].last = NULL; /* set some standard values */ smd->domain->fluid = NULL; smd->domain->wt = NULL; @@ -1323,35 +1320,22 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM float light[3]; PointCache *cache = NULL; PTCacheID pid; - PointCache *cache_wt = NULL; - PTCacheID pid_wt; int startframe, endframe, framenr; float timescale; - int cache_result = 0, cache_result_wt = 0; - int did_init = 0; framenr = scene->r.cfra; - printf("time: %d\n", scene->r.cfra); + //printf("time: %d\n", scene->r.cfra); cache = sds->point_cache[0]; BKE_ptcache_id_from_smoke(&pid, ob, smd); BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, ×cale); - cache_wt = sds->point_cache[1]; - BKE_ptcache_id_from_smoke_turbulence(&pid_wt, ob, smd); - if(!smd->domain->fluid || framenr == startframe) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; - - BKE_ptcache_id_reset(scene, &pid_wt, PTCACHE_RESET_OUTDATED); - if(cache_wt) { - BKE_ptcache_validate(cache_wt, framenr); - cache_wt->flag &= ~PTCACHE_REDO_NEEDED; - } } if(!smd->domain->fluid && (framenr != startframe) && (smd->domain->flags & MOD_SMOKE_FILE_LOAD)==0 && (cache->flag & PTCACHE_BAKED)==0) @@ -1359,11 +1343,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smd->domain->flags &= ~MOD_SMOKE_FILE_LOAD; - if(framenr < startframe) - framenr = startframe; - - if(framenr > endframe) - framenr = endframe; + CLAMP(framenr, startframe, endframe); /* If already viewing a pre/after frame, no need to reload */ if ((smd->time == framenr) && (framenr != scene->r.cfra)) @@ -1371,42 +1351,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM // printf("startframe: %d, framenr: %d\n", startframe, framenr); - if(!(did_init = smokeModifier_init(smd, ob, scene, dm))) + if(smokeModifier_init(smd, ob, scene, dm)==0) { printf("bad smokeModifier_init\n"); return; } /* try to read from cache */ - cache_result = BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec); - // printf("cache_result: %d\n", cache_result); - - if(cache_result == PTCACHE_READ_EXACT) - { + if(BKE_ptcache_read_cache(&pid, (float)framenr, scene->r.frs_sec) == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, framenr); smd->time = framenr; - - if(sds->wt) - { - cache_result_wt = BKE_ptcache_read_cache(&pid_wt, (float)framenr, scene->r.frs_sec); - - if(cache_result_wt == PTCACHE_READ_EXACT) - { - BKE_ptcache_validate(cache_wt, framenr); - - return; - } - else - { - ; /* don't return in the case we only got low res cache but no high res cache */ - /* we still need to calculate the high res cache */ - } - } - else - return; + return; } + /* only calculate something when we advanced a single frame */ - else if(framenr != (int)smd->time+1) + if(framenr != (int)smd->time+1) return; /* don't simulate if viewing start frame, but scene frame is not real start frame */ @@ -1418,15 +1377,19 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_calc_domain(scene, ob, smd); /* if on second frame, write cache for first frame */ - /* this needs to be done for smoke too so that pointcache works properly */ if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) { // create shadows straight after domain initialization so we get nice shadows for startframe, too if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); - BKE_ptcache_write_cache(&pid, startframe); if(sds->wt) - BKE_ptcache_write_cache(&pid_wt, startframe); + { + if(sds->flags & MOD_SMOKE_DISSOLVE) + smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + smoke_turbulence_step(sds->wt, sds->fluid); + } + + BKE_ptcache_write_cache(&pid, startframe); } // set new time @@ -1444,39 +1407,24 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base); } - else - { - /* Smoke did not load cache and was not reset but we're on startframe */ - /* So now reinit the smoke since it was not done yet */ - if(did_init == 2) - { - smokeModifier_reset(smd); - smokeModifier_init(smd, ob, scene, dm); - } - } // create shadows before writing cache so they get stored if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); - - BKE_ptcache_validate(cache, framenr); - BKE_ptcache_write_cache(&pid, framenr); if(sds->wt) { - if(framenr!=startframe) - { - if(sds->flags & MOD_SMOKE_DISSOLVE) - smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); - smoke_turbulence_step(sds->wt, sds->fluid); - } - - BKE_ptcache_validate(cache_wt, framenr); - BKE_ptcache_write_cache(&pid_wt, framenr); + if(sds->flags & MOD_SMOKE_DISSOLVE) + smoke_dissolve_wavelet(sds->wt, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); + smoke_turbulence_step(sds->wt, sds->fluid); } + + BKE_ptcache_validate(cache, framenr); + if(framenr != startframe) + BKE_ptcache_write_cache(&pid, framenr); tend(); - printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() ); + //printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() ); } } -- cgit v1.2.3 From 89abb9f2d2470cf808fd1f42c67d82355d1ade8e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 30 Nov 2010 23:38:31 +0000 Subject: bugfix [#22638] Alpha channel not saved when using texture paint check for alpha channel while saving images that have been painted onto. It would be nicer to do this while in paint mode except this isn't so simple with project paint using multiple images at once. --- source/blender/blenkernel/intern/image.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b624feeaf9d..31eae70f159 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1188,6 +1188,29 @@ void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf) if (stamp_data.rendertime[0]) IMB_metadata_change_field (ibuf, "RenderTime", stamp_data.rendertime); } +int BKE_alphatest_ibuf(ImBuf *ibuf) +{ + int tot; + if(ibuf->rect_float) { + float *buf= ibuf->rect_float; + for(tot= ibuf->x * ibuf->y; tot--; buf+=4) { + if(buf[3] < 1.0f) { + return TRUE; + } + } + } + else if (ibuf->rect) { + unsigned char *buf= (unsigned char *)ibuf->rect; + for(tot= ibuf->x * ibuf->y; tot--; buf+=4) { + if(buf[3] != 255) { + return TRUE; + } + } + } + + return FALSE; +} + int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality) { int ok; -- cgit v1.2.3 From b5ba824cf28e61cea21042bf58ef628bef6a2d13 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Dec 2010 02:28:08 +0000 Subject: patch from JacobF on IRC, copy smoke settings. double checked none of these are used for runtime. --- source/blender/blenkernel/intern/smoke.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 8fd9c48cc61..b449ebb89ac 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -773,6 +773,9 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->domain->viewsettings = smd->domain->viewsettings; tsmd->domain->fluid_group = smd->domain->fluid_group; tsmd->domain->coll_group = smd->domain->coll_group; + tsmd->domain->vorticity = smd->domain->vorticity; + tsmd->domain->time_scale = smd->domain->time_scale; + tsmd->domain->border_collisions = smd->domain->border_collisions; MEM_freeN(tsmd->domain->effector_weights); tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights); @@ -781,6 +784,8 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData tsmd->flow->temp = smd->flow->temp; tsmd->flow->psys = smd->flow->psys; tsmd->flow->type = smd->flow->type; + tsmd->flow->flags = smd->flow->flags; + tsmd->flow->vel_multi = smd->flow->vel_multi; } else if (tsmd->coll) { ; /* leave it as initialised, collision settings is mostly caches */ -- cgit v1.2.3 From ad0dd98f26bc681c92a0a1893c17a3bc484a0cb5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Dec 2010 02:40:13 +0000 Subject: fix for some mistakes in recent commit. --- source/blender/blenkernel/intern/pointcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 440a3136108..c989db9dfd1 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2982,7 +2982,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) if(cache->totpoint > totpoint) sprintf(mem_info, "%i cells + High Resolution cached", totpoint); else - sprintf(mem_info, "%i cells cached"); + sprintf(mem_info, "%i cells cached", totpoint); } else { int cfra = cache->startframe; -- cgit v1.2.3 From f5f332892cd12a4323650504b33de40f529d2b8a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Dec 2010 05:59:11 +0000 Subject: workaround [#24958] Cloth pinning not working detailed explanation as to why this is needed in report. --- source/blender/blenkernel/intern/cloth.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index f8772cd802f..946d03d388a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -447,6 +447,11 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return dm; } + /* XXX, workaround for bug [#24958], see report for more info */ + if(CustomData_has_layer(&dm->vertData, CD_MDEFORMVERT) && !CustomData_has_layer(&result->vertData, CD_MDEFORMVERT)) { + DM_add_vert_layer(result, CD_MDEFORMVERT, CD_DUPLICATE, dm->getVertDataArray(dm, CD_MDEFORMVERT)); + } + if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts)) -- cgit v1.2.3 From b36ab837780c513ab38f56294092816e1fd67af9 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Wed, 1 Dec 2010 12:23:10 +0000 Subject: Fix for [#24958] Cloth pinning not working * Cloth now uses the original derived mesh for simulation and a new dm only for applying the simulation result. * Reverted Campbell's temporary workaround r33406. --- source/blender/blenkernel/intern/cloth.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 946d03d388a..be715fac352 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -447,11 +447,6 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, return dm; } - /* XXX, workaround for bug [#24958], see report for more info */ - if(CustomData_has_layer(&dm->vertData, CD_MDEFORMVERT) && !CustomData_has_layer(&result->vertData, CD_MDEFORMVERT)) { - DM_add_vert_layer(result, CD_MDEFORMVERT, CD_DUPLICATE, dm->getVertDataArray(dm, CD_MDEFORMVERT)); - } - if(clmd->sim_parms->reset || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) || (clmd->clothObject && result->getNumVerts(result) != clmd->clothObject->numverts)) @@ -473,10 +468,10 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, BKE_ptcache_invalidate(cache); /* do simulation */ - if(!do_init_cloth(ob, clmd, result, framenr)) + if(!do_init_cloth(ob, clmd, dm, framenr)) return result; - do_step_cloth(ob, clmd, result, framenr); + do_step_cloth(ob, clmd, dm, framenr); cloth_to_object(ob, clmd, result); return result; @@ -497,12 +492,12 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, framedelta= -1; /* initialize simulation data if it didn't exist already */ - if(!do_init_cloth(ob, clmd, result, framenr)) + if(!do_init_cloth(ob, clmd, dm, framenr)) return result; if((framenr == startframe) && (clmd->sim_parms->preroll == 0)) { BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED); - do_init_cloth(ob, clmd, result, framenr); + do_init_cloth(ob, clmd, dm, framenr); BKE_ptcache_validate(cache, framenr); cache->flag &= ~PTCACHE_REDO_NEEDED; return result; @@ -540,7 +535,7 @@ DerivedMesh *clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, /* do simulation */ BKE_ptcache_validate(cache, framenr); - if(!do_step_cloth(ob, clmd, result, framenr)) { + if(!do_step_cloth(ob, clmd, dm, framenr)) { BKE_ptcache_invalidate(cache); } else -- cgit v1.2.3 From 024b0f92d52cc2a6851d1b58aa68c58a644c4cb4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Dec 2010 23:40:21 +0000 Subject: fixed crash with rigid body constraints not having their child pointer read correctly. --- source/blender/blenkernel/intern/constraint.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index f15e0bc3144..c1a6200bf60 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2996,6 +2996,7 @@ static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userda /* target only */ func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->child, userdata); } static int rbj_get_tars (bConstraint *con, ListBase *list) -- cgit v1.2.3 From 1dbc93b540ade1d7883bb9e3080e4581ddf2c4dc Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 2 Dec 2010 04:06:02 +0000 Subject: Additional fix for #24958 Cloth pinning not working * Don't assume that the original dm given to cloth modifier is a cddm --- source/blender/blenkernel/intern/cloth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index be715fac352..b781b18862c 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -936,7 +936,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm ) { unsigned int numverts = dm->getNumVerts ( dm ); unsigned int numfaces = dm->getNumFaces ( dm ); - MFace *mface = CDDM_get_faces(dm); + MFace *mface = dm->getFaceArray( dm ); unsigned int i = 0; /* Allocate our vertices. */ @@ -1049,8 +1049,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm ) unsigned int numverts = (unsigned int)dm->getNumVerts ( dm ); unsigned int numedges = (unsigned int)dm->getNumEdges ( dm ); unsigned int numfaces = (unsigned int)dm->getNumFaces ( dm ); - MEdge *medge = CDDM_get_edges ( dm ); - MFace *mface = CDDM_get_faces ( dm ); + MEdge *medge = dm->getEdgeArray ( dm ); + MFace *mface = dm->getFaceArray ( dm ); int index2 = 0; // our second vertex index LinkNode **edgelist = NULL; EdgeHash *edgehash = NULL; -- cgit v1.2.3 From 5ca7c1b0f88ec3f48a83dc641f864d6ee4979ae2 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Thu, 2 Dec 2010 14:52:07 +0000 Subject: Fix for [#25006] Particle system crash (missing check for negative index) --- source/blender/blenkernel/intern/particle_system.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 63f2d692c6d..f4af518d137 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -340,6 +340,11 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) /* cache the verts/faces! */ LOOP_PARTICLES { + if(pa->num < 0) { + pa->num_dmcache = -1; + continue; + } + if(psys->part->from == PART_FROM_VERT) { if(nodearray[pa->num]) pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link); -- cgit v1.2.3 From 30179f4dc66ff45a5e0077962c0151d7e7865ca1 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 2 Dec 2010 16:12:55 +0000 Subject: IRC comment fix: Option "free all texture-images" after render, was also freeing unsaved painted images. Now it skips them. --- source/blender/blenkernel/intern/image.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 31eae70f159..da1d59a0835 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -607,15 +607,21 @@ void BKE_image_free_all_textures(void) for(ima= G.main->image.first; ima; ima= ima->id.next) { if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) { - /* ImBuf *ibuf; + for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) { - if(ibuf->mipmap[0]) + /* escape when image is painted on */ + if(ibuf->userflags & IB_BITMAPDIRTY) + break; + + /* if(ibuf->mipmap[0]) totsize+= 1.33*ibuf->x*ibuf->y*4; else - totsize+= ibuf->x*ibuf->y*4; - } */ - image_free_buffers(ima); + totsize+= ibuf->x*ibuf->y*4;*/ + + } + if(ibuf==NULL) + image_free_buffers(ima); } } /* printf("freed total %d MB\n", totsize/(1024*1024)); */ -- cgit v1.2.3 From b45c3363fd65a734a87d0917988fda6ae9d9df3c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 01:52:28 +0000 Subject: fix for some pedantic warnings. --- source/blender/blenkernel/intern/deform.c | 4 ++-- source/blender/blenkernel/intern/pointcache.c | 2 ++ source/blender/blenkernel/intern/smoke.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 2eecc6d5c1b..ad797736a85 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -463,7 +463,7 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, } -MDeformWeight *defvert_find_index(const MDeformVert *dvert, int defgroup) +MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup) { if(dvert && defgroup >= 0) { MDeformWeight *dw = dvert->dw; @@ -479,7 +479,7 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, int defgroup) /* Ensures that mv has a deform weight entry for the specified defweight group */ /* Note this function is mirrored in editmesh_tools.c, for use for editvertices */ -MDeformWeight *defvert_verify_index(MDeformVert *dv, int defgroup) +MDeformWeight *defvert_verify_index(MDeformVert *dv, const int defgroup) { MDeformWeight *newdw; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index c989db9dfd1..fb0d04b7473 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -652,6 +652,7 @@ static int ptcache_totpoint_smoke(void *smoke_v, int UNUSED(cfra)) } /* Smoke functions */ +#if 0 static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; @@ -663,6 +664,7 @@ static int ptcache_totpoint_smoke_turbulence(void *smoke_v, int UNUSED(cfra)) else return 0; } +#endif // forward decleration static int ptcache_file_write(PTCacheFile *pf, void *f, size_t tot, int size); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index b449ebb89ac..cca02dde25d 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -110,6 +110,8 @@ static void tend ( void ) { gettimeofday ( &_tend,&tz ); } + +#if 0 // unused static double tval() { double t1, t2; @@ -118,6 +120,7 @@ static double tval() return t2-t1; } #endif +#endif struct Object; struct Scene; -- cgit v1.2.3 From cfc1b133f664b024acc460e0204bb0bea66a83d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 03:44:39 +0000 Subject: updates to patch from Dan Eicher, allow adding a NodeGroup through bpy.data.node_groups.new(name, type) made some minor changes. --- source/blender/blenkernel/intern/node.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 4c88cbfaa55..7f6fcdbdf40 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -496,9 +496,7 @@ bNode *nodeMakeGroupFromSelected(bNodeTree *ntree) return NULL; /* OK! new nodetree */ - ngroup= alloc_libblock(&G.main->nodetree, ID_NT, "NodeGroup"); - ngroup->type= ntree->type; - ngroup->alltypes= ntree->alltypes; + ngroup= ntreeAddTree("NodeGroup", ntree->type, TRUE); /* move nodes over */ for(node= ntree->nodes.first; node; node= nextn) { @@ -884,6 +882,11 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup, ID *id) bNode *node= NULL; bNodeType *ntype= NULL; + if (ngroup && BLI_findindex(&G.main->nodetree, ngroup)==-1) { + printf("nodeAddNodeType() error: '%s' not in main->nodetree\n", ngroup->id.name); + return NULL; + } + if(type>=NODE_DYNAMIC_MENU) { int a=0, idx= type-NODE_DYNAMIC_MENU; ntype= ntree->alltypes.first; @@ -1034,21 +1037,22 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock) } -bNodeTree *ntreeAddTree(int type) +bNodeTree *ntreeAddTree(const char *name, int type, const short is_group) { - bNodeTree *ntree= MEM_callocN(sizeof(bNodeTree), "new node tree"); + bNodeTree *ntree; + + if (is_group) + ntree= alloc_libblock(&G.main->nodetree, ID_NT, name); + else { + ntree= MEM_callocN(sizeof(bNodeTree), "new node tree"); + *( (short *)ntree->id.name )= type; + BLI_strncpy(ntree->id.name+2, name, sizeof(ntree->id.name)); + } + ntree->type= type; ntree->alltypes.first = NULL; ntree->alltypes.last = NULL; - /* this helps RNA identify ID pointers as nodetree */ - if(ntree->type==NTREE_SHADER) - BLI_strncpy(ntree->id.name, "NTShader Nodetree", sizeof(ntree->id.name)); - else if(ntree->type==NTREE_COMPOSIT) - BLI_strncpy(ntree->id.name, "NTCompositing Nodetree", sizeof(ntree->id.name)); - else if(ntree->type==NTREE_TEXTURE) - BLI_strncpy(ntree->id.name, "NTTexture Nodetree", sizeof(ntree->id.name)); - ntreeInitTypes(ntree); return ntree; } -- cgit v1.2.3 From aca76ddb502cbf0ee7888c3356f9f35240919410 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 3 Dec 2010 12:08:59 +0000 Subject: Fix for [#24899] Sequence Transform strips don't apply animation properly to scale. * Rendering a scene strip updated all animation data to it's frame, so fcurves were left with the wrong value. * Now the animation data is recalculated to original frame after rendering each scene strip. --- source/blender/blenkernel/intern/sequencer.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 9eafb3fb3e3..f5842fbe72d 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2085,6 +2085,9 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr { // scene can be NULL after deletions ibuf = seq_render_scene_strip_impl(context, seq, nr); + /* Scene strips update all animation, so we need to restore original state.*/ + BKE_animsys_evaluate_all_animation(context.bmain, cfra); + copy_to_ibuf_still(context, seq, nr, ibuf); break; } -- cgit v1.2.3 From cd972535027a73ba70069051fe9038b6a8b5696a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 12:30:59 +0000 Subject: - added GCC warning -Wstrict-prototypes - fixed bug in paste material, exposed by stricter warnings. - removed/renamed various shadowed vars. - removed BGE lamp.colour, only allow lamp.color attribute. --- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/blenkernel/intern/fmodifier.c | 2 +- source/blender/blenkernel/intern/icons.c | 2 +- source/blender/blenkernel/intern/implicit.c | 2 +- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/seqeffects.c | 26 +++++++++++----------- source/blender/blenkernel/intern/softbody.c | 6 ++--- source/blender/blenkernel/intern/suggestions.c | 4 ++-- source/blender/blenkernel/intern/text.c | 2 +- .../blender/blenkernel/intern/writeframeserver.c | 8 +++---- 11 files changed, 29 insertions(+), 29 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index b781b18862c..2469f7f7dbe 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -65,7 +65,7 @@ void tend ( void ) { gettimeofday ( &_tend,&tz ); } -double tval() +double tval(void) { double t1, t2; t1 = ( double ) _tstart.tv_sec + ( double ) _tstart.tv_usec/ ( 1000*1000 ); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index c1a6200bf60..f92f2326aeb 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -3903,7 +3903,7 @@ static bConstraintTypeInfo *constraintsTypeInfo[NUM_CONSTRAINT_TYPES]; static short CTI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when CTI_INIT is non-zero */ -static void constraints_init_typeinfo () { +static void constraints_init_typeinfo (void) { constraintsTypeInfo[0]= NULL; /* 'Null' Constraint */ constraintsTypeInfo[1]= &CTI_CHILDOF; /* ChildOf Constraint */ constraintsTypeInfo[2]= &CTI_TRACKTO; /* TrackTo Constraint */ diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 5ef41d17d63..1ed8241325e 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -932,7 +932,7 @@ static FModifierTypeInfo *fmodifiersTypeInfo[FMODIFIER_NUM_TYPES]; static short FMI_INIT= 1; /* when non-zero, the list needs to be updated */ /* This function only gets called when FMI_INIT is non-zero */ -static void fmods_init_typeinfo () +static void fmods_init_typeinfo (void) { fmodifiersTypeInfo[0]= NULL; /* 'Null' F-Curve Modifier */ fmodifiersTypeInfo[1]= &FMI_GENERATOR; /* Generator F-Curve Modifier */ diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 78306705d6b..30e4318e256 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -76,7 +76,7 @@ static void icon_free(void *val) /* create an id for a new icon and make sure that ids from deleted icons get reused after the integer number range is used up */ -static int get_next_free_id() +static int get_next_free_id(void) { int startId = gFirstIconId; diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index bdf71a8c6f0..3d6710b186d 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -85,7 +85,7 @@ static void itend(void) { gettimeofday(&_itend,&itz); } -double itval() +double itval(void) { double t1, t2; t1 = (double)_itstart.tv_sec + (double)_itstart.tv_usec/(1000*1000); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 8096f0277bb..ac61acac56a 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1402,7 +1402,7 @@ void paste_matcopybuf(Material *ma) MEM_freeN(ma->nodetree); } - GPU_materials_free(ma); + GPU_material_free(ma); id= (ma->id); memcpy(ma, &matcopybuf, sizeof(Material)); diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 2efef52ed3e..c11b51b9dd4 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -119,8 +119,8 @@ static struct ImBuf * prepare_effect_imbufs( static void open_plugin_seq(PluginSeq *pis, const char *seqname) { - int (*version)(); - void* (*alloc_private)(); + int (*version)(void); + void* (*alloc_private)(void); char *cp; /* to be sure: (is tested for) */ @@ -143,7 +143,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) if (pis->handle != 0) { /* find the address of the version function */ - version= (int (*)())PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); + version= (int (*)(void))PIL_dynlib_find_symbol(pis->handle, "plugin_seq_getversion"); if (test_dlerr(pis->name, "plugin_seq_getversion")) return; if (version != 0) { @@ -177,7 +177,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname) return; } } - alloc_private = (void* (*)())PIL_dynlib_find_symbol( + alloc_private = (void* (*)(void))PIL_dynlib_find_symbol( pis->handle, "plugin_seq_alloc_private_data"); if (alloc_private) { pis->instance_private_data = alloc_private(); @@ -246,7 +246,7 @@ static void init_plugin(Sequence * seq, const char * fname) /* * FIXME: should query plugin! Could be generator, that needs zero inputs... */ -static int num_inputs_plugin() +static int num_inputs_plugin(void) { return 1; } @@ -969,7 +969,7 @@ static void gamtabs(float gamma) } -static void build_gammatabs() +static void build_gammatabs(void) { if (gamma_tabs_init == FALSE) { gamtabs(2.0f); @@ -1860,7 +1860,7 @@ static void init_wipe_effect(Sequence *seq) seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars"); } -static int num_inputs_wipe() +static int num_inputs_wipe(void) { return 1; } @@ -2044,7 +2044,7 @@ static void init_transform_effect(Sequence *seq) transform->uniform_scale=0; } -static int num_inputs_transform() +static int num_inputs_transform(void) { return 1; } @@ -2613,7 +2613,7 @@ static void init_glow_effect(Sequence *seq) glow->bNoComp = 0; } -static int num_inputs_glow() +static int num_inputs_glow(void) { return 1; } @@ -2700,7 +2700,7 @@ static void init_solid_color(Sequence *seq) cv->col[0] = cv->col[1] = cv->col[2] = 0.5; } -static int num_inputs_color() +static int num_inputs_color(void) { return 0; } @@ -2809,7 +2809,7 @@ static struct ImBuf * do_solid_color( ********************************************************************** */ /* no effect inputs for multicam, we use give_ibuf_seq */ -static int num_inputs_multicam() +static int num_inputs_multicam(void) { return 0; } @@ -2884,7 +2884,7 @@ static void load_speed_effect(Sequence * seq) v->length = 0; } -static int num_inputs_speed() +static int num_inputs_speed(void) { return 1; } @@ -3059,7 +3059,7 @@ static void free_noop(struct Sequence *UNUSED(seq)) } -static int num_inputs_default() +static int num_inputs_default(void) { return 2; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 978b3c9864f..ceee544d1b8 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1659,7 +1659,7 @@ static void *exec_scan_for_ext_spring_forces(void *data) return 0; } -static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func())) +static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,int totsprings,int *UNUSED(ptr_to_break_func(void))) { ListBase *do_effector = NULL; ListBase threads; @@ -2175,7 +2175,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN /* since this is definitely the most CPU consuming task here .. try to spread it */ /* core function _softbody_calc_forces_slice_in_a_thread */ /* result is int to be able to flag user break */ -static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func()),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow,int ifirst,int ilast,int *UNUSED(ptr_to_break_func(void)),ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { float iks; int bb,do_selfcollision,do_springcollision,do_aero; @@ -2386,7 +2386,7 @@ static void *exec_softbody_calc_forces(void *data) return 0; } -static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func()),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) +static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow,int totpoint,int *UNUSED(ptr_to_break_func(void)),struct ListBase *do_effector,int do_deflector,float fieldfactor, float windfactor) { ListBase threads; SB_thread_context *sb_threads; diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 1b720c1adaa..7d39203cefc 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -54,7 +54,7 @@ static int txttl_cmp(const char *first, const char *second, int len) { return cmp; } -static void txttl_free_suggest() { +static void txttl_free_suggest(void) { SuggItem *item, *prev; for (item = suggestions.last; item; item=prev) { prev = item->prev; @@ -66,7 +66,7 @@ static void txttl_free_suggest() { suggestions.top = 0; } -static void txttl_free_docs() { +static void txttl_free_docs(void) { if (documentation) { MEM_freeN(documentation); documentation = NULL; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index bdb8d11945c..b78525d4f4e 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -93,7 +93,7 @@ TMARK_EDITALL is set the group ID defines which other markers should be edited. The mrk->clr field is used to visually group markers where the flags may not match. A template system, for example, may allow editing of repeating tokens (in one group) but include other marked positions (in another group) all in the -same template with the same colour. +same template with the same color. Undo -- diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index bbc441f3622..3bdfd6c6b74 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -77,16 +77,16 @@ static int select_was_interrupted_by_signal() return (WSAGetLastError() == WSAEINTR); } #else -static int startup_socket_system() +static int startup_socket_system(void) { return 1; } -static void shutdown_socket_system() +static void shutdown_socket_system(void) { } -static int select_was_interrupted_by_signal() +static int select_was_interrupted_by_signal(void) { return (errno == EINTR); } @@ -367,7 +367,7 @@ int append_frameserver(RenderData *UNUSED(rd), int frame, int *pixels, int rectx return 0; } -void end_frameserver() +void end_frameserver(void) { if (connsock != -1) { closesocket(connsock); -- cgit v1.2.3 From 8934b617394ae4508968e5676526c9c4427e7b06 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 3 Dec 2010 14:35:03 +0000 Subject: Fix #25017: Bezier Curve Deform Twisting after adding Shape Keys - Invalid step was used in curve_applyKeyVertexTilts - Minor cleanup in editcurve stuff --- source/blender/blenkernel/intern/curve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 42d1c13c9ac..d5d13c9badd 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3056,7 +3056,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key) for(i=0; ipntsu; i++,bezt++) { key+=3*3; bezt->alfa= *key; - key++; + key+=3; } } else { -- cgit v1.2.3 From 7c86a1a95cbc643fdbbf8c28f0422face8a15a19 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 16:45:04 +0000 Subject: compile fixes for mingw32. --- source/blender/blenkernel/intern/cloth.c | 2 +- source/blender/blenkernel/intern/implicit.c | 2 +- source/blender/blenkernel/intern/smoke.c | 2 +- source/blender/blenkernel/intern/writeframeserver.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 2469f7f7dbe..7473ff6875a 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -49,7 +49,7 @@ void tstart ( void ) void tend ( void ) { } -double tval() +double tval( void ) { return 0; } diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index 3d6710b186d..e19f36a2a0b 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -63,7 +63,7 @@ static void itend(void) { QueryPerformanceCounter(&_itend); } -double itval() +double itval(void) { return ((double)_itend.QuadPart - (double)_itstart.QuadPart)/((double)ifreq.QuadPart); diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index cca02dde25d..1833cc4eeac 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -94,7 +94,7 @@ static void tend ( void ) { QueryPerformanceCounter ( &liCurrentTime ); } -static double tval() +static double tval( void ) { return ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart )); } diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index 3bdfd6c6b74..dd63c266491 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -62,17 +62,17 @@ static int render_height; #if defined(_WIN32) -static int startup_socket_system() +static int startup_socket_system(void) { WSADATA wsa; return (WSAStartup(MAKEWORD(2,0),&wsa) == 0); } -static void shutdown_socket_system() +static void shutdown_socket_system(void) { WSACleanup(); } -static int select_was_interrupted_by_signal() +static int select_was_interrupted_by_signal(void) { return (WSAGetLastError() == WSAEINTR); } -- cgit v1.2.3 From 263830f0004481cd4921f03f4242d7c80794b08d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Dec 2010 17:05:21 +0000 Subject: Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,. Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into. --- source/blender/blenkernel/intern/BME_Customdata.c | 2 +- source/blender/blenkernel/intern/anim_sys.c | 10 ++++---- source/blender/blenkernel/intern/context.c | 4 +-- source/blender/blenkernel/intern/customdata.c | 6 ++--- source/blender/blenkernel/intern/depsgraph.c | 8 +++--- source/blender/blenkernel/intern/fcurve.c | 4 +-- source/blender/blenkernel/intern/gpencil.c | 2 +- source/blender/blenkernel/intern/idcode.c | 2 +- source/blender/blenkernel/intern/image.c | 2 +- source/blender/blenkernel/intern/ipo.c | 29 +++++++++++----------- source/blender/blenkernel/intern/library.c | 8 +++--- source/blender/blenkernel/intern/modifier.c | 2 +- source/blender/blenkernel/intern/node.c | 6 ++--- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 4 +-- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenkernel/intern/property.c | 2 +- source/blender/blenkernel/intern/report.c | 14 ++++++----- source/blender/blenkernel/intern/seqcache.c | 10 ++++---- source/blender/blenkernel/intern/sequencer.c | 10 ++++---- source/blender/blenkernel/intern/text.c | 10 ++++---- source/blender/blenkernel/intern/writeffmpeg.c | 2 +- 22 files changed, 72 insertions(+), 69 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index 1087b3a873c..b64efa811de 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -43,7 +43,7 @@ /********************* Layer type information **********************/ typedef struct BME_LayerTypeInfo { int size; - char *defaultname; + const char *defaultname; void (*copy)(const void *source, void *dest, int count); void (*free)(void *data, int count, int size); void (*interp)(void **sources, float *weights, float *sub_weights, int count, void *dest); diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ae683dab7b2..e48183ac479 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -294,7 +294,7 @@ static short check_rna_path_is_valid (ID *owner_id, char *path) /* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate * NOTE: we assume that oldName and newName have [" "] padding around them */ -static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldpath, int verify_paths) +static char *rna_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, char *oldpath, int verify_paths) { char *prefixPtr= strstr(oldpath, prefix); char *oldNamePtr= strstr(oldpath, oldName); @@ -352,7 +352,7 @@ static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, cha } /* Check RNA-Paths for a list of F-Curves */ -static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths) +static void fcurves_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *curves, int verify_paths) { FCurve *fcu; @@ -365,7 +365,7 @@ static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, } /* Check RNA-Paths for a list of Drivers */ -static void drivers_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths) +static void drivers_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, char *oldKey, char *newKey, ListBase *curves, int verify_paths) { FCurve *fcu; @@ -405,7 +405,7 @@ static void drivers_path_rename_fix (ID *owner_id, char *prefix, char *oldName, } /* Fix all RNA-Paths for Actions linked to NLA Strips */ -static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *strips, int verify_paths) +static void nlastrips_path_rename_fix (ID *owner_id, const char *prefix, char *oldName, char *newName, ListBase *strips, int verify_paths) { NlaStrip *strip; @@ -425,7 +425,7 @@ static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName * NOTE: it is assumed that the structure we're replacing is <["><"]> * i.e. pose.bones["Bone"] */ -void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths) +void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, const char *prefix, char *oldName, char *newName, int oldSubscript, int newSubscript, int verify_paths) { NlaTrack *nlt; char *oldN, *newN; diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index fe010d812b1..96dbe727505 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -773,7 +773,7 @@ int CTX_data_mode_enum(const bContext *C) /* would prefer if we can use the enum version below over this one - Campbell */ /* must be aligned with above enum */ -static char *data_mode_strings[] = { +static const char *data_mode_strings[] = { "mesh_edit", "curve_edit", "surface_edit", @@ -790,7 +790,7 @@ static char *data_mode_strings[] = { "objectmode", 0 }; -char *CTX_data_mode_string(const bContext *C) +const char *CTX_data_mode_string(const bContext *C) { return data_mode_strings[CTX_data_mode_enum(C)]; } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 1ef1cefa120..1a3d31bdcf8 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -60,9 +60,9 @@ /********************* Layer type information **********************/ typedef struct LayerTypeInfo { int size; /* the memory size of one element of this layer's data */ - char *structname; /* name of the struct used, for file writing */ + const char *structname; /* name of the struct used, for file writing */ int structnum; /* number of structs per element, for file writing */ - char *defaultname; /* default layer name */ + const char *defaultname; /* default layer name */ /* a function to copy count elements of this layer's data * (deep copy if appropriate) @@ -2212,7 +2212,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest, } -void CustomData_file_write_info(int type, char **structname, int *structnum) +void CustomData_file_write_info(int type, const char **structname, int *structnum) { const LayerTypeInfo *typeInfo = layerType_getInfo(type); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index c4ee97c21c5..65a58b02377 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -846,7 +846,7 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob) return node; } -static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, char *name) +static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, DagNode *fob2, short rel, const char *name) { DagAdjList *itA = fob2->parent; @@ -868,7 +868,7 @@ static void dag_add_parent_relation(DagForest *UNUSED(forest), DagNode *fob1, Da fob2->parent = itA; } -void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name) +void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, const char *name) { DagAdjList *itA = fob1->child; @@ -893,7 +893,7 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel fob1->child = itA; } -static char *dag_node_name(DagNode *node) +static const char *dag_node_name(DagNode *node) { if(node->ob == NULL) return "null"; @@ -938,7 +938,7 @@ static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode) return 0; } -static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, DagNode *endnode, char *name) +static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode, DagNode *endnode, const char *name) { DagNode *node; diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 888eae3ed78..325e64bf768 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -166,7 +166,7 @@ void copy_fcurves (ListBase *dst, ListBase *src) /* ----------------- Finding F-Curves -------------------------- */ /* high level function to get an fcurve from C without having the rna */ -FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, char *prop_name, int index) +FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *prop_name, int index) { /* anim vars */ AnimData *adt= BKE_animdata_from_id(id); @@ -884,7 +884,7 @@ typedef struct DriverVarTypeInfo { /* allocation of target slots */ int num_targets; /* number of target slots required */ - char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ + const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ int target_flags[MAX_DRIVER_TARGETS]; /* flags defining the requirements for each slot */ } DriverVarTypeInfo; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 5612d69ed76..80f26277689 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -190,7 +190,7 @@ bGPDlayer *gpencil_layer_addnew (bGPdata *gpd) } /* add a new gp-datablock */ -bGPdata *gpencil_data_addnew (char name[]) +bGPdata *gpencil_data_addnew (const char name[]) { bGPdata *gpd; diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 6411959e655..359603e9a50 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -35,7 +35,7 @@ typedef struct { unsigned short code; - char *name, *plural; + const char *name, *plural; int flags; #define IDTYPE_FLAGS_ISLINKABLE (1<<0) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index da1d59a0835..5c48569575e 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -766,7 +766,7 @@ int BKE_imtype_is_movie(int imtype) int BKE_add_image_extension(char *string, int imtype) { - char *extension= NULL; + const char *extension= NULL; if(imtype== R_IRIS) { if(!BLI_testextensie(string, ".rgb")) diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5dc1cc2d746..7a32562d3d7 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -102,7 +102,7 @@ void free_ipo (Ipo *ipo) /* Mapping Table for bitflag <-> RNA path */ typedef struct AdrBit2Path { int bit; - char *path; + const char *path; int array_index; } AdrBit2Path; @@ -171,7 +171,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths (int blocktype, int adrcode, int *t /* ADRCODE to RNA-Path Conversion Code - Standard */ /* Object types */ -static char *ob_adrcodes_to_paths (int adrcode, int *array_index) +static const char *ob_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -252,7 +252,7 @@ static char *ob_adrcodes_to_paths (int adrcode, int *array_index) /* PoseChannel types * NOTE: pchan name comes from 'actname' added earlier... */ -static char *pchan_adrcodes_to_paths (int adrcode, int *array_index) +static const char *pchan_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -296,7 +296,7 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index) } /* Constraint types */ -static char *constraint_adrcodes_to_paths (int adrcode, int *array_index) +static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -330,9 +330,9 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) } /* MTex (Texture Slot) types */ -static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) +static const char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) { - char *base=NULL, *prop=NULL; + const char *base=NULL, *prop=NULL; static char buf[128]; /* base part of path */ @@ -400,7 +400,7 @@ static char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index)) } /* Texture types */ -static char *texture_adrcodes_to_paths (int adrcode, int *array_index) +static const char *texture_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -480,7 +480,7 @@ static char *texture_adrcodes_to_paths (int adrcode, int *array_index) } /* Material Types */ -static char *material_adrcodes_to_paths (int adrcode, int *array_index) +static const char *material_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -564,7 +564,7 @@ static char *material_adrcodes_to_paths (int adrcode, int *array_index) } /* Camera Types */ -static char *camera_adrcodes_to_paths (int adrcode, int *array_index) +static const char *camera_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -604,7 +604,7 @@ static char *camera_adrcodes_to_paths (int adrcode, int *array_index) } /* Lamp Types */ -static char *lamp_adrcodes_to_paths (int adrcode, int *array_index) +static const char *lamp_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -646,7 +646,7 @@ static char *lamp_adrcodes_to_paths (int adrcode, int *array_index) } /* Sound Types */ -static char *sound_adrcodes_to_paths (int adrcode, int *array_index) +static const char *sound_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -669,7 +669,7 @@ static char *sound_adrcodes_to_paths (int adrcode, int *array_index) } /* World Types */ -static char *world_adrcodes_to_paths (int adrcode, int *array_index) +static const char *world_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -722,7 +722,7 @@ static char *world_adrcodes_to_paths (int adrcode, int *array_index) } /* Particle Types */ -static char *particle_adrcodes_to_paths (int adrcode, int *array_index) +static const char *particle_adrcodes_to_paths (int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index= 0; @@ -800,7 +800,8 @@ static char *particle_adrcodes_to_paths (int adrcode, int *array_index) static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence * seq, int *array_index) { DynStr *path= BLI_dynstr_new(); - char *propname=NULL, *rpath=NULL; + const char *propname=NULL; + char *rpath=NULL; char buf[512]; int dummy_index= 0; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8ce89182a3a..8e1220dde24 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -852,7 +852,7 @@ void free_main(Main *mainvar) /* ***************** ID ************************ */ -ID *find_id(char *type, const char *name) /* type: "OB" or "MA" etc */ +ID *find_id(const char *type, const char *name) /* type: "OB" or "MA" etc */ { ListBase *lb= which_libbase(G.main, GS(type)); return BLI_findstring(lb, name, offsetof(ID, name) + 2); @@ -941,7 +941,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor /* used by headerbuttons.c buttons.c editobject.c editseq.c */ /* if nr==NULL no MAX_IDPUP, this for non-header browsing */ -void IDnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr) +void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds= BLI_dynstr_new(); @@ -963,7 +963,7 @@ void IDnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, } /* skips viewer images */ -void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr) +void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr) { DynStr *pupds= BLI_dynstr_new(); @@ -1361,7 +1361,7 @@ void text_idbutton(struct ID *id, char *text) } } -void rename_id(ID *id, char *name) +void rename_id(ID *id, const char *name) { ListBase *lb; diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index dc2992662c9..6381315a8ca 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -216,7 +216,7 @@ int modifier_sameTopology(ModifierData *md) return ( mti->type == eModifierTypeType_OnlyDeform || mti->type == eModifierTypeType_Nonconstructive); } -void modifier_setError(ModifierData *md, char *format, ...) +void modifier_setError(ModifierData *md, const char *format, ...) { char buffer[2048]; va_list ap; diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 7f6fcdbdf40..120e6466608 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3220,7 +3220,7 @@ static void remove_dynamic_typeinfos(ListBase *list) if(ntype->inputs) { bNodeSocketType *sock= ntype->inputs; while(sock->type!=-1) { - MEM_freeN(sock->name); + MEM_freeN((void *)sock->name); sock++; } MEM_freeN(ntype->inputs); @@ -3228,13 +3228,13 @@ static void remove_dynamic_typeinfos(ListBase *list) if(ntype->outputs) { bNodeSocketType *sock= ntype->outputs; while(sock->type!=-1) { - MEM_freeN(sock->name); + MEM_freeN((void *)sock->name); sock++; } MEM_freeN(ntype->outputs); } if(ntype->name) { - MEM_freeN(ntype->name); + MEM_freeN((void *)ntype->name); } MEM_freeN(ntype); } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index fe557dfefa0..5f2a10c0b3e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -969,7 +969,7 @@ static void *add_obdata_from_type(int type) } } -static char *get_obdata_defname(int type) +static const char *get_obdata_defname(int type) { switch (type) { case OB_MESH: return "Mesh"; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f4af518d137..4e393af1a1c 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3625,8 +3625,8 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra)) FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; ParticleData *pa=0; - char *suffix = "fluidsurface_particles_####"; - char *suffix2 = ".gz"; + const char *suffix = "fluidsurface_particles_####"; + const char *suffix2 = ".gz"; char filename[256]; char debugStrBuffer[256]; int curFrame = sim->scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index fb0d04b7473..f7af3c68814 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1233,7 +1233,7 @@ static int ptcache_file_read_header_begin(PTCacheFile *pf) static int ptcache_file_write_header_begin(PTCacheFile *pf) { - char *bphysics = "BPHYSICS"; + const char *bphysics = "BPHYSICS"; if(fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) return 0; diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index d8001572b4f..dd57fef50c5 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -179,7 +179,7 @@ void unique_property(bProperty *first, bProperty *prop, int force) } } -bProperty *get_ob_property(Object *ob, char *name) +bProperty *get_ob_property(Object *ob, const char *name) { return BLI_findstring(&ob->prop, name, offsetof(bProperty, name)); } diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index f69547fd1da..5df912c871d 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -44,7 +44,7 @@ #endif #endif -static char *report_type_str(int type) +static const char *report_type_str(int type) { switch(type) { case RPT_DEBUG: return "Debug"; @@ -82,7 +82,7 @@ void BKE_reports_clear(ReportList *reports) while (report) { report_next= report->next; - MEM_freeN(report->message); + MEM_freeN((void *)report->message); MEM_freeN(report); report= report_next; } @@ -105,13 +105,15 @@ void BKE_report(ReportList *reports, ReportType type, const char *message) } if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) { + char *message_alloc; report= MEM_callocN(sizeof(Report), "Report"); report->type= type; report->typestr= report_type_str(type); len= strlen(message); - report->message= MEM_callocN(sizeof(char)*(len+1), "ReportMessage"); - memcpy(report->message, message, sizeof(char)*(len+1)); + message_alloc= MEM_callocN(sizeof(char)*(len+1), "ReportMessage"); + memcpy(message_alloc, message, sizeof(char)*(len+1)); + report->message= message_alloc; report->len= len; BLI_addtail(&reports->list, report); } @@ -163,7 +165,7 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend) BLI_dynstr_append(ds, prepend); BLI_dynstr_append(ds, report->message); - MEM_freeN(report->message); + MEM_freeN((void *)report->message); report->message= BLI_dynstr_get_cstring(ds); report->len= BLI_dynstr_get_len(ds); @@ -188,7 +190,7 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...) va_end(args); BLI_dynstr_append(ds, report->message); - MEM_freeN(report->message); + MEM_freeN((void *)report->message); report->message= BLI_dynstr_get_cstring(ds); report->len= BLI_dynstr_get_len(ds); diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 73351edbdd5..b25c533ad4c 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -60,9 +60,9 @@ static struct BLI_mempool * keypool = 0; static int ibufs_in = 0; static int ibufs_rem = 0; -static unsigned int HashHash(void *key_) +static unsigned int HashHash(const void *key_) { - seqCacheKey * key = (seqCacheKey*) key_; + const seqCacheKey *key = (seqCacheKey*) key_; unsigned int rval = seq_hash_render_data(&key->context); rval ^= *(unsigned int*) &key->cfra; @@ -72,10 +72,10 @@ static unsigned int HashHash(void *key_) return rval; } -static int HashCmp(void *a_, void *b_) +static int HashCmp(const void *a_, const void *b_) { - seqCacheKey * a = (seqCacheKey*) a_; - seqCacheKey * b = (seqCacheKey*) b_; + const seqCacheKey * a = (seqCacheKey*) a_; + const seqCacheKey * b = (seqCacheKey*) b_; if (a->seq < b->seq) { return -1; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index f5842fbe72d..fac773b2c6f 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -263,7 +263,7 @@ SeqRenderData seq_new_render_data( return rval; } -int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b) +int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b) { if (a->preview_render_size < b->preview_render_size) { return -1; @@ -317,7 +317,7 @@ int seq_cmp_render_data(SeqRenderData * a, SeqRenderData * b) return 0; } -unsigned int seq_hash_render_data(SeqRenderData * a) +unsigned int seq_hash_render_data(const SeqRenderData * a) { unsigned int rval = a->rectx + a->recty; @@ -875,7 +875,7 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) strcpy(seq->name+2, sui.name_dest); } -static char *give_seqname_by_type(int type) +static const char *give_seqname_by_type(int type) { switch(type) { case SEQ_META: return "Meta"; @@ -902,9 +902,9 @@ static char *give_seqname_by_type(int type) } } -char *give_seqname(Sequence *seq) +const char *give_seqname(Sequence *seq) { - char * name = give_seqname_by_type(seq->type); + const char *name = give_seqname_by_type(seq->type); if (!name) { if(seq->typeformat= NULL; } -static TextLine *txt_new_line(char *str) +static TextLine *txt_new_line(const char *str) { TextLine *tmp; @@ -1431,7 +1431,7 @@ void txt_print_undo(Text *text) { int i= 0; int op; - char *ops; + const char *ops; int linep, charp; dump_buffer(text); @@ -2470,7 +2470,7 @@ void indent(Text *text) int len, num; char *tmp; - char *add = "\t"; + const char *add = "\t"; int indentlen = 1; /* hardcoded: TXT_TABSIZE = 4 spaces: */ @@ -2531,7 +2531,7 @@ void indent(Text *text) void unindent(Text *text) { int num = 0; - char *remove = "\t"; + const char *remove = "\t"; int indent = 1; /* hardcoded: TXT_TABSIZE = 4 spaces: */ @@ -2694,7 +2694,7 @@ int setcurr_tab_spaces (Text *text, int space) const char *word = ":"; const char *comm = "#"; const char indent= (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t'; - static char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; + static const char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; if (!text) return 0; if (!text->curl) return 0; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 0ec38a035aa..bb00e6de5ce 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -69,7 +69,7 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -extern void do_init_ffmpeg(); +extern void do_init_ffmpeg(void); static int ffmpeg_type = 0; static int ffmpeg_codec = CODEC_ID_MPEG4; -- cgit v1.2.3 From 990b487c730ac192405682fa45232f6542cdd14c Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 3 Dec 2010 17:31:34 +0000 Subject: Bugfix #25026 Nurbs edit: 'switch order' crashed when order was higher than amount of points. --- source/blender/blenkernel/intern/curve.c | 63 +++++++++++++++++--------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index d5d13c9badd..9be64e27d20 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2906,38 +2906,41 @@ void switchdirectionNurb(Nurb *nu) bp2--; } if(nu->type == CU_NURBS) { - /* inverse knots */ - a= KNOTSU(nu); - fp1= nu->knotsu; - fp2= fp1+(a-1); - a/= 2; - while(fp1!=fp2 && a>0) { - SWAP(float, *fp1, *fp2); - a--; - fp1++; - fp2--; - } - /* and make in increasing order again */ - a= KNOTSU(nu); - fp1= nu->knotsu; - fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect"); - while(a--) { - fp2[0]= fabs(fp1[1]-fp1[0]); - fp1++; - fp2++; - } - - a= KNOTSU(nu)-1; - fp1= nu->knotsu; - fp2= tempf; - fp1[0]= 0.0; - fp1++; - while(a--) { - fp1[0]= fp1[-1]+fp2[0]; + /* no knots for too short paths */ + if(nu->knotsu) { + /* inverse knots */ + a= KNOTSU(nu); + fp1= nu->knotsu; + fp2= fp1+(a-1); + a/= 2; + while(fp1!=fp2 && a>0) { + SWAP(float, *fp1, *fp2); + a--; + fp1++; + fp2--; + } + /* and make in increasing order again */ + a= KNOTSU(nu); + fp1= nu->knotsu; + fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect"); + while(a--) { + fp2[0]= fabs(fp1[1]-fp1[0]); + fp1++; + fp2++; + } + + a= KNOTSU(nu)-1; + fp1= nu->knotsu; + fp2= tempf; + fp1[0]= 0.0; fp1++; - fp2++; + while(a--) { + fp1[0]= fp1[-1]+fp2[0]; + fp1++; + fp2++; + } + MEM_freeN(tempf); } - MEM_freeN(tempf); } } else { -- cgit v1.2.3 From fa4bbbb249bf9706e9c71d34748fbde87fa385fb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 4 Dec 2010 13:00:28 +0000 Subject: Maintenance, - remove some redundant declarations - changed VertexTangent and Path structs to avoid compiler alignment padding. --- source/blender/blenkernel/intern/colortools.c | 2 +- source/blender/blenkernel/intern/node.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 1be1b9b9ad0..1b3d100c3f8 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -43,7 +43,7 @@ #include "BKE_colortools.h" #include "BKE_curve.h" -#include "BKE_ipo.h" +#include "BKE_fcurve.h" #include "BKE_utildefines.h" #include "BLI_blenlib.h" diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 120e6466608..8db64e190a2 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1972,7 +1972,6 @@ static void composit_begin_exec(bNodeTree *ntree, int is_group) /* copy stack compbufs to sockets */ static void composit_end_exec(bNodeTree *ntree, int is_group) { - extern void print_compbuf(char *str, struct CompBuf *cbuf); bNode *node; bNodeStack *ns; int a; -- cgit v1.2.3 From 8c467a9c8a0a305182874f7acbaf0d29d82948e6 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 5 Dec 2010 01:48:49 +0000 Subject: Fix for [#25036] boids particle from 2.49 opened in 2.5 is crash !? * Old boids didn't have all of the necessary data for the new system. * Changed the particles code so that a check for all necessary data is always done before starting actual dynamics calculations. --- source/blender/blenkernel/intern/particle_system.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 4e393af1a1c..931339d90b4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3964,7 +3964,7 @@ static void fluid_default_settings(ParticleSettings *part){ fluid->buoyancy = 0.f; } -static void psys_changed_physics(ParticleSimulationData *sim) +static void psys_prepare_physics(ParticleSimulationData *sim) { ParticleSettings *part = sim->psys->part; @@ -4047,8 +4047,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if(psys->recalc & PSYS_RECALC_TYPE) psys_changed_type(&sim); - else if(psys->recalc & PSYS_RECALC_PHYS) - psys_changed_physics(&sim); + + /* setup necessary physics type dependent additional data if it doesn't yet exist */ + psys_prepare_physics(&sim); switch(part->type) { case PART_HAIR: -- cgit v1.2.3 From b110c7c8f2c5fafa6412e01d21d751a884bfe8b2 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 5 Dec 2010 18:59:23 +0000 Subject: Dependency graph: changed DAG_id_flush_update to DAG_id_tag_update. Now it only tags the ID and does the actual flush/update delayed, before the next redraw. For objects the update was already delayed, just flushing wasn't yet. This should help performance in python and animation editors, by making calls to RNA property update quicker. Still need to add calls in a few places where this was previously avoided due to bad performance. --- source/blender/blenkernel/intern/depsgraph.c | 163 +++++++++++++------------- source/blender/blenkernel/intern/mesh.c | 4 - source/blender/blenkernel/intern/particle.c | 4 +- source/blender/blenkernel/intern/pointcache.c | 2 +- source/blender/blenkernel/intern/scene.c | 2 + source/blender/blenkernel/intern/text.c | 2 +- 6 files changed, 88 insertions(+), 89 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 65a58b02377..97a27405db3 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -52,6 +52,7 @@ #include "BKE_global.h" #include "BKE_group.h" #include "BKE_key.h" +#include "BKE_library.h" #include "BKE_main.h" #include "BKE_mball.h" #include "BKE_modifier.h" @@ -2290,26 +2291,21 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS } } -void DAG_id_flush_update(ID *id, short flag) +static void dag_id_flush_update(Scene *sce, ID *id) { Main *bmain= G.main; - Scene *sce; Object *obt, *ob= NULL; short idtype; - unsigned int lay; - dag_current_scene_layers(bmain, &sce, &lay); - - if(!id || !sce || !sce->theDag) - return; + /* here we flush a few things before actual scene wide flush, mostly + due to only objects and not other datablocks being in the depsgraph */ /* set flags & pointcache for object */ if(GS(id->name) == ID_OB) { ob= (Object*)id; - ob->recalc |= (flag & OB_RECALC_ALL); BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH); - if(flag & OB_RECALC_DATA) { + if(ob->recalc & OB_RECALC_DATA) { /* all users of this ob->data should be checked */ id= ob->data; @@ -2374,23 +2370,90 @@ void DAG_id_flush_update(ID *id, short flag) /* set flags based on particle settings */ if(idtype == ID_PA) { ParticleSystem *psys; - for(obt=bmain->object.first; obt; obt= obt->id.next) { - for(psys=obt->particlesystem.first; psys; psys=psys->next) { - if(&psys->part->id == id) { + for(obt=bmain->object.first; obt; obt= obt->id.next) + for(psys=obt->particlesystem.first; psys; psys=psys->next) + if(&psys->part->id == id) BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH); - obt->recalc |= (flag & OB_RECALC_ALL); - psys->recalc |= (flag & PSYS_RECALC); - } - } - } } /* update editors */ dag_editors_update(bmain, id); } +} + +void DAG_ids_flush_tagged(Main *bmain) +{ + ListBase *lbarray[MAX_LIBARRAY]; + Scene *sce; + unsigned int lay; + int a, have_tag = 0; + + dag_current_scene_layers(bmain, &sce, &lay); + + if(!sce || !sce->theDag) + return; + + /* loop over all ID types */ + a = set_listbasepointers(bmain, lbarray); + + while(a--) { + ListBase *lb = lbarray[a]; + ID *id = lb->first; + + /* we tag based on first ID type character to avoid + looping over all ID's in case there are no tags */ + if(id && bmain->id_tag_update[id->name[0]]) { + for(; id; id=id->next) { + if(id->flag & LIB_ID_RECALC) { + dag_id_flush_update(sce, id); + id->flag &= ~LIB_ID_RECALC; + } + } + + have_tag = 1; + } + } - /* flush to other objects that depend on this one */ - DAG_scene_flush_update(bmain, sce, lay, 0); + if(have_tag) { + /* clear tags */ + memset(bmain->id_tag_update, 0, sizeof(bmain->id_tag_update)); + + /* flush changes to other objects */ + DAG_scene_flush_update(bmain, sce, lay, 0); + } +} + +void DAG_id_tag_update(ID *id, short flag) +{ + Main *bmain= G.main; + + /* tag ID for update */ + id->flag |= LIB_ID_RECALC; + bmain->id_tag_update[id->name[0]] = 1; + + /* flag is for objects and particle systems */ + if(flag) { + Object *ob; + ParticleSystem *psys; + short idtype = GS(id->name); + + if(idtype == ID_OB) { + /* only quick tag */ + ob = (Object*)id; + ob->recalc |= (flag & OB_RECALC_ALL); + } + else if(idtype == ID_PA) { + /* this is weak still, should be done delayed as well */ + for(ob=bmain->object.first; ob; ob=ob->id.next) { + for(psys=ob->particlesystem.first; psys; psys=psys->next) { + if(&psys->part->id == id) { + ob->recalc |= (flag & OB_RECALC_ALL); + psys->recalc |= (flag & PSYS_RECALC); + } + } + } + } + } } /* recursively descends tree, each node only checked once */ @@ -2423,68 +2486,6 @@ static int parent_check_node(DagNode *node, int curtime) return DAG_WHITE; } -/* all nodes that influence this object get tagged, for calculating the exact - position of this object at a given timeframe */ -void DAG_id_update_flags(ID *id) -{ - Main *bmain= G.main; - Scene *sce; - DagNode *node; - DagAdjList *itA; - Object *ob; - unsigned int lay; - - dag_current_scene_layers(bmain, &sce, &lay); - - if(!id || !sce || !sce->theDag) - return; - - /* objects only currently */ - if(GS(id->name) != ID_OB) - return; - - ob= (Object*)id; - - /* tag nodes unchecked */ - for(node = sce->theDag->DagNode.first; node; node= node->next) - node->color = DAG_WHITE; - - node= dag_find_node(sce->theDag, ob); - - /* object not in scene? then handle group exception. needs to be dagged once too */ - if(node==NULL) { - Group *group= NULL; - while( (group = find_group(ob, group)) ) { - GroupObject *go; - /* primitive; tag all... this call helps building groups for particles */ - for(go= group->gobject.first; go; go= go->next) - go->ob->recalc= OB_RECALC_ALL; - } - } - else { - - node->color = DAG_GRAY; - - sce->theDag->time++; - node= sce->theDag->DagNode.first; - for(itA = node->child; itA; itA= itA->next) { - if(itA->node->type==ID_OB && itA->node->lasttime!=sce->theDag->time) - itA->node->color= parent_check_node(itA->node, sce->theDag->time); - } - - /* set recalcs and flushes */ - DAG_scene_update_flags(bmain, sce, lay); - - /* now we clear recalcs, unless color is set */ - for(node = sce->theDag->DagNode.first; node; node= node->next) { - if(node->type==ID_OB && node->color==DAG_WHITE) { - Object *ob= node->ob; - ob->recalc= 0; - } - } - } -} - /* ******************* DAG FOR ARMATURE POSE ***************** */ /* we assume its an armature with pose */ diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index eb413187544..7a72207ff69 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1222,8 +1222,6 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth) mf->flag &= ~ME_SMOOTH; } } - -// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA); } void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float **faceNors_r) @@ -1483,8 +1481,6 @@ void mesh_pmv_revert(Mesh *me) me->pv->edge_map= NULL; MEM_freeN(me->pv->vert_map); me->pv->vert_map= NULL; - -// XXX do this in caller DAG_id_flush_update(&me->id, OB_RECALC_DATA); } } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 9c2efe395dc..6fec4775769 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3425,7 +3425,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0); DAG_scene_sort(G.main, scene); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); return md; } @@ -3462,7 +3462,7 @@ void object_remove_particle_system(Scene *scene, Object *ob) ob->mode &= ~OB_MODE_PARTICLE_EDIT; DAG_scene_sort(G.main, scene); - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } static void default_particle_settings(ParticleSettings *part) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index f7af3c68814..cd45a39f2c9 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2313,7 +2313,7 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) if(CONTINUE_PHYSICS == 0) { for(ob=bmain->object.first; ob; ob=ob->id.next) if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED)) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } } } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index edbace71c6d..9bbadbacb37 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -968,6 +968,8 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen /* this is called in main loop, doing tagged updates before redraw */ void scene_update_tagged(Main *bmain, Scene *scene) { + DAG_ids_flush_tagged(bmain); + scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index f6833596883..6e0289e907b 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -521,7 +521,7 @@ void unlink_text(Main *bmain, Text *text) } if(update) - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } /* pynodes */ -- cgit v1.2.3 From 9668c29ba00ed830109665ea132b6292cdfe9e2a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Dec 2010 23:14:48 +0000 Subject: bpath iterator updates - loop over sequencer plugin and texture voxel paths. - fix leak in python bpy.utils.blend_path() and use PyUnicode_DecodeFSDefault() to ensure correct paths with different encodings. - operators to make paths absolute & relative now redraw the view. --- source/blender/blenkernel/intern/depsgraph.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 97a27405db3..fe6b320d0bd 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2456,6 +2456,7 @@ void DAG_id_tag_update(ID *id, short flag) } } +#if 0 // UNUSED /* recursively descends tree, each node only checked once */ /* node is checked to be of type object */ static int parent_check_node(DagNode *node, int curtime) @@ -2485,6 +2486,7 @@ static int parent_check_node(DagNode *node, int curtime) return DAG_WHITE; } +#endif /* ******************* DAG FOR ARMATURE POSE ***************** */ -- cgit v1.2.3 From 2f366d1544ecc5618d7190b779ccc75f2f144d0a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 5 Dec 2010 23:50:55 +0000 Subject: use BLI_strnlen rather then strlen when comparing against fixed lengths. --- source/blender/blenkernel/intern/exotic.c | 12 ++++++------ source/blender/blenkernel/intern/ipo.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index c16d566c7c5..51fd5e1e4c6 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -1171,10 +1171,10 @@ static void dxf_get_mesh(Scene *scene, Mesh** m, Object** o, int noob) *o = add_object(scene, OB_MESH); ob = *o; - if (strlen(entname)) new_id(&G.main->object, (ID *)ob, entname); - else if (strlen(layname)) new_id(&G.main->object, (ID *)ob, layname); + if (entname[0]) new_id(&G.main->object, (ID *)ob, entname); + else if (layname[0]) new_id(&G.main->object, (ID *)ob, layname); - if (strlen(layname)) ob->lay= dxf_get_layer_num(scene, layname); + if (layname[0]) ob->lay= dxf_get_layer_num(scene, layname); else ob->lay= scene->lay; // not nice i know... but add_object() sets active base, which needs layer setting too (ton) scene->basact->lay= ob->lay; @@ -1193,8 +1193,8 @@ static void dxf_get_mesh(Scene *scene, Mesh** m, Object** o, int noob) ((ID *)me)->us=0; - if (strlen(entname)) new_id(&G.main->mesh, (ID *)me, entname); - else if (strlen(layname)) new_id(&G.main->mesh, (ID *)me, layname); + if (entname[0]) new_id(&G.main->mesh, (ID *)me, entname); + else if (layname[0]) new_id(&G.main->mesh, (ID *)me, layname); vcenter = zerovec; } @@ -2395,7 +2395,7 @@ static void dxf_read(Scene *scene, const char *filename) I leave it commented out here as warning (ton) */ //for (i=0; itotcol; i++) ob->mat[i]= ((Mesh*)ob->data)->mat[i]; - if (strlen(layname)) ob->lay= dxf_get_layer_num(scene, layname); + if (layname[0]) ob->lay= dxf_get_layer_num(scene, layname); else ob->lay= scene->lay; /* link to scene */ diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 7a32562d3d7..5be8bda4cd9 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1197,7 +1197,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve * fcurve= fcu; /* set path */ - fcurve->rna_path= BLI_strdupn(abp->path, strlen(abp->path)); + fcurve->rna_path= BLI_strdup(abp->path); fcurve->array_index= abp->array_index; /* convert keyframes -- cgit v1.2.3