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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-04-17 18:41:44 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-04-24 13:57:43 +0300
commit3e26b84397fcb5d0b0d8b7e96282f14645577a76 (patch)
treeb2a4c0e1391e6d6d348c0f328acd2eb6635499c8 /source/blender/editors/space_view3d/view3d_manipulator_camera.c
parent15bfa175f849d2ca97b6680046db8b52fc0df4b7 (diff)
Camera manipulator: Make it aware of evaluated version of object
Reviewers: brecht, dfelinto Reviewed By: brecht Differential Revision: https://developer.blender.org/D3159
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_manipulator_camera.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_camera.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_camera.c b/source/blender/editors/space_view3d/view3d_manipulator_camera.c
index 3c826c69f3c..87e550ba638 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_camera.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_camera.c
@@ -47,6 +47,8 @@
#include "WM_types.h"
#include "WM_message.h"
+#include "DEG_depsgraph_query.h"
+
#include "view3d_intern.h" /* own include */
@@ -76,7 +78,9 @@ static bool WIDGETGROUP_camera_poll(const bContext *C, wmManipulatorGroupType *U
static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgroup)
{
+ const Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *ob = CTX_data_active_object(C);
+ const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
float dir[3];
const wmManipulatorType *wt_arrow = WM_manipulatortype_find("MANIPULATOR_WT_arrow_3d", true);
@@ -84,7 +88,7 @@ static void WIDGETGROUP_camera_setup(const bContext *C, wmManipulatorGroup *mgro
struct CameraWidgetGroup *camgroup = MEM_callocN(sizeof(struct CameraWidgetGroup), __func__);
mgroup->customdata = camgroup;
- negate_v3_v3(dir, ob->obmat[2]);
+ negate_v3_v3(dir, ob_eval->obmat[2]);
/* dof distance */
{
@@ -124,26 +128,28 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
if (!mgroup->customdata)
return;
+ const Depsgraph *depsgraph = CTX_data_depsgraph(C);
struct CameraWidgetGroup *camgroup = mgroup->customdata;
Object *ob = CTX_data_active_object(C);
+ const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
Camera *ca = ob->data;
PointerRNA camera_ptr;
float dir[3];
const float ob_scale_inv[3] = {
- 1.0f / len_v3(ob->obmat[0]),
- 1.0f / len_v3(ob->obmat[1]),
- 1.0f / len_v3(ob->obmat[2]),
+ 1.0f / len_v3(ob_eval->obmat[0]),
+ 1.0f / len_v3(ob_eval->obmat[1]),
+ 1.0f / len_v3(ob_eval->obmat[2]),
};
const float ob_scale_uniform_inv = (ob_scale_inv[0] + ob_scale_inv[1] + ob_scale_inv[2]) / 3.0f;
RNA_pointer_create(&ca->id, &RNA_Camera, ca, &camera_ptr);
- negate_v3_v3(dir, ob->obmat[2]);
+ negate_v3_v3(dir, ob_eval->obmat[2]);
if (ca->flag & CAM_SHOWLIMITS) {
- WM_manipulator_set_matrix_location(camgroup->dop_dist, ob->obmat[3]);
- WM_manipulator_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob->obmat[1], dir);
+ WM_manipulator_set_matrix_location(camgroup->dop_dist, ob_eval->obmat[3]);
+ WM_manipulator_set_matrix_rotation_from_yz_axis(camgroup->dop_dist, ob_eval->obmat[1], dir);
WM_manipulator_set_scale(camgroup->dop_dist, ca->drawsize);
WM_manipulator_set_flag(camgroup->dop_dist, WM_MANIPULATOR_HIDDEN, false);
@@ -180,8 +186,8 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
aspect[1] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? aspy / aspx : 1.0f;
unit_m4(widget->matrix_basis);
- WM_manipulator_set_matrix_location(widget, ob->obmat[3]);
- WM_manipulator_set_matrix_rotation_from_yz_axis(widget, ob->obmat[1], dir);
+ WM_manipulator_set_matrix_location(widget, ob_eval->obmat[3]);
+ WM_manipulator_set_matrix_rotation_from_yz_axis(widget, ob_eval->obmat[1], dir);
if (is_ortho) {
scale_matrix = ca->ortho_scale * 0.5f;