diff --git a/CHANGELOG.md b/CHANGELOG.md index 576b23d505..cbb5bcc471 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * MSFT_texture_dds * field values from metadata for non-standard nodes * Improvements + * isBound and bindTime output for bindable nodes * generate module builds (x3dom-modules.js etc.) * allow null value for glTF.scene.nodes * improved fog over shadows ([dmorehead](https://github.com/dmorehead)) diff --git a/src/nodes/Core/X3DBindableNode.js b/src/nodes/Core/X3DBindableNode.js index 0e12eacded..7734c172f5 100644 --- a/src/nodes/Core/X3DBindableNode.js +++ b/src/nodes/Core/X3DBindableNode.js @@ -57,6 +57,27 @@ x3dom.registerNodeType( */ this.addField_SFBool( ctx, "isActive", false ); + /** + * Output event true gets sent when node becomes bound and activated, + * otherwise output event false gets sent when node becomes unbound and deactivated. + * Only appears in messages + * @var {x3dom.fields.SFBool} isBound + * @memberof x3dom.nodeTypes.X3DBindableNode + * @initvalue false + * @field x3d + * @instance + */ + + /** + * Event sent reporting timestamp when node becomes active/inactive. + * Only appears in messages + * @var {x3dom.fields.SFTime} bindTime + * @memberof x3dom.nodeTypes.X3DBindableNode + * @initvalue null + * @field x3d + * @instance + */ + this._autoGen = ( ctx && ctx.autoGen ? true : false ); if ( this._autoGen ) {this._vf.description = "default" + this.constructor.superClass._typeName;} @@ -88,6 +109,8 @@ x3dom.registerNodeType( activate : function ( prev ) { this.postMessage( "isActive", true ); + this.postMessage( "isBound", true ); + this.postMessage( "bindTime", Date.now() / 1000 ); x3dom.debug.logInfo( "activate " + this.typeName() + "Bindable " + this._DEF + "/" + this._vf.description ); }, @@ -95,6 +118,8 @@ x3dom.registerNodeType( deactivate : function ( prev ) { this.postMessage( "isActive", false ); + this.postMessage( "isBound", false ); + this.postMessage( "bindTime", Date.now() / 1000 ); x3dom.debug.logInfo( "deactivate " + this.typeName() + "Bindable " + this._DEF + "/" + this._vf.description ); },