HI Max, If you have got things working could you post the changed file to osg-submissions, and if possible include an OpenFlight file and test problem that reproduces the problem before so that we can reproduce then confirm the fix. I very concerned that you fix will fix one type of usage and break another, so we'll need to be very thorough in reviewing these changes.
Robert. On Tue, Aug 26, 2008 at 10:16 PM, Max Bandazian <[EMAIL PROTECTED]> wrote: > Hi, > > I'm not sure if this should go on osg-submissions instead, or if it's even a > submission at all (deletion?), but simply removing line 192 (_start = _now) > fixes the problem. > > The bug is that the openflight loader sets the sequence's mode to START > before it's in the scene graph, so the _start time is always set to 0. This > breaks the update function and causes the strange behavior. Since the update > function correctly handles the default value of _start == -1, there doesn't > seem to be any need to change it when setting the animation mode. > > -Max > > On Thu, Aug 14, 2008 at 12:08 PM, Robert Osfield <[EMAIL PROTECTED]> > wrote: >> >> Hi Max, >> >> My guess is that your Viewer's SimulationTime is up and running by the >> time the new model is loaded, rather than starting off at 0.0 which is >> causing the problems. >> >> The actual implementation details of osg::Sequence is something that >> community members have working on over the years, rather than me >> developing it so I'm not best placed to answer why this/why that will >> all the implementation details. >> >> Robert. >> >> On Thu, Aug 14, 2008 at 4:27 PM, Max Bandazian <[EMAIL PROTECTED]> >> wrote: >> > Thanks for the responses. >> > >> > I'm not sure what "stopping the frame loop refers to", since something >> > like >> > >> > while(!viewer->done()) >> > { >> > if (viewer->getFrameStamp()->getFrameNumber() == 500) >> > { >> > rootNode->addChild( >> > osgDB::readNodeFile("some_animation.flt")); >> > } >> > >> > viewer->frame(); >> > } >> > >> > would exhibit the same problem. I've loooked at the source in more >> > detail, >> > so I can be more explicit now about exactly what's going on. >> > >> > When the sequence is loaded, the sim time is around 8 seconds, but the >> > sequence's _start (which I am assuming represents the time at which the >> > current frame started) is 0. The _start time is increased every frame >> > by: >> > (line 312) _start += _frameTime[_value]*osg::absolute(_speed); >> > So since _start is so far behind _now, the animation runs 1 frame per >> > update >> > until the time catches up. >> > >> > With this in mind, I'll rephrase my questions: >> > 1. Shouldn't line 312 be _start = _now; ? >> > 2. What is the purpose of _sync, and why would an OSG user choose to set >> > it >> > one way or the other? >> > 3. Since with _sync off the animation speed is dependent on framerate, >> > and >> > in most dynamic scenes framerate is not constant, shouldn't the default >> > value be true? >> > >> > Thanks, >> > Max Bandazian >> > >> > >> > I looked at the sequence source in more detail, and I can be more >> > explicit >> > about exactly what is going on. When the sequence node is loaded, the >> > frametime is >> > >> > On Tue, Aug 12, 2008 at 1:28 PM, Robert Osfield >> > <[EMAIL PROTECTED]> >> > wrote: >> >> >> >> Hi Max, >> >> >> >> Stopping the frame loop and restarting it without explictly adjusting >> >> the simulation time to account for your frameloop stop is something >> >> that I'd expect to cause problems - I also can't see how the OSG could >> >> automatically catch this particular usage model. >> >> >> >> Robert. >> >> >> >> On Thu, Aug 7, 2008 at 6:26 PM, Max Bandazian <[EMAIL PROTECTED]> >> >> wrote: >> >> > Hi, >> >> > I am experiencing some buggy behavior relating to loaded openflight >> >> > files >> >> > containing sequences, and I would appreciate any suggestions. When >> >> > such >> >> > a >> >> > file is loaded after the viewer has been running for a bit, the >> >> > animation >> >> > runs at the wrong speed. Here's some sample code that illustrates the >> >> > problem: >> >> > >> >> > osg::ref_ptr<osg::Group> rootNode = new osg::Group; >> >> > >> >> > osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer; >> >> > viewer->setUpViewOnSingleScreen(0); >> >> > viewer->setSceneData(rootNode.get()); >> >> > viewer->setCameraManipulator(new >> >> > osgGA::TrackballManipulator()); >> >> > >> >> > viewer->realize(); >> >> > >> >> > while(!viewer->done() && >> >> > viewer->getFrameStamp()->getFrameNumber() >> >> > < >> >> > 500) >> >> > { >> >> > viewer->frame(); >> >> > } >> >> > >> >> > osg::ref_ptr<osg::Node> modelNode = >> >> > osgDB::readNodeFile("some_animation.flt"); >> >> > rootNode->addChild(modelNode.get()); >> >> > >> >> > while(!viewer->done()) >> >> > { >> >> > viewer->frame(); >> >> > } >> >> > >> >> > When the animation gets loaded in the above code, it runs much faster >> >> > than >> >> > it ought to for around 5 seconds, and then runs at the normal rate. >> >> > It >> >> > appears to be "catching up" with the frame time. Sending a visitor >> >> > down >> >> > every loaded flt file and setting sync to true on all sequences seems >> >> > to >> >> > fix >> >> > the problem, but it seems like this should not be necessary. >> >> > >> >> > Thanks, >> >> > Max Bandazian >> >> > >> >> > _______________________________________________ >> >> > osg-users mailing list >> >> > osg-users@lists.openscenegraph.org >> >> > >> >> > >> >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > >> >> > >> >> _______________________________________________ >> >> osg-users mailing list >> >> osg-users@lists.openscenegraph.org >> >> >> >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> > _______________________________________________ >> > osg-users mailing list >> > osg-users@lists.openscenegraph.org >> > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > >> > >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org