[osg-users] osgManipulator error bug? in removeTransformUpdating

Robert Osfield robert.osfield at gmail.com
Thu Nov 19 09:43:18 PST 2009


Hi Mathias,

I've now merged Stephan's bug fix, could you please test svn/trunk to
see if things are now fixed.

Cheers,
Robert.

On Sun, Nov 1, 2009 at 11:40 AM, Matthias Asselborn
<matthias.asselborn at gmx.de> wrote:
> Hi,
>
> iam using the trunk of OSG
> i ve a simple code snipped
> a Group with a dragger and two transformmatrix objects
> and their childs
>
> there is no problem to call the method
> pDragger->addTransformUpdating( pTransformBrick1 );
> pDragger->addTransformUpdating( pTransformBrick2 );
>
> but when i call the methods
>
> pDragger->removeTransformUpdating( pTransformBrick1 );
> pDragger->removeTransformUpdating( pTransformBrick2 );
>
> the code crashes with "Expression: ("This->_has_container()",0)
> in dragger.cpp line 204
>
> Code:
>
> void Dragger::removeTransformUpdating(osg::MatrixTransform* transform)
> {
>    for(Dragger::DraggerCallbacks::iterator itr = _draggerCallbacks.begin();
>        itr != _draggerCallbacks.end();
>        ++itr)
>
>
>
>
> here is my test programm
>
>
> Code:
>
> int main( int argc, char **argv )
> {
>        osgViewer::Viewer viewer;
>
>        osg::ref_ptr<osg::Group> pRoot = new osg::Group;
>
>        osg::ref_ptr<osg::Node> pBrick1 = osgDB::readNodeFile( "D:\\bricks\\obj\\3001.obj" );
>        osg::ref_ptr<osg::Node> pBrick2 = osgDB::readNodeFile( "D:\\bricks\\obj\\3005.obj" );
>
>        osg::MatrixTransform* pTransformBrick1 = new osg::MatrixTransform;
>    pTransformBrick1->addChild( pBrick1 );
>
>        osg::MatrixTransform* pTransformBrick2 = new osg::MatrixTransform;
>    pTransformBrick2->addChild( pBrick2 );
>
>        osgManipulator::Dragger* pDragger = 0;
>        osg::ref_ptr<osgManipulator::TabBoxDragger> pTabBoxDragger = new osgManipulator::TabBoxDragger();
>    pTabBoxDragger->setupDefaultGeometry();
>    pDragger = pTabBoxDragger;
>
>        pRoot->addChild(pTransformBrick1);
>        pRoot->addChild(pTransformBrick2);
>        pRoot->addChild( pDragger );
>
>     float scale = pBrick1->getBound().radius() * 1.6;
>     pDragger->setMatrix(osg::Matrix::scale( scale, scale, scale ) *
>                        osg::Matrix::translate( pBrick1->getBound().center() ) );
>
>    pDragger->addTransformUpdating( pTransformBrick1 );
>        pDragger->addTransformUpdating( pTransformBrick2 );
>        pDragger->removeTransformUpdating( pTransformBrick1 );
>        pDragger->removeTransformUpdating( pTransformBrick2 );
>
>    pDragger->setHandleEvents(true);
>
>    osgUtil::Optimizer optimizer;
>    optimizer.optimize( pRoot.get() );
>
>        viewer.setSceneData( pRoot.get() );
>    return viewer.run();
> }
>
>
>
> Why doesnt it work?
> Is there another way to activate and deactivate the dragger to the nodes?
>
> Thank you!
>
> Cheers,
> Matthias
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=18996#18996
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


More information about the osg-users mailing list