[osg-users] osgAnimation::ReaderWriter Bug on Linux ?

2009-10-26 Thread pp
We noticed a Bug in osgAnimation of the stable osg release 2.8.2, and 
only on Linux ( Ubuntu 9.04 ), which does not occur on Windows with 
Visual Studio 2005.
When writing out an osgAnimation programm to a osg file, the process 
stops before writing keyframe data:


Node {
nodeMask 0x
cullingActive TRUE
UpdateCallbacks {
  osgAnimation::BasicAnimationManager {
num_animations 1
osgAnimation::Animation {
  name myTestanimation
  num_channels 1
  Channel {
name position
target whatever
Keyframes Vec3 2 {

In Debug Mode we figured out, that the problem comes from 
src/osgplugins/osganimation/ReaderWriter.cpp  Line 273, 274, pointer kk 
points to adresse 0x0 after dynamic_cast


osgAnimation::Vec3KeyframeContainer* kk = 
dynamic_castosgAnimation::Vec3KeyframeContainer*(kf);
fw.indent()  key   (*kk)[k].getTime()  
(*kk)[k].getValue()  std::endl;


Source Code Attached

Cheers, searching for the Pivot of my Soul, PP !!!
/*  -*-c++-*- 
 *  Copyright (C) 2008 Cedric Pinson morni...@plopbyte.net
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#include iostream
#include osg/Geometry
#include osg/Shape
#include osg/ShapeDrawable
#include osgViewer/Viewer
#include osgDB/FileUtils
#include osgDB/WriteFile
#include osgDB/ReadFile
#include osgGA/TrackballManipulator
#include osg/MatrixTransform
#include osg/Material
#include osgAnimation/Sampler
#include osgAnimation/BasicAnimationManager
#include osgAnimation/Animation




int main( int , char** )
{
   //create node
   osg::Node* testNode = new osg::Node(); //you can also use osg::Group or osg::MatrixTransform here

   //create animationmanager (= updatecallback)
   osgAnimation::BasicAnimationManager* testanimationManager = new osgAnimation::BasicAnimationManager();

   //create animation for this updatecallback
   osgAnimation::Animation* testAnimation = new osgAnimation::Animation();
   testAnimation-setName(myTestanimation);

   //create channel for this animation
   osgAnimation::Vec3LinearChannel* testchannel = new osgAnimation::Vec3LinearChannel; //we are not using Vec3CubicBezier because this cannot be written to file. maybe it is not specified in writer.
   testchannel-setTargetName(whatever);
   testchannel-setName(position); //the name must be a certain keyword like position otherwise it does not work
   //get keys and fill them with some data --- WARNING: IF you add no keys, programm will crash when calling testAnimation-addChannel(testchannel);
   osgAnimation::Vec3KeyframeContainer* keys = testchannel-getOrCreateSampler()-getOrCreateKeyframeContainer();
   keys-push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0))); //first frame
   keys-push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0))); //second frame

   // now add channel to animation
   testAnimation-addChannel(testchannel);
   //add animation to updatecallback
   testanimationManager-registerAnimation(testAnimation);
   //add updatecallback (=animationmanager) to node
   testNode-addUpdateCallback(testanimationManager);


   //in the end write all data to a file
   osgDB::writeNodeFile(*testNode, testNode.osg);
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgAnimation::ReaderWriter Bug on Linux ?

2009-10-26 Thread Cedric Pinson
Hi pp,

Did you notice the same behavior with the current svn version ? There
are a lot of fixed bug since the 2.8.xx about osgAnimation

Cheers,
Cedric

-- 
+33 659 598 614  Cedric Pinson mailto:cedric.pin...@plopbyte.net
http://www.plopbyte.net


On Mon, 2009-10-26 at 11:08 +0100, p...@graphics.cs.uni-sb.de wrote:
 We noticed a Bug in osgAnimation of the stable osg release 2.8.2, and 
 only on Linux ( Ubuntu 9.04 ), which does not occur on Windows with 
 Visual Studio 2005.
 When writing out an osgAnimation programm to a osg file, the process 
 stops before writing keyframe data:
 
 Node {
  nodeMask 0x
  cullingActive TRUE
  UpdateCallbacks {
osgAnimation::BasicAnimationManager {
  num_animations 1
  osgAnimation::Animation {
name myTestanimation
num_channels 1
Channel {
  name position
  target whatever
  Keyframes Vec3 2 {
 
 In Debug Mode we figured out, that the problem comes from 
 src/osgplugins/osganimation/ReaderWriter.cpp  Line 273, 274, pointer kk 
 points to adresse 0x0 after dynamic_cast
 
 osgAnimation::Vec3KeyframeContainer* kk = 
 dynamic_castosgAnimation::Vec3KeyframeContainer*(kf);
 fw.indent()  key   (*kk)[k].getTime()  
 (*kk)[k].getValue()  std::endl;
 
 Source Code Attached
 
 Cheers, searching for the Pivot of my Soul, PP !!!
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


signature.asc
Description: This is a digitally signed message part
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgAnimation::ReaderWriter Bug on Linux ?

2009-10-26 Thread pp

Cedric Pinson wrote:

Hi pp,

Did you notice the same behavior with the current svn version ? There
are a lot of fixed bug since the 2.8.xx about osgAnimation

Cheers,
Cedric
  

Hi, the current hg version does not have this bug.
Problem is that we are supposed to use the stable releases only.
Anyway, thx.

Cheers, searching for the Pivot of my Soul, PP !!!
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgAnimation::ReaderWriter Bug on Linux ?

2009-10-26 Thread Cedric Pinson
Hi pp,

If you have a fix maybe it could have its place in a new release of the
2.8.x branch. I read Paul would like to make a new release.

Cheers,
Cedric

-- 
+33 659 598 614  Cedric Pinson mailto:cedric.pin...@plopbyte.net
http://www.plopbyte.net


On Mon, 2009-10-26 at 13:48 +0100, p...@graphics.cs.uni-sb.de wrote:
 Cedric Pinson wrote:
  Hi pp,
 
  Did you notice the same behavior with the current svn version ? There
  are a lot of fixed bug since the 2.8.xx about osgAnimation
 
  Cheers,
  Cedric

 Hi, the current hg version does not have this bug.
 Problem is that we are supposed to use the stable releases only.
 Anyway, thx.
 
 Cheers, searching for the Pivot of my Soul, PP !!!
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 


signature.asc
Description: This is a digitally signed message part
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org