Lamps: Make default size more usable

This way the area light shapes are more visible (and usable) by default.

Changes were discussed with @venomgfx
This commit is contained in:
Clément Foucault 2018-06-24 15:02:52 +02:00
parent a9bc880cf8
commit 6454319033
2 changed files with 16 additions and 2 deletions

View File

@ -72,7 +72,7 @@ void BKE_lamp_init(Lamp *la)
la->samp = 3;
la->bias = 1.0f;
la->soft = 3.0f;
la->area_size = la->area_sizey = la->area_sizez = 0.1f;
la->area_size = la->area_sizey = la->area_sizez = 0.25f;
la->buffers = 1;
la->preview = NULL;
la->falloff_type = LA_FALLOFF_INVSQUARE;

View File

@ -1013,7 +1013,21 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
ob = ED_object_add_type(C, OB_LAMP, get_lamp_defname(type), loc, rot, false, layer);
BKE_object_obdata_size_init(ob, RNA_float_get(op->ptr, "radius"));
float size = RNA_float_get(op->ptr, "radius");
/* Better defaults for lamp size. */
switch(type) {
case LA_LOCAL:
case LA_SPOT:
break;
case LA_AREA:
size *= 4.0f;
break;
default:
size *= 0.5f;
break;
}
BKE_object_obdata_size_init(ob, size);
la = (Lamp *)ob->data;
la->type = type;