diff options
Diffstat (limited to 'source/blender/blenkernel/intern/object.c')
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 96 |
1 files changed, 85 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f3486360d08..b25c130590e 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -50,6 +50,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_sequence_types.h" +#include "DNA_smoke_types.h" #include "DNA_sound_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -971,7 +972,6 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) void copy_object_particlesystems(Object *obn, Object *ob) { - ParticleSystemModifierData *psmd; ParticleSystem *psys, *npsys; ModifierData *md; @@ -984,10 +984,28 @@ void copy_object_particlesystems(Object *obn, Object *ob) /* need to update particle modifiers too */ for(md=obn->modifiers.first; md; md=md->next) { if(md->type==eModifierType_ParticleSystem) { - psmd= (ParticleSystemModifierData*)md; + ParticleSystemModifierData *psmd= (ParticleSystemModifierData*)md; if(psmd->psys==psys) psmd->psys= npsys; } + else if(md->type==eModifierType_DynamicPaint) { + DynamicPaintModifierData *pmd= (DynamicPaintModifierData*)md; + if (pmd->brush) { + if(pmd->brush->psys==psys) { + pmd->brush->psys= npsys; + } + } + } + else if (md->type==eModifierType_Smoke) { + SmokeModifierData *smd = (SmokeModifierData*) md; + + if(smd->type==MOD_SMOKE_TYPE_FLOW) { + if (smd->flow) { + if (smd->flow->psys == psys) + smd->flow->psys= npsys; + } + } + } } } } @@ -1879,13 +1897,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4]) } } -// XXX what the hell is this? -static int no_parent_ipo=0; -void set_no_parent_ipo(int val) -{ - no_parent_ipo= val; -} - static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4]) { float *fp1, *fp2; @@ -1893,7 +1904,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ int a; // include framerate - fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) ); + fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) ); if(fac1 >= 1.0f) return 0; fac2= 1.0f-fac1; @@ -1925,7 +1936,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) /* hurms, code below conflicts with depgraph... (ton) */ /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */ - if(no_parent_ipo==0 && stime != par->ctime) { + if(stime != par->ctime) { // only for ipo systems? Object tmp= *par; @@ -2343,6 +2354,69 @@ int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max) return ok; } +void BKE_object_foreach_display_point( + Object *ob, float obmat[4][4], + void (*func_cb)(const float[3], void *), void *user_data) +{ + float co[3]; + + if (ob->derivedFinal) { + DerivedMesh *dm= ob->derivedFinal; + MVert *mv= dm->getVertArray(dm); + int totvert= dm->getNumVerts(dm); + int i; + + for (i= 0; i < totvert; i++, mv++) { + mul_v3_m4v3(co, obmat, mv->co); + func_cb(co, user_data); + } + } + else if (ob->disp.first) { + DispList *dl; + + for (dl=ob->disp.first; dl; dl=dl->next) { + float *v3= dl->verts; + int totvert= dl->nr; + int i; + + for (i= 0; i < totvert; i++, v3+=3) { + mul_v3_m4v3(co, obmat, v3); + func_cb(co, user_data); + } + } + } +} + +void BKE_scene_foreach_display_point( + Scene *scene, View3D *v3d, const short flag, + void (*func_cb)(const float[3], void *), void *user_data) +{ + Base *base; + Object *ob; + + for(base= FIRSTBASE; base; base = base->next) { + if(BASE_VISIBLE(v3d, base) && (base->flag & flag) == flag) { + ob= base->object; + + if ((ob->transflag & OB_DUPLI)==0) { + BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data); + } + else { + ListBase *lb; + DupliObject *dob; + + lb= object_duplilist(scene, ob); + for(dob= lb->first; dob; dob= dob->next) { + if(dob->no_draw == 0) { + BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data); + } + } + free_object_duplilist(lb); /* does restore */ + } + } + } +} + /* copied from DNA_object_types.h */ typedef struct ObTfmBack { float loc[3], dloc[3], orig[3]; |