[Source] Xj3D reload (replaceWorld) not updating USE nodes

Norbraten, Terry (CIV) tdnorbra at nps.edu
Tue Dec 9 11:53:22 PST 2014


We fixed this yesterday.  In this case, saving the file “refreshes” the scene which worked well.  The save function in X3D-Edit was only doing some “cookie” stuff that Mike explained.  We added the “refresh” function at that point and it works



> On Dec 9, 2014, at 10:34 AM, Don Brutzman <brutzman at nps.edu> wrote:
> 
> Terry, have isolated the problem we saw last Friday where it appeared as is the "Reload Xj3D" feature wasn't working when we changed some Material values.  There was no apparent change when the Text node in the HelloWorld.x3d scene had its color changed.
> 
> The issue is that restarting an Xj3D viewer is not reloading the USE nodes in the scene.  It does appear to be reloading everything else.
> 
> Test scene:  http://www.web3d.org/x3d/content/examples/HelloWorld.x3d
> 
> Code snippets follow from X3D-Edit illustrating the sequence of steps triggering the reload:
> 
> =====================
> ReloadXj3dAction.java
> 
> public final class ReloadXj3dComponentAction extends CookieAction
> {
>  @Override
>  protected void performAction(Node[] activatedNodes)
>  {
>    Xj3dNewTopComponent topC = Xj3dNewTopComponent.findInstance();
>        if(!topC.isOpened()) {
>        topC.open();
>        topC.requestActive();
>    }
>    topC.getViewerPanel().reloadXj3dComponent();
>  }
> ...
> 
> =====================
> Xj3dViewerPanel.java
> 
>  public void reloadXj3dComponent()
>  {
>    //System.out.println("XJ3D:.....reloadXj3dScene(xObj)");
>    initialize();
>    openXj3dScene(currentX3dObject);
>  }
> 
> ...
> 
>  // New methods to simplify life and get some of the xj3d logic out of the TopComponent
>  public void openXj3dScene(X3DDataObject xObj)
>  {
>      // This has been happening for some reason
>      if (xObj == null) {return;}
> 
>    //System.out.println("XJ3D:.....openXj3dScene(xObj)");
>      try {
>        currentX3dObject = xObj;
>        currentFile = FileUtil.toFile(xObj.getPrimaryFile());
>        currentURLString = Utilities.toURI(currentFile).toURL().toExternalForm();
>        currentScene = x3dBrowser.createX3DFromURL(new String[]{currentURLString});
>      } catch(MalformedURLException ex) {
>        ErrorManager.getDefault().log(ErrorManager.ERROR, ex.getLocalizedMessage());
>      }
> 
>      loadScene(false);
>  }
> 
> ...
> 
>  private void loadScene(boolean stream) {
>    String msg;
>    x3dBrowser.beginUpdate();
>    x3dBrowser.replaceWorld(currentScene);
>    x3dBrowser.endUpdate();
>    if (stream) {
>      msg = "openxj3dScene loaded (stream): "  + currentURLString;
>    } else {
>      msg = "openxj3dScene loaded (file): "  + currentURLString;
>    }
>    System.out.println(msg);
>  }
> =====================
> 
> This is as far as I got.  Based on preceding source fragments, I suspect that the Xj3D omission leading to incomplete reload can be found via further sleuthing in the following method:
> 
>    x3dBrowser.replaceWorld(currentScene);
> 
> all the best, Don
> -- 
> Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the Source mailing list