#70 ✓resolved
lindsay.kay (at xeolabs)

Expose state of SceneJS.Load<xx> nodes through API

Reported by lindsay.kay (at xeolabs) | May 12th, 2010 @ 12:52 PM | in V0.7.5

Add ability to get state of SceneJS.Load and SceneJS.LoadCollada nodes.

A SceneJS.Load node has four states it can be in:

  • STATE_INITIAL - node has been defined, but not rendered yet and hence has not yet made its load request
  • STATE_LOADING - has made its load request and is waiting for the response, which it will receive on a future render of its scene graph
  • STATE_LOADED - has successfully received its response and loaded the content into its subgraph
  • STATE_ERROR - attempted to load but failed (eg. HTTP 404) and now permanently inactivated by SceneJS

When a SceneJS.Load has not been rendered in a while (maybe it's within a SceneJS.Boundary that's been outside of the view frustum for a long time) it may transition back to STATE_INITIAL when SceneJS evicts it's subgraph from the scene to reclaim memory.

Provide a new method, SceneJS.Load.getState() to query the node's state, plus a "state-changed" event to listen to through the new SceneJS.Node event API.

for example:

var myLoad = new SceneJS.Load({ uri: "http://foo.com/..." });

var handler = function(node, params) {
                  alert("Node " + node.getType() + " has changed state to " + node.getState());
             };
 
myLoad.addListener("state-changed", handler,

               // Listener options
               {
                     scope: this   // Optional scope for handler call, defaults to this
               });
 
myLoad.removeListener("state-changed", handler);

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

SceneJS provides easy access to WebGL through a simple and declarative JavaScript API. The SceneJS API is functional, which enables its scene definitions to be really compact and expressive, while hooking into other JavaScript code just that little bit more smoothly.

Shared Ticket Bins

People watching this ticket

Pages