xml3d / xml3d.js

The WebGL/JS implementation of XML3D
Other
75 stars 25 forks source link

Adding an object with visible=false causes it to stay invisible forever #102

Closed ghost closed 9 years ago

ghost commented 9 years ago

Adding an object during runtime with its 'visible' attribute set to false causes the object to not show up initially, just as intended. However setting the 'visible' attribute to true will not actually make the object visible. Hiding and unhiding works fine as long as the added objects 'visible' property is not set to false when appending.

How to reproduce:

// adding the object
var modelNode = XML3D.createElement('model');
modelNode.setAttribute('id', 'CubeAsset');
modelNode.setAttribute('src', 'assets/Cube.xml#Cube');
// if the following is left out, setting visibility works just as expected
modelNode.setAttribute('visible', false);
var groupNode = document.querySelector('#Cube');
groupNode.appendChild(modelNode);
// setting visible
var modelNode = document.querySelector('#CubeAsset');
modelNode.setAttribute('visible', true);
csvurt commented 9 years ago

This seems to be working properly in our development branch, could you try your use case with one of our dev builds and let me know if that works for you?

In the mean time I've added a few more tests for the model element, I couldn't find any visibility tests for it in our suite and it does work a bit differently internally than mesh.

ksons commented 9 years ago

This issue has been fixed in a94749bd2a52ff354814b66733dbbcc606ed32a7 which is on develop branch. It doesn't fix changing visibility within an asset, but since most assets are immutable external resources, this fixes at least the common use case to be able to set the visibility of the instantiation.

ghost commented 9 years ago

Using the dev build as suggested fixes the problem.