From 291c99c5d9fd25e69a17a150ee86d3261987cf34 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 09:28:01 +0000 Subject: - saturation option for sequencer strips, runs before multiply and color balance. - multiply of 0.0 wasnt being applied. --- source/blender/blenkernel/intern/sequencer.c | 29 +++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 1ab4e75ee06..69dd4b3a1b7 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1769,12 +1769,31 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf if(seq->flag & SEQ_FLIPX) { IMB_flipx(se->ibuf); } - if(seq->flag & SEQ_FLIPY) { - IMB_flipy(se->ibuf); - } - if(seq->mul == 0.0) { - seq->mul = 1.0; + if(seq->sat != 1.0f) { + /* inline for now, could become an imbuf function */ + int i; + char *rct= (char *)se->ibuf->rect; + float *rctf= se->ibuf->rect_float; + const float sat= seq->sat; + float hsv[3]; + + if(rct) { + float rgb[3]; + for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rct+=4) { + rgb_byte_to_float(rct, rgb); + rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2); + rgb_float_to_byte(rgb, rct); + } + } + + if(rctf) { + for (i = se->ibuf->x * se->ibuf->y; i > 0; i--, rctf+=4) { + rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2); + hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2); + } + } } mul = seq->mul; -- cgit v1.2.3 From 862427e0b2de1a0dc3d5bed023a3e908c2444775 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 09:31:28 +0000 Subject: fix for crash copying in the sequencer. --- source/blender/blenkernel/intern/sequencer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 69dd4b3a1b7..4a5d08f96cc 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -247,9 +247,9 @@ void seq_free_sequence(Scene *scene, Sequence *seq) if(seq->scene_sound) sound_remove_scene_sound(scene, seq->scene_sound); - } - seq_free_animdata(scene, seq); + seq_free_animdata(scene, seq); + } MEM_freeN(seq); } @@ -4062,6 +4062,7 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine) seq->flag= SELECT; seq->start= cfra; seq->machine= machine; + seq->sat= 1.0; seq->mul= 1.0; seq->blend_opacity = 100.0; seq->volume = 1.0f; -- cgit v1.2.3 From 161ee379a06d57f0dc732960ae05f089924727fb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 13 Jul 2010 10:29:41 +0000 Subject: 2.5: startup.blend changes, these should all be consistent with new datablocks, mostly the startup.blend was trailing behind. Also renamed B.blend.c. * Lamp shadow buffer was Classical instead of Classical Halfway. * Point Lamp was named "Spot". * Render resolution is 50% 1080p. * Scene and material bake/use tangent space normal maps. * Remove empty text datablock. * Enable auto ray bias on material. * Change default material diffuse color to match new material. * Mist start/depth from 0/0 to 5/25 so it does something. * AO uses Add instead of Multiply. * Change world colors for new world same as startup.blend. * Default cube rotation was 0,-0,0 now 0,0,0. * Enable relative/filter/hide files in user preferences. --- source/blender/blenkernel/intern/world.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index fa8c8188f54..6fb1c5ff70c 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -72,12 +72,12 @@ World *add_world(char *name) wrld= alloc_libblock(&G.main->world, ID_WO, name); - wrld->horr= 0.25f; - wrld->horg= 0.25f; - wrld->horb= 0.25f; - wrld->zenr= 0.1f; - wrld->zeng= 0.1f; - wrld->zenb= 0.1f; + wrld->horr= 0.05f; + wrld->horg= 0.05f; + wrld->horb= 0.05f; + wrld->zenr= 0.01f; + wrld->zeng= 0.01f; + wrld->zenb= 0.01f; wrld->skytype= 0; wrld->stardist= 15.0f; wrld->starsize= 2.0f; @@ -96,6 +96,8 @@ World *add_world(char *name) wrld->ao_approx_error= 0.25f; wrld->preview = NULL; + wrld->miststa = 5.0f; + wrld->mistdist = 25.0f; return wrld; } -- cgit v1.2.3 From e86b78c47c7ebfd15ea51de99c02e45790cbf9d7 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 13 Jul 2010 15:19:15 +0000 Subject: Merging revision 30264:30270 from my GSoC branch to trunk, logs: Bugfix for [#22284] Blender cursor gets stuck in the timeline when scrubbing (jack transport). Dirty hack fix for: * [#22366] Cutting audio and meta strips with audio does not actually cut audio * [#22639] Audio not clipped to meta bounds Also fixed a seemingly symptomless bug in sequencer_edit.c --- source/blender/blenkernel/intern/sequencer.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 4a5d08f96cc..e8f8c2f3c3b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -517,6 +517,31 @@ void calc_sequence_disp(Scene *scene, Sequence *seq) seq_update_sound(scene, seq); } +static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq) +{ + Sequence *seq; + + /* for sound we go over full meta tree to update bounds of the sound strips, + since sound is played outside of evaluating the imbufs, */ + for(seq=metaseq->seqbase.first; seq; seq=seq->next) { + if(seq->type == SEQ_META) { + seq_update_sound_bounds_recursive(scene, seq); + } + else if((seq->type == SEQ_SOUND) || (seq->type == SEQ_SCENE)) { + if(seq->scene_sound) { + int startofs = seq->startofs; + int endofs = seq->endofs; + if(seq->startofs + seq->start < metaseq->start + metaseq->startofs) + startofs = metaseq->start + metaseq->startofs - seq->start; + + if(seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs) + endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs; + sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs); + } + } + } +} + void calc_sequence(Scene *scene, Sequence *seq) { Sequence *seqm; @@ -576,6 +601,7 @@ void calc_sequence(Scene *scene, Sequence *seq) new_tstripdata(seq); } } + seq_update_sound_bounds_recursive(scene, seq); } calc_sequence_disp(scene, seq); } -- cgit v1.2.3 From 8ee36e1da56b10a84e02ba9790fbcafbdbf43f51 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 16:06:51 +0000 Subject: - fix for eternal loop with metaballs in set scenes. - next_object() now loops through all set scenes, not just the first one. - removed F_SET, rather them having a mode for looping on a set, just use the set when the first scene ends. - metaballs can now glob between scenes however there are still some depsgraph issues that existed before. --- source/blender/blenkernel/BKE_scene.h | 2 +- source/blender/blenkernel/intern/mball.c | 16 ++++++++------- source/blender/blenkernel/intern/scene.c | 35 +++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 20 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index b5b0a72d2d8..f0fb2a65673 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -63,7 +63,7 @@ struct Scene *set_scene_name(char *name); struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); -int next_object(struct Scene *scene, int val, struct Base **base, struct Object **ob); +int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob); struct Object *scene_find_camera(struct Scene *sc); struct Object *scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH int scene_camera_switch_update(struct Scene *scene); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index c41dcfa9588..e35d8bce886 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -296,6 +296,7 @@ int is_mball_basis_for(Object *ob1, Object *ob2) * because this metaball influence polygonisation of metaballs. */ void copy_mball_properties(Scene *scene, Object *active_object) { + Scene *sce_iter= scene; Base *base; Object *ob; MetaBall *active_mball = (MetaBall*)active_object->data; @@ -305,10 +306,10 @@ void copy_mball_properties(Scene *scene, Object *active_object) splitIDname(active_object->id.name+2, basisname, &basisnr); /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if(F_ERROR==next_object(scene, 0, 0, 0)) + if(F_ERROR==next_object(&sce_iter, 0, 0, 0)) return; - while(next_object(scene, 1, &base, &ob)) { + while(next_object(&sce_iter, 1, &base, &ob)) { if (ob->type==OB_MBALL) { if(ob!=active_object){ splitIDname(ob->id.name+2, obname, &obnr); @@ -338,6 +339,7 @@ void copy_mball_properties(Scene *scene, Object *active_object) */ Object *find_basis_mball(Scene *scene, Object *basis) { + Scene *sce_iter= scene; Base *base; Object *ob,*bob= basis; MetaElem *ml=NULL; @@ -348,10 +350,10 @@ Object *find_basis_mball(Scene *scene, Object *basis) totelem= 0; /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if(F_ERROR==next_object(scene, 0, 0, 0)) + if(F_ERROR==next_object(&sce_iter, 0, 0, 0)) return NULL; - while(next_object(scene, 1, &base, &ob)) { + while(next_object(&sce_iter, 1, &base, &ob)) { if (ob->type==OB_MBALL) { if(ob==bob){ @@ -1507,6 +1509,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb) float init_meta(Scene *scene, Object *ob) /* return totsize */ { + Scene *sce_iter= scene; Base *base; Object *bob; MetaBall *mb; @@ -1523,9 +1526,8 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ splitIDname(ob->id.name+2, obname, &obnr); /* make main array */ - - next_object(scene, 0, 0, 0); - while(next_object(scene, 1, &base, &bob)) { + next_object(&sce_iter, 0, 0, 0); + while(next_object(&sce_iter, 1, &base, &bob)) { if(bob->type==OB_MBALL) { zero_size= 0; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 2896ac68f40..fe52375617b 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -593,7 +593,7 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce) /* used by metaballs * doesnt return the original duplicated object, only dupli's */ -int next_object(Scene *scene, int val, Base **base, Object **ob) +int next_object(Scene **scene, int val, Base **base, Object **ob) { static ListBase *duplilist= NULL; static DupliObject *dupob; @@ -622,17 +622,21 @@ int next_object(Scene *scene, int val, Base **base, Object **ob) /* the first base */ if(fase==F_START) { - *base= scene->base.first; + *base= (*scene)->base.first; if(*base) { *ob= (*base)->object; fase= F_SCENE; } else { /* exception: empty scene */ - if(scene->set && scene->set->base.first) { - *base= scene->set->base.first; - *ob= (*base)->object; - fase= F_SET; + while((*scene)->set) { + (*scene)= (*scene)->set; + if((*scene)->base.first) { + *base= (*scene)->base.first; + *ob= (*base)->object; + fase= F_SCENE; + break; + } } } } @@ -642,11 +646,14 @@ int next_object(Scene *scene, int val, Base **base, Object **ob) if(*base) *ob= (*base)->object; else { if(fase==F_SCENE) { - /* scene is finished, now do the set */ - if(scene->set && scene->set->base.first) { - *base= scene->set->base.first; - *ob= (*base)->object; - fase= F_SET; + /* (*scene) is finished, now do the set */ + while((*scene)->set) { + (*scene)= (*scene)->set; + if((*scene)->base.first) { + *base= (*scene)->base.first; + *ob= (*base)->object; + break; + } } } } @@ -661,7 +668,7 @@ int next_object(Scene *scene, int val, Base **base, Object **ob) this enters eternal loop because of makeDispListMBall getting called inside of group_duplilist */ if((*base)->object->dup_group == NULL) { - duplilist= object_duplilist(scene, (*base)->object); + duplilist= object_duplilist((*scene), (*base)->object); dupob= duplilist->first; @@ -697,6 +704,10 @@ int next_object(Scene *scene, int val, Base **base, Object **ob) } } + /* if(ob && *ob) { + printf("Scene: '%s', '%s'\n", (*scene)->id.name+2, (*ob)->id.name+2); + } */ + /* reset recursion test */ in_next_object= 0; -- cgit v1.2.3 From c0ba1671c34683654b691684473bb4f3899604a7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 16:53:17 +0000 Subject: group refcount checking was inconsistent. - if a group has one or more objects in it, it gets a refcount of 1 on load (unchanged from before) - dupli-groups, and materials no longer add/remove a reference. - now groups are only freed when they contain no objects or when manually unlinked. --- source/blender/blenkernel/intern/anim.c | 2 +- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/object.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index fa0ddc5f1d3..157c0743c50 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -741,7 +741,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i if(go->ob->transflag & OB_DUPLI) { copy_m4_m4(dob->ob->obmat, dob->mat); - object_duplilist_recursive((ID *)group, scene, go->ob, lb, ob->obmat, level+1, animated); + object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, level+1, animated); copy_m4_m4(dob->ob->obmat, dob->omat); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3b6a10c0872..11c96e9a347 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -210,7 +210,7 @@ Material *copy_material(Material *ma) #if 0 // XXX old animation system id_us_plus((ID *)man->ipo); #endif // XXX old animation system - id_us_plus((ID *)man->group); + id_lib_extern((ID *)man->group); for(a=0; amtex[a]) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6d264b3fed2..012b38570da 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -283,7 +283,6 @@ void free_object(Object *ob) ob->path= 0; if(ob->adt) BKE_free_animdata((ID *)ob); if(ob->poselib) ob->poselib->id.us--; - if(ob->dup_group) ob->dup_group->id.us--; if(ob->gpd) ob->gpd->id.us--; if(ob->defbase.first) BLI_freelistN(&ob->defbase); @@ -1320,7 +1319,7 @@ Object *copy_object(Object *ob) /* increase user numbers */ id_us_plus((ID *)obn->data); - id_us_plus((ID *)obn->dup_group); + id_lib_extern((ID *)obn->dup_group); for(a=0; atotcol; a++) id_us_plus((ID *)obn->mat[a]); -- cgit v1.2.3 From 03e638d1285b2a26902230772ae9261406fd6658 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 22:21:59 +0000 Subject: - make duplis real wasnt redrawing - small caps option for titles (doing manually is quite painful to watch). --- source/blender/blenkernel/intern/curve.c | 1 + source/blender/blenkernel/intern/font.c | 65 +++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 18 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index a01ee15dde1..2e645592229 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -138,6 +138,7 @@ Curve *add_curve(char *name, int type) cu->fsize= 1.0; cu->ulheight = 0.05; cu->texflag= CU_AUTOSPACE; + cu->smallcaps_scale= 0.75f; cu->twist_mode= CU_TWIST_MINIMUM; // XXX: this one seems to be the best one in most cases, at least for curve deform... cu->bb= unit_boundbox(); diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 01f2b57de71..d07bd2ba8e5 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1,4 +1,4 @@ -/* font.c +/* font.c * * * $Id$ @@ -34,6 +34,7 @@ #include #include #include +#include #include "MEM_guardedalloc.h" @@ -597,9 +598,23 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float } bezt2 = nu2->bezt; + if(info->flag & CU_SMALLCAPS) { + const float sca= cu->smallcaps_scale; + for (i= nu2->pntsu; i > 0; i--) { + fp= bezt2->vec[0]; + fp[0] *= sca; + fp[1] *= sca; + fp[3] *= sca; + fp[4] *= sca; + fp[6] *= sca; + fp[7] *= sca; + bezt2++; + } + } + bezt2 = nu2->bezt; + for (i= nu2->pntsu; i > 0; i--) { fp= bezt2->vec[0]; - fp[0]= (fp[0]+ofsx)*fsize; fp[1]= (fp[1]+ofsy)*fsize; fp[3]= (fp[3]+ofsx)*fsize; @@ -635,6 +650,20 @@ int BKE_font_getselection(Object *ob, int *start, int *end) } } +static float char_width(Curve *cu, VChar *che, CharInfo *info) +{ + // The character wasn't found, propably ascii = 0, then the width shall be 0 as well + if(che == NULL) { + return 0.0f; + } + else if(info->flag & CU_SMALLCAPS) { + return che->width * cu->smallcaps_scale; + } + else { + return che->width; + } +} + struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) { VFont *vfont, *oldvfont; @@ -729,8 +758,18 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) makebreak: // Characters in the list che = vfd->characters.first; - ascii = mem[i]; info = &(custrinfo[i]); + ascii = mem[i]; + if(info->flag & CU_SMALLCAPS) { + ascii = towupper(ascii); + if(mem[i] != ascii) { + mem[i]= ascii; + } + else { + info->flag &= ~CU_SMALLCAPS; /* could have a different way to not scale caps */ + } + } + vfont = which_vfont(cu, info); if(vfont==NULL) break; @@ -780,11 +819,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) return 0; } - // The character wasn't found, propably ascii = 0, then the width shall be 0 as well - if(!che) - twidth = 0; - else - twidth = che->width; + twidth = char_width(cu, che, info); // Calculate positions if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) { @@ -881,10 +916,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) else wsfac = 1.0; // Set the width of the character - if(!che) - twidth = 0; - else - twidth = che->width; + twidth = char_width(cu, che, info); xof += (twidth*wsfac*(1.0+(info->kern/40.0)) ) + xtrax; @@ -1024,10 +1056,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) che = che->next; } - if(che) - twidth = che->width; - else - twidth = 0; + twidth = char_width(cu, che, info); dtime= distfac*0.35f*twidth; /* why not 0.5? */ dtime= distfac*0.5f*twidth; /* why not 0.5? */ @@ -1167,8 +1196,8 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) break; che = che->next; } - - if(!che) twidth =0; else twidth=che->width; + + twidth = char_width(cu, che, info); ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap); build_underline(cu, ct->xof*cu->fsize, ct->yof*cu->fsize + (cu->ulpos-0.05)*cu->fsize, ct->xof*cu->fsize + ulwidth, -- cgit v1.2.3 From 3580d6229a2c2ee5815ff76665d4bb014eacfb99 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 13 Jul 2010 23:51:21 +0000 Subject: - text3d was missing menu items for toggling bold/underline/italic/smallcaps. - made smallcaps use a temp flag so caps can still have the smallcaps flag. - utility function for getting the char from a font. find_vfont_char(), was inline in ~5 places. - removed CU_STYLE mix of flags only used in one place, not needed. removed 'style' from rna too. - fix for some warnings. --- source/blender/blenkernel/intern/font.c | 81 +++++++++++++-------------------- 1 file changed, 31 insertions(+), 50 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index d07bd2ba8e5..a99f2599f66 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -427,12 +427,12 @@ VFont *load_vfont(char *name) static VFont *which_vfont(Curve *cu, CharInfo *info) { - switch(info->flag & CU_STYLE) { - case CU_BOLD: + switch(info->flag & (CU_CHINFO_BOLD|CU_CHINFO_ITALIC)) { + case CU_CHINFO_BOLD: if (cu->vfontb) return(cu->vfontb); else return(cu->vfont); - case CU_ITALIC: + case CU_CHINFO_ITALIC: if (cu->vfonti) return(cu->vfonti); else return(cu->vfont); - case (CU_BOLD|CU_ITALIC): + case (CU_CHINFO_BOLD|CU_CHINFO_ITALIC): if (cu->vfontbi) return(cu->vfontbi); else return(cu->vfont); default: return(cu->vfont); @@ -450,6 +450,17 @@ VFont *get_builtin_font(void) return load_vfont(""); } +static VChar *find_vfont_char(VFontData *vfd, intptr_t character) +{ + VChar *che= NULL; + + for(che = vfd->characters.first; che; che = che->next) { + if(che->index == character) + break; + } + return che; /* NULL if not found */ +} + static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, int charidx, short mat_nr) { Nurb *nu2; @@ -524,14 +535,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float si= (float)sin(rot); co= (float)cos(rot); - // Find the correct character from the font - che = vfd->characters.first; - while(che) - { - if(che->index == character) - break; - che = che->next; - } + che= find_vfont_char(vfd, character); // Select the glyph data if(che) @@ -598,7 +602,7 @@ static void buildchar(Curve *cu, unsigned long character, CharInfo *info, float } bezt2 = nu2->bezt; - if(info->flag & CU_SMALLCAPS) { + if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) { const float sca= cu->smallcaps_scale; for (i= nu2->pntsu; i > 0; i--) { fp= bezt2->vec[0]; @@ -656,7 +660,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info) if(che == NULL) { return 0.0f; } - else if(info->flag & CU_SMALLCAPS) { + else if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) { return che->width * cu->smallcaps_scale; } else { @@ -745,7 +749,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) oldvfont = NULL; - for (i=0; iselboxes) MEM_freeN(cu->selboxes); cu->selboxes = NULL; @@ -760,26 +764,19 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) che = vfd->characters.first; info = &(custrinfo[i]); ascii = mem[i]; - if(info->flag & CU_SMALLCAPS) { + if(info->flag & CU_CHINFO_SMALLCAPS) { ascii = towupper(ascii); if(mem[i] != ascii) { mem[i]= ascii; - } - else { - info->flag &= ~CU_SMALLCAPS; /* could have a different way to not scale caps */ + info->flag |= CU_CHINFO_SMALLCAPS_CHECK; } } vfont = which_vfont(cu, info); if(vfont==NULL) break; - - // Find the character - while(che) { - if(che->index == ascii) - break; - che = che->next; - } + + che= find_vfont_char(vfd, ascii); /* * The character wasn't in the current curve base so load it @@ -791,12 +788,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) } /* Try getting the character again from the list */ - che = vfd->characters.first; - while(che) { - if(che->index == ascii) - break; - che = che->next; - } + che= find_vfont_char(vfd, ascii); /* No VFont found */ if (vfont==0) { @@ -833,13 +825,13 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) i = j-1; xof = ct->xof; ct[1].dobreak = 1; - custrinfo[i+1].flag |= CU_WRAP; + custrinfo[i+1].flag |= CU_CHINFO_WRAP; goto makebreak; } if (chartransdata[j].dobreak) { // fprintf(stderr, "word too long: %c%c%c...\n", mem[j], mem[j+1], mem[j+2]); ct->dobreak= 1; - custrinfo[i+1].flag |= CU_WRAP; + custrinfo[i+1].flag |= CU_CHINFO_WRAP; ct -= 1; cnr -= 1; i--; @@ -1047,14 +1039,8 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) /* rotate around center character */ ascii = mem[i]; - - // Find the character - che = vfd->characters.first; - while(che) { - if(che->index == ascii) - break; - che = che->next; - } + + che= find_vfont_char(vfd, ascii); twidth = char_width(cu, che, info); @@ -1180,22 +1166,17 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) if(cha != '\n' && cha != '\r') buildchar(cu, cha, info, ct->xof, ct->yof, ct->rot, i); - if ((info->flag & CU_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { + if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) { float ulwidth, uloverlap= 0.0f; if ( (i<(slen-1)) && (mem[i+1] != '\n') && (mem[i+1] != '\r') && - ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_UNDERLINE)) && ((custrinfo[i+1].flag & CU_WRAP)==0) + ((mem[i+1] != ' ') || (custrinfo[i+1].flag & CU_CHINFO_UNDERLINE)) && ((custrinfo[i+1].flag & CU_CHINFO_WRAP)==0) ) { uloverlap = xtrax + 0.1; } // Find the character, the characters has to be in the memory already // since character checking has been done earlier already. - che = vfd->characters.first; - while(che) { - if(che->index == cha) - break; - che = che->next; - } + che= find_vfont_char(vfd, cha); twidth = char_width(cu, che, info); ulwidth = cu->fsize * ((twidth* (1.0+(info->kern/40.0)))+uloverlap); -- cgit v1.2.3 From 6b6cdbe322a2663954b8c46699a8e162d1e923c5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Jul 2010 07:47:03 +0000 Subject: pointcache support for relative external paths with the useual // prefix as well as library path option. --- source/blender/blenkernel/intern/pointcache.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index e14828d0f20..5295a496d2b 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1067,20 +1067,20 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup static int ptcache_path(PTCacheID *pid, char *filename) { - Library *lib; + Library *lib= (pid)? pid->ob->id.lib: NULL; + const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce; size_t i; - lib= (pid)? pid->ob->id.lib: NULL; - if(pid->cache->flag & PTCACHE_EXTERNAL) { strcpy(filename, pid->cache->path); + + if(strncmp(filename, "//", 2)==0) + BLI_path_abs(filename, blendfilename); + return BLI_add_slash(filename); /* new strlen() */ } else if (G.relbase_valid || lib) { char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */ - char *blendfilename; - - blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.sce; BLI_split_dirfile(blendfilename, NULL, file); i = strlen(file); -- cgit v1.2.3 From 7ad8e5b6f87fbee78d6676e33b80be9cfc74feea Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Jul 2010 09:46:26 +0000 Subject: Fix #22816: crash in depsgraph loading some 2.49 files, tagging objects for update on load should be done later because it's not known yet which scene is used with which layers visible before the windows are created. --- source/blender/blenkernel/intern/blender.c | 5 +++-- source/blender/blenkernel/intern/depsgraph.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 57e72fc5671..101c7a3bbbd 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -313,8 +313,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) /* baseflags, groups, make depsgraph, etc */ set_scene_bg(CTX_data_scene(C)); - - DAG_on_load_update(); MEM_freeN(bfd); } @@ -478,6 +476,9 @@ static int read_undosave(bContext *C, UndoElem *uel) strcpy(G.sce, scestr); G.fileflags= fileflags; + if(success) + DAG_on_load_update(); + return success; } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 1a1ca8a8d3e..142f80a350e 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -2217,7 +2217,7 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay *sce= bmain->scene.first; if(*sce) *lay= (*sce)->lay; - /* XXX for background mode, we should get the scen + /* XXX for background mode, we should get the scene from somewhere, for the -S option, but it's in the context, how to get it here? */ } @@ -2248,7 +2248,7 @@ void DAG_on_load_update(void) dag_current_scene_layers(bmain, &scene, &lay); - if(scene) { + if(scene && scene->theDag) { /* derivedmeshes and displists are not saved to file so need to be remade, tag them so they get remade in the scene update loop, note armature poses or object matrices are preserved and do not -- cgit v1.2.3 From f406cf4ac82510c6b064d9411ec0cbd38a0ef7e0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 14 Jul 2010 10:46:12 +0000 Subject: Fix a few compile warnings and rename gpu_buffers.h to GPU_buffers.h for consistency. --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index d5ece6ae31f..8b1443403a3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -59,7 +59,7 @@ #include "BIF_gl.h" #include "BIF_glutil.h" -#include "gpu_buffers.h" +#include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_extensions.h" #include "GPU_material.h" diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index a586ca57966..41e33002999 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -54,7 +54,7 @@ #include "MEM_guardedalloc.h" -#include "gpu_buffers.h" +#include "GPU_buffers.h" #include "GPU_draw.h" #include "GPU_extensions.h" #include "GPU_material.h" -- cgit v1.2.3 From ae1748b98470f08ed805e101b218f44c17d9b6b2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Jul 2010 12:16:23 +0000 Subject: bugfix [#22847] 18+ char Name in Edit Strip causes errors when duplicating strips --- source/blender/blenkernel/intern/sequencer.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index e8f8c2f3c3b..d97e6151a13 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -795,7 +795,7 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui) Sequence *seq; for(seq=seqbasep->first; seq; seq= seq->next) { if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) { - sprintf(sui->name_dest, "%.18s.%03d", sui->name_src, sui->count++); + sprintf(sui->name_dest, "%.17s.%03d", sui->name_src, sui->count++); /*24 - 2 for prefix, -1 for \0 */ sui->match= 1; /* be sure to re-scan */ } } @@ -816,12 +816,17 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq) strcpy(sui.name_src, seq->name+2); strcpy(sui.name_dest, seq->name+2); + sui.count= 1; + sui.match= 1; /* assume the worst to start the loop */ + /* Strip off the suffix */ - if ((dot=strrchr(sui.name_src, '.'))) + if ((dot=strrchr(sui.name_src, '.'))) { *dot= '\0'; + dot++; - sui.count= 1; - sui.match= 1; /* assume the worst to start the loop */ + if(*dot) + sui.count= atoi(dot) + 1; + } while(sui.match) { sui.match= 0; -- cgit v1.2.3 From 5505697ac508c02b8a2e196c5a8c07431bc687cf Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Wed, 14 Jul 2010 14:11:03 +0000 Subject: Merge GSOC Sculpt Branch: 28499-30319 https://svn.blender.org/svnroot/bf-blender/branches/soc-2010-jwilkins See log of that branch for details. --- source/blender/blenkernel/BKE_blender.h | 4 +- source/blender/blenkernel/BKE_brush.h | 10 +++ source/blender/blenkernel/BKE_paint.h | 4 + source/blender/blenkernel/intern/brush.c | 102 +++++++++++++++++++------- source/blender/blenkernel/intern/colortools.c | 56 ++++++++++---- source/blender/blenkernel/intern/icons.c | 5 +- source/blender/blenkernel/intern/image.c | 6 +- 7 files changed, 140 insertions(+), 47 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 7ac5815943a..5936805765d 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -43,9 +43,9 @@ struct bContext; struct ReportList; struct Scene; struct Main; - + #define BLENDER_VERSION 252 -#define BLENDER_SUBVERSION 5 +#define BLENDER_SUBVERSION 6 // XXX: this shouldn't be merged with trunk, this is so Sculpt branch can detect old files #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index fcc636215c9..6a209167f93 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -84,5 +84,15 @@ unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float size_weight); int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight); +/* unified strength and size */ +int sculpt_get_brush_size(struct Brush *brush); +void sculpt_set_brush_size(struct Brush *brush, int size); +int sculpt_get_lock_brush_size(struct Brush *brush); +float sculpt_get_brush_unprojected_radius(struct Brush *brush); +void sculpt_set_brush_unprojected_radius(struct Brush *brush, float unprojected_radius); +float sculpt_get_brush_alpha(struct Brush *brush); +void sculpt_set_brush_alpha(struct Brush *brush, float alpha); + + #endif diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index cd412ca5a74..f9954b3d55d 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -28,6 +28,8 @@ #ifndef BKE_PAINT_H #define BKE_PAINT_H +#include "DNA_vec_types.h" + struct Brush; struct MFace; struct MultireModifierData; @@ -96,6 +98,8 @@ typedef struct SculptSession { struct GPUDrawObject *drawobject; int modifiers_active; + + rcti previous_r; } SculptSession; void free_sculptsession(struct Object *ob); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 538012ccc41..c423d426e32 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -53,8 +53,7 @@ #include "BKE_main.h" #include "BKE_paint.h" #include "BKE_texture.h" - - +#include "BKE_icons.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -70,29 +69,59 @@ Brush *add_brush(const char *name) brush= alloc_libblock(&G.main->brush, ID_BR, name); - brush->rgb[0]= 1.0f; + /* BRUSH SCULPT TOOL SETTINGS */ + brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */ + brush->size= 35; /* radius of the brush in pixels */ + brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */ + brush->autosmooth_factor= 0.0f; + brush->crease_pinch_factor= 0.5f; + brush->sculpt_plane = SCULPT_DISP_DIR_VIEW; + brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */ + brush->plane_trim= 0.5f; + brush->clone.alpha= 0.5f; + brush->normal_weight= 0.0f; + + /* BRUSH PAINT TOOL SETTINGS */ + brush->rgb[0]= 1.0f; /* default rgb color of the brush when painting - white */ brush->rgb[1]= 1.0f; brush->rgb[2]= 1.0f; - brush->alpha= 0.2f; - brush->size= 25; - brush->spacing= 3.5f; + + /* BRUSH STROKE SETTINGS */ + brush->flag |= (BRUSH_SPACE|BRUSH_SPACE_ATTEN); + brush->spacing= 10; /* how far each brush dot should be spaced as a percentage of brush diameter */ + brush->smooth_stroke_radius= 75; - brush->smooth_stroke_factor= 0.9; - brush->rate= 0.1f; + brush->smooth_stroke_factor= 0.9f; + + brush->rate= 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */ + brush->jitter= 0.0f; - brush->clone.alpha= 0.5; - brush->sculpt_tool = SCULPT_TOOL_DRAW; - brush->flag |= BRUSH_SPACE; - brush_curve_preset(brush, CURVE_PRESET_SMOOTH); - + /* BRUSH TEXTURE SETTINGS */ default_mtex(&brush->mtex); + brush->texture_sample_bias= 0; /* value to added to texture samples */ + + /* brush appearance */ + + brush->image_icon= NULL; + + brush->add_col[0]= 1.00; /* add mode color is light red */ + brush->add_col[1]= 0.39; + brush->add_col[2]= 0.39; + + brush->sub_col[0]= 0.39; /* subtract mode color is light blue */ + brush->sub_col[1]= 0.39; + brush->sub_col[2]= 1.00; + + /* the default alpha falloff curve */ + brush_curve_preset(brush, CURVE_PRESET_SMOOTH); + /* enable fake user by default */ brush->id.flag |= LIB_FAKEUSER; brush_toggled_fake_user(brush); - - return brush; + + return brush; } Brush *copy_brush(Brush *brush) @@ -118,7 +147,7 @@ Brush *copy_brush(Brush *brush) void free_brush(Brush *brush) { if(brush->mtex.tex) brush->mtex.tex->id.us--; - + curvemapping_free(brush->curve); } @@ -731,11 +760,19 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres brush->spacing = MAX2(1.0, painter->startspacing*(1.5f-pressure)); } -static void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) +void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) { if(brush->jitter){ - jitterpos[0] = pos[0] + ((BLI_frand()-0.5f) * brush->size * brush->jitter * 2); - jitterpos[1] = pos[1] + ((BLI_frand()-0.5f) * brush->size * brush->jitter * 2); + float rand_pos[2]; + + // find random position within a circle of diameter 1 + do { + rand_pos[0] = BLI_frand()-0.5f; + rand_pos[1] = BLI_frand()-0.5f; + } while (len_v2(rand_pos) > 0.5f); + + jitterpos[0] = pos[0] + 2*rand_pos[0]*brush->size*brush->jitter; + jitterpos[1] = pos[1] + 2*rand_pos[1]*brush->size*brush->jitter; } else { VECCOPY2D(jitterpos, pos); @@ -887,7 +924,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl /* Uses the brush curve control to find a strength value between 0 and 1 */ float brush_curve_strength_clamp(Brush *br, float p, const float len) { - if(p >= len) p= 1.0f; + if(p >= len) return 0; else p= p/len; p= curvemapping_evaluateF(br->curve, 0, p); @@ -899,9 +936,12 @@ float brush_curve_strength_clamp(Brush *br, float p, const float len) * used for sculpt only */ float brush_curve_strength(Brush *br, float p, const float len) { - if(p >= len) p= 1.0f; - else p= p/len; - return curvemapping_evaluateF(br->curve, 0, p); + if(p >= len) + p= 1.0f; + else + p= p/len; + + return curvemapping_evaluateF(br->curve, 0, p); } /* TODO: should probably be unified with BrushPainter stuff? */ @@ -915,7 +955,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side) memset(&texres, 0, sizeof(TexResult)); - if(mtex && mtex->tex) { + if(mtex->tex) { float x, y, step = 2.0 / side, co[3]; texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache"); @@ -993,9 +1033,9 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight) float original_value= 0; if(mode == WM_RADIALCONTROL_SIZE) - original_value = br->size * size_weight; + original_value = sculpt_get_brush_size(br) * size_weight; else if(mode == WM_RADIALCONTROL_STRENGTH) - original_value = br->alpha; + original_value = sculpt_get_brush_alpha(br); else if(mode == WM_RADIALCONTROL_ANGLE) { MTex *mtex = brush_active_texture(br); if(mtex) @@ -1013,9 +1053,15 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight) const float conv = 0.017453293; if(mode == WM_RADIALCONTROL_SIZE) - br->size = new_value * size_weight; + if (sculpt_get_lock_brush_size(br)) { + float initial_value = RNA_float_get(op->ptr, "initial_value"); + const float unprojected_radius = sculpt_get_brush_unprojected_radius(br); + sculpt_set_brush_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight); + } + else + sculpt_set_brush_size(br, new_value * size_weight); else if(mode == WM_RADIALCONTROL_STRENGTH) - br->alpha = new_value; + sculpt_set_brush_alpha(br, new_value); else if(mode == WM_RADIALCONTROL_ANGLE) { MTex *mtex = brush_active_texture(br); if(mtex) diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index c8a01b1c12f..a07c18f42f3 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -126,6 +126,9 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa cumap->cm[a].curve[1].x= maxx; cumap->cm[a].curve[1].y= maxy; } + + cumap->changed_timestamp = 0; + return cumap; } @@ -240,10 +243,12 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) switch(preset) { case CURVE_PRESET_LINE: cuma->totpoint= 2; break; - case CURVE_PRESET_SHARP: cuma->totpoint= 3; break; + case CURVE_PRESET_SHARP: cuma->totpoint= 4; break; case CURVE_PRESET_SMOOTH: cuma->totpoint= 4; break; case CURVE_PRESET_MAX: cuma->totpoint= 2; break; - case CURVE_PRESET_MID9: cuma->totpoint= 9; + case CURVE_PRESET_MID9: cuma->totpoint= 9; break; + case CURVE_PRESET_ROUND: cuma->totpoint= 4; break; + case CURVE_PRESET_ROOT: cuma->totpoint= 4; break; } cuma->curve= MEM_callocN(cuma->totpoint*sizeof(CurveMapPoint), "curve points"); @@ -251,27 +256,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) switch(preset) { case CURVE_PRESET_LINE: cuma->curve[0].x= clipr->xmin; - cuma->curve[0].y= clipr->ymin; + cuma->curve[0].y= clipr->ymax; cuma->curve[0].flag= 0; cuma->curve[1].x= clipr->xmax; - cuma->curve[1].y= clipr->ymax; + cuma->curve[1].y= clipr->ymin; cuma->curve[1].flag= 0; break; case CURVE_PRESET_SHARP: cuma->curve[0].x= 0; cuma->curve[0].y= 1; - cuma->curve[1].x= 0.33; - cuma->curve[1].y= 0.33; - cuma->curve[2].x= 1; - cuma->curve[2].y= 0; + cuma->curve[1].x= 0.25; + cuma->curve[1].y= 0.50; + cuma->curve[2].x= 0.75; + cuma->curve[2].y= 0.04; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; break; case CURVE_PRESET_SMOOTH: cuma->curve[0].x= 0; cuma->curve[0].y= 1; cuma->curve[1].x= 0.25; - cuma->curve[1].y= 0.92; + cuma->curve[1].y= 0.94; cuma->curve[2].x= 0.75; - cuma->curve[2].y= 0.08; + cuma->curve[2].y= 0.06; cuma->curve[3].x= 1; cuma->curve[3].y= 0; break; @@ -290,8 +297,29 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) cuma->curve[i].y= 0.5; } } + break; + case CURVE_PRESET_ROUND: + cuma->curve[0].x= 0; + cuma->curve[0].y= 1; + cuma->curve[1].x= 0.5; + cuma->curve[1].y= 0.90; + cuma->curve[2].x= 0.86; + cuma->curve[2].y= 0.5; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; + break; + case CURVE_PRESET_ROOT: + cuma->curve[0].x= 0; + cuma->curve[0].y= 1; + cuma->curve[1].x= 0.25; + cuma->curve[1].y= 0.95; + cuma->curve[2].x= 0.75; + cuma->curve[2].y= 0.44; + cuma->curve[3].x= 1; + cuma->curve[3].y= 0; + break; } - + if(cuma->table) { MEM_freeN(cuma->table); cuma->table= NULL; @@ -619,7 +647,9 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles) float thresh= 0.01f*(clipr->xmax - clipr->xmin); float dx= 0.0f, dy= 0.0f; int a; - + + cumap->changed_timestamp++; + /* clamp with clip */ if(cumap->flag & CUMA_DO_CLIP) { for(a=0; atotpoint; a++) { @@ -701,7 +731,7 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value) if(cuma->table==NULL) { curvemap_make_table(cuma, &cumap->clipr); if(cuma->table==NULL) - return value; + return 1.0f-value; } return curvemap_evaluateF(cuma, value); } diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 29314fb4865..ad2c857be75 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -38,6 +38,7 @@ #include "DNA_material_types.h" #include "DNA_texture_types.h" #include "DNA_world_types.h" +#include "DNA_brush_types.h" #include "BLI_ghash.h" @@ -120,6 +121,7 @@ struct PreviewImage* BKE_previewimg_create() for (i=0; ichanged[i] = 1; + prv_img->changed_timestamp[i] = 0; } return prv_img; } @@ -202,7 +204,7 @@ PreviewImage* BKE_previewimg_get(ID *id) Image *img = (Image*)id; if (!img->preview) img->preview = BKE_previewimg_create(); prv_img = img->preview; - } + } return prv_img; } @@ -224,6 +226,7 @@ void BKE_icon_changed(int id) int i; for (i=0; ichanged[i] = 1; + prv->changed_timestamp[i]++; } } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index dc78dac04dd..b66b5c60916 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -200,9 +200,9 @@ void free_image(Image *ima) } BKE_icon_delete(&ima->id); ima->id.icon_id = 0; - if (ima->preview) { - BKE_previewimg_free(&ima->preview); - } + + BKE_previewimg_free(&ima->preview); + for(a=0; arenders[a]) { RE_FreeRenderResult(ima->renders[a]); -- cgit v1.2.3 From 8e3a9634a3dd939225d1424e0fd97b3d45746503 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Jul 2010 17:47:58 +0000 Subject: Change to text3d: When back or front is enabled, the bevel rim on the other side is not created anymore, just as the back/front filling faces are not created when disabled. when both are off the behavior is unchanged. This is needed when rendering alpha text so its possible to have a single layer of faces but use the bevel option to make text thicker. adding a rim on the back when back is disabled also doesnt make much sense IMHO. minor python edits too. --- source/blender/blenkernel/intern/curve.c | 99 +++++++++++++++++--------------- 1 file changed, 52 insertions(+), 47 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 2e645592229..aa7b44aecda 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1318,30 +1318,33 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) short dnr; /* bevel now in three parts, for proper vertex normals */ - /* part 1 */ - dnr= nr= 2+ cu->bevresol; - if( (cu->flag & (CU_FRONT|CU_BACK))==0) - nr= 3+ 2*cu->bevresol; - - dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1"); - dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1"); - BLI_addtail(disp, dl); - dl->type= DL_SEGM; - dl->parts= 1; - dl->flag= DL_BACK_CURVE; - dl->nr= nr; + /* part 1, back */ - /* half a circle */ - fp= dl->verts; - dangle= (0.5*M_PI/(dnr-1)); - angle= -(nr-1)*dangle; - - for(a=0; aext2)); - fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1; - angle+= dangle; - fp+= 3; + if((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) { + dnr= nr= 2+ cu->bevresol; + if( (cu->flag & (CU_FRONT|CU_BACK))==0) + nr= 3+ 2*cu->bevresol; + + dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1"); + dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p1"); + BLI_addtail(disp, dl); + dl->type= DL_SEGM; + dl->parts= 1; + dl->flag= DL_BACK_CURVE; + dl->nr= nr; + + /* half a circle */ + fp= dl->verts; + dangle= (0.5*M_PI/(dnr-1)); + angle= -(nr-1)*dangle; + + for(a=0; aext2)); + fp[2]= (float)(sin(angle)*(cu->ext2)) - cu->ext1; + angle+= dangle; + fp+= 3; + } } /* part 2, sidefaces */ @@ -1374,30 +1377,32 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) } } - /* part 3 */ - dnr= nr= 2+ cu->bevresol; - if( (cu->flag & (CU_FRONT|CU_BACK))==0) - nr= 3+ 2*cu->bevresol; - - dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3"); - dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3"); - BLI_addtail(disp, dl); - dl->type= DL_SEGM; - dl->flag= DL_FRONT_CURVE; - dl->parts= 1; - dl->nr= nr; - - /* half a circle */ - fp= dl->verts; - angle= 0.0; - dangle= (0.5*M_PI/(dnr-1)); - - for(a=0; aext2)); - fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1; - angle+= dangle; - fp+= 3; + /* part 3, front */ + if((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) { + dnr= nr= 2+ cu->bevresol; + if( (cu->flag & (CU_FRONT|CU_BACK))==0) + nr= 3+ 2*cu->bevresol; + + dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3"); + dl->verts= MEM_mallocN(nr*3*sizeof(float), "makebevelcurve p3"); + BLI_addtail(disp, dl); + dl->type= DL_SEGM; + dl->flag= DL_FRONT_CURVE; + dl->parts= 1; + dl->nr= nr; + + /* half a circle */ + fp= dl->verts; + angle= 0.0; + dangle= (0.5*M_PI/(dnr-1)); + + for(a=0; aext2)); + fp[2]= (float)(sin(angle)*(cu->ext2)) + cu->ext1; + angle+= dangle; + fp+= 3; + } } } } -- cgit v1.2.3 From 7de6a8e1aceaa109cd4c4f9274b25303c7c8a2ba Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Wed, 14 Jul 2010 20:08:30 +0000 Subject: * Accidentally bumped file subversion after sculpt merge. Perhaps this should be done, but not without permission. My comment even said not to merge it :) --- source/blender/blenkernel/BKE_blender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 5936805765d..baec6ecfe6a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -45,7 +45,7 @@ struct Scene; struct Main; #define BLENDER_VERSION 252 -#define BLENDER_SUBVERSION 6 // XXX: this shouldn't be merged with trunk, this is so Sculpt branch can detect old files +#define BLENDER_SUBVERSION 5 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 -- cgit v1.2.3 From d94868f82138baedbd227c708878577061191bbe Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 16 Jul 2010 09:45:09 +0000 Subject: Incorrect flags were checing for cyclic in order clamping functions --- source/blender/blenkernel/intern/curve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index aa7b44aecda..5015e0cef6c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3078,7 +3078,7 @@ int clamp_nurb_order_u( struct Nurb *nu ) nu->orderu= nu->pntsu; change= 1; } - if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { + if(((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { CLAMP(nu->orderu, 3,4); change= 1; } @@ -3092,7 +3092,7 @@ int clamp_nurb_order_v( struct Nurb *nu) nu->orderv= nu->pntsv; change= 1; } - if(((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { + if(((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { CLAMP(nu->orderv, 3,4); change= 1; } -- cgit v1.2.3 From 3ef41270f96b4ee3592ec5302a5383399c38ff5d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Jul 2010 15:45:35 +0000 Subject: [#22880] SEQUENCER: Flip Y broken in recent builds (Windows & Linux) own fault when adding saturation. --- source/blender/blenkernel/intern/sequencer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index d97e6151a13..de4e7a5ccbe 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1800,6 +1800,10 @@ static void input_preprocess(Scene *scene, Sequence *seq, TStripElem *se, int cf if(seq->flag & SEQ_FLIPX) { IMB_flipx(se->ibuf); } + + if(seq->flag & SEQ_FLIPY) { + IMB_flipy(se->ibuf); + } if(seq->sat != 1.0f) { /* inline for now, could become an imbuf function */ @@ -2279,6 +2283,13 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int addzbuffloatImBuf(se->ibuf); memcpy(se->ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty); } + + /* { + ImBuf *imb= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0); + IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata); + IMB_freeImBuf(imb); + } */ + } else if (rres.rect32) { se->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0); memcpy(se->ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); -- cgit v1.2.3 From 22c6b7d174ec7158acc526821b002d9703cf4f56 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Jul 2010 13:29:55 +0000 Subject: PNG Compression can now be set, writing uncompressed PNG's is significantly faster for high resolution images - 2k. --- source/blender/blenkernel/intern/image.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index b66b5c60916..ffd0b378f07 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1180,6 +1180,10 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, char *name, int imtype, int subimt } else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) { ibuf->ftype= PNG; + + if(imtype==R_PNG) + ibuf->ftype |= quality; /* quality is actually compression 0-100 --> 0-9 */ + } #ifdef WITH_DDS else if ((imtype==R_DDS)) { -- cgit v1.2.3 From fd982af4471d55e756629c0aeffe60fe8f5b4687 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 17 Jul 2010 13:41:22 +0000 Subject: Merging revision 30434 from my GSoC branch, log: Fixed sound wave display bug for sounds that are not full length. --- source/blender/blenkernel/BKE_sound.h | 2 +- source/blender/blenkernel/intern/sound.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 50c86e80b08..190b0400aff 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -94,6 +94,6 @@ float sound_sync_scene(struct Scene *scene); int sound_scene_playing(struct Scene *scene); -int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length); +int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end); #endif diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 6402f908422..f780e71d5cd 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -468,7 +468,9 @@ int sound_scene_playing(struct Scene *scene) return -1; } -int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length) +int sound_read_sound_buffer(struct bSound* sound, float* buffer, int length, float start, float end) { - return AUD_readSound(sound->cache, buffer, length); + AUD_Sound* limiter = AUD_limitSound(sound->cache, start, end); + return AUD_readSound(limiter, buffer, length); + AUD_unload(limiter); } -- cgit v1.2.3 From 02ef91a6195db38388b12ec9c643858ba1b5be7e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Jul 2010 16:17:30 +0000 Subject: [#22876] Add new scene, stacker ".00" bug finding duplicates is a bit faster now too since it doesnt split the name and number before comparing ID's prefix. --- source/blender/blenkernel/BKE_library.h | 3 +-- source/blender/blenkernel/intern/library.c | 40 ++++++++++++++++-------------- 2 files changed, 23 insertions(+), 20 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index cb61a08f3ba..fcf7ae85738 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -63,7 +63,7 @@ void free_libblock_us(struct ListBase *lb, void *idv); void free_main(struct Main *mainvar); void tag_main(struct Main *mainvar, int tag); -void splitIDname(char *name, char *left, int *nr); +int splitIDname(char *name, char *left, int *nr); void rename_id(struct ID *id, char *name); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); @@ -85,4 +85,3 @@ void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowMa #define ID_FALLBACK_NAME "Untitled" #endif - diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8d859a2f712..0cc31cc1cfa 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -995,7 +995,7 @@ void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb /* used by buttons.c library.c mball.c */ -void splitIDname(char *name, char *left, int *nr) +int splitIDname(char *name, char *left, int *nr) { int a; @@ -1003,19 +1003,21 @@ void splitIDname(char *name, char *left, int *nr) strncpy(left, name, 21); a= strlen(name); - if(a>1 && name[a-1]=='.') return; + if(a>1 && name[a-1]=='.') return a; while(a--) { if( name[a]=='.' ) { left[a]= 0; *nr= atol(name+a+1); - return; + return a; } if( isdigit(name[a])==0 ) break; left[a]= 0; } strcpy(left, name); + + return a; } static void sort_alpha_id(ListBase *lb, ID *id) @@ -1077,8 +1079,7 @@ static ID *is_dupid(ListBase *lb, ID *id, char *name) static int check_for_dupid(ListBase *lb, ID *id, char *name) { ID *idtest; - int nr= 0, nrtest, a; - const int maxtest=32; + int nr= 0, nrtest, a, left_len; char left[32], leftest[32], in_use[32]; /* make sure input name is terminated properly */ @@ -1095,22 +1096,25 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) /* we have a dup; need to make a new name */ /* quick check so we can reuse one of first 32 ids if vacant */ - memset(in_use, 0, maxtest); + memset(in_use, 0, sizeof(in_use)); /* get name portion, number portion ("name.number") */ - splitIDname( name, left, &nr); + left_len= splitIDname(name, left, &nr); /* if new name will be too long, truncate it */ if(nr>999 && strlen(left)>16) left[16]= 0; else if(strlen(left)>17) left[17]= 0; - for( idtest = lb->first; idtest; idtest = idtest->next ) { - if( id != idtest && idtest->lib == NULL ) { - splitIDname(idtest->name+2, leftest, &nrtest); - /* if base names match... */ - /* optimized */ - if( *left == *leftest && strcmp(left, leftest)==0 ) { - if(nrtest < maxtest) + if(left_len) { + for(idtest= lb->first; idtest; idtest= idtest->next) { + if( (id != idtest) && + (idtest->lib == NULL) && + (*name == *(idtest->name+2)) && + (strncmp(name, idtest->name+2, left_len)==0) && + (splitIDname(idtest->name+2, leftest, &nrtest) == left_len) + + ) { + if(nrtest < sizeof(in_use)) in_use[nrtest]= 1; /* mark as used */ if(nr <= nrtest) nr= nrtest+1; /* track largest unused */ @@ -1119,7 +1123,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) } /* decide which value of nr to use */ - for(a=0; a=nr) break; /* stop when we've check up to biggest */ if( in_use[a]==0 ) { /* found an unused value */ nr = a; @@ -1129,8 +1133,9 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) /* If the original name has no numeric suffix, * rather than just chopping and adding numbers, - * shave off the end chars until we have a unique name */ - if (nr==0) { + * shave off the end chars until we have a unique name. + * Check the null terminators match as well so we dont get Cube.000 -> Cube.00 */ + if (nr==0 && name[left_len] == left[left_len]) { int len = strlen(name)-1; idtest= is_dupid(lb, id, name); @@ -1389,4 +1394,3 @@ void rename_id(ID *id, char *name) new_id(lb, id, name); } - -- cgit v1.2.3 From 21cb1f82db01f9e0a69c955569cd6af4356b63e5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 17 Jul 2010 17:07:50 +0000 Subject: Revert part of commit 29079, cleanup of particle path drawing logic This commit and other commits attempting to fix it broke various things. The main thing that changed was that instead of computing children/paths in advance as part of particle_system_update, this was moved to do it just before drawing or rendering. I've changed back that behavior and tried to keep the other fixes in the commit. When the new particle system was just committed, it also worked this way but gave various problems, and I had to remove that behavior to get things working stable. Basically it meant that you could get have a path cache that was outdated in various situations, and it doesn't fit well with dependency graph evaluation order. This fixes: #22823: Children Particle Rendering is broken #22733: Particle objects not displayed #22888: SigSegV when rending hair particles #22820: Another SigSegV when undo adding hairs in particel edit mode Some particle setups in dupligroups. The three bugs that the original commit fixed are now also still working in my tests: #21316: Hair weight drawing is wrong #21923: Consistent Crash When Rendering Particle Scene. #21950: Path rendering option for particles causes crash --- source/blender/blenkernel/BKE_particle.h | 2 - source/blender/blenkernel/intern/particle.c | 8 +- source/blender/blenkernel/intern/particle_system.c | 86 ++++++++++++++++------ 3 files changed, 67 insertions(+), 29 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 33a41821fe2..fcef00ae9b3 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -255,11 +255,9 @@ void psys_threads_free(ParticleThread *threads); void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]); /* particle_system.c */ -void psys_update_path_cache(struct ParticleSimulationData *sim, float cfra); struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt); void psys_count_keyed_targets(struct ParticleSimulationData *sim); void psys_update_particle_tree(struct ParticleSystem *psys, float cfra); -void psys_update_children(struct ParticleSimulationData *sim); void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys); void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 96c0afedfb0..3791d808d01 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -433,7 +433,7 @@ void free_keyed_keys(ParticleSystem *psys) } } } -void psys_free_child_path_cache(ParticleSystem *psys) +static void free_child_path_cache(ParticleSystem *psys) { psys_free_path_cache_buffers(psys->childcache, &psys->childcachebufs); psys->childcache = NULL; @@ -451,7 +451,7 @@ void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit) psys->pathcache= NULL; psys->totcached= 0; - psys_free_child_path_cache(psys); + free_child_path_cache(psys); } } void psys_free_children(ParticleSystem *psys) @@ -462,7 +462,7 @@ void psys_free_children(ParticleSystem *psys) psys->totchild=0; } - psys_free_child_path_cache(psys); + free_child_path_cache(psys); } void psys_free_particles(ParticleSystem *psys) { @@ -2721,7 +2721,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd } else { /* clear out old and create new empty path cache */ - psys_free_child_path_cache(sim->psys); + free_child_path_cache(sim->psys); sim->psys->childcache= psys_alloc_path_cache_buffers(&sim->psys->childcachebufs, totchild, ctx->steps+1); sim->psys->totchildcache = totchild; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 33ea9f5ba6e..181d8fee4ba 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3075,18 +3075,66 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo /* Hair */ /************************************************/ /* check if path cache or children need updating and do it if needed */ -void psys_update_path_cache(ParticleSimulationData *sim, float cfra) +static void psys_update_path_cache(ParticleSimulationData *sim, float cfra) { ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; - - /* only hair, keyed and baked stuff can have paths */ - if(part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->mem_cache.first) { + ParticleEditSettings *pset = &sim->scene->toolsettings->particle; + int distr=0, alloc=0, skip=0; + + if((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET) + alloc=1; + + if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT))) + distr=1; + + if(distr){ + if(alloc) + realloc_particles(sim, sim->psys->totpart); + + if(get_psys_tot_child(sim->scene, psys)) { + /* don't generate children while computing the hair keys */ + if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) { + distribute_particles(sim, PART_FROM_CHILD); + + if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES && part->parents!=0.0) + psys_find_parents(sim); + } + } + else + psys_free_children(psys); + } + + if((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0) + skip = 1; /* only hair, keyed and baked stuff can have paths */ + else if(part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR))) + skip = 1; /* particle visualization must be set as path */ + else if(!psys->renderdata) { + if(part->draw_as != PART_DRAW_REND) + skip = 1; /* draw visualization */ + else if(psys->pointcache->flag & PTCACHE_BAKING) + skip = 1; /* no need to cache paths while baking dynamics */ + else if(psys_in_edit_mode(sim->scene, psys)) { + if((pset->flag & PE_DRAW_PART)==0) + skip = 1; + else if(part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0) + skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */ + } + } + + if(!skip) { psys_cache_paths(sim, cfra); /* for render, child particle paths are computed on the fly */ - if(part->childtype && psys->totchild) - psys_cache_child_paths(sim, cfra, 0); + if(part->childtype) { + if(!psys->totchild) + skip = 1; + else if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0) + skip = 1; + + if(!skip) + psys_cache_child_paths(sim, cfra, 0); + } } else if(psys->pathcache) psys_free_path_cache(psys, NULL); @@ -3201,8 +3249,6 @@ static void do_hair_dynamics(ParticleSimulationData *sim) psys->hair_out_dm = clothModifier_do(psys->clmd, sim->scene, sim->ob, dm, 0, 0); psys->clmd->sim_parms->effector_weights = NULL; - - psys_free_path_cache(psys, NULL); } static void hair_step(ParticleSimulationData *sim, float cfra) { @@ -3454,19 +3500,14 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) } free_collider_cache(&sim->colliders); - - if(psys->pathcache) - psys_free_path_cache(psys, NULL); } -void psys_update_children(ParticleSimulationData *sim) +static void update_children(ParticleSimulationData *sim) { if((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0) /* don't generate children while growing hair - waste of time */ psys_free_children(sim->psys); - else if(sim->psys->part->childtype) { - if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys)) - distribute_particles(sim, PART_FROM_CHILD); - } + else if(sim->psys->part->childtype && sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys)) + distribute_particles(sim, PART_FROM_CHILD); else psys_free_children(sim->psys); } @@ -3721,6 +3762,8 @@ static void system_step(ParticleSimulationData *sim, float cfra) if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) { cached_step(sim, cfra); + update_children(sim); + psys_update_path_cache(sim, cfra); BKE_ptcache_validate(cache, framenr); @@ -3784,6 +3827,9 @@ static void system_step(ParticleSimulationData *sim, float cfra) BKE_ptcache_write_cache(use_cache, framenr); } + if(init) + update_children(sim); + /* cleanup */ if(psys->lattice){ end_latt_deform(psys->lattice); @@ -3946,13 +3992,6 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) /* execute drivers only, as animation has already been done */ BKE_animsys_evaluate_animdata(&part->id, part->adt, cfra, ADT_RECALC_DRIVERS); - /* TODO: only free child paths in case of PSYS_RECALC_CHILD */ - if(psys->recalc & PSYS_RECALC || ob->recalc & OB_RECALC_ALL) - psys_free_path_cache(psys, NULL); - - if(psys->recalc & PSYS_RECALC_CHILD) - psys_free_children(psys); - if(psys->recalc & PSYS_RECALC_TYPE) psys_changed_type(&sim); else if(psys->recalc & PSYS_RECALC_PHYS) @@ -4009,6 +4048,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if(part->phystype == PART_PHYS_KEYED) { psys_count_keyed_targets(&sim); set_keyed_keys(&sim); + psys_update_path_cache(&sim,(int)cfra); } break; } -- cgit v1.2.3 From 1bb0c84236ec98647dabdd944d8575f32db33650 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Jul 2010 17:50:20 +0000 Subject: - added text3d.body_format to be able to set bold/italic/smallcaps etc on text. - the length of a new text object wasnt set on creation. - tex3d and controllers rna name was being set to its body (rather then ID name) - remove reference to wave objects which are very old and not used anymore. --- source/blender/blenkernel/BKE_object.h | 1 - source/blender/blenkernel/intern/curve.c | 2 +- source/blender/blenkernel/intern/object.c | 8 -------- 3 files changed, 1 insertion(+), 10 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 07c3da48792..2a7ba4f98c9 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -83,7 +83,6 @@ struct Lamp *copy_lamp(struct Lamp *la); void make_local_lamp(struct Lamp *la); void free_camera(struct Camera *ca); void free_lamp(struct Lamp *la); -void *add_wave(void); struct Object *add_only_object(int type, char *name); struct Object *add_object(struct Scene *scene, int type); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 5015e0cef6c..d355a520a8c 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -148,7 +148,7 @@ Curve *add_curve(char *name, int type) cu->vfont->id.us+=4; cu->str= MEM_mallocN(12, "str"); strcpy(cu->str, "Text"); - cu->pos= 4; + cu->len= cu->pos= 4; cu->strinfo= MEM_callocN(12*sizeof(CharInfo), "strinfo new"); cu->totbox= cu->actbox= 1; cu->tb= MEM_callocN(MAXTEXTBOX*sizeof(TextBox), "textbox"); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 012b38570da..75b5e6d9331 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -948,12 +948,6 @@ void free_lamp(Lamp *la) la->id.icon_id = 0; } -void *add_wave() -{ - return 0; -} - - /* *************************************************** */ static void *add_obdata_from_type(int type) @@ -967,7 +961,6 @@ static void *add_obdata_from_type(int type) case OB_CAMERA: return add_camera("Camera"); case OB_LAMP: return add_lamp("Lamp"); case OB_LATTICE: return add_lattice("Lattice"); - case OB_WAVE: return add_wave(); case OB_ARMATURE: return add_armature("Armature"); case OB_EMPTY: return NULL; default: @@ -987,7 +980,6 @@ static char *get_obdata_defname(int type) case OB_CAMERA: return "Camera"; case OB_LAMP: return "Lamp"; case OB_LATTICE: return "Lattice"; - case OB_WAVE: return "Wave"; case OB_ARMATURE: return "Armature"; case OB_EMPTY: return "Empty"; default: -- cgit v1.2.3 From fd31436897f49ddf6e51a059add2e74361fbfdd8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Jul 2010 18:08:14 +0000 Subject: spelling correction: alredy --> already --- source/blender/blenkernel/intern/library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 0cc31cc1cfa..8b035ff1bba 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1308,7 +1308,7 @@ void all_local(Library *lib, int untagged_only) /* The check on the second line (LIB_PRE_EXISTING) is done so its * possible to tag data you dont want to be made local, used for - * appending data, so any libdata alredy linked wont become local + * appending data, so any libdata already linked wont become local * (very nasty to discover all your links are lost after appending) * */ if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) && -- cgit v1.2.3 From 7aebd561539140e2ae53b464536ba9aa43177795 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sun, 18 Jul 2010 01:51:14 +0000 Subject: fixing small ambiguity in the logic brick link code (not sure it booms in any compiler, but it doesn't hurt to make it right) --- source/blender/blenkernel/intern/sca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index 61e98ce9d45..f5ca7ee3cef 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -800,7 +800,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size) (*tot) ++; *ppoin = MEM_callocN((*tot)*size, "new link"); - for (ibrick=0; ibrick < *tot - 1; ibrick++) { + for (ibrick=0; ibrick < *(tot) - 1; ibrick++) { (*ppoin)[ibrick] = old_links[ibrick]; } (*ppoin)[ibrick] = *poin; -- cgit v1.2.3 From acf3c4bb02c329f628f1314b0515db39cfdeebbf Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Mon, 19 Jul 2010 07:29:52 +0000 Subject: * decrementing image_icon ref count from wrong place --- source/blender/blenkernel/intern/brush.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c423d426e32..c47f5a3ddba 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -131,7 +131,9 @@ Brush *copy_brush(Brush *brush) brushn= copy_libblock(brush); if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex); - + + if(brush->image_icon) id_us_plus((ID*)brush->image_icon); + brushn->curve= curvemapping_copy(brush->curve); /* enable fake user by default */ -- cgit v1.2.3 From c7ce37471d8f7858735695ad92db1731fa2c1ae3 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Mon, 19 Jul 2010 20:01:18 +0000 Subject: == Sequencer == Bugfix: free_imbuf_seq() was closing IMB anim handles on nearly every change of RNA variables. This can be *very* slow, if you twiddle with parameters during playback. Especially multicam editing... Now: we close IMB anim handles only on refresh_all() and filepath changes. --- source/blender/blenkernel/BKE_sequencer.h | 4 +- source/blender/blenkernel/intern/sequencer.c | 60 +++------------------------- 2 files changed, 7 insertions(+), 57 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 002a1958a13..c5417e04780 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -191,13 +191,13 @@ void seq_dupe_animdata(struct Scene *scene, char *name_from, char *name_to); int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test, struct Scene *evil_scene); int shuffle_seq_time(ListBase * seqbasep, struct Scene *evil_scene); int seqbase_isolated_sel_check(struct ListBase *seqbase); -void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage); +void free_imbuf_seq(struct Scene *scene, struct ListBase * seqbasep, int check_mem_usage, int keep_file_handles); struct Sequence *seq_dupli_recursive(struct Scene *scene, struct Sequence * seq, int dupe_flag); int seq_swap(struct Sequence *seq_a, struct Sequence *seq_b); void seq_update_sound(struct Scene* scene, struct Sequence *seq); void seq_update_muting(struct Scene* scene, struct Editing *ed); -void seqbase_sound_reload(Scene *scene, ListBase *seqbase); +void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase); void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq); void seqbase_dupli_recursive(struct Scene *scene, ListBase *nseqbase, ListBase *seqbase, int dupe_flag); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index de4e7a5ccbe..f631e42e05a 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3267,59 +3267,8 @@ static void free_anim_seq(Sequence *seq) } } -#if 0 -static void free_imbuf_seq_except(Scene *scene, int cfra) -{ - Editing *ed= seq_give_editing(scene, FALSE); - Sequence *seq; - TStripElem *se; - int a; - - if(ed==NULL) return; - - SEQ_BEGIN(ed, seq) { - if(seq->strip) { - TStripElem * curelem = give_tstripelem(seq, cfra); - - for(a = 0, se = seq->strip->tstripdata; - a < seq->strip->len && se; a++, se++) { - if(se != curelem) { - free_imbuf_strip_elem(se); - } - } - for(a = 0, se = seq->strip->tstripdata_startstill; - a < seq->strip->startstill && se; a++, se++) { - if(se != curelem) { - free_imbuf_strip_elem(se); - } - } - for(a = 0, se = seq->strip->tstripdata_endstill; - a < seq->strip->endstill && se; a++, se++) { - if(se != curelem) { - free_imbuf_strip_elem(se); - } - } - if(seq->strip->ibuf_startstill) { - IMB_freeImBuf(seq->strip->ibuf_startstill); - seq->strip->ibuf_startstill = 0; - } - - if(seq->strip->ibuf_endstill) { - IMB_freeImBuf(seq->strip->ibuf_endstill); - seq->strip->ibuf_endstill = 0; - } - - if(seq->type==SEQ_MOVIE) - if(seq->startdisp > cfra || seq->enddisp < cfra) - free_anim_seq(seq); - free_proxy_seq(seq); - } - } - SEQ_END -} -#endif - -void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage) +void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage, + int keep_file_handles) { Sequence *seq; TStripElem *se; @@ -3374,14 +3323,15 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage) seq->strip->ibuf_endstill = 0; } - if(seq->type==SEQ_MOVIE) + if(seq->type==SEQ_MOVIE && !keep_file_handles) free_anim_seq(seq); if(seq->type==SEQ_SPEED) { sequence_effect_speed_rebuild_map(scene, seq, 1); } } if(seq->type==SEQ_META) { - free_imbuf_seq(scene, &seq->seqbase, FALSE); + free_imbuf_seq(scene, &seq->seqbase, FALSE, + keep_file_handles); } if(seq->type==SEQ_SCENE) { /* FIXME: recurs downwards, -- cgit v1.2.3 From 80e63236464a7e864c45e163dd059ffe61735926 Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Tue, 20 Jul 2010 02:18:10 +0000 Subject: * Images for brush icons are now reloaded when they are needed from an external file * First, try to load the file from the given filename. This is either absolute or relative to the current .blend * If file is found using the given filename directly then look for the file in the datafiles/brushicons directory (local, user, or system). * Note: This commit does not update the .blend to reference the default icons * Note: This commit does not make sure that the build system copies the default icons to the 2.52/datafiles/brushicons directory --- source/blender/blenkernel/BKE_brush.h | 3 +++ source/blender/blenkernel/intern/brush.c | 33 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 6a209167f93..a2168d2a888 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -44,6 +44,9 @@ struct Brush *copy_brush(struct Brush *brush); void make_local_brush(struct Brush *brush); void free_brush(struct Brush *brush); +/* image icon function */ +struct Image *get_brush_icon(struct Brush *brush); + /* brush library operations used by different paint panels */ int brush_set_nr(struct Brush **current_brush, int nr, const char *name); int brush_delete(struct Brush **current_brush); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c47f5a3ddba..cea9ba32160 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -132,8 +132,6 @@ Brush *copy_brush(Brush *brush) if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex); - if(brush->image_icon) id_us_plus((ID*)brush->image_icon); - brushn->curve= curvemapping_copy(brush->curve); /* enable fake user by default */ @@ -205,6 +203,37 @@ void make_local_brush(Brush *brush) } } +/* image icon function */ +Image* get_brush_icon(Brush *brush) +{ + + if (!(brush->image_icon) && brush->image_icon_path[0]) { + // first use the path directly to try and load the file + brush->image_icon= BKE_add_image_file(brush->image_icon_path, 1); + + // otherwise lets try to find it in other directories + if (!(brush->image_icon)) { + char path[240]; + char *folder; + + folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons"); + + path[0] = 0; + + BLI_make_file_string(G.sce, path, folder, brush->image_icon_path); + + if (path[0]) + brush->image_icon= BKE_add_image_file(path, 1); + } + + // remove user count so image isn't saved on exit + if (brush->image_icon) + id_us_min((ID*)(brush->image_icon)); + } + + return brush->image_icon; +} + /* Library Operations */ int brush_set_nr(Brush **current_brush, int nr, const char *name) -- cgit v1.2.3 From 75410037fd0d5ec81ef24c70789b9a684ca86f3f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 20 Jul 2010 10:41:08 +0000 Subject: - correct some spelling errors. - remove FreeCamera struct (wasnt used) - remove world color alpha values (not used anywhre). --- source/blender/blenkernel/BKE_fcurve.h | 2 +- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/collision.c | 2 +- source/blender/blenkernel/intern/fmodifier.c | 2 +- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/softbody.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 835e2ed80c8..6de0c55af3b 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -143,7 +143,7 @@ typedef enum eFMI_Action_Types { typedef enum eFMI_Requirement_Flags { /* modifier requires original data-points (kindof beats the purpose of a modifier stack?) */ FMI_REQUIRES_ORIGINAL_DATA = (1<<0), - /* modifier doesn't require on any preceeding data (i.e. it will generate a curve). + /* modifier doesn't require on any preceding data (i.e. it will generate a curve). * Use in conjunction with FMI_TYPE_GENRATE_CURVE */ FMI_REQUIRES_NOTHING = (1<<1), diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 6c8e5c48745..228860c9287 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -301,7 +301,7 @@ void action_groups_add_channel (bAction *act, bActionGroup *agrp, FCurve *fcurve /* firstly, link this F-Curve to the group */ agrp->channels.first = agrp->channels.last = fcurve; - /* step through the groups preceeding this one, finding the F-Curve there to attach this one after */ + /* step through the groups preceding this one, finding the F-Curve there to attach this one after */ for (grp= agrp->prev; grp; grp= grp->prev) { /* if this group has F-Curves, we want weave the given one in right after the last channel there, * but via the Action's list not this group's list diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 9b49ac9c6ff..54adc648539 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -591,7 +591,7 @@ int cloth_collision_response_static ( ClothModifierData *clmd, CollisionModifier return result; } -//Determines collisions on overlap, collisions are writen to collpair[i] and collision+number_collision_found is returned +//Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap *overlap, CollPair *collpair ) { ClothModifierData *clmd = ( ClothModifierData * ) md1; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 6fcc49f9ec1..3271749643a 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -1193,7 +1193,7 @@ short list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype * - this step acts as an optimisation to prevent the F-Curve stack being evaluated * several times by modifiers requesting the time be modified, as the final result * would have required using the modified time - * - modifiers only ever recieve the unmodified time, as subsequent modifiers should be + * - modifiers only ever receive the unmodified time, as subsequent modifiers should be * working on the 'global' result of the modified curve, not some localised segment, * so nevaltime gets set to whatever the last time-modifying modifier likes... * - we start from the end of the stack, as only the last one matters for now diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index cd8ab8290e5..64c9bf4bd07 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -906,7 +906,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co *array_index= dummy_index; } - /* append preceeding bits to path */ + /* append preceding bits to path */ if ((actname && actname[0]) && (constname && constname[0])) { /* Constraint in Pose-Channel */ sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index b44fe1ad1d0..c82595ee2b2 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -251,7 +251,7 @@ static float _final_mass(Object *ob,BodyPoint *bp) /******************** for each target object/face the axis aligned bounding box (AABB) is stored -faces paralell to global axes +faces parallel to global axes so only simple "value" in [min,max] ckecks are used float operations still */ -- cgit v1.2.3 From b618a335f5e7b5b3d291aa0cba8be232b79e9a4e Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Tue, 20 Jul 2010 11:32:30 +0000 Subject: * Made the default sculpt icons an internal part of the executable * Default icons can be selected from a menu * Option to make a custom icon from a file is present but the UI is disabled because of a mysterious crash * New startup.blend that has the appropriate icons selected --- source/blender/blenkernel/BKE_brush.h | 2 +- source/blender/blenkernel/intern/brush.c | 157 ++++++++++++++++++++++++++----- source/blender/blenkernel/intern/icons.c | 7 ++ 3 files changed, 142 insertions(+), 24 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index a2168d2a888..75fdb719a62 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -45,7 +45,7 @@ void make_local_brush(struct Brush *brush); void free_brush(struct Brush *brush); /* image icon function */ -struct Image *get_brush_icon(struct Brush *brush); +struct ImBuf *get_brush_icon(struct Brush *brush); /* brush library operations used by different paint panels */ int brush_set_nr(struct Brush **current_brush, int nr, const char *name); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index cea9ba32160..dcc96e65988 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -104,7 +104,7 @@ Brush *add_brush(const char *name) /* brush appearance */ - brush->image_icon= NULL; + brush->icon_imbuf= get_brush_icon(brush); brush->add_col[0]= 1.00; /* add mode color is light red */ brush->add_col[1]= 0.39; @@ -132,6 +132,8 @@ Brush *copy_brush(Brush *brush) if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex); + IMB_refImBuf(brushn->icon_imbuf); + brushn->curve= curvemapping_copy(brush->curve); /* enable fake user by default */ @@ -146,7 +148,13 @@ Brush *copy_brush(Brush *brush) /* not brush itself */ void free_brush(Brush *brush) { - if(brush->mtex.tex) brush->mtex.tex->id.us--; + if (brush->mtex.tex) + brush->mtex.tex->id.us--; + + if (brush->icon==BRUSH_ICON_FILE && brush->icon_imbuf) + IMB_freeImBuf(brush->icon_imbuf); + + BKE_previewimg_free(&(brush->preview)); curvemapping_free(brush->curve); } @@ -176,7 +184,7 @@ void make_local_brush(Brush *brush) if(scene->id.lib) lib= 1; else local= 1; } - + if(local && lib==0) { brush->id.lib= 0; brush->id.flag= LIB_LOCAL; @@ -204,34 +212,137 @@ void make_local_brush(Brush *brush) } /* image icon function */ -Image* get_brush_icon(Brush *brush) +ImBuf* get_brush_icon(Brush *brush) { + extern char datatoc_blob_png; + extern char datatoc_clay_png; + extern char datatoc_crease_png; + extern char datatoc_draw_png; + extern char datatoc_fill_png; + extern char datatoc_flatten_png; + extern char datatoc_grab_png; + extern char datatoc_inflate_png; + extern char datatoc_layer_png; + extern char datatoc_nudge_png; + extern char datatoc_pinch_png; + extern char datatoc_scrape_png; + extern char datatoc_smooth_png; + extern char datatoc_snake_hook_png; + extern char datatoc_thumb_png; + extern char datatoc_twist_png; + + extern int datatoc_blob_png_size; + extern int datatoc_clay_png_size; + extern int datatoc_crease_png_size; + extern int datatoc_draw_png_size; + extern int datatoc_fill_png_size; + extern int datatoc_flatten_png_size; + extern int datatoc_grab_png_size; + extern int datatoc_inflate_png_size; + extern int datatoc_layer_png_size; + extern int datatoc_nudge_png_size; + extern int datatoc_pinch_png_size; + extern int datatoc_scrape_png_size; + extern int datatoc_smooth_png_size; + extern int datatoc_snake_hook_png_size; + extern int datatoc_thumb_png_size; + extern int datatoc_twist_png_size; + + void *icon_data[]= { + 0, + &datatoc_blob_png, + &datatoc_clay_png, + &datatoc_crease_png, + &datatoc_draw_png, + &datatoc_fill_png, + &datatoc_flatten_png, + &datatoc_grab_png, + &datatoc_inflate_png, + &datatoc_layer_png, + &datatoc_nudge_png, + &datatoc_pinch_png, + &datatoc_scrape_png, + &datatoc_smooth_png, + &datatoc_snake_hook_png, + &datatoc_thumb_png, + &datatoc_twist_png, + }; + + size_t icon_size[]= { + 0, + datatoc_blob_png_size, + datatoc_clay_png_size, + datatoc_crease_png_size, + datatoc_draw_png_size, + datatoc_fill_png_size, + datatoc_flatten_png_size, + datatoc_grab_png_size, + datatoc_inflate_png_size, + datatoc_layer_png_size, + datatoc_nudge_png_size, + datatoc_pinch_png_size, + datatoc_scrape_png_size, + datatoc_smooth_png_size, + datatoc_snake_hook_png_size, + datatoc_thumb_png_size, + datatoc_twist_png_size, + }; + + static ImBuf *icon_imbuf[BRUSH_ICON_COUNT]= { 0 }; + + static const int flags = IB_rect|IB_multilayer|IB_metadata; + + static const int default_icon = BRUSH_ICON_DRAW; + + char path[240]; + char *folder; + + if (!(brush->icon_imbuf)) { + if (brush->icon==BRUSH_ICON_FILE) { + + if (brush->icon_filepath[0]) { + // first use the path directly to try and load the file + + BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); + BLI_path_abs(path, G.sce); + + brush->icon_imbuf= IMB_loadiffname(path, flags); + + // otherwise lets try to find it in other directories + if (!(brush->icon_imbuf)) { + folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons"); + + path[0]= 0; + + BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); + + if (path[0]) + brush->icon_imbuf= IMB_loadiffname(path, flags); + } + } - if (!(brush->image_icon) && brush->image_icon_path[0]) { - // first use the path directly to try and load the file - brush->image_icon= BKE_add_image_file(brush->image_icon_path, 1); - - // otherwise lets try to find it in other directories - if (!(brush->image_icon)) { - char path[240]; - char *folder; - - folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons"); - - path[0] = 0; + // if all else fails use a default image + if (!(brush->icon_imbuf)) { + if (!icon_imbuf[default_icon]) + icon_imbuf[default_icon]= IMB_ibImageFromMemory(icon_data[default_icon], icon_size[default_icon], flags); - BLI_make_file_string(G.sce, path, folder, brush->image_icon_path); + brush->icon_imbuf= icon_imbuf[default_icon]; + } + } + else { + if (!icon_imbuf[brush->icon]) + icon_imbuf[brush->icon]= IMB_ibImageFromMemory(icon_data[brush->icon], icon_size[brush->icon], flags); - if (path[0]) - brush->image_icon= BKE_add_image_file(path, 1); + brush->icon_imbuf= icon_imbuf[brush->icon]; } - // remove user count so image isn't saved on exit - if (brush->image_icon) - id_us_min((ID*)(brush->image_icon)); + BKE_icon_changed(BKE_icon_getid(&(brush->id))); } - return brush->image_icon; + if (!(brush->icon_imbuf)) + printf("get_brush_icon: unable to resolve brush icon imbuf\n"); + + return brush->icon_imbuf; } /* Library Operations */ diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index ad2c857be75..c1e00e091e8 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -177,6 +177,9 @@ void BKE_previewimg_free_id(ID *id) } else if (GS(id->name) == ID_IM) { Image *img = (Image*)id; BKE_previewimg_free(&img->preview); + } else if (GS(id->name) == ID_BR) { + Brush *br = (Brush*)br; + BKE_previewimg_free(&br->preview); } } @@ -204,6 +207,10 @@ PreviewImage* BKE_previewimg_get(ID *id) Image *img = (Image*)id; if (!img->preview) img->preview = BKE_previewimg_create(); prv_img = img->preview; + } else if (GS(id->name) == ID_BR) { + Brush *br = (Brush*)id; + if (!br->preview) br->preview = BKE_previewimg_create(); + prv_img = br->preview; } return prv_img; -- cgit v1.2.3 From f9e9e90a0293e4251528ceaaf7e7b000d7c05874 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Tue, 20 Jul 2010 12:22:45 +0000 Subject: == Sequencer == Cutting effect strips (esp multicam) didn't free endstill tstripdata. Doesn't sound like much of a problem, but those can get big on large timelines. So every cut eating 3 MB of memory doesn't leave much room for editing decisions :) --- source/blender/blenkernel/intern/sequencer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index f631e42e05a..94aa2c62f1a 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1142,7 +1142,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra) Strip * s = seq->strip; if (cfra < seq->start) { se = s->tstripdata_startstill; - if (seq->startstill > s->startstill) { + if (seq->startstill != s->startstill) { free_tstripdata(s->startstill, s->tstripdata_startstill); se = 0; @@ -1159,7 +1159,7 @@ static TStripElem *give_tstripelem(Sequence *seq, int cfra) } else if (cfra > seq->start + seq->len-1) { se = s->tstripdata_endstill; - if (seq->endstill > s->endstill) { + if (seq->endstill != s->endstill) { free_tstripdata(s->endstill, s->tstripdata_endstill); se = 0; -- cgit v1.2.3 From 886ce5a35101ea8bfef9c02745a94b1ab017f12f Mon Sep 17 00:00:00 2001 From: Jason Wilkins Date: Tue, 20 Jul 2010 13:42:27 +0000 Subject: * can use file for brush icon * fixed memory leaks * moved some of the brush icon code around * the update of the icon after a change is more responsive --- source/blender/blenkernel/intern/brush.c | 144 ++----------------------------- 1 file changed, 5 insertions(+), 139 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index dcc96e65988..8e3cc0751b5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -104,8 +104,6 @@ Brush *add_brush(const char *name) /* brush appearance */ - brush->icon_imbuf= get_brush_icon(brush); - brush->add_col[0]= 1.00; /* add mode color is light red */ brush->add_col[1]= 0.39; brush->add_col[2]= 0.39; @@ -130,9 +128,11 @@ Brush *copy_brush(Brush *brush) brushn= copy_libblock(brush); - if(brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex); + if (brush->mtex.tex) + id_us_plus((ID*)brush->mtex.tex); - IMB_refImBuf(brushn->icon_imbuf); + if (brush->icon_imbuf) + brushn->icon_imbuf= IMB_dupImBuf(brush->icon_imbuf); brushn->curve= curvemapping_copy(brush->curve); @@ -151,7 +151,7 @@ void free_brush(Brush *brush) if (brush->mtex.tex) brush->mtex.tex->id.us--; - if (brush->icon==BRUSH_ICON_FILE && brush->icon_imbuf) + if (brush->icon_imbuf) IMB_freeImBuf(brush->icon_imbuf); BKE_previewimg_free(&(brush->preview)); @@ -211,140 +211,6 @@ void make_local_brush(Brush *brush) } } -/* image icon function */ -ImBuf* get_brush_icon(Brush *brush) -{ - extern char datatoc_blob_png; - extern char datatoc_clay_png; - extern char datatoc_crease_png; - extern char datatoc_draw_png; - extern char datatoc_fill_png; - extern char datatoc_flatten_png; - extern char datatoc_grab_png; - extern char datatoc_inflate_png; - extern char datatoc_layer_png; - extern char datatoc_nudge_png; - extern char datatoc_pinch_png; - extern char datatoc_scrape_png; - extern char datatoc_smooth_png; - extern char datatoc_snake_hook_png; - extern char datatoc_thumb_png; - extern char datatoc_twist_png; - - extern int datatoc_blob_png_size; - extern int datatoc_clay_png_size; - extern int datatoc_crease_png_size; - extern int datatoc_draw_png_size; - extern int datatoc_fill_png_size; - extern int datatoc_flatten_png_size; - extern int datatoc_grab_png_size; - extern int datatoc_inflate_png_size; - extern int datatoc_layer_png_size; - extern int datatoc_nudge_png_size; - extern int datatoc_pinch_png_size; - extern int datatoc_scrape_png_size; - extern int datatoc_smooth_png_size; - extern int datatoc_snake_hook_png_size; - extern int datatoc_thumb_png_size; - extern int datatoc_twist_png_size; - - void *icon_data[]= { - 0, - &datatoc_blob_png, - &datatoc_clay_png, - &datatoc_crease_png, - &datatoc_draw_png, - &datatoc_fill_png, - &datatoc_flatten_png, - &datatoc_grab_png, - &datatoc_inflate_png, - &datatoc_layer_png, - &datatoc_nudge_png, - &datatoc_pinch_png, - &datatoc_scrape_png, - &datatoc_smooth_png, - &datatoc_snake_hook_png, - &datatoc_thumb_png, - &datatoc_twist_png, - }; - - size_t icon_size[]= { - 0, - datatoc_blob_png_size, - datatoc_clay_png_size, - datatoc_crease_png_size, - datatoc_draw_png_size, - datatoc_fill_png_size, - datatoc_flatten_png_size, - datatoc_grab_png_size, - datatoc_inflate_png_size, - datatoc_layer_png_size, - datatoc_nudge_png_size, - datatoc_pinch_png_size, - datatoc_scrape_png_size, - datatoc_smooth_png_size, - datatoc_snake_hook_png_size, - datatoc_thumb_png_size, - datatoc_twist_png_size, - }; - - static ImBuf *icon_imbuf[BRUSH_ICON_COUNT]= { 0 }; - - static const int flags = IB_rect|IB_multilayer|IB_metadata; - - static const int default_icon = BRUSH_ICON_DRAW; - - char path[240]; - char *folder; - - if (!(brush->icon_imbuf)) { - if (brush->icon==BRUSH_ICON_FILE) { - - if (brush->icon_filepath[0]) { - // first use the path directly to try and load the file - - BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath)); - BLI_path_abs(path, G.sce); - - brush->icon_imbuf= IMB_loadiffname(path, flags); - - // otherwise lets try to find it in other directories - if (!(brush->icon_imbuf)) { - folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons"); - - path[0]= 0; - - BLI_make_file_string(G.sce, path, folder, brush->icon_filepath); - - if (path[0]) - brush->icon_imbuf= IMB_loadiffname(path, flags); - } - } - - // if all else fails use a default image - if (!(brush->icon_imbuf)) { - if (!icon_imbuf[default_icon]) - icon_imbuf[default_icon]= IMB_ibImageFromMemory(icon_data[default_icon], icon_size[default_icon], flags); - - brush->icon_imbuf= icon_imbuf[default_icon]; - } - } - else { - if (!icon_imbuf[brush->icon]) - icon_imbuf[brush->icon]= IMB_ibImageFromMemory(icon_data[brush->icon], icon_size[brush->icon], flags); - - brush->icon_imbuf= icon_imbuf[brush->icon]; - } - - BKE_icon_changed(BKE_icon_getid(&(brush->id))); - } - - if (!(brush->icon_imbuf)) - printf("get_brush_icon: unable to resolve brush icon imbuf\n"); - - return brush->icon_imbuf; -} - /* Library Operations */ int brush_set_nr(Brush **current_brush, int nr, const char *name) -- cgit v1.2.3 From 75913ce446ba43098f78700b985da28b2e48b39f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 20 Jul 2010 16:44:59 +0000 Subject: 2.5 Beta version files increment, from 2.52 to 2.53. --- source/blender/blenkernel/BKE_blender.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index baec6ecfe6a..4e299accffc 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -44,8 +44,8 @@ struct ReportList; struct Scene; struct Main; -#define BLENDER_VERSION 252 -#define BLENDER_SUBVERSION 5 +#define BLENDER_VERSION 253 +#define BLENDER_SUBVERSION 0 #define BLENDER_MINVERSION 250 #define BLENDER_MINSUBVERSION 0 -- cgit v1.2.3 From d17ce0f148d5cb5d11cc3b1591b397865f3fb641 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Wed, 21 Jul 2010 07:55:53 +0000 Subject: Merging revision 30567 from my GSoC branch, log: Fix for sound not possible to load when file unsaved. --- source/blender/blenkernel/intern/sound.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index f780e71d5cd..ca39355976b 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -122,10 +122,15 @@ struct bSound* sound_new_file(struct Main *bmain, char* filename) bSound* sound = NULL; char str[FILE_MAX]; + char *path; + int len; strcpy(str, filename); - BLI_path_abs(str, bmain->name); + + path = /*bmain ? bmain->name :*/ G.sce; + + BLI_path_abs(str, path); len = strlen(filename); while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') @@ -258,7 +263,7 @@ void sound_load(struct Main *bmain, struct bSound* sound) if(sound->id.lib) path = sound->id.lib->filepath; else - path = bmain ? bmain->name : G.sce; + path = /*bmain ? bmain->name :*/ G.sce; BLI_path_abs(fullpath, path); -- cgit v1.2.3 From edeef8bcd7af488bb11f03464d0bce7757eefcf8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jul 2010 10:39:51 +0000 Subject: Revert revision 30441: [#22876] Add new scene, stacker ".00" bug This commit broke unique datablock naming, tried to fix it properly but the code here is too tricky to change now, will just reopen the bug report. --- source/blender/blenkernel/BKE_library.h | 3 ++- source/blender/blenkernel/intern/library.c | 40 ++++++++++++++---------------- 2 files changed, 20 insertions(+), 23 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index fcf7ae85738..cb61a08f3ba 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -63,7 +63,7 @@ void free_libblock_us(struct ListBase *lb, void *idv); void free_main(struct Main *mainvar); void tag_main(struct Main *mainvar, int tag); -int splitIDname(char *name, char *left, int *nr); +void splitIDname(char *name, char *left, int *nr); void rename_id(struct ID *id, char *name); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); @@ -85,3 +85,4 @@ void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowMa #define ID_FALLBACK_NAME "Untitled" #endif + diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 8b035ff1bba..fdc98d9ed29 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -995,7 +995,7 @@ void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb /* used by buttons.c library.c mball.c */ -int splitIDname(char *name, char *left, int *nr) +void splitIDname(char *name, char *left, int *nr) { int a; @@ -1003,21 +1003,19 @@ int splitIDname(char *name, char *left, int *nr) strncpy(left, name, 21); a= strlen(name); - if(a>1 && name[a-1]=='.') return a; + if(a>1 && name[a-1]=='.') return; while(a--) { if( name[a]=='.' ) { left[a]= 0; *nr= atol(name+a+1); - return a; + return; } if( isdigit(name[a])==0 ) break; left[a]= 0; } strcpy(left, name); - - return a; } static void sort_alpha_id(ListBase *lb, ID *id) @@ -1079,7 +1077,8 @@ static ID *is_dupid(ListBase *lb, ID *id, char *name) static int check_for_dupid(ListBase *lb, ID *id, char *name) { ID *idtest; - int nr= 0, nrtest, a, left_len; + int nr= 0, nrtest, a; + const int maxtest=32; char left[32], leftest[32], in_use[32]; /* make sure input name is terminated properly */ @@ -1096,25 +1095,22 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) /* we have a dup; need to make a new name */ /* quick check so we can reuse one of first 32 ids if vacant */ - memset(in_use, 0, sizeof(in_use)); + memset(in_use, 0, maxtest); /* get name portion, number portion ("name.number") */ - left_len= splitIDname(name, left, &nr); + splitIDname( name, left, &nr); /* if new name will be too long, truncate it */ if(nr>999 && strlen(left)>16) left[16]= 0; else if(strlen(left)>17) left[17]= 0; - if(left_len) { - for(idtest= lb->first; idtest; idtest= idtest->next) { - if( (id != idtest) && - (idtest->lib == NULL) && - (*name == *(idtest->name+2)) && - (strncmp(name, idtest->name+2, left_len)==0) && - (splitIDname(idtest->name+2, leftest, &nrtest) == left_len) - - ) { - if(nrtest < sizeof(in_use)) + for( idtest = lb->first; idtest; idtest = idtest->next ) { + if( id != idtest && idtest->lib == NULL ) { + splitIDname(idtest->name+2, leftest, &nrtest); + /* if base names match... */ + /* optimized */ + if( *left == *leftest && strcmp(left, leftest)==0 ) { + if(nrtest < maxtest) in_use[nrtest]= 1; /* mark as used */ if(nr <= nrtest) nr= nrtest+1; /* track largest unused */ @@ -1123,7 +1119,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) } /* decide which value of nr to use */ - for(a=0; a < sizeof(in_use); a++) { + for(a=0; a=nr) break; /* stop when we've check up to biggest */ if( in_use[a]==0 ) { /* found an unused value */ nr = a; @@ -1133,9 +1129,8 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) /* If the original name has no numeric suffix, * rather than just chopping and adding numbers, - * shave off the end chars until we have a unique name. - * Check the null terminators match as well so we dont get Cube.000 -> Cube.00 */ - if (nr==0 && name[left_len] == left[left_len]) { + * shave off the end chars until we have a unique name */ + if (nr==0) { int len = strlen(name)-1; idtest= is_dupid(lb, id, name); @@ -1394,3 +1389,4 @@ void rename_id(ID *id, char *name) new_id(lb, id, name); } + -- cgit v1.2.3 From b72af8c09a37854fa71f26b3d929cda41e003e44 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jul 2010 15:58:15 +0000 Subject: Fix #20983: cloth and smoke point cache step was not enforced to 1. --- source/blender/blenkernel/intern/cloth.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index ce5bca1da56..b9b1c16c0c4 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -144,6 +144,9 @@ void cloth_init ( ClothModifierData *clmd ) if(!clmd->sim_parms->effector_weights) clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); + + if(clmd->point_cache) + clmd->point_cache->step = 1; } static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon) -- cgit v1.2.3 From 4536a4c6104085f39fe8fcd1c27f37caa3cd8950 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Jul 2010 16:20:54 +0000 Subject: Fix #22841: crash rendering scene with opengl in sequencer as part of animation. Only allow this from main thread, opengl can't be called from render threads. It was already disabled in background mode. For now I'm going to consider this a limitation. --- source/blender/blenkernel/intern/sequencer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 94aa2c62f1a..61415eb4a52 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -55,6 +55,7 @@ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLI_threads.h" #include #include "IMB_imbuf.h" @@ -2258,7 +2259,7 @@ static void do_build_seq_ibuf(Scene *scene, Sequence * seq, TStripElem *se, int seq->scene->markers.first= seq->scene->markers.last= NULL; #endif - if(sequencer_view3d_cb && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { + if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { /* opengl offscreen render */ scene_update_for_newframe(seq->scene, seq->scene->lay); se->ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type); -- cgit v1.2.3