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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-10-27 06:57:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-27 07:05:33 +0300
commitde7544202ab968b1e9b6c529b09bc2616e0f4f00 (patch)
treef44f9238987a067a8cc8563ab0f1502e81b47cf9 /source
parent7ffd3490a873c162cd6b6a3e7698df3c5869a2f9 (diff)
Fix camera lens/ortho manipulator
Update issues remain, require listening to notifiers.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_camera.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_camera.c b/source/blender/editors/space_view3d/view3d_manipulator_camera.c
index cac849bcb09..7d4a8820c9a 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_camera.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_camera.c
@@ -170,11 +170,6 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
/* TODO - make focal length/ortho scale widget optional */
if (true) {
const bool is_ortho = (ca->type == CAM_ORTHO);
- const float scale[3] = {1.0f / len_v3(ob->obmat[0]), 1.0f / len_v3(ob->obmat[1]), 1.0f / len_v3(ob->obmat[2])};
- const float scale_fac = ca->drawsize;
- const float drawsize = is_ortho ?
- (0.5f * ca->ortho_scale) :
- (scale_fac / ((scale[0] + scale[1] + scale[2]) / 3.0f));
float offset[3];
float aspect[2];
@@ -196,13 +191,30 @@ static void WIDGETGROUP_camera_refresh(const bContext *C, wmManipulatorGroup *mg
aspect[0] = (sensor_fit == CAMERA_SENSOR_FIT_HOR) ? 1.0f : aspx / aspy;
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);
+ {
+ float scale_matrix;
+ if (is_ortho) {
+ scale_matrix = ca->ortho_scale * 0.5f;
+ }
+ else {
+ const float scale[3] = {
+ 1.0f / len_v3(ob->obmat[0]),
+ 1.0f / len_v3(ob->obmat[1]),
+ 1.0f / len_v3(ob->obmat[2]),
+ };
+ scale_matrix = ca->drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f);
+ }
+ mul_v3_fl(widget->matrix_basis[0], scale_matrix);
+ mul_v3_fl(widget->matrix_basis[1], scale_matrix);
+ }
+
RNA_float_set_array(widget->ptr, "aspect", aspect);
WM_manipulator_set_matrix_offset_location(widget, offset);
- WM_manipulator_set_scale(widget, drawsize);
/* need to set property here for undo. TODO would prefer to do this in _init */
WM_manipulator_target_property_def_rna(camgroup->focal_len, "offset", &camera_ptr, "lens", -1);
@@ -217,7 +229,6 @@ void VIEW3D_WGT_camera(wmManipulatorGroupType *wgt)
wgt->flag = (WM_MANIPULATORGROUPTYPE_PERSISTENT |
WM_MANIPULATORGROUPTYPE_3D |
- WM_MANIPULATORGROUPTYPE_SCALE |
WM_MANIPULATORGROUPTYPE_DEPTH_3D);
wgt->poll = WIDGETGROUP_camera_poll;