[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51982] trunk/blender/source/blender: Bugfix #32806
Ton Roosendaal
ton at blender.org
Wed Nov 7 17:18:23 CET 2012
Revision: 51982
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51982
Author: ton
Date: 2012-11-07 16:18:20 +0000 (Wed, 07 Nov 2012)
Log Message:
-----------
Bugfix #32806
Two fixes for NDOF device:
- RNA item for setting turntable or trackball for ndof was using wrong variable
- Some moment the option "rotate around selection" stopped to work for ndof.
Note: the latter option doesn't do dolly in, use shift+ndof for that.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
trunk/blender/source/blender/makesrna/intern/rna_userdef.c
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2012-11-07 14:56:53 UTC (rev 51981)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_edit.c 2012-11-07 16:18:20 UTC (rev 51982)
@@ -992,8 +992,10 @@
* -- zooming
* -- panning in rotationally-locked views
*/
-static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+static int ndof_orbit_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
+ ViewOpsData *vod = op->customdata;
+
if (event->type != NDOF_MOTION)
return OPERATOR_CANCELLED;
else {
@@ -1074,6 +1076,7 @@
rot[1] = rot[2] = 0.0;
rot[3] = sin(angle);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
}
else {
float rot[4];
@@ -1088,6 +1091,7 @@
if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
axis[1] = -axis[1];
+
/* transform rotation axis from view to world coordinates */
mul_qt_v3(view_inv, axis);
@@ -1100,8 +1104,23 @@
/* apply rotation */
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
+
}
+
+ /* rotate around custom center */
+ if (vod && vod->use_dyn_ofs) {
+ float q1[4];
+
+ /* compute the post multiplication quat, to rotate the offset correctly */
+ conjugate_qt_qt(q1, vod->oldquat);
+ mul_qt_qtqt(q1, q1, rv3d->viewquat);
+
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ copy_v3_v3(rv3d->ofs, vod->ofs);
+ sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ }
}
}
@@ -1267,6 +1286,9 @@
float axis[3];
#endif
+ /* inverse view */
+ invert_qt_qt(view_inv, rv3d->viewquat);
+
if (U.ndof_flag & NDOF_PANX_INVERT_AXIS)
pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
else
@@ -1285,12 +1307,11 @@
mul_v3_fl(pan_vec, speed * dt);
/* transform motion from view to world coordinates */
- invert_qt_qt(view_inv, rv3d->viewquat);
mul_qt_v3(view_inv, pan_vec);
/* move center of view opposite of hand motion (this is camera mode, not object mode) */
sub_v3_v3(rv3d->ofs, pan_vec);
-
+
if (U.ndof_flag & NDOF_TURNTABLE) {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
float angle, rot[4];
@@ -1350,8 +1371,24 @@
/* apply rotation */
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
+ }
+
+ /* rotate around custom center */
+ if (vod && vod->use_dyn_ofs) {
+ float q1[4];
+
+ /* compute the post multiplication quat, to rotate the offset correctly */
+ conjugate_qt_qt(q1, vod->oldquat);
+ mul_qt_qtqt(q1, q1, rv3d->viewquat);
+
+ conjugate_qt(q1); /* conj == inv for unit quat */
+ copy_v3_v3(rv3d->ofs, vod->ofs);
+ sub_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ mul_qt_v3(q1, rv3d->ofs);
+ add_v3_v3(rv3d->ofs, vod->dyn_ofs);
+ }
- }
}
ED_view3d_camera_lock_sync(v3d, rv3d);
Modified: trunk/blender/source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_userdef.c 2012-11-07 14:56:53 UTC (rev 51981)
+++ trunk/blender/source/blender/makesrna/intern/rna_userdef.c 2012-11-07 16:18:20 UTC (rev 51982)
@@ -3424,7 +3424,7 @@
/* 3D view */
prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
RNA_def_property_enum_items(prop, ndof_view_rotation_items);
RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport");
More information about the Bf-blender-cvs
mailing list