Gui: Refactor navigation animations
- Animations are played through an Animator - Standard animations have a fixed duration and inherit from QVariantAnimation - The animation duration can be changed in the preferences - Fix animations when using the two arrows above the NaviCube - Start an animation or start and wait for an animation - Replaces standard camera animations (e.g. by selecting standard views or NaviCube) with FixedTimeAnimation - Replace View3DInventorViewer's CameraAnimation with FixedTimeAnimation - Replace OpenInventor navigation style infinite spin animation with SpinningAnimation - Stops an active animation when a new animation is started - Stops an active animation when the user starts dragging, panning or zooming - Refactor reorientCamera so it can be used in animations - Enable animations by default
This commit is contained in:
@@ -777,10 +777,8 @@ Py::Object View3DInventorPy::getCameraOrientation()
|
||||
|
||||
Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args)
|
||||
{
|
||||
PyObject* p=nullptr;
|
||||
int steps = 20;
|
||||
int ms = 30;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|O!ii",&Base::PlacementPy::Type,&p,&steps,&ms))
|
||||
PyObject* p = nullptr;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "|O!", &Base::PlacementPy::Type, &p))
|
||||
throw Py::Exception();
|
||||
|
||||
if (p) {
|
||||
@@ -791,7 +789,7 @@ Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args)
|
||||
rot.getValue(q0,q1,q2,q3);
|
||||
getView3DIventorPtr()->getViewer()->moveCameraTo(
|
||||
SbRotation((float)q0, (float)q1, (float)q2, (float)q3),
|
||||
SbVec3f((float)pos.x, (float)pos.y, (float)pos.z), steps, ms);
|
||||
SbVec3f((float)pos.x, (float)pos.y, (float)pos.z));
|
||||
}
|
||||
|
||||
SoCamera* cam = getView3DIventorPtr()->getViewer()->getSoRenderManager()->getCamera();
|
||||
@@ -810,11 +808,11 @@ Py::Object View3DInventorPy::viewPosition(const Py::Tuple& args)
|
||||
|
||||
Py::Object View3DInventorPy::startAnimating(const Py::Tuple& args)
|
||||
{
|
||||
float x,y,z;
|
||||
float x, y, z;
|
||||
float velocity;
|
||||
if (!PyArg_ParseTuple(args.ptr(), "ffff", &x,&y,&z,&velocity))
|
||||
if (!PyArg_ParseTuple(args.ptr(), "ffff", &x, &y, &z, &velocity))
|
||||
throw Py::Exception();
|
||||
getView3DIventorPtr()->getViewer()->startAnimating(SbVec3f(x,y,z),velocity);
|
||||
getView3DIventorPtr()->getViewer()->startSpinningAnimation(SbVec3f(x, y, z), velocity);
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user