[Source] Xj3D reload (replaceWorld) not updating USE nodes
Don Brutzman
brutzman at nps.edu
Wed Dec 10 05:34:51 PST 2014
Terry and I continued debugging yesterday and isolated some deeper problems.
Tricky diagnosis for diffuseColor problem because it only occurs in a special case.
1. Material diffuseColor ignored for USE nodes, but only when there is an associated ImageTexture.
2. Vertical justification of Text strings is incorrect.
Image attached illustrating these two problems.
Source and pretty-print listing:
http://www.web3d.org/x3d/content/examples/HelloWorld.x3d
http://www.web3d.org/x3d/content/examples/HelloWorld.html
On 12/9/2014 11:53 AM, Norbraten, Terry (CIV) wrote:
> 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
Really great feature and very sensible, thanks! "Reload on save" will be part of next release.
p.s. so far am liking the Xj3D button/hotkey that launches (if needed) and reloads the scene, pretty convenient. 8)
>> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HelloWorldXj3dProblemsDiffuseColorVerticalJustification.png
Type: image/png
Size: 102790 bytes
Desc: not available
URL: <http://web3d.org/mailman/private/source_web3d.org/attachments/20141210/283a6861/attachment-0001.png>
More information about the Source
mailing list