3D Node Events

3D Node Events are sent to notify code of interesting things that have taken place. Each event is repsented by an object with common properties:

code type of notification. For list of possible values see table below
source 3d node - source of notifications
doDef [Optional], if exist you set to false in order to stop default processing.

Event may have additional custom fields used to get additional information about what happened.

Following events are currently implemented:

"childadded" New child node was added. Additional event properties:
  • event.child - new child node.
"childremoved"

Child node was removed.

Additional properties:

  • child.node - removed node.
"state" Node state has been changed. This notification is sent only if state was changed via node methods. Direct modifications of node.state will not send this notification.
  • event.old - old node state. Current state may be retrived from node itself

Sample

 var t=this;
node.addRefTarget(function(event)
	{
	 switch(event.code)
	{
	 case "state":if((event.source.state&3)!=(event.old&3))t._updateVisibility(item);break;
	}
	});

	  

 

See Also

In this article