Changeset 229 for osgVisual/trunk/src


Ignore:
Timestamp:
Feb 13, 2011, 2:00:53 PM (14 years ago)
Author:
Torben Dannhauer
Message:

Fixed NodeTrackerManipulators?: Now the don't crash even if they are activated without a valid node to track.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/src/manip_Spacemouse/manip_nodeTrackerSpaceMouse.cpp

    r228 r229  
    324324    osg::NodePath nodePath;
    325325       
    326     if (  _trackNodePath.getNodePath(nodePath))
    327     {
    328         worldToLocal = osg::computeWorldToLocal(nodePath);
    329         localToWorld = osg::computeLocalToWorld(nodePath);
     326        if (_trackNodePath.getNodePath(nodePath) && !nodePath.empty())
     327        {
     328                worldToLocal = osg::computeWorldToLocal(nodePath);
     329                localToWorld = osg::computeLocalToWorld(nodePath);
    330330        nodeCenter = osg::Vec3d(nodePath.back()->getBound().center())*localToWorld;
    331     }
     331        }
    332332    else
    333     {
    334333        nodeCenter = osg::Vec3d(0.0f,0.0f,0.0f)*localToWorld;
    335     }
    336334
    337335
Note: See TracChangeset for help on using the changeset viewer.