diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-26 10:44:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-26 10:45:58 +0300 |
commit | 33e45658ebc2a79acda259f7be748ad64780e982 (patch) | |
tree | d0d28e1e1356720087097fb57149b4ebc82985f4 /source/blender/editors/space_view3d | |
parent | 64ee6f4e9f31d991ee83c77c428736b9c4e81b59 (diff) |
COW Fix: Lamp manipulators
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_manipulator_lamp.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c index 88c36fc2c0b..e659c67396d 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_lamp.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_lamp.c @@ -45,6 +45,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "DEG_depsgraph_query.h" + #include "view3d_intern.h" /* own include */ /* -------------------------------------------------------------------- */ @@ -80,16 +82,18 @@ static void WIDGETGROUP_lamp_spot_setup(const bContext *UNUSED(C), wmManipulator static void WIDGETGROUP_lamp_spot_refresh(const bContext *C, wmManipulatorGroup *mgroup) { + const Depsgraph *depsgraph = CTX_data_depsgraph(C); wmManipulatorWrapper *wwrapper = mgroup->customdata; wmManipulator *mpr = wwrapper->manipulator; Object *ob = CTX_data_active_object(C); + const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); Lamp *la = ob->data; float dir[3]; - negate_v3_v3(dir, ob->obmat[2]); + negate_v3_v3(dir, ob_eval->obmat[2]); WM_manipulator_set_matrix_rotation_from_z_axis(mpr, dir); - WM_manipulator_set_matrix_location(mpr, ob->obmat[3]); + WM_manipulator_set_matrix_location(mpr, ob_eval->obmat[3]); /* need to set property here for undo. TODO would prefer to do this in _init */ PointerRNA lamp_ptr; @@ -179,11 +183,13 @@ static void WIDGETGROUP_lamp_area_setup(const bContext *UNUSED(C), wmManipulator static void WIDGETGROUP_lamp_area_refresh(const bContext *C, wmManipulatorGroup *mgroup) { wmManipulatorWrapper *wwrapper = mgroup->customdata; + const Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *ob = CTX_data_active_object(C); - Lamp *la = ob->data; + const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + Lamp *la = ob_eval->data; wmManipulator *mpr = wwrapper->manipulator; - copy_m4_m4(mpr->matrix_basis, ob->obmat); + copy_m4_m4(mpr->matrix_basis, ob_eval->obmat); int flag = ED_MANIPULATOR_CAGE2D_XFORM_FLAG_SCALE; if (ELEM(la->area_shape, LA_AREA_SQUARE, LA_AREA_DISK)) { @@ -266,10 +272,12 @@ static void WIDGETGROUP_lamp_target_setup(const bContext *UNUSED(C), wmManipulat static void WIDGETGROUP_lamp_target_draw_prepare(const bContext *C, wmManipulatorGroup *mgroup) { wmManipulatorWrapper *wwrapper = mgroup->customdata; + const Depsgraph *depsgraph = CTX_data_depsgraph(C); Object *ob = CTX_data_active_object(C); + const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); wmManipulator *mpr = wwrapper->manipulator; - copy_m4_m4(mpr->matrix_basis, ob->obmat); + copy_m4_m4(mpr->matrix_basis, ob_eval->obmat); unit_m4(mpr->matrix_offset); mpr->matrix_offset[3][2] = -2.4f / mpr->scale_basis; WM_manipulator_set_flag(mpr, WM_MANIPULATOR_DRAW_OFFSET_SCALE, true); |