From 8cfdfa582aaa411c47334c5c32363606f7c94eb6 Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Thu, 15 Feb 2007 01:06:15 +0000 Subject: Fix to Issue 274 : NPE With Simultaneous View and Content Side PickingBehaviors git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@776 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/classes/share/javax/media/j3d/PickInfo.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/classes/share/javax') diff --git a/src/classes/share/javax/media/j3d/PickInfo.java b/src/classes/share/javax/media/j3d/PickInfo.java index f1b0b0d..5c3c856 100644 --- a/src/classes/share/javax/media/j3d/PickInfo.java +++ b/src/classes/share/javax/media/j3d/PickInfo.java @@ -597,10 +597,17 @@ public class PickInfo extends Object { Shape3DRetained shape = geomAtoms[i].source; srcNode = shape.sourceNode; + // Fix to Issue 274 : NPE With Simultaneous View and Content Side PickingBehaviors + // This node isn't under the selected BG for pick operation. + if (!inside(shape.branchGroupPath,bgRetained)) { + continue; + } + if (srcNode == null) { // The node is just detach from branch so sourceNode = null continue; } + // Special case, for Text3DRetained, it is possible // for different geomAtoms pointing to the same @@ -657,8 +664,7 @@ public class PickInfo extends Object { pickInfo = null; // PickInfo.SCENEGRAPHPATH - request for computed SceneGraphPath. - if (((flags & SCENEGRAPHPATH) != 0) && - (inside(shape.branchGroupPath,bgRetained))){ + if ((flags & SCENEGRAPHPATH) != 0){ if(first) { mpath = createPath(srcNode, bgRetained, geomAtoms[i], initpath); @@ -714,19 +720,18 @@ public class PickInfo extends Object { Node[] mpath = null; // PickInfo.SCENEGRAPHPATH - request for computed SceneGraphPath. - if (((flags & SCENEGRAPHPATH) != 0) && - (inside(shape.branchGroupPath,bgRetained))) { - + if ((flags & SCENEGRAPHPATH) != 0) { + mpath = createPath(srcNode, bgRetained, geomAtoms[i], initpath); if(mpath != null) { SceneGraphPath sgpath = new SceneGraphPath(locale, mpath, (Node) srcNode.source); sgpath.setTransform(shape.getCurrentLocalToVworld(0)); - if(pickInfo == null) - pickInfo = new PickInfo(); + if(pickInfo == null) + pickInfo = new PickInfo(); pickInfo.setSceneGraphPath(sgpath); - } + } } // PickInfo.NODE - request for computed intersected Node. -- cgit v1.2.3