Unigine.Node Class
In terms of Unigine, all of the objects added into the scene are called nodes. Nodes can be of different types, determining their visual representation and behavior.
The node is created and stored in the world. All changes are saved into the .world file.
The node can be also saved into an external .node file and then imported into the world when necessary. Also it is possible to create a reference to the exported node.
You can associate any string data (written directly into a *.node or a *.world file) or an arbitrary user variable with a node.
See Also#
- How to handle ownership
- How to work with the node's matrix transformations
Creating a Node#
The Node class doesn't provide node creation. You can create an instance of any class inherited from the Node class and then obtain the node via automatic upcasting.
For example:
- Use the box mesh to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
- Get the node via upcasting.
void Init()
{
// create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
ObjectMeshStatic object_mesh = new ObjectMeshStatic("core/meshes/box.mesh");
// declare a node and obtain the node from the created ObjectMeshStatic
Node node = object_mesh;
}
Now you can operate the ObjectMeshStatic instance as a node.
Editing a Node and Saving Changes#
The Node class contains common settings of the node. Also each node has special settings, which vary depending on the type of the node.
Editing the node also includes editing materials and properties assigned to the node.
For the edited node to be saved in the .world file, you should enable the corresponding option via the setSaveToWorldEnabled() method.
For example:
- Create a box mesh by using the Mesh class.
- Save the mesh on the disk. It is required as the node we are going to save to the .world file need to reference to a mesh stored on the disk.
- Use the saved .mesh file to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
- Get the node from the ObjectMeshStatic instance via upcasting.
- Enable saving to .world file for the node (and all its children).
- Edit the node and save the world by calling the world_saveconsole command.
void Init()
{
// create a mesh
Mesh mesh = new Mesh();
mesh.AddBoxSurface("box_0", new vec3(1.0f));
// save a mesh into a file on the disk
mesh.Save("unigine_project/meshes/my_mesh.mesh");
// declare a smart pointer for any type of the node inherited from the Node class (e.g. ObjectMeshStatic)
// and call a constructor of the corresponding class
ObjectMeshStatic object_mesh = new ObjectMeshStatic("unigine_project/meshes/my_mesh.mesh");
// declare a smart pointer for the node,
// obtain the node from the created ObjectMeshStatic,
Node node = object_mesh;
// enable saving the node (with all its children) to a *.world file
node.SetSaveToWorldEnabledRecursive(true);
// change the node name
node.Name = "my_node";
// change node transformation
node.WorldTransform = MathLib.Translate(new Vec3(0.0f, 0.0f, 2.0f));
// save node changes in the *.world file
Console.Run("world_save");
}
Exporting and Importing a Node#
To export a node stored in the world into the external .node file, you should pass it to the saveNode() method of the World class.
To import the existing node stored in the .node file to the world, you should call the loadNode() method of the World class.
For example:
- Create a box mesh by using the Mesh class.
- Save the mesh on the disk. It is required as the node we are going to export need to reference to a mesh stored on the disk.
- Use the saved .mesh file to create an instance of the ObjectMeshStatic class. This class is inherited from the Node class.
- Get the node from the ObjectMeshStatic instance via upcasting.
- Export the node to an external .node file.
- Import the prevoiusly exported node to check the result.
void Init()
{
// create a mesh
Mesh mesh = new Mesh();
mesh.AddBoxSurface("box_0", new vec3(1.0f));
// save a mesh into a file on the disk
mesh.Save("unigine_project/meshes/my_mesh.mesh");
// create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
ObjectMeshStatic object_mesh = new ObjectMeshStatic("unigine_project/meshes/my_mesh.mesh");
// declare a smart pointer for the node
// and obtain the node pointer from the created NodeDummy
Node node = object_mesh;
// export the node into a *.node file
World.SaveNode("unigine_project/nodes/my_node.node", node);
// import the exported node to check the result
Node imported_node = World.LoadNode("unigine_project/nodes/my_node.node");
// set position of the node
imported_node.Position = new Vec3(4.0f, 0.0f, 1.0f);
}
Deleting a Node#
By default each new node's lifetime matches the lifetime of the World (i.e. such node shall be deleted when the world is closed). But you can also choose node's lifetime to be managed:
- by the Engine - is this case the node shall be deleted automatically on Engine shutdown.
- manually - is this case the node should be deleted manually by the user.
To delete a node you can use the following two methods:
- deleteLater() - performs delayed deletion, in this case the object will be deleted during the next swap stage of the main loop (rendering of the object ceases immediately, but it still exists in memory for a while, so you can get it from its parent, for example). This method simplifies object deletion from a secondary thread, so you can call it and forget about the details, letting the Engine take control over the process of deletion, which can be used for future optimizations.
- deleteForce() - performs immediate deletion, which might be necessary in some cases. Calling this method for main-loop-dependent objects (e.g., nodes) is safe only when performed from the Main thread.
void Init()
{
// create an instance of any class inherited from the Node class (e.g. ObjectMeshStatic)
ObjectMeshStatic object_mesh = new ObjectMeshStatic("core/meshes/box.mesh");
// declare a smart pointer for the node
// and obtain the node pointer from the created ObjectMeshStatic
Node node = object_mesh;
// do something with the node
// ...
// delete the node
node.DeleteLater();
}
Node Class
Enums
TYPE#
Name | Description |
---|---|
ANY_TYPE = -1 | Any node type. |
NODE_BEGIN = 0 | Begin of the nodes range. |
NODE_DUMMY = 0 | Dummy node. See the NodeDummy class. |
NODE_LAYER = 1 | Layer node. See the NodeLayer class. |
NODE_TRIGGER = 2 | Dummy node that can fire callbacks on its enabling/disabling or repositioning. See the NodeTrigger class. |
NODE_REFERENCE = 3 | Node reference that refers to an external NODE file. See the NodeReference class. |
NODE_EXTERN = 4 | Extern node. See the NodeExtern class. |
NODE_ANIMATION_PLAYBACK = 5 | Animation playback node. See the NodeAnimationPlayback class. |
NODE_END = 5 | End of the nodes range. |
WORLD_BEGIN = 6 | Begin of the world nodes range. |
WORLD_SPLINE_GRAPH = 6 | World spline graph. See the WorldSplineGraph class. |
WORLD_TRIGGER = 7 | World trigger. See the WorldTrigger class. |
WORLD_CLUTTER = 8 | World clutter. See the WorldClutter class. |
WORLD_SWITCHER = 9 | Node switcher (to switch off parts of the world). See the WorldSwitcher class. |
WORLD_OCCLUDER = 10 | World occluder. See the WorldOccluder class. |
WORLD_OCCLUDER_MESH = 11 | World mesh occluder. See the WorldOccluderMesh class. |
WORLD_TRANSFORM_PATH = 12 | Path defined transformer. See the WorldTransformPath |
WORLD_TRANSFORM_BONE = 13 | Bone defined transformer. See the WorldTransformBone class. |
WORLD_EXPRESSION = 14 | Node which allows to execute arbitrary expression. See the WorldExpression class. |
WORLD_EXTERN = 15 | External world. See the WorldExtern class. |
WORLD_END = 15 | End of the world nodes range. |
GEODETIC_BEGIN = 16 | Begin of the geodetic nodes range. |
GEODETIC_PIVOT = 16 | Geodetic Pivot node. See the GeodeticPivot class. |
GEODETIC_END = 16 | End of the geodetic nodes range. |
FIELD_BEGIN = 17 | Begin of the field nodes range. |
FIELD_SPACER = 17 | Field Spacer node. See the FieldSpacer class. |
FIELD_ANIMATION = 18 | Field Animation node. See the FieldAnimation class. |
FIELD_HEIGHT = 19 | Field Height node. See the FieldHeight class. |
FIELD_SHORELINE = 20 | Field Shoreline node. See the FieldShoreline class. |
FIELD_WEATHER = 21 | Field Weather node. See the FieldWeather class. |
FIELD_END = 21 | End of the field nodes range. |
PARTICLES_FIELD_BEGIN = 22 | Beginning of the particles field range. |
PARTICLES_FIELD_SPACER = 22 | Particles Field Spacer node. See the ParticlesFieldSpacer class. |
PARTICLES_FIELD_DEFLECTOR = 23 | Particles Field Deflector node. See the ParticlesFieldDeflector class. |
PARTICLES_FIELD_END = 23 | End of the particles field nodes range. |
LIGHT_BEGIN = 24 | Begin of the light nodes range. |
LIGHT_VOXEL_PROBE = 24 | Voxel probe. See the LightVoxelProbe class. |
LIGHT_ENVIRONMENT_PROBE = 25 | Environment probe. See the LightEnvironmentProbe class. |
LIGHT_PLANAR_PROBE = 26 | Planar probe. See the LightPlanarProbe class. |
LIGHT_OMNI = 27 | Omni-directional light source. See the LightOmni class. |
LIGHT_PROJ = 28 | Projected light source. See the LightProj class. |
LIGHT_WORLD = 29 | World light source. See the LightWorld class. |
LIGHT_END = 29 | End of the light nodes range. |
DECAL_BEGIN = 30 | Begin of the decal nodes range. |
DECAL_PROJ = 30 | Projected decal node. See the DecalProj class. |
DECAL_ORTHO = 31 | Orthographic decal node. See the DecalOrtho class. |
DECAL_MESH = 32 | Mesh decal node. See the DecalMesh class. |
DECAL_END = 32 | End of the decal nodes range. |
LANDSCAPE_LAYER_BEGIN = 33 | Beginning of the landscape layers range. |
LANDSCAPE_LAYER_MAP = 33 | Landscape Layer Map. See the LandscapeLayerMap class. |
LANDSCAPE_LAYER_END = 33 | End of the landscape layers range. |
OBJECT_BEGIN = 34 | Begin of the object nodes range. |
OBJECT_DUMMY = 34 | Dummy object. See the ObjectDummy class. |
OBJECT_DYNAMIC = 35 | Dynamic object. See the ObjectDynamic class. |
OBJECT_MESH_STATIC = 36 | Static mesh object. See the ObjectMeshStatic class. |
OBJECT_MESH_CLUSTER = 37 | Mesh Cluster object. See the ObjectMeshCluster class. |
OBJECT_MESH_CLUTTER = 38 | Mesh Clutter object. See the ObjectMeshClutter class. |
OBJECT_MESH_SKINNED = 39 | Skinned mesh object. See the ObjectMeshSkinned class. |
OBJECT_MESH_DYNAMIC = 40 | Dynamic mesh object. See the ObjectMeshDynamic class. |
OBJECT_MESH_SPLINE_CLUSTER = 41 | Mesh Spline Cluster object. See the ObjectMeshSplineCluster class. |
OBJECT_LANDSCAPE_TERRAIN = 42 | LandscapeTerrain object. See the ObjectLandscapeTerrain class. |
OBJECT_TERRAIN_GLOBAL = 43 | Terrain global object. See the ObjectTerrainGlobal class. |
OBJECT_GRASS = 44 | Grass. See the ObjectGrass class. |
OBJECT_PARTICLES = 45 | Particles object. See the ObjectParticles class. |
OBJECT_BILLBOARDS = 46 | Billboards object for rendering a high number of billboards. See the ObjectBillboard class. |
OBJECT_VOLUME_BOX = 47 | Volume box object. See the ObjectVolumeBox class. |
OBJECT_VOLUME_SPHERE = 48 | Volume sphere object. See the ObjectVolumeSphere class. |
OBJECT_VOLUME_OMNI = 49 | Volume omni light object. See the ObjectVolumeOmni class. |
OBJECT_VOLUME_PROJ = 50 | Volume projected light object. See the ObjectVolumeProj class. |
OBJECT_GUI = 51 | GUI object. See the ObjectGui class. |
OBJECT_GUI_MESH = 52 | GUI mesh object. See the ObjectGuiMesh class. |
OBJECT_WATER_GLOBAL = 53 | Water global object. See the ObjectWaterGlobal class. |
OBJECT_WATER_MESH = 54 | Water mesh object. See the ObjectWaterMesh class. |
OBJECT_SKY = 55 | Sky object. See the ObjectSky class. |
OBJECT_CLOUD_LAYER = 56 | Cloud layer object. See the ObjectCloudLayer class. |
OBJECT_EXTERN = 57 | Extern object. See the ObjectExtern class. |
OBJECT_TEXT = 58 | Text object. See the ObjectText class. |
OBJECT_END = 58 | End of the object nodes range. |
PLAYER_BEGIN = 59 | Begin of the player nodes range. |
PLAYER_DUMMY = 59 | Dummy player. See the PlayerDummy class. |
PLAYER_SPECTATOR = 60 | Observing player. See the PlayerSpectator class. |
PLAYER_PERSECUTOR = 61 | Persecuting player. See the PlayerPersecutor class. |
PLAYER_ACTOR = 62 | Acting player. See the PlayerActor class. |
PLAYER_END = 62 | End of the player nodes range. |
PHYSICAL_BEGIN = 63 | Begin of the physical nodes range. |
PHYSICAL_WIND = 63 | Physical wind object. See the PhysicalWind class. |
PHYSICAL_FORCE = 64 | Physical force node that allows to simulate point forces applied to dynamic objects. See the PhysicalForce class. |
PHYSICAL_NOISE = 65 | Physical noise node that allows to simulate force field. See the PhysicalNoise class. |
PHYSICAL_WATER = 66 | Physical water object that has no visual representation. See the PhysicalWater class. |
PHYSICAL_TRIGGER = 67 | Physical trigger. See the PhysicalTrigger class. |
PHYSICAL_END = 67 | End of the physical nodes range. |
NAVIGATION_BEGIN = 68 | Begin of the navigation nodes range. |
NAVIGATION_SECTOR = 68 | Sector within which pathfinding is performed. See the NavigationSector class. |
NAVIGATION_MESH = 69 | Mesh-based navigation area across which pathfinding is performed. See the NavigationMesh class. |
NAVIGATION_END = 69 | End of the navigation nodes range. |
OBSTACLE_BEGIN = 70 | Begin of the obstacle nodes range. |
OBSTACLE_BOX = 70 | Obstacle in the shape of a box avoided by pathfinding. See the ObstacleBox class. |
OBSTACLE_SPHERE = 71 | Obstacle in the shape of a sphere avoided by pathfinding. See the ObstacleSphere class. |
OBSTACLE_CAPSULE = 72 | Obstacle in the shape of a capsule avoided by pathfinding. See the ObstacleCapsule class. |
OBSTACLE_END = 72 | End of the obstacle nodes range. |
SOUND_BEGIN = 73 | Begin of the sound nodes range. |
SOUND_SOURCE = 73 | Sound source. See the SoundSource class. |
SOUND_REVERB = 74 | Sound reverberation zone. See the SoundReverb class. |
SOUND_END = 74 | End of the sound nodes range. |
NUM_NODES = 75 | Counter of node types. |
NUM_WORLDS = WORLD_END - WORLD_BEGIN + 1 | Counter of world node types. |
NUM_GEODETICS = GEODETIC_END - GEODETIC_BEGIN + 1 | Counter of geodetic node types. |
NUM_FIELDS = FIELD_END - FIELD_BEGIN + 1 | Counter of field node types. |
NUM_PARTICLES_FIELDS = PARTICLES_FIELD_END - PARTICLES_FIELD_BEGIN + 1 | Counter of particles field node types. |
NUM_LIGHTS = LIGHT_END - LIGHT_BEGIN + 1 | Counter of light node types. |
NUM_DECALS = DECAL_END - DECAL_BEGIN + 1 | Counter of decal node types. |
NUM_OBJECTS = OBJECT_END - OBJECT_BEGIN + 1 | Counter of object node types. |
NUM_PLAYERS = PLAYER_END - PLAYER_BEGIN + 1 | Counter of player node types. |
NUM_PHYSICALS = PHYSICAL_END - PHYSICAL_BEGIN + 1 | Counter of physical node types. |
NUM_NAVIGATIONS = NAVIGATION_END - NAVIGATION_BEGIN + 1 | Counter of navigation node types. |
NUM_OBSTACLES = OBSTACLE_BEGIN - OBSTACLE_END + 1 | Counter of obstacle node types. |
NUM_SOUNDS = SOUND_END - SOUND_BEGIN + 1 | Counter of sound node types. |
DUMMY = 0 | Dummy node. See the NodeDummy class. |
LAYER = 1 | Layer node. See the NodeLayer class. |
TRIGGER = 2 | Dummy node that can fire callbacks on its enabling/disabling or repositioning. See the NodeTrigger class. |
REFERENCE = 3 | Node reference that refers to an external NODE file. See the NodeReference class. |
EXTERN = 4 | Extern node. See the NodeExtern class. |
LIFETIME#
Properties
GeodeticPivot GeodeticPivot#
Variable Variable#
vec3 WorldScale#
vec3 WorldPosition#
vec3 Scale#
vec3 Position#
vec3 BodyAngularVelocity#
vec3 BodyLinearVelocity#
BodyRigid ObjectBodyRigid#
Body ObjectBody#
WorldBoundSphere WorldBoundSphere#
WorldBoundBox WorldBoundBox#
BoundSphere BoundSphere#
BoundBox BoundBox#
mat4 OldWorldTransform#
mat4 WorldTransform#
mat4 Transform#
int NumProperties#
Node Possessor#
- NodeReference
- WorldCluster
- WorldClutter
- WorldLayer
int NumChildren#
Node RootNode#
Node Parent#
int NumAncestors#
string Name#
bool Query#
bool ClutterInteractionEnabled#
bool GrassInteractionEnabled#
bool TriggerInteractionEnabled#
bool Immovable#
bool Handled#
bool Enabled#
bool IsExtern#
bool IsField#
bool IsParticlesField#
bool IsSound#
bool IsObstacle#
bool IsNavigation#
bool IsPhysical#
bool IsPlayer#
bool IsObject#
bool IsDecal#
bool IsLight#
bool IsGeodetic#
bool IsWorld#
bool IsImmovableSupported#
bool IsSurfacesCollisionSupported#
bool IsSurfacesIntersectionSupported#
string TypeName#
Node.TYPE Type#
int ID#
bool SaveToWorldEnabled#
bool IsSaveToWorldEnabledSelf#
bool ShowInEditorEnabled#
bool IsShowInEditorEnabledSelf#
int NumWorldTriggers#
WorldBoundSphere SpatialBoundSphere#
WorldBoundBox SpatialBoundBox#
bool IsLandscapeLayer#
mat4 IWorldTransform#
vec3 OldWorldPosition#
Node.LIFETIME Lifetime#
Event<Node, Node> EventNodeSwap#
Usage Example
// implement the NodeSwap event handler
void nodeswap_event_handler(Node first_node, Node second_node)
{
Log.Message("\Handling NodeSwap event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections nodeswap_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventNodeSwap.Connect(nodeswap_event_connections, nodeswap_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventNodeSwap.Connect(nodeswap_event_connections, (Node first_node, Node second_node) => {
Log.Message("Handling NodeSwap event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
nodeswap_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeSwap event with a handler function
Node.EventNodeSwap.Connect(nodeswap_event_handler);
// remove subscription to the NodeSwap event later by the handler function
Node.EventNodeSwap.Disconnect(nodeswap_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection nodeswap_event_connection;
// subscribe to the NodeSwap event with a lambda handler function and keeping the connection
nodeswap_event_connection = Node.EventNodeSwap.Connect((Node first_node, Node second_node) => {
Log.Message("Handling NodeSwap event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
nodeswap_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
nodeswap_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
nodeswap_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring NodeSwap events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventNodeSwap.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventNodeSwap.Enabled = true;
Event<Node, Node> EventNodeClone#
Usage Example
// implement the NodeClone event handler
void nodeclone_event_handler(Node node_clone, Node node_original)
{
Log.Message("\Handling NodeClone event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections nodeclone_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventNodeClone.Connect(nodeclone_event_connections, nodeclone_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventNodeClone.Connect(nodeclone_event_connections, (Node node_clone, Node node_original) => {
Log.Message("Handling NodeClone event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
nodeclone_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeClone event with a handler function
Node.EventNodeClone.Connect(nodeclone_event_handler);
// remove subscription to the NodeClone event later by the handler function
Node.EventNodeClone.Disconnect(nodeclone_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection nodeclone_event_connection;
// subscribe to the NodeClone event with a lambda handler function and keeping the connection
nodeclone_event_connection = Node.EventNodeClone.Connect((Node node_clone, Node node_original) => {
Log.Message("Handling NodeClone event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
nodeclone_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
nodeclone_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
nodeclone_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring NodeClone events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventNodeClone.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventNodeClone.Enabled = true;
Event<Node> EventNodeChangeEnabled#
Usage Example
// implement the NodeChangeEnabled event handler
void nodechangeenabled_event_handler(Node node)
{
Log.Message("\Handling NodeChangeEnabled event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections nodechangeenabled_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventNodeChangeEnabled.Connect(nodechangeenabled_event_connections, nodechangeenabled_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventNodeChangeEnabled.Connect(nodechangeenabled_event_connections, (Node node) => {
Log.Message("Handling NodeChangeEnabled event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
nodechangeenabled_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeChangeEnabled event with a handler function
Node.EventNodeChangeEnabled.Connect(nodechangeenabled_event_handler);
// remove subscription to the NodeChangeEnabled event later by the handler function
Node.EventNodeChangeEnabled.Disconnect(nodechangeenabled_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection nodechangeenabled_event_connection;
// subscribe to the NodeChangeEnabled event with a lambda handler function and keeping the connection
nodechangeenabled_event_connection = Node.EventNodeChangeEnabled.Connect((Node node) => {
Log.Message("Handling NodeChangeEnabled event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
nodechangeenabled_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
nodechangeenabled_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
nodechangeenabled_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring NodeChangeEnabled events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventNodeChangeEnabled.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventNodeChangeEnabled.Enabled = true;
Event<Node> EventNodeRemove#
Usage Example
// implement the NodeRemove event handler
void noderemove_event_handler(Node node)
{
Log.Message("\Handling NodeRemove event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections noderemove_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventNodeRemove.Connect(noderemove_event_connections, noderemove_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventNodeRemove.Connect(noderemove_event_connections, (Node node) => {
Log.Message("Handling NodeRemove event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
noderemove_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeRemove event with a handler function
Node.EventNodeRemove.Connect(noderemove_event_handler);
// remove subscription to the NodeRemove event later by the handler function
Node.EventNodeRemove.Disconnect(noderemove_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection noderemove_event_connection;
// subscribe to the NodeRemove event with a lambda handler function and keeping the connection
noderemove_event_connection = Node.EventNodeRemove.Connect((Node node) => {
Log.Message("Handling NodeRemove event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
noderemove_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
noderemove_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
noderemove_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring NodeRemove events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventNodeRemove.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventNodeRemove.Enabled = true;
Event<Node> EventNodeLoad#
Usage Example
// implement the NodeLoad event handler
void nodeload_event_handler(Node node)
{
Log.Message("\Handling NodeLoad event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections nodeload_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventNodeLoad.Connect(nodeload_event_connections, nodeload_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventNodeLoad.Connect(nodeload_event_connections, (Node node) => {
Log.Message("Handling NodeLoad event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
nodeload_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the NodeLoad event with a handler function
Node.EventNodeLoad.Connect(nodeload_event_handler);
// remove subscription to the NodeLoad event later by the handler function
Node.EventNodeLoad.Disconnect(nodeload_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection nodeload_event_connection;
// subscribe to the NodeLoad event with a lambda handler function and keeping the connection
nodeload_event_connection = Node.EventNodeLoad.Connect((Node node) => {
Log.Message("Handling NodeLoad event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
nodeload_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
nodeload_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
nodeload_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring NodeLoad events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventNodeLoad.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventNodeLoad.Enabled = true;
Event<Node> EventCacheNodeAdd#
Usage Example
// implement the CacheNodeAdd event handler
void cachenodeadd_event_handler(Node node)
{
Log.Message("\Handling CacheNodeAdd event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections cachenodeadd_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventCacheNodeAdd.Connect(cachenodeadd_event_connections, cachenodeadd_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventCacheNodeAdd.Connect(cachenodeadd_event_connections, (Node node) => {
Log.Message("Handling CacheNodeAdd event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
cachenodeadd_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the CacheNodeAdd event with a handler function
Node.EventCacheNodeAdd.Connect(cachenodeadd_event_handler);
// remove subscription to the CacheNodeAdd event later by the handler function
Node.EventCacheNodeAdd.Disconnect(cachenodeadd_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection cachenodeadd_event_connection;
// subscribe to the CacheNodeAdd event with a lambda handler function and keeping the connection
cachenodeadd_event_connection = Node.EventCacheNodeAdd.Connect((Node node) => {
Log.Message("Handling CacheNodeAdd event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
cachenodeadd_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
cachenodeadd_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
cachenodeadd_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring CacheNodeAdd events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventCacheNodeAdd.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventCacheNodeAdd.Enabled = true;
Event<Node, Property> EventPropertySurfaceRemove#
Usage Example
// implement the PropertySurfaceRemove event handler
void propertysurfaceremove_event_handler(Node node, Property property)
{
Log.Message("\Handling PropertySurfaceRemove event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertysurfaceremove_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertySurfaceRemove.Connect(propertysurfaceremove_event_connections, propertysurfaceremove_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertySurfaceRemove.Connect(propertysurfaceremove_event_connections, (Node node, Property property) => {
Log.Message("Handling PropertySurfaceRemove event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertysurfaceremove_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertySurfaceRemove event with a handler function
Node.EventPropertySurfaceRemove.Connect(propertysurfaceremove_event_handler);
// remove subscription to the PropertySurfaceRemove event later by the handler function
Node.EventPropertySurfaceRemove.Disconnect(propertysurfaceremove_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertysurfaceremove_event_connection;
// subscribe to the PropertySurfaceRemove event with a lambda handler function and keeping the connection
propertysurfaceremove_event_connection = Node.EventPropertySurfaceRemove.Connect((Node node, Property property) => {
Log.Message("Handling PropertySurfaceRemove event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertysurfaceremove_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertysurfaceremove_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertysurfaceremove_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertySurfaceRemove events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertySurfaceRemove.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertySurfaceRemove.Enabled = true;
Event<Node, Property> EventPropertySurfaceAdd#
Usage Example
// implement the PropertySurfaceAdd event handler
void propertysurfaceadd_event_handler(Node node, Property property)
{
Log.Message("\Handling PropertySurfaceAdd event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertysurfaceadd_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertySurfaceAdd.Connect(propertysurfaceadd_event_connections, propertysurfaceadd_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertySurfaceAdd.Connect(propertysurfaceadd_event_connections, (Node node, Property property) => {
Log.Message("Handling PropertySurfaceAdd event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertysurfaceadd_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertySurfaceAdd event with a handler function
Node.EventPropertySurfaceAdd.Connect(propertysurfaceadd_event_handler);
// remove subscription to the PropertySurfaceAdd event later by the handler function
Node.EventPropertySurfaceAdd.Disconnect(propertysurfaceadd_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertysurfaceadd_event_connection;
// subscribe to the PropertySurfaceAdd event with a lambda handler function and keeping the connection
propertysurfaceadd_event_connection = Node.EventPropertySurfaceAdd.Connect((Node node, Property property) => {
Log.Message("Handling PropertySurfaceAdd event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertysurfaceadd_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertysurfaceadd_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertysurfaceadd_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertySurfaceAdd events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertySurfaceAdd.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertySurfaceAdd.Enabled = true;
Event<Node, int, int> EventPropertyNodeSwap#
Usage Example
// implement the PropertyNodeSwap event handler
void propertynodeswap_event_handler(Node node, int index_from, int index_to)
{
Log.Message("\Handling PropertyNodeSwap event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertynodeswap_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertyNodeSwap.Connect(propertynodeswap_event_connections, propertynodeswap_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertyNodeSwap.Connect(propertynodeswap_event_connections, (Node node, int index_from, int index_to) => {
Log.Message("Handling PropertyNodeSwap event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertynodeswap_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertyNodeSwap event with a handler function
Node.EventPropertyNodeSwap.Connect(propertynodeswap_event_handler);
// remove subscription to the PropertyNodeSwap event later by the handler function
Node.EventPropertyNodeSwap.Disconnect(propertynodeswap_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertynodeswap_event_connection;
// subscribe to the PropertyNodeSwap event with a lambda handler function and keeping the connection
propertynodeswap_event_connection = Node.EventPropertyNodeSwap.Connect((Node node, int index_from, int index_to) => {
Log.Message("Handling PropertyNodeSwap event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertynodeswap_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertynodeswap_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertynodeswap_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertyNodeSwap events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertyNodeSwap.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertyNodeSwap.Enabled = true;
Event<Node, Property, int> EventPropertyChangeEnabled#
Usage Example
// implement the PropertyChangeEnabled event handler
void propertychangeenabled_event_handler(Node node, Property property, int property_index)
{
Log.Message("\Handling PropertyChangeEnabled event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertychangeenabled_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertyChangeEnabled.Connect(propertychangeenabled_event_connections, propertychangeenabled_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertyChangeEnabled.Connect(propertychangeenabled_event_connections, (Node node, Property property, int property_index) => {
Log.Message("Handling PropertyChangeEnabled event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertychangeenabled_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertyChangeEnabled event with a handler function
Node.EventPropertyChangeEnabled.Connect(propertychangeenabled_event_handler);
// remove subscription to the PropertyChangeEnabled event later by the handler function
Node.EventPropertyChangeEnabled.Disconnect(propertychangeenabled_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertychangeenabled_event_connection;
// subscribe to the PropertyChangeEnabled event with a lambda handler function and keeping the connection
propertychangeenabled_event_connection = Node.EventPropertyChangeEnabled.Connect((Node node, Property property, int property_index) => {
Log.Message("Handling PropertyChangeEnabled event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertychangeenabled_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertychangeenabled_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertychangeenabled_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertyChangeEnabled events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertyChangeEnabled.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertyChangeEnabled.Enabled = true;
Event<Node, Property, int> EventPropertyNodeRemove#
Usage Example
// implement the PropertyNodeRemove event handler
void propertynoderemove_event_handler(Node node, Property property, int property_index)
{
Log.Message("\Handling PropertyNodeRemove event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertynoderemove_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertyNodeRemove.Connect(propertynoderemove_event_connections, propertynoderemove_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertyNodeRemove.Connect(propertynoderemove_event_connections, (Node node, Property property, int property_index) => {
Log.Message("Handling PropertyNodeRemove event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertynoderemove_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertyNodeRemove event with a handler function
Node.EventPropertyNodeRemove.Connect(propertynoderemove_event_handler);
// remove subscription to the PropertyNodeRemove event later by the handler function
Node.EventPropertyNodeRemove.Disconnect(propertynoderemove_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertynoderemove_event_connection;
// subscribe to the PropertyNodeRemove event with a lambda handler function and keeping the connection
propertynoderemove_event_connection = Node.EventPropertyNodeRemove.Connect((Node node, Property property, int property_index) => {
Log.Message("Handling PropertyNodeRemove event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertynoderemove_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertynoderemove_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertynoderemove_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertyNodeRemove events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertyNodeRemove.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertyNodeRemove.Enabled = true;
Event<Node, Property, int> EventPropertyNodeAdd#
Usage Example
// implement the PropertyNodeAdd event handler
void propertynodeadd_event_handler(Node node, Property property, int property_index)
{
Log.Message("\Handling PropertyNodeAdd event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertynodeadd_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertyNodeAdd.Connect(propertynodeadd_event_connections, propertynodeadd_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertyNodeAdd.Connect(propertynodeadd_event_connections, (Node node, Property property, int property_index) => {
Log.Message("Handling PropertyNodeAdd event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertynodeadd_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertyNodeAdd event with a handler function
Node.EventPropertyNodeAdd.Connect(propertynodeadd_event_handler);
// remove subscription to the PropertyNodeAdd event later by the handler function
Node.EventPropertyNodeAdd.Disconnect(propertynodeadd_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertynodeadd_event_connection;
// subscribe to the PropertyNodeAdd event with a lambda handler function and keeping the connection
propertynodeadd_event_connection = Node.EventPropertyNodeAdd.Connect((Node node, Property property, int property_index) => {
Log.Message("Handling PropertyNodeAdd event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertynodeadd_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertynodeadd_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertynodeadd_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertyNodeAdd events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertyNodeAdd.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertyNodeAdd.Enabled = true;
Event<Node, int> EventPropertyNodeSlotsChanged#
Usage Example
// implement the PropertyNodeSlotsChanged event handler
void propertynodeslotschanged_event_handler(Node node, int num_slots)
{
Log.Message("\Handling PropertyNodeSlotsChanged event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an EventConnections instance
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections propertynodeslotschanged_event_connections = new EventConnections();
// link to this instance when subscribing to an event (subscription to various events can be linked)
Node.EventPropertyNodeSlotsChanged.Connect(propertynodeslotschanged_event_connections, propertynodeslotschanged_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
Node.EventPropertyNodeSlotsChanged.Connect(propertynodeslotschanged_event_connections, (Node node, int num_slots) => {
Log.Message("Handling PropertyNodeSlotsChanged event lambda\n");
}
);
// later all of these linked subscriptions can be removed with a single line
propertynodeslotschanged_event_connections.DisconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via the handler function directly
//////////////////////////////////////////////////////////////////////////////
// subscribe to the PropertyNodeSlotsChanged event with a handler function
Node.EventPropertyNodeSlotsChanged.Connect(propertynodeslotschanged_event_handler);
// remove subscription to the PropertyNodeSlotsChanged event later by the handler function
Node.EventPropertyNodeSlotsChanged.Disconnect(propertynodeslotschanged_event_handler);
//////////////////////////////////////////////////////////////////////////////
// 3. Subscribe to an event and unsubscribe later via an EventConnection instance
//////////////////////////////////////////////////////////////////////////////
// define a connection to be used to unsubscribe later
EventConnection propertynodeslotschanged_event_connection;
// subscribe to the PropertyNodeSlotsChanged event with a lambda handler function and keeping the connection
propertynodeslotschanged_event_connection = Node.EventPropertyNodeSlotsChanged.Connect((Node node, int num_slots) => {
Log.Message("Handling PropertyNodeSlotsChanged event lambda\n");
}
);
// ...
// you can temporarily disable a particular event connection
propertynodeslotschanged_event_connection.Enabled = false;
// ... perform certain actions
// and enable it back when necessary
propertynodeslotschanged_event_connection.Enabled = true;
// ...
// remove the subscription later using the saved connection
propertynodeslotschanged_event_connection.Disconnect();
//////////////////////////////////////////////////////////////////////////////
// 4. Ignoring PropertyNodeSlotsChanged events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
Node.EventPropertyNodeSlotsChanged.Enabled = false;
// ... actions to be performed
// and enable it back when necessary
Node.EventPropertyNodeSlotsChanged.Enabled = true;
int IDFromFile#
Members
Node GetAncestor ( int num ) #
Returns a node ancestor by its number.Arguments
- int num - Ancestor ID.
Return value
Ancestor node.Node GetChild ( int num ) #
Returns a node child by its number.Arguments
- int num - Child ID.
Return value
Child node.bool IsChild ( Node n ) #
Checks if a given node is a child of the node.Arguments
- Node n - Node to check.
Return value
true if the given node is a child; otherwise, false.void SetChildIndex ( Node n, int index ) #
Sets the index for a given child node of the node.Arguments
- Node n - Child node.
- int index - Node index.
int GetChildIndex ( Node n ) #
Returns the index of a given child node of the node.Arguments
- Node n - Child node.
Return value
Node index.void SetData ( string name, string data ) #
Sets user data associated with the node.- If the node was loaded from the *.node file, data is saved directly into the data tag of this file.
- If the node is loaded from the *.world file, data is saved into the Node data tag of the *.world file.
- If the node is loaded from the *.world file as a NodeReference, data will be saved to the NodeReference data tag of the *.world file.
Arguments
- string name - String containing a key identifying user data to be stored in the *.node file.
The "editor_data" key is reserved for the UnigineEditor.
- string data - New user data. Data can contain an XML formatted string.
string GetData ( string name ) #
Returns user data associated with the node.- If the node was loaded from the *.node file, data from the data tag of this file is returned.
- If the node is loaded from the *.world file, data from the Node data tag of the *.world file is returned.
- If the node is loaded from the *.world file as a NodeReference, data from the NodeReference data tag of the *.world file is returned.
Arguments
- string name - String containing a key identifying user data stored in the *.node file.
The "editor_data" key is reserved for the UnigineEditor.
Return value
User string data. Data can be an xml formatted string.void UpdateEnabled ( ) #
Updates node's internal state according to the current "enabled" state.bool IsEnabledSelf ( ) #
Returns a value indicating if the node is enabled.Return value
true if the node is enabled; otherwise, false.void GetHierarchy ( Node[] OUT_hierarchy ) #
Retrieves the whole hierarchy of the node and puts it to the hierarchy buffer.Arguments
- Node[]
OUT_hierarchy - Hierarchy buffer.This output buffer is to be filled by the Engine as a result of executing the method.
Node GetNode ( int id ) #
Returns a node pointer.Arguments
- int id - Node identifier.
Return value
Node pointer.bool IsNode ( Node node ) #
Check the node pointer.Arguments
- Node node - Node pointer.
Return value
1 if the node is valid; otherwise, 0.bool IsNode ( int id ) #
Check the node pointer.Arguments
- int id - Node pointer.
Return value
1 if the node is valid; otherwise, 0.int AddProperty ( string name ) #
Inherits a new property from the one with the given name and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.Arguments
- string name - Name of the property to be added.
Return value
Index of the new node property if it was added successfully; otherwise, -1.int AddProperty ( UGUID guid ) #
Inherits a new property from the one with the given GUID and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.Arguments
Return value
Index of the new node property if it was added successfully; otherwise, -1.int AddProperty ( Property property ) #
Inherits a new property from the specified one and adds it to the list of properties associated with the node. The inherited property will be internal, such properties are saved in a *.world or *.node file.Arguments
- Property property - Property to be added.
Return value
Index of the new node property if it was added successfully; otherwise, -1.int InsertProperty ( int num, string name ) #
Inserts the property with the specified name at the specified position.Arguments
- int num - Position at which a new property is to be inserted, in the range from 0 to the total number of node properties.
- string name - Name of the property to be inserted.
Return value
int InsertProperty ( int num, UGUID guid ) #
Inserts the property with the specified GUID at the specified position.Arguments
- int num - Position at which a new property is to be inserted, in the range from 0 to the total number of node properties.
- UGUID guid - GUID of the property to be inserted.
Return value
int InsertProperty ( int num, Property property ) #
Inserts the specified property at the specified position.Arguments
- int num - Position at which a new property is to be inserted, in the range from 0 to the total number of node properties.
- Property property - Property to be added.
Return value
int SetProperty ( string name ) #
Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one with the specified name will be set. Such internal properties are saved in a *.world or *.node file.Arguments
- string name - Name of the property to be set.
Return value
int SetProperty ( UGUID guid ) #
Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one with the specified GUID will be set. Such internal properties are saved in a *.world or *.node file.Arguments
Return value
int SetProperty ( Property property ) #
Updates the first node property (the one with a 0 index) in the list of properties associated with the node. A new internal property inherited from the one specified will be set. Such internal properties are saved in a *.world or *.node file.Arguments
- Property property - Property to be set.
Return value
int SetProperty ( int num, string name ) #
Updates the node property with the specified number. A new internal property inherited from the one with the specified name will be set. Such internal properties are saved in a *.world or *.node file.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
- string name - Name of the property to be set.
Return value
int SetProperty ( int num, UGUID guid ) #
Updates the node property with the specified number. A new internal property inherited from the one with the specified GUID will be set. Such internal properties are saved in a *.world or *.node file.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
- UGUID guid - GUID of the property to be set.
Return value
int SetProperty ( int num, Property property ) #
Updates the node property with the specified number. A new internal property inherited from the specified one will be set. Such internal properties are saved in a *.world or *.node file.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
- Property property - Property to be set.
Return value
void SetPropertyEnabled ( int num, bool enable ) #
Enables or disables the node property with the specified number.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
- bool enable - true to enable the specified node property, false to disable it.
bool IsPropertyEnabled ( int num ) #
Returns a value indicating if the node property with the specified number is enabled.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
Return value
true if the specified property is enabled; otherwise, false.void SwapProperty ( int from_num, int to_num ) #
Swaps two properties with specified numbers in the list of properties associated with the node.Arguments
- int from_num - Number of the first node property to be swapped, in the range from 0 to the total number of node properties.
- int to_num - Number of the second node property to be swapped, in the range from 0 to the total number of node properties.
void RemoveProperty ( int num ) #
Removes the node property with the specified number.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
void RemoveProperty ( string name ) #
Removes the node property that has the specified name.Arguments
- string name - Name of the node property to be removed.
void RemoveProperty ( UGUID guid ) #
Removes the node property that has the GUID or parent GUID equal to the specified one.Arguments
void RemoveProperty ( Property property ) #
Removes the specified node property or a node property inherited from it.Arguments
- Property property - Node property to be removed.
void ClearProperties ( ) #
Clears the list of properties associated with the node.Property GetProperty ( int num ) #
Returns a node property with the specified number if it exists.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
Return value
Node property smart pointer, if exists; otherwise, NULL.string GetPropertyName ( int num ) #
Returns the name of a node property with the specified number.Arguments
- int num - Node property number in the range from 0 to the total number of node properties.
Return value
Property name, if exists; otherwise, NULL.int FindProperty ( string name ) #
Searches for a property with the specified name among the ones assigned to the node.Arguments
- string name - GUID of a node property to be found.
Return value
Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.int FindProperty ( UGUID guid ) #
Searches for a property with the specified GUID among the ones assigned to the node.Arguments
Return value
Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.int FindProperty ( Property property ) #
Searches for a specified property among the ones assigned to the node.Arguments
- Property property - Node property to be found.
Return value
Node property number in the range from 0 to the total number of node properties if such a property exists; otherwise -1.bool HasQueryForce ( ) #
Returns a value indicating if the Culled By Occlusion Queryoption is force-enabled for the node by the Engine.Return value
true if the Culled By Occlusion Queryoption is force-enabled for the node by the Engine; otherwise, false.void SetRotation ( quat rot, bool identity = 0 ) #
Sets the node rotation.Arguments
- quat rot - Quaternion representing node rotation in the local space.
- bool identity - Flag indicating if node's scale is to be ignored or taken into account:
- false - node's scale is taken into account. In this case additional calculations are performed to extract current node's scale and apply it when building the final transformation matrix. These additional operations reduce performance and may lead to error accumulation.
- true - node's scale is ignored (assumed to be equal to 1 along all axes). Thus, the number of calculations performed for each rotation is reduced and error accumulation is minimal.
- It is recommended to set this flag for all non-scaled nodes to improve performance and accuracy.
- Scaling of nodes should be avoided whenever possible, as it requires addidional calculations and may lead to error accumulation.
quat GetRotation ( ) #
Returns the node rotation.Return value
Quaternion representing node rotation in the local space.void SetWorldRotation ( quat rot, bool identity = 0 ) #
Sets the node rotation in the world space.Arguments
- quat rot - Node rotation in the world space.
- bool identity - Flag indicating if node's scale is to be ignored or taken into account:
- false - node's scale is taken into account. In this case additional calculations are performed to extract current node's scale and apply it when building the final transformation matrix. These additional operations reduce performance and may lead to error accumulation.
- true - node's scale is ignored (assumed to be equal to 1 along all axes). Thus, the number of calculations performed for each rotation is reduced and error accumulation is minimal.
- It is recommended to set this flag for all non-scaled nodes to improve performance and accuracy.
- Scaling of nodes should be avoided whenever possible, as it requires addidional calculations and may lead to error accumulation.
quat GetWorldRotation ( ) #
Returns the node rotation in the world space.Return value
Node rotation in the world space.void SetTransformWithoutChildren ( mat4 transform ) #
Sets the transformation matrix for the node in local coordinates (transformations of all node's children are not affected). This method can be used to change node's transformation relative to its children.Arguments
- mat4 transform - New transformation matrix to be set for the node (local coordinates).
Node.TYPE GetTypeID ( string type ) #
Returns the ID of a node type with a given name.Arguments
- string type - Node type name.
Return value
Node type ID, if such type exists; otherwise, -1.string GetTypeName ( Node.TYPE type ) #
Returns the name of a node type with a given ID.Arguments
- Node.TYPE type - Node type ID.
Return value
Node type name.void setVariable ( ) #
Sets the value of a variable with a given name. If such variable does not exist it will be added with a specified value.NodeDummy container;
if(container.HasVariable("key1")) {
container.SetVariable("key1", new Variable(42));
}
Variable value = container.GetVariable("key1");
container.RemoveVariable("key1");
Arguments
Variable GetVariable ( ) #
Returns the variable with a given name.NodeDummy container;
if(container.HasVariable("key1")) {
container.SetVariable("key1", new Variable(42));
}
Variable value = container.GetVariable("key1");
container.RemoveVariable("key1");
Arguments
Return value
Variable if it exists; otherwise, variable with 0 value.void SetWorldParent ( Node n ) #
Sets the new parent of the node. Transformations of the current node will be done in the world coordinates.Arguments
- Node n - New parent node or null.
void SetWorldTransformWithoutChildren ( mat4 transform ) #
Sets the transformation matrix for the node in world coordinates (transformations of all node's children are not affected). This method can be used to change node's transformation relative to its children.Arguments
- mat4 transform - New transformation matrix to be set for the node (world coordinates).
vec3 GetBodyWorldVelocity ( vec3 point ) #
Returns linear velocity of a point of the node's physical body in the world space.Arguments
- vec3 point - Target point.
Return value
Linear velocity in the world space.void AddChild ( Node n ) #
Adds a child to the node. Transformations of the new child will be done in the coordinates of the parent.Arguments
- Node n - New child node.
void AddWorldChild ( Node n ) #
Adds a child to the node. Transformations of the new child will be done in the world coordinates.Arguments
- Node n - New child node.
Node Clone ( ) #
Clones the node.Return value
Cloned node.int FindAncestor ( int type ) #
Returns the ID of node's ancestor of a given type.Arguments
- int type - Ancestor type identifier. One of the NODE_* pre-defined variables.
Return value
Ancestor ID if it exists; otherwise -1.int FindAncestor ( string name ) #
Returns the ID of node's ancestor with a given name.Arguments
- string name - Ancestor name.
Return value
Ancestor ID if it exists; otherwise -1.int FindChild ( string name ) #
Searches for a child node with a given name among the children of the node.Arguments
- string name - Name of the child node.
Return value
Child node number, if it is found; otherwise, -1.Node FindNode ( string name, int recursive = 0 ) #
Searches for a node with a given name among the children of the node.Arguments
- string name - Name of the child node to search for.
- int recursive - 1 if the search is recursive (i.e. performed for children of child nodes); otherwise, 0.
Return value
Child node, if it is found; otherwise, NULL.void FindNodes ( string name, Node[] OUT_nodes, int recursive = 0 ) #
Searches for a node with a given name among the children of the node and puts them to the specified output nodes buffer.Arguments
- string name - Name of the node to search for.
- Node[]
OUT_nodes - Output buffer to which all found nodes with the specified name will be put.This output buffer is to be filled by the Engine as a result of executing the method.
- int recursive - 1 if the search is recursive (i.e. performed for children of child nodes); otherwise, 0.
bool LoadWorld ( Xml xml ) #
Loads a node state from the Xml.Arguments
- Xml xml - Xml smart pointer.
Return value
void RemoveChild ( Node n ) #
Removes a child node (added by the addChild() method) from the list of children.Arguments
- Node n - Child node to remove.
void RemoveWorldChild ( Node n ) #
Removes a child node (added by the addWorldChild() method) from the list of children.Arguments
- Node n - Child node to remove.
void RenderVisualizer ( ) #
Renders a bounding box / sphere of the object.bool SaveState ( Stream stream ) #
Saves a node state to a binary stream.Example using saveState() and restoreState() methods:
// initialize a node and set its state
NodeDummy node = new NodeDummy();
node.Position = new vec3(1, 1, 0);
// save state
Blob blob_state = new Blob();
node.SaveState(blob_state);
// change the node state
node.Position = new vec3(0, 0, 0);
// restore state
blob_state.SeekSet(0); // returning the carriage to the start of the blob
node.RestoreState(blob_state);
Arguments
- Stream stream - Stream to save node state data.
Return value
true if node state is successfully saved; otherwise, false.bool RestoreState ( Stream stream ) #
Restores a node state from a binary stream.Example using saveState() and restoreState() methods:
// initialize a node and set its state
NodeDummy node = new NodeDummy();
node.Position = new vec3(1, 1, 0);
// save state
Blob blob_state = new Blob();
node.SaveState(blob_state);
// change the node state
node.Position = new vec3(0, 0, 0);
// restore state
blob_state.SeekSet(0); // returning the carriage to the start of the blob
node.RestoreState(blob_state);
Arguments
- Stream stream - Stream with saved node state data.
Return value
true if node state is successfully restored; otherwise, false.bool SaveWorld ( Xml xml ) #
Saves the node into the Xml.Arguments
- Xml xml - Xml smart pointer.
Return value
true if the node is successfully saved; otherwise, false.void Swap ( Node n ) #
Swaps two nodes.Arguments
- Node n - Node to swap.
vec3 ToLocal ( vec3 p ) #
Converts a given vector in the world space to the node's local space.Arguments
- vec3 p - Vector in the world space.
Return value
Vector in the local space.vec3 ToWorld ( vec3 p ) #
Converts a given vector in the local space to the world space.Arguments
- vec3 p - Vector in the local space.
Return value
Vector in the world space.void Translate ( vec3 t ) #
Translates the node relative to its local coordinate system: the parent node transformation isn't taken into account.Arguments
- vec3 t - Translation vector.
void Translate ( Scalar x, Scalar y, Scalar z ) #
Translates the node relative to its local coordinate system: the parent node transformation isn't taken into account.Arguments
- Scalar x - Node translation along the X axis, in units.
- Scalar y - Node translation along the Y axis, in units.
- Scalar z - Node translation along the Z axis, in units.
void WorldTranslate ( vec3 t ) #
Translates the node in the world space using the specified vector.Arguments
- vec3 t - Translation vector.
void WorldTranslate ( Scalar x, Scalar y, Scalar z ) #
Translates the node in the world space using the values specified for the corresponding axes.Arguments
- Scalar x - Node translation along the X axis, in units.
- Scalar y - Node translation along the Y axis, in units.
- Scalar z - Node translation along the Z axis, in units.
void WorldLookAt ( vec3 target, vec3 up ) #
Reorients the node to "look" at the target point and sets the given up vector:- If the node is a Player-related one, it will "look" at the target point along the negative Z axis. The Y axis will be oriented along the specified up vector.
- Other nodes will "look" at the target point along the Y axis. The Z axis will be oriented along the specified up vector.
Arguments
- vec3 target - Coordinates of the target point in the world space.
- vec3 up - Up vector of the node in the world space. By default, the up vector is oriented along the Z axis.
void WorldLookAt ( vec3 target ) #
Reorients the node to "look" at the target point. The up vector is oriented along the Z axis.- If the node is a Player-related one, it will "look" at the target point along the negative Z axis. The Y axis will be oriented along the world Z axis.
- Other nodes will "look" at the target point along the Y axis.
Arguments
- vec3 target - Coordinates of the target point in the world space.
void Rotate ( quat r ) #
Rotates the node relative to its local coordinate system: the parent node transformation isn't taken into account. Rotation is determined by the specified quaternion.Arguments
- quat r - Rotation quaternion.
void Rotate ( vec3 angles ) #
Rotates the node in the local space. Rotation is determined by Euler angles passed as a vec3 vector.Arguments
- vec3 angles
void Rotate ( float angle_x, float angle_y, float angle_z ) #
Rotates the node in the world space according to specified Euler angles.Arguments
- float angle_x - Pitch angle, in degrees.
- float angle_y - Roll angle, in degrees.
- float angle_z - Yaw angle, in degrees.
void WorldRotate ( quat r ) #
Rotates the node in the world space. Rotation is determined by the specified quaternion.Arguments
- quat r - Rotation quaternion.
void WorldRotate ( vec3 angles ) #
Rotates the node in the world space. Rotation is determined by Euler angles passed as a vec3 vector.Arguments
- vec3 angles - Vector containing Euler angles (Pitch, Yaw, Roll).
void WorldRotate ( float angle_x, float angle_y, float angle_z ) #
Rotates the node in the world space according to specified Euler angles.Arguments
- float angle_x - Pitch angle, in degrees.
- float angle_y - Roll angle, in degrees.
- float angle_z - Yaw angle, in degrees.
void SetDirection ( vec3 dir, vec3 up, MathLib.AXIS axis = AXIS_NZ ) #
Updates the direction vector of the node and reorients this node: the specified axis of the node becomes oriented along the specified vector in local coordinates. For example, after running the code below, you will get the X axis of the node pointed along the Y axis in local coordinates.// get the node
Node node = World.GetNodeByName("material_ball");
// set the X axis to be pointed along the Y axis in local coordinates
node.SetDirection(new vec3(0.0f,1.0f,0.0f),new vec3(0.0f,0.0f,1.0f),MathLib.AXIS.X);
Arguments
- vec3 dir - New direction vector in local coordinates. The direction vector always has unit length.
- vec3 up - New up vector in local coordinates. If you skip this argument, the Z axis (in local coordinates) will be used. Note that the specified up vector is a hint vector only: the node's up vector points in the direction hinted by the specified up vector. The node's up vector matches the specified up vector (up) only if it is perpendicular to the specified direction vector (dir).
- MathLib.AXIS axis - Axis along which the direction vector should be pointed. The default is the negative Z axis.
vec3 GetDirection ( MathLib.AXIS axis = AXIS_NZ ) #
Returns the normalized direction vector pointing along the given node axis in local coordinates (i.e. relative to the node's parent). By default, the direction vector pointing along the negative Z axis of the node (in local coordinates) is returned. The direction vector always has a unit length.node.GetDirection(node.IsPlayer ? MathLib.AXIS.NZ : MathLib.AXIS.Y); // forward direction vector
node.GetDirection(node.IsPlayer ? MathLib.AXIS.Z : MathLib.AXIS.NY); // backward direction vector
node.GetDirection(node.IsPlayer ? MathLib.AXIS.Y : MathLib.AXIS.Z); // upward direction vector
node.GetDirection(node.IsPlayer ? MathLib.AXIS.NY : MathLib.AXIS.NZ); // down direction vector
node.GetDirection(MathLib.AXIS.X); // right direction vector
node.GetDirection(MathLib.AXIS.NX); // left direction vector
Arguments
- MathLib.AXIS axis - Axis along which the direction vector points. The default is the negative Z axis.
Return value
Direction vector in local coordinates.void SetWorldDirection ( vec3 dir, vec3 up, MathLib.AXIS axis = AXIS_NZ ) #
Updates the direction vector of the node and reorients this node: the specified axis of the node becomes oriented along the specified vector in world coordinates. For example, after running the code below, you will get the X axis of the node pointed along the Y axis in world coordinates:// get the node
Node node = World.GetNodeByName("material_ball");
// set the X axis to be pointed along the Y axis in world coordinates
node.SetWorldDirection(new vec3(0.0f,1.0f,0.0f),new vec3(0.0f,0.0f,1.0f),MathLib.AXIS.X);
Arguments
- vec3 dir - New direction vector in world coordinates. The direction vector always has unit length.
- vec3 up - New up vector in world coordinates. If you skip this argument, the Z axis (in local coordinates) will be used. Note that the specified up vector is a hint vector only: the node's up vector points in the direction hinted by the specified up vector. The node's up vector matches the specified up vector (up) only if it is perpendicular to the specified direction vector (dir).
- MathLib.AXIS axis - Axis along which the direction vector should be pointed. The default is the negative Z axis.
vec3 GetWorldDirection ( MathLib.AXIS axis = AXIS_NZ ) #
Returns the normalized direction vector pointing along the given node axis in world coordinates. By default, the direction vector pointing along the negative Z axis of the node is returned. The direction vector always has a unit length.node.GetWorldDirection(node.IsPlayer() ? MathLib.AXIS.NZ : MathLib.AXIS.Y); // forward direction vector
node.GetWorldDirection(node.IsPlayer() ? MathLib.AXIS.Z : MathLib.AXIS.NY); // backward direction vector
node.GetWorldDirection(node.IsPlayer() ? MathLib.AXIS.Y : MathLib.AXIS.Z); // upward direction vector
node.GetWorldDirection(node.IsPlayer() ? MathLib.AXIS.NY : MathLib.AXIS.NZ); // down direction vector
node.GetWorldDirection(MathLib.AXIS.X); // right direction vector
node.GetWorldDirection(MathLib.AXIS.NX); // left direction vector
Arguments
- MathLib.AXIS axis - Axis along which the direction vector points. The default is the negative Z axis.
Return value
Direction vector in world coordinates.Node GetCloneNode ( Node original_node ) #
Returns a node cloned from the specified original node.Arguments
- Node original_node - Original node that was cloned.
Return value
Clone of the specified original node if it exists; otherwise the original node itself.Property GetCloneProperty ( Property original_property ) #
Returns a node property cloned from the specified original property.Arguments
- Property original_property - Original node property that was cloned.
Return value
Clone of the specified original node property if it exists; otherwise the original node property itself.void SetSaveToWorldEnabledRecursive ( bool enable ) #
Sets a value indicating if saving to *.world file is enabled for the node and all its children (if any).Arguments
- bool enable - true to enable saving to *.world file for the node and all its children (if any); 0 to disable.
void SetShowInEditorEnabledRecursive ( bool enable ) #
Sets a value indicating if displaying in the World Hierarchy window of the UnigineEditor is enabled for the node and all its children (if any).Arguments
- bool enable - true to enable displaying in the World Hierarchy window of the UnigineEditor for the node and all its children (if any); 0 to disable.
Node.LIFETIME GetLifetimeSelf ( ) #
Returns the lifetime management type set for the node itself.Return value
Lifetime management type for the node (see the LIFETIME enum).WorldBoundBox GetHierarchyBoundBox ( bool only_enabled_nodes = false ) #
Returns a bounding box with local coordinates that takes children into account, but doesn't participate in physics calculations. Exclusion of objects from the spatial tree significantly reduces the size of the tree and improves performance due to saving time on bounding box recalculation when transforming nodes.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding box with world coordinates.WorldBoundSphere GetHierarchyBoundSphere ( bool only_enabled_nodes = false ) #
Returns a bounding sphere with local coordinates that takes children into account, but doesn't participate in physics calculations. Exclusion of objects from the spatial tree significantly reduces the size of the tree and improves performance due to saving time on bounding sphere recalculation when transforming nodes.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding sphere with world coordinates.WorldBoundBox GetHierarchyWorldBoundBox ( bool only_enabled_nodes = false ) #
Returns a bounding box with world coordinates that takes children into account, but doesn't participate in physics calculations. Exclusion of objects from the spatial tree significantly reduces the size of the tree and improves performance due to saving time on bounding box recalculation when transforming nodes.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding box with world coordinates.WorldBoundSphere GetHierarchyWorldBoundSphere ( bool only_enabled_nodes = false ) #
Returns a bounding sphere with world coordinates that takes children into account, but doesn't participate in physics calculations. Exclusion of objects from the spatial tree significantly reduces the size of the tree and improves performance due to saving time on bounding sphere recalculation when transforming nodes.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding sphere with world coordinates.WorldBoundBox GetHierarchySpatialBoundBox ( bool only_enabled_nodes = false ) #
Returns a bounding box with world coordinates that takes all children and physics into account. This bounding box is used by the spatial tree.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding box with world coordinates.WorldBoundSphere GetHierarchySpatialBoundSphere ( bool only_enabled_nodes = false ) #
Returns a bounding sphere with world coordinates that takes all children and physics into account. This bounding sphere is used by the spatial tree.Arguments
- bool only_enabled_nodes - Set true to obtain the result taking into account only the nodes in the hierarchy that are enabled, or false - to take into account all nodes in the hierarchy regardless of their enabled state.
Return value
The bounding sphere with world coordinates.virtual void UpdateSpatialTree ( ) #
Updates node bounds in the spatial tree in the current frame. This method can be used in case you use some custom logic affecting node bounds or position and need to have your changes to be taken into account in the current frame, as well as to process such changes for your custom nodes ( ObjectExtern, NodeExtern) which are otherwise ignored. Calling this method enables you to apply changes for this node fast without complete tree recalculation. But you should be aware that node bounds fast-updated this way might be inaccurate (they can only be expanded, as shrinking will require tree recalculation). In case you need to have 100% accurate bounds in the current frame, call the World.UpdateSpatial() method. You can also simply tell the spatial tree to update node bounds in the next frame via the UpdateSpatialTreeDelayed() method.void UpdateSpatialTreeDelayed ( ) #
Mark node bounds in the spatial tree to be updated in the next frame (all bounds will be 100% accurate in this case unlike for the UpdateSpatialTree() method). This method can be used in case you use some custom logic affecting node bounds or position, as well as to process such changes for your custom nodes ( ObjectExtern, NodeExtern) which are otherwise ignored. The changes will only be applied in the next frame, in case you need to have your changes to be taken into account right in the current frame use the World.UpdateSpatial() method for 100% accurate bounds (slow), or the fast UpdateSpatialTree() method which only expands node bounds if necessary.WorldTrigger GetWorldTrigger ( int num ) #
Returns one of the World Triggers inside which the node is located at the moment by its number. For any node in the world, you can check whether it is currently inside any World Trigger and access any of such triggers by simply calling this method.Arguments
- int num - Number of the World Trigger in the list of World Triggers inside which the node is located at the moment.
Return value
World Trigger with the specified number inside which the node is located at the moment.UGUID GetLostNodePropertyGUID ( int num ) #
Returns the GUID of a lost property assigned to the node. If for some reason a property assigned to the specified slot of the node is missing, this method can be used to get it's GUID.Arguments
- int num - Target property slot number.
Return value
Lost property GUID.void RenderBounds ( bool render_node_bound = true, bool render_instance_bound = false ) #
Renders the node bounds. The method is applied for checking the actual size of the CPU-rendered node bounds that may differ from the GPU-rendered mesh size, if the latter has been modified by the shader. For nodes that consist of multiple mesh instances (Clutter, Cluster) rendering of each individual mesh bound is also available.Arguments
- bool render_node_bound - true to enable rendering of the node bounds, false to disable it.
- bool render_instance_bound - true to enable bound rendering for each individual mesh instance (applicable for Clutter and Cluster nodes), false to disable it.