diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index fda31d9e7c0..83b014cdd63 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -62,12 +62,18 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa { CurveMapping *cumap; int a; + float clipminx, clipminy, clipmaxx, clipmaxy; cumap= MEM_callocN(sizeof(CurveMapping), "new curvemap"); cumap->flag= CUMA_DO_CLIP; if(tot==4) cumap->cur= 3; /* rhms, hack for 'col' curve? */ - BLI_init_rctf(&cumap->curr, minx, maxx, miny, maxy); + clipminx = MIN2(minx, maxx); + clipminy = MIN2(miny, maxy); + clipmaxx = MAX2(minx, maxx); + clipmaxy = MAX2(miny, maxy); + + BLI_init_rctf(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy); cumap->clipr= cumap->curr; cumap->white[0]= cumap->white[1]= cumap->white[2]= 1.0f; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9f68706716a..751887b9f42 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -70,6 +70,7 @@ #include "BKE_armature.h" #include "BKE_action.h" +#include "BKE_colortools.h" #include "BKE_deform.h" #include "BKE_DerivedMesh.h" #include "BKE_nla.h" @@ -601,6 +602,9 @@ void *add_lamp(char *name) la->ray_samp_method = LA_SAMP_HALTON; la->adapt_thresh = 0.001; la->preview=NULL; + la->falloff_type = LA_FALLOFF_INVLINEAR; + la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f); + curvemapping_initialize(la->curfalloff); return la; } @@ -619,6 +623,8 @@ Lamp *copy_lamp(Lamp *la) } } + lan->curfalloff = curvemapping_copy(la->curfalloff); + id_us_plus((ID *)lan->ipo); if (la->preview) lan->preview = BKE_previewimg_copy(la->preview); @@ -693,13 +699,15 @@ void free_lamp(Lamp *la) /* scriptlinks */ BPY_free_scriptlink(&la->scriptlink); - + for(a=0; a<MAX_MTEX; a++) { mtex= la->mtex[a]; if(mtex && mtex->tex) mtex->tex->id.us--; if(mtex) MEM_freeN(mtex); } la->ipo= 0; + + curvemapping_free(la->curfalloff); BKE_previewimg_free(&la->preview); BKE_icon_delete(&la->id); |