On an old hdd I've found a little plugin for tweak-manipulating objects, which intended for fast bones manipulations (but I never finished it)
Its my modification of a plugin of someone else, which did i dont remember what
Here is a piece of code which obviously rotates object around viewplane normal on mousedrag:
Code: Select all
CStatus MouseDrag( ToolContext& in_ctxt )
{
LONG x, y;
in_ctxt.GetMousePosition( x, y );
if ( in_ctxt.IsLeftButtonDown() )
{
X3DObject x3dobj(sel.GetItem(0));
CPlane vp;
CVector3 vn;
in_ctxt.GetViewPlane(vp);
vn = vp.GetNormal();
CTransformation t = x3dobj.GetKinematics().GetGlobal().GetTransform();
CRotation r = x3dobj.GetKinematics().GetGlobal().GetTransform().GetRotation();
CRotation r2;
CTransformation t2;
KinematicState lightKine = x3dobj.GetKinematics().GetGlobal();
r2.SetFromAxisAngle (vn, 0.017);
CMatrix3 mtr1 = r.GetMatrix();
CMatrix3 mtr2 = r2.GetMatrix();
mtr1 *= mtr2;
r.SetFromMatrix(mtr1);
t.SetRotation(r);
in_ctxt.UpdateKinematicState(lightKine, t);
}
return CStatus::OK;
}
Thanks for your time!