Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-05-02 15:40:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-02 15:40:00 +0300
commit5659d8bc0aa334aee20f29548e048f3002f1cff6 (patch)
tree924286c8a2cac613491de5fabb6208192960f58a /source/blender/editors/object/object_transform.c
parent23fe6e7eab3a728f1d1c6df2cef97ad02c222d37 (diff)
parent522bee3fc838c83b377d0e05fef8299a29ae5a16 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/object/object_transform.c')
-rw-r--r--source/blender/editors/object/object_transform.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index df8a1b8b87a..f3045d44826 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -35,6 +35,7 @@
#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_group_types.h"
@@ -479,6 +480,18 @@ static int apply_objects_internal(
changed = false;
}
}
+
+ if (ob->type == OB_LAMP) {
+ Lamp *la = ob->data;
+ if (la->type == LA_AREA) {
+ if (apply_rot || apply_loc) {
+ BKE_reportf(reports, RPT_ERROR,
+ "Area Lamps can only have scale applied: \"%s\"",
+ ob->id.name + 2);
+ changed = false;
+ }
+ }
+ }
}
CTX_DATA_END;
@@ -608,6 +621,22 @@ static int apply_objects_internal(
ob->empty_drawsize *= max_scale;
}
}
+ else if (ob->type == OB_LAMP) {
+ Lamp *la = ob->data;
+ if (la->type != LA_AREA) {
+ continue;
+ }
+
+ bool keeps_aspect_ratio = compare_ff_relative(rsmat[0][0], rsmat[1][1], FLT_EPSILON, 64);
+ if ((la->area_shape == LA_AREA_SQUARE) && !keeps_aspect_ratio) {
+ la->area_shape = LA_AREA_RECT;
+ la->area_sizey = la->area_size;
+ }
+
+ la->area_size *= rsmat[0][0];
+ la->area_sizey *= rsmat[1][1];
+ la->area_sizez *= rsmat[2][2];
+ }
else {
continue;
}