Browse Source

Tidied up the sample descriptions.
Exposed UIElement::SetVar() and GetVar() to Lua script.
Modified the Lua Sprites sample to use custom vars inside UIElement.

Lasse Öörni 12 years ago
parent
commit
7a55a43725
55 changed files with 190 additions and 173 deletions
  1. 3 3
      Bin/Data/LuaScripts/01_HelloWorld.lua
  2. 3 3
      Bin/Data/LuaScripts/02_HelloGUI.lua
  3. 23 10
      Bin/Data/LuaScripts/03_Sprites.lua
  4. 3 3
      Bin/Data/LuaScripts/04_StaticScene.lua
  5. 3 3
      Bin/Data/LuaScripts/05_AnimatingScene.lua
  6. 5 5
      Bin/Data/LuaScripts/06_SkeletalAnimation.lua
  7. 3 3
      Bin/Data/LuaScripts/07_Billboards.lua
  8. 4 4
      Bin/Data/LuaScripts/08_Decals.lua
  9. 2 2
      Bin/Data/LuaScripts/09_MultipleViewports.lua
  10. 3 3
      Bin/Data/LuaScripts/12_PhysicsStressTest.lua
  11. 2 2
      Bin/Data/LuaScripts/14_SoundEffects.lua
  12. 2 2
      Bin/Data/LuaScripts/19_VehicleDemo.lua
  13. 4 4
      Bin/Data/LuaScripts/20_HugeObjectCount.lua
  14. 3 3
      Bin/Data/Scripts/01_HelloWorld.as
  15. 3 3
      Bin/Data/Scripts/02_HelloGUI.as
  16. 3 3
      Bin/Data/Scripts/03_Sprites.as
  17. 3 3
      Bin/Data/Scripts/04_StaticScene.as
  18. 3 3
      Bin/Data/Scripts/05_AnimatingScene.as
  19. 4 4
      Bin/Data/Scripts/06_SkeletalAnimation.as
  20. 3 3
      Bin/Data/Scripts/07_Billboards.as
  21. 4 4
      Bin/Data/Scripts/08_Decals.as
  22. 2 2
      Bin/Data/Scripts/09_MultipleViewports.as
  23. 2 2
      Bin/Data/Scripts/10_RenderToTexture.as
  24. 4 4
      Bin/Data/Scripts/11_Physics.as
  25. 3 3
      Bin/Data/Scripts/12_PhysicsStressTest.as
  26. 3 3
      Bin/Data/Scripts/13_Ragdolls.as
  27. 2 2
      Bin/Data/Scripts/14_SoundEffects.as
  28. 4 4
      Bin/Data/Scripts/15_Navigation.as
  29. 2 2
      Bin/Data/Scripts/16_Chat.as
  30. 3 3
      Bin/Data/Scripts/17_SceneReplication.as
  31. 4 5
      Bin/Data/Scripts/18_CharacterDemo.as
  32. 3 3
      Bin/Data/Scripts/19_VehicleDemo.as
  33. 3 3
      Bin/Data/Scripts/20_HugeObjectCount.as
  34. 3 0
      Docs/LuaScriptAPI.dox
  35. 4 1
      Source/Extras/LuaScript/pkgs/UI/UIElement.pkg
  36. 3 3
      Source/Samples/01_HelloWorld/HelloWorld.h
  37. 3 3
      Source/Samples/02_HelloGUI/HelloGUI.h
  38. 3 3
      Source/Samples/03_Sprites/Sprites.h
  39. 3 3
      Source/Samples/04_StaticScene/StaticScene.h
  40. 3 3
      Source/Samples/05_AnimatingScene/AnimatingScene.h
  41. 3 3
      Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h
  42. 3 3
      Source/Samples/07_Billboards/Billboards.h
  43. 4 4
      Source/Samples/08_Decals/Decals.h
  44. 2 2
      Source/Samples/09_MultipleViewports/MultipleViewports.h
  45. 2 2
      Source/Samples/10_RenderToTexture/RenderToTexture.h
  46. 4 4
      Source/Samples/11_Physics/Physics.h
  47. 3 3
      Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h
  48. 3 3
      Source/Samples/13_Ragdolls/Ragdolls.h
  49. 2 2
      Source/Samples/14_SoundEffects/SoundEffects.h
  50. 4 4
      Source/Samples/15_Navigation/Navigation.h
  51. 2 2
      Source/Samples/16_Chat/Chat.h
  52. 4 4
      Source/Samples/17_SceneReplication/SceneReplication.h
  53. 4 5
      Source/Samples/18_CharacterDemo/CharacterDemo.h
  54. 3 3
      Source/Samples/19_VehicleDemo/VehicleDemo.h
  55. 4 4
      Source/Samples/20_HugeObjectCount/HugeObjectCount.h

+ 3 - 3
Bin/Data/LuaScripts/01_HelloWorld.lua

@@ -1,8 +1,8 @@
 -- This first example, maintaining tradition, prints a "Hello World" message.
 -- Furthermore it shows:
---     - Using the Sample utility functions as a base for the application;
---     - Adding a Text element to the graphical user interface;
---     - Subscribing to and handling of update events;
+--     - Using the Sample utility functions as a base for the application
+--     - Adding a Text element to the graphical user interface
+--     - Subscribing to and handling of update events
 
 require "LuaScripts/Utilities/Sample"
 

+ 3 - 3
Bin/Data/LuaScripts/02_HelloGUI.lua

@@ -1,8 +1,8 @@
 -- A simple 'HelloWorld' GUI created purely from code.
 -- This sample demonstrates:
---     - Creation of controls and building a UI hierarchy;
---     - Loading UI style from XML and applying it to controls;
---     - Handling of global and per-control events;
+--     - Creation of controls and building a UI hierarchy
+--     - Loading UI style from XML and applying it to controls
+--     - Handling of global and per-control events
 
 require "LuaScripts/Utilities/Sample"
 

+ 23 - 10
Bin/Data/LuaScripts/03_Sprites.lua

@@ -1,14 +1,16 @@
 -- Moving sprites example.
 -- This sample demonstrates:
---     - Adding Sprite elements to the UI;
---     - Storing custom data (sprite velocity) inside UI elements;
---     - Handling frame update events in which the sprites are moved;
+--     - Adding Sprite elements to the UI
+--     - Storing custom data (sprite velocity) inside UI elements
+--     - Handling frame update events in which the sprites are moved
 
 require "LuaScripts/Utilities/Sample"
 
 local numSprites = 100
 local sprites = {}
-local speeds = {}
+
+-- Custom variable identifier for storing sprite velocity within the UI element
+local VAR_VELOCITY = ShortStringHash("Velocity")
 
 local context = GetContext()
 
@@ -35,22 +37,33 @@ function CreateSprites()
     local height = graphics.height
     
     for i = 1, numSprites do
+        -- Create a new sprite, set it to use the texture
         local sprite = Sprite:new(context)
         sprite.texture = decalTex
-        sprite:SetFullImageRect()
+        sprite:SetFullImageRect()       
+        
+        -- The UI root element is as big as the rendering window, set random position within it
         sprite.position = Vector2(Random(width), Random(height))
+        
+        -- Set sprite size & hotspot in its center
         sprite:SetSize(128, 128)
         sprite.hotSpot = IntVector2(64, 64)
-        sprite.rotation = Random(360)
-        sprite.scale = Vector2(1, 1) * (Random(1) + 0.5)
         
+        -- Set random rotation in degrees and random scale
+        sprite.rotation = Random(360.0)
+        sprite.scale = Vector2(1.0, 1.0) * (Random(1.0) + 0.5)
+        
+        -- Set random color and additive blending mode
         sprite:SetColor(Color(Random(0.5) + 0.5, Random(0.5) + 0.5, Random(0.5) + 0.5, 1.0))
         sprite.blendMode = BLEND_ADD
-        
+
+        -- Add as a child of the root UI element
         ui.root:AddChild(sprite)
         
+        -- Store sprite's velocity as a custom variable
+        sprite:SetVar(VAR_VELOCITY, Variant(Vector2(Random(200.0) - 100.0, Random(200.0) - 100.0)))
+        
         table.insert(sprites, sprite)
-        table.insert(speeds, Vector2(Random(200) - 100, Random(200) - 100))
     end
 end
 
@@ -68,7 +81,7 @@ function MoveSprites(timeStep)
         sprite.rotation = sprite.rotation + timeStep * 30
         
         local newPos = sprite.position
-        newPos = newPos + speeds[i] * timeStep
+        newPos = newPos + sprite:GetVar(VAR_VELOCITY):GetVector2() * timeStep
         
         if newPos.x >= width then
             newPos.x = newPos.x - width

+ 3 - 3
Bin/Data/LuaScripts/04_StaticScene.lua

@@ -1,8 +1,8 @@
 -- Static 3D scene example.
 -- This sample demonstrates:
---     - Creating a 3D scene with static content;
---     - Displaying the scene using the Renderer subsystem;
---     - Handling keyboard and mouse input to move a freelook camera;
+--     - Creating a 3D scene with static content
+--     - Displaying the scene using the Renderer subsystem
+--     - Handling keyboard and mouse input to move a freelook camera
 
 require "LuaScripts/Utilities/Sample"
 

+ 3 - 3
Bin/Data/LuaScripts/05_AnimatingScene.lua

@@ -1,8 +1,8 @@
 -- Animating 3D scene example.
 -- This sample demonstrates:
---     - Creating a 3D scene and using a script component to animate the objects;
---     - Controlling scene ambience with the Zone component;
---     - Attaching a light to an object (the camera);
+--     - Creating a 3D scene and using a script component to animate the objects
+--     - Controlling scene ambience with the Zone component
+--     - Attaching a light to an object (the camera)
 
 require "LuaScripts/Utilities/Sample"
 

+ 5 - 5
Bin/Data/LuaScripts/06_SkeletalAnimation.lua

@@ -1,10 +1,10 @@
 -- Skeletal animation example.
 -- This sample demonstrates:
---     - Populating a 3D scene with skeletally animated AnimatedModel components;
---     - Moving the animated models and advancing their animation using a script object;
---     - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows;
---       over a large area (typically used in outdoor scenes for shadows cast by sunlight);
---     - Displaying renderer debug geometry;
+--     - Populating a 3D scene with skeletally animated AnimatedModel components
+--     - Moving the animated models and advancing their animation using a script object
+--     - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
+--       over a large area (typically used in outdoor scenes for shadows cast by sunlight)
+--     - Displaying renderer debug geometry
 
 require "LuaScripts/Utilities/Sample"
 

+ 3 - 3
Bin/Data/LuaScripts/07_Billboards.lua

@@ -1,8 +1,8 @@
 -- Billboard example.
 -- This sample demonstrates:
---     - Populating a 3D scene with billboard sets and several shadow casting spotlights;
---     - Parenting scene nodes to allow more intuitive creation of groups of objects;
---     - Examining rendering performance with a somewhat large object and light count;
+--     - Populating a 3D scene with billboard sets and several shadow casting spotlights
+--     - Parenting scene nodes to allow more intuitive creation of groups of objects
+--     - Examining rendering performance with a somewhat large object and light count
 
 require "LuaScripts/Utilities/Sample"
 

+ 4 - 4
Bin/Data/LuaScripts/08_Decals.lua

@@ -1,9 +1,9 @@
 -- Decals example.
 -- This sample demonstrates:
---     - Performing a raycast to the octree and adding a decal to the hit location;
---     - Defining a Cursor UI element which stays inside the window and can be shown/hidden;
---     - Marking suitable (large) objects as occluders for occlusion culling;
---     - Displaying renderer debug geometry to see the effect of occlusion;
+--     - Performing a raycast to the octree and adding a decal to the hit location
+--     - Defining a Cursor UI element which stays inside the window and can be shown/hidden
+--     - Marking suitable (large) objects as occluders for occlusion culling
+--     - Displaying renderer debug geometry to see the effect of occlusion
 
 require "LuaScripts/Utilities/Sample"
 

+ 2 - 2
Bin/Data/LuaScripts/09_MultipleViewports.lua

@@ -1,7 +1,7 @@
 -- Multiple viewports example.
 -- This sample demonstrates:
---     - Setting up two viewports with two separate cameras;
---     - Adding post processing effects to a viewport's render path and toggling them;
+--     - Setting up two viewports with two separate cameras
+--     - Adding post processing effects to a viewport's render path and toggling them
 
 require "LuaScripts/Utilities/Sample"
 

+ 3 - 3
Bin/Data/LuaScripts/12_PhysicsStressTest.lua

@@ -1,8 +1,8 @@
 -- Physics stress test example.
 -- This sample demonstrates:
---     - Physics and rendering performance with a high (1000) moving object count;
---     - Using triangle meshes for collision;
---     - Optimizing physics simulation by leaving out collision event signaling;
+--     - Physics and rendering performance with a high (1000) moving object count
+--     - Using triangle meshes for collision
+--     - Optimizing physics simulation by leaving out collision event signaling
 
 require "LuaScripts/Utilities/Sample"
 

+ 2 - 2
Bin/Data/LuaScripts/14_SoundEffects.lua

@@ -1,7 +1,7 @@
 -- Sound effects example
 -- This sample demonstrates:
---     - Playing sound effects and music;
---     - Controlling sound and music master volume;
+--     - Playing sound effects and music
+--     - Controlling sound and music master volume
 
 require "LuaScripts/Utilities/Sample"
 

+ 2 - 2
Bin/Data/LuaScripts/19_VehicleDemo.lua

@@ -1,7 +1,7 @@
 -- Vehicle example.
 -- This sample demonstrates:
---     - Creating a heightmap terrain with collision;
---     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints;
+--     - Creating a heightmap terrain with collision
+--     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
 
 require "LuaScripts/Utilities/Sample"
 

+ 4 - 4
Bin/Data/LuaScripts/20_HugeObjectCount.lua

@@ -1,9 +1,9 @@
 -- Huge object count example.
 -- This sample demonstrates:
---     - Creating a scene with 250 x 250 simple objects;
---     - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :);
---     - Allowing examination of performance hotspots in the rendering code;
---     - Optionally speeding up rendering by grouping the objects using StaticModelGroup component;
+--     - Creating a scene with 250 x 250 simple objects
+--     - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
+--     - Allowing examination of performance hotspots in the rendering code
+--     - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
 
 require "LuaScripts/Utilities/Sample"
 

+ 3 - 3
Bin/Data/Scripts/01_HelloWorld.as

@@ -1,8 +1,8 @@
 // This first example, maintaining tradition, prints a "Hello World" message.
 // Furthermore it shows:
-//     - Using the Sample utility functions as a base for the application;
-//     - Adding a Text element to the graphical user interface;
-//     - Subscribing to and handling of update events;
+//     - Using the Sample utility functions as a base for the application
+//     - Adding a Text element to the graphical user interface
+//     - Subscribing to and handling of update events
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/02_HelloGUI.as

@@ -1,8 +1,8 @@
 // A simple 'HelloWorld' GUI created purely from code.
 // This sample demonstrates:
-//     - Creation of controls and building a UI hierarchy;
-//     - Loading UI style from XML and applying it to controls;
-//     - Handling of global and per-control events;
+//     - Creation of controls and building a UI hierarchy
+//     - Loading UI style from XML and applying it to controls
+//     - Handling of global and per-control events
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/03_Sprites.as

@@ -1,8 +1,8 @@
 // Moving sprites example.
 // This sample demonstrates:
-//     - Adding Sprite elements to the UI;
-//     - Storing custom data (sprite velocity) inside UI elements;
-//     - Handling frame update events in which the sprites are moved;
+//     - Adding Sprite elements to the UI
+//     - Storing custom data (sprite velocity) inside UI elements
+//     - Handling frame update events in which the sprites are moved
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/04_StaticScene.as

@@ -1,8 +1,8 @@
 // Static 3D scene example.
 // This sample demonstrates:
-//     - Creating a 3D scene with static content;
-//     - Displaying the scene using the Renderer subsystem;
-//     - Handling keyboard and mouse input to move a freelook camera;
+//     - Creating a 3D scene with static content
+//     - Displaying the scene using the Renderer subsystem
+//     - Handling keyboard and mouse input to move a freelook camera
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/05_AnimatingScene.as

@@ -1,8 +1,8 @@
 // Animating 3D scene example.
 // This sample demonstrates:
-//     - Creating a 3D scene and using a script component to animate the objects;
-//     - Controlling scene ambience with the Zone component;
-//     - Attaching a light to an object (the camera);
+//     - Creating a 3D scene and using a script component to animate the objects
+//     - Controlling scene ambience with the Zone component
+//     - Attaching a light to an object (the camera)
 
 #include "Scripts/Utilities/Sample.as"
 

+ 4 - 4
Bin/Data/Scripts/06_SkeletalAnimation.as

@@ -1,10 +1,10 @@
 // Skeletal animation example.
 // This sample demonstrates:
-//     - Populating a 3D scene with skeletally animated AnimatedModel components;
-//     - Moving the animated models and advancing their animation using a script object;
+//     - Populating a 3D scene with skeletally animated AnimatedModel components
+//     - Moving the animated models and advancing their animation using a script object
 //     - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
-//       over a large area (typically used in outdoor scenes for shadows cast by sunlight);
-//     - Displaying renderer debug geometry;
+//       over a large area (typically used in outdoor scenes for shadows cast by sunlight)
+//     - Displaying renderer debug geometry
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/07_Billboards.as

@@ -1,8 +1,8 @@
 // Billboard example.
 // This sample demonstrates:
-//     - Populating a 3D scene with billboard sets and several shadow casting spotlights;
-//     - Parenting scene nodes to allow more intuitive creation of groups of objects;
-//     - Examining rendering performance with a somewhat large object and light count;
+//     - Populating a 3D scene with billboard sets and several shadow casting spotlights
+//     - Parenting scene nodes to allow more intuitive creation of groups of objects
+//     - Examining rendering performance with a somewhat large object and light count
 
 #include "Scripts/Utilities/Sample.as"
 

+ 4 - 4
Bin/Data/Scripts/08_Decals.as

@@ -1,9 +1,9 @@
 // Decals example.
 // This sample demonstrates:
-//     - Performing a raycast to the octree and adding a decal to the hit location;
-//     - Defining a Cursor UI element which stays inside the window and can be shown/hidden;
-//     - Marking suitable (large) objects as occluders for occlusion culling;
-//     - Displaying renderer debug geometry to see the effect of occlusion;
+//     - Performing a raycast to the octree and adding a decal to the hit location
+//     - Defining a Cursor UI element which stays inside the window and can be shown/hidden
+//     - Marking suitable (large) objects as occluders for occlusion culling
+//     - Displaying renderer debug geometry to see the effect of occlusion
 
 #include "Scripts/Utilities/Sample.as"
 

+ 2 - 2
Bin/Data/Scripts/09_MultipleViewports.as

@@ -1,7 +1,7 @@
 // Multiple viewports example.
 // This sample demonstrates:
-//     - Setting up two viewports with two separate cameras;
-//     - Adding post processing effects to a viewport's render path and toggling them;
+//     - Setting up two viewports with two separate cameras
+//     - Adding post processing effects to a viewport's render path and toggling them
 
 #include "Scripts/Utilities/Sample.as"
 

+ 2 - 2
Bin/Data/Scripts/10_RenderToTexture.as

@@ -1,7 +1,7 @@
 // Render to texture example
 // This sample demonstrates:
-//     - Creating two 3D scenes and rendering the other into a texture;
-//     - Creating rendertarget textures and materials programmatically;
+//     - Creating two 3D scenes and rendering the other into a texture
+//     - Creating rendertarget texture and material programmatically
 
 #include "Scripts/Utilities/Sample.as"
 

+ 4 - 4
Bin/Data/Scripts/11_Physics.as

@@ -1,9 +1,9 @@
 // Physics example.
 // This sample demonstrates:
-//     - Creating both static and moving physics objects to a scene;
-//     - Displaying physics debug geometry;
-//     - Using the Skybox component for setting up an unmoving sky;
-//     - Saving a scene to a file and loading it to restore a previous state;
+//     - Creating both static and moving physics objects to a scene
+//     - Displaying physics debug geometry
+//     - Using the Skybox component for setting up an unmoving sky
+//     - Saving a scene to a file and loading it to restore a previous state
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/12_PhysicsStressTest.as

@@ -1,8 +1,8 @@
 // Physics stress test example.
 // This sample demonstrates:
-//     - Physics and rendering performance with a high (1000) moving object count;
-//     - Using triangle meshes for collision;
-//     - Optimizing physics simulation by leaving out collision event signaling;
+//     - Physics and rendering performance with a high (1000) moving object count
+//     - Using triangle meshes for collision
+//     - Optimizing physics simulation by leaving out collision event signaling
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/13_Ragdolls.as

@@ -1,8 +1,8 @@
 // Ragdoll example.
 // This sample demonstrates:
-//     - Detecting physics collisions;
-//     - Moving an AnimatedModel's bones with physics and connecting them with constraints;
-//     - Using rolling friction to stop rolling objects from moving infinitely;
+//     - Detecting physics collisions
+//     - Moving an AnimatedModel's bones with physics and connecting them with constraints
+//     - Using rolling friction to stop rolling objects from moving infinitely
 
 #include "Scripts/Utilities/Sample.as"
 

+ 2 - 2
Bin/Data/Scripts/14_SoundEffects.as

@@ -1,7 +1,7 @@
 // Sound effects example
 // This sample demonstrates:
-//     - Playing sound effects and music;
-//     - Controlling sound and music master volume;
+//     - Playing sound effects and music
+//     - Controlling sound and music master volume
 
 #include "Scripts/Utilities/Sample.as"
 

+ 4 - 4
Bin/Data/Scripts/15_Navigation.as

@@ -1,9 +1,9 @@
 // Navigation example.
 // This sample demonstrates:
-//     - Generating a navigation mesh into the scene;
-//     - Performing path queries to the navigation mesh;
-//     - Rebuilding the navigation mesh partially when adding or removing objects;
-//     - Visualizing custom debug geometry;
+//     - Generating a navigation mesh into the scene
+//     - Performing path queries to the navigation mesh
+//     - Rebuilding the navigation mesh partially when adding or removing objects
+//     - Visualizing custom debug geometry
 
 #include "Scripts/Utilities/Sample.as"
 

+ 2 - 2
Bin/Data/Scripts/16_Chat.as

@@ -1,7 +1,7 @@
 // Chat example
 // This sample demonstrates:
-//     - Starting up a network server or connecting to it;
-//     - Implementing simple chat functionality with network messages;
+//     - Starting up a network server or connecting to it
+//     - Implementing simple chat functionality with network messages
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/17_SceneReplication.as

@@ -1,9 +1,9 @@
 // Scene network replication example.
 // This sample demonstrates:
-//     - Creating a scene in which network clients can join;
+//     - Creating a scene in which network clients can join
 //     - Giving each client an object to control and sending the controls from the clients to the server,
-//       where the authoritative simulation happens;
-//     - Controlling a physics object's movement by applying forces;
+//       where the authoritative simulation happens
+//     - Controlling a physics object's movement by applying forces
 
 #include "Scripts/Utilities/Sample.as"
 

+ 4 - 5
Bin/Data/Scripts/18_CharacterDemo.as

@@ -1,10 +1,9 @@
 // Moving character example.
 // This sample demonstrates:
-//     - Controlling a humanoid character through physics;
-//     - Driving animations using the AnimationController component;
-//     - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera
-//       clipping into scenery;
-//     - Saving and loading the variables of a script object;
+//     - Controlling a humanoid character through physics
+//     - Driving animations using the AnimationController component
+//     - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera clipping into scenery
+//     - Saving and loading the variables of a script object
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/19_VehicleDemo.as

@@ -1,8 +1,8 @@
 // Vehicle example.
 // This sample demonstrates:
-//     - Creating a heightmap terrain with collision;
-//     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints;
-//     - Saving and loading the variables of a script object, including node & component references;
+//     - Creating a heightmap terrain with collision
+//     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
+//     - Saving and loading the variables of a script object, including node & component references
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 3
Bin/Data/Scripts/20_HugeObjectCount.as

@@ -1,9 +1,9 @@
 // Huge object count example.
 // This sample demonstrates:
-//     - Creating a scene with 250 x 250 simple objects;
+//     - Creating a scene with 250 x 250 simple objects
 //     - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
-//     - Allowing examination of performance hotspots in the rendering code;
-//     - Optionally speeding up rendering by grouping the objects using StaticModelGroup component;
+//     - Allowing examination of performance hotspots in the rendering code
+//     - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
 
 #include "Scripts/Utilities/Sample.as"
 

+ 3 - 0
Docs/LuaScriptAPI.dox

@@ -4528,6 +4528,7 @@ Methods:<br>
 - void Remove()
 - unsigned FindChild(UIElement* element) const
 - void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED)
+- void SetVar(ShortStringHash key, const Variant& value)
 - void SetInternal(bool enable)
 - void SetTraversalMode(TraversalMode traversalMode)
 - void SetElementEventSender(bool flag)
@@ -4578,6 +4579,8 @@ Methods:<br>
 - UIElement* GetParent() const
 - UIElement* GetRoot() const
 - const Color& GetDerivedColor() const
+- const Variant& GetVar(ShortStringHash key) const
+- const VariantMap& GetVars() const
 - IntVector2 ScreenToElement(const IntVector2& screenPosition)
 - IntVector2 ElementToScreen(const IntVector2& position)
 - bool IsInside(IntVector2 position, bool isScreen)

+ 4 - 1
Source/Extras/LuaScript/pkgs/UI/UIElement.pkg

@@ -134,10 +134,11 @@ class UIElement : public Serializable
     void Remove();
     unsigned FindChild(UIElement* element) const;
     void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED);
+    void SetVar(ShortStringHash key, const Variant& value);
     void SetInternal(bool enable);
     void SetTraversalMode(TraversalMode traversalMode);
     void SetElementEventSender(bool flag);
-    
+
     const String& GetName() const;
     const IntVector2& GetPosition() const;
     const IntVector2& GetSize() const;
@@ -187,6 +188,8 @@ class UIElement : public Serializable
     UIElement* GetParent() const;
     UIElement* GetRoot() const;
     const Color& GetDerivedColor() const;
+    const Variant& GetVar(ShortStringHash key) const;
+    const VariantMap& GetVars() const;
     IntVector2 ScreenToElement(const IntVector2& screenPosition);
     IntVector2 ElementToScreen(const IntVector2& position);
     bool IsInside(IntVector2 position, bool isScreen);

+ 3 - 3
Source/Samples/01_HelloWorld/HelloWorld.h

@@ -26,9 +26,9 @@
 
 /// This first example, maintaining tradition, prints a "Hello World" message.
 /// Furthermore it shows:
-///     - Using the Sample / Application classes, which initialize the Urho3D engine and run the main loop;
-///     - Adding a Text element to the graphical user interface;
-///     - Subscribing to and handling of update events;
+///     - Using the Sample / Application classes, which initialize the Urho3D engine and run the main loop
+///     - Adding a Text element to the graphical user interface
+///     - Subscribing to and handling of update events
 class HelloWorld : public Sample
 {
     OBJECT(HelloWorld);

+ 3 - 3
Source/Samples/02_HelloGUI/HelloGUI.h

@@ -33,9 +33,9 @@ class Window;
 
 /// A simple 'HelloWorld' GUI created purely from code.
 /// This sample demonstrates:
-///     - Creation of controls and building a UI hierarchy;
-///     - Loading UI style from XML and applying it to controls;
-///     - Handling of global and per-control events;
+///     - Creation of controls and building a UI hierarchy
+///     - Loading UI style from XML and applying it to controls
+///     - Handling of global and per-control events
 class HelloGUI : public Sample
 {
     OBJECT(HelloGUI);

+ 3 - 3
Source/Samples/03_Sprites/Sprites.h

@@ -26,9 +26,9 @@
 
 /// Moving sprites example.
 /// This sample demonstrates:
-///     - Adding Sprite elements to the UI;
-///     - Storing custom data (sprite velocity) inside UI elements;
-///     - Handling frame update events in which the sprites are moved;
+///     - Adding Sprite elements to the UI
+///     - Storing custom data (sprite velocity) inside UI elements
+///     - Handling frame update events in which the sprites are moved
 class Sprites : public Sample
 {
     // Enable type information.

+ 3 - 3
Source/Samples/04_StaticScene/StaticScene.h

@@ -34,9 +34,9 @@ class Scene;
 
 /// Static 3D scene example.
 /// This sample demonstrates:
-///     - Creating a 3D scene with static content;
-///     - Displaying the scene using the Renderer subsystem;
-///     - Handling keyboard and mouse input to move a freelook camera;
+///     - Creating a 3D scene with static content
+///     - Displaying the scene using the Renderer subsystem
+///     - Handling keyboard and mouse input to move a freelook camera
 class StaticScene : public Sample
 {
     OBJECT(StaticScene);

+ 3 - 3
Source/Samples/05_AnimatingScene/AnimatingScene.h

@@ -34,9 +34,9 @@ class Scene;
 
 /// Animating 3D scene example.
 /// This sample demonstrates:
-///     - Creating a 3D scene and using a custom component to animate the objects;
-///     - Controlling scene ambience with the Zone component;
-///     - Attaching a light to an object (the camera);
+///     - Creating a 3D scene and using a custom component to animate the objects
+///     - Controlling scene ambience with the Zone component
+///     - Attaching a light to an object (the camera)
 class AnimatingScene : public Sample
 {
     OBJECT(AnimatingScene);

+ 3 - 3
Source/Samples/06_SkeletalAnimation/SkeletalAnimation.h

@@ -35,10 +35,10 @@ class Scene;
 /// Skeletal animation example.
 /// This sample demonstrates:
 ///     - Populating a 3D scene with skeletally animated AnimatedModel components;
-///     - Moving the animated models and advancing their animation using a custom component;
+///     - Moving the animated models and advancing their animation using a custom component
 ///     - Enabling a cascaded shadow map on a directional light, which allows high-quality shadows
-///       over a large area (typically used in outdoor scenes for shadows cast by sunlight);
-///     - Displaying renderer debug geometry;
+///       over a large area (typically used in outdoor scenes for shadows cast by sunlight)
+///     - Displaying renderer debug geometry
 class SkeletalAnimation : public Sample
 {
     OBJECT(SkeletalAnimation);

+ 3 - 3
Source/Samples/07_Billboards/Billboards.h

@@ -34,9 +34,9 @@ class Scene;
 
 /// Billboard example.
 /// This sample demonstrates:
-///     - Populating a 3D scene with billboard sets and several shadow casting spotlights;
-///     - Parenting scene nodes to allow more intuitive creation of groups of objects;
-///     - Examining rendering performance with a somewhat large object and light count;
+///     - Populating a 3D scene with billboard sets and several shadow casting spotlights
+///     - Parenting scene nodes to allow more intuitive creation of groups of objects
+///     - Examining rendering performance with a somewhat large object and light count
 class Billboards : public Sample
 {
     OBJECT(Billboards);

+ 4 - 4
Source/Samples/08_Decals/Decals.h

@@ -35,10 +35,10 @@ class Scene;
 
 /// Decals example.
 /// This sample demonstrates:
-///     - Performing a raycast to the octree and adding a decal to the hit location;
-///     - Defining a Cursor UI element which stays inside the window and can be shown/hidden;
-///     - Marking suitable (large) objects as occluders for occlusion culling;
-///     - Displaying renderer debug geometry to see the effect of occlusion;
+///     - Performing a raycast to the octree and adding a decal to the hit location
+///     - Defining a Cursor UI element which stays inside the window and can be shown/hidden
+///     - Marking suitable (large) objects as occluders for occlusion culling
+///     - Displaying renderer debug geometry to see the effect of occlusion
 class Decals : public Sample
 {
     OBJECT(Decals);

+ 2 - 2
Source/Samples/09_MultipleViewports/MultipleViewports.h

@@ -34,8 +34,8 @@ class Scene;
 
 /// Multiple viewports example.
 /// This sample demonstrates:
-///     - Setting up two viewports with two separate cameras;
-///     - Adding post processing effects to a viewport's render path and toggling them;
+///     - Setting up two viewports with two separate cameras
+///     - Adding post processing effects to a viewport's render path and toggling them
 class MultipleViewports : public Sample
 {
     OBJECT(MultipleViewports);

+ 2 - 2
Source/Samples/10_RenderToTexture/RenderToTexture.h

@@ -34,8 +34,8 @@ class Scene;
 
 /// Render to texture example
 /// This sample demonstrates:
-///     - Creating two 3D scenes and rendering the other into a texture;
-///     - Creating rendertarget textures and materials programmatically;
+///     - Creating two 3D scenes and rendering the other into a texture
+///     - Creating rendertarget texture and material programmatically
 class RenderToTexture : public Sample
 {
     OBJECT(RenderToTexture);

+ 4 - 4
Source/Samples/11_Physics/Physics.h

@@ -34,10 +34,10 @@ class Scene;
 
 /// Physics example.
 /// This sample demonstrates:
-///     - Creating both static and moving physics objects to a scene;
-///     - Displaying physics debug geometry;
-///     - Using the Skybox component for setting up an unmoving sky;
-///     - Saving a scene to a file and loading it to restore a previous state;
+///     - Creating both static and moving physics objects to a scene
+///     - Displaying physics debug geometry
+///     - Using the Skybox component for setting up an unmoving sky
+///     - Saving a scene to a file and loading it to restore a previous state
 class Physics : public Sample
 {
     OBJECT(Physics);

+ 3 - 3
Source/Samples/12_PhysicsStressTest/PhysicsStressTest.h

@@ -34,9 +34,9 @@ class Scene;
 
 /// Physics stress test example.
 /// This sample demonstrates:
-///     - Physics and rendering performance with a high (1000) moving object count;
-///     - Using triangle meshes for collision;
-///     - Optimizing physics simulation by leaving out collision event signaling;
+///     - Physics and rendering performance with a high (1000) moving object count
+///     - Using triangle meshes for collision
+///     - Optimizing physics simulation by leaving out collision event signaling
 class PhysicsStressTest : public Sample
 {
     OBJECT(PhysicsStressTest);

+ 3 - 3
Source/Samples/13_Ragdolls/Ragdolls.h

@@ -34,9 +34,9 @@ class Scene;
 
 /// Ragdoll example.
 /// This sample demonstrates:
-///     - Detecting physics collisions;
-///     - Moving an AnimatedModel's bones with physics and connecting them with constraints;
-///     - Using rolling friction to stop rolling objects from moving infinitely;
+///     - Detecting physics collisions
+///     - Moving an AnimatedModel's bones with physics and connecting them with constraints
+///     - Using rolling friction to stop rolling objects from moving infinitely
 class Ragdolls : public Sample
 {
     OBJECT(Ragdolls);

+ 2 - 2
Source/Samples/14_SoundEffects/SoundEffects.h

@@ -35,8 +35,8 @@ class Slider;
 
 /// Sound effects example
 /// This sample demonstrates:
-///     - Playing sound effects and music;
-///     - Controlling sound and music master volume;
+///     - Playing sound effects and music
+///     - Controlling sound and music master volume
 class SoundEffects : public Sample
 {
     OBJECT(SoundEffects);

+ 4 - 4
Source/Samples/15_Navigation/Navigation.h

@@ -35,10 +35,10 @@ class Scene;
 
 /// Navigation example.
 /// This sample demonstrates:
-///     - Generating a navigation mesh into the scene;
-///     - Performing path queries to the navigation mesh;
-///     - Rebuilding the navigation mesh partially when adding or removing objects;
-///     - Visualizing custom debug geometry;
+///     - Generating a navigation mesh into the scene
+///     - Performing path queries to the navigation mesh
+///     - Rebuilding the navigation mesh partially when adding or removing objects
+///     - Visualizing custom debug geometry
 class Navigation : public Sample
 {
     OBJECT(Navigation);

+ 2 - 2
Source/Samples/16_Chat/Chat.h

@@ -36,8 +36,8 @@ class UIElement;
 
 /// Chat example
 /// This sample demonstrates:
-///     - Starting up a network server or connecting to it;
-///     - Implementing simple chat functionality with network messages;
+///     - Starting up a network server or connecting to it
+///     - Implementing simple chat functionality with network messages
 class Chat : public Sample
 {
     OBJECT(Chat);

+ 4 - 4
Source/Samples/17_SceneReplication/SceneReplication.h

@@ -37,10 +37,10 @@ class UIElement;
 
 /// Scene network replication example.
 /// This sample demonstrates:
-///     - Creating a scene in which network clients can join;
-///     - Giving each client an object to control and sending the controls from the clients to the server,
-///       where the authoritative simulation happens;
-///     - Controlling a physics object's movement by applying forces;
+///     - Creating a scene in which network clients can join
+///     - Giving each client an object to control and sending the controls from the clients to the server
+///       where the authoritative simulation happens
+///     - Controlling a physics object's movement by applying forces
 class SceneReplication : public Sample
 {
     OBJECT(SceneReplication);

+ 4 - 5
Source/Samples/18_CharacterDemo/CharacterDemo.h

@@ -36,11 +36,10 @@ class Character;
 
 /// Moving character example.
 /// This sample demonstrates:
-///     - Controlling a humanoid character through physics;
-///     - Driving animations using the AnimationController component;
-///     - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera
-///       clipping into scenery;
-///     - Defining attributes of a custom component so that it can be saved and loaded;
+///     - Controlling a humanoid character through physics
+///     - Driving animations using the AnimationController component
+///     - Implementing 1st and 3rd person cameras, using raycasts to avoid the 3rd person camera clipping into scenery
+///     - Defining attributes of a custom component so that it can be saved and loaded
 class CharacterDemo : public Sample
 {
     OBJECT(CharacterDemo);

+ 3 - 3
Source/Samples/19_VehicleDemo/VehicleDemo.h

@@ -36,9 +36,9 @@ class Vehicle;
 
 /// Vehicle example.
 /// This sample demonstrates:
-///     - Creating a heightmap terrain with collision;
-///     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints;
-///     - Defining attributes (including node and component references) of a custom component so that it can be saved and loaded;
+///     - Creating a heightmap terrain with collision
+///     - Constructing a physical vehicle with rigid bodies for the hull and the wheels, joined with constraints
+///     - Defining attributes (including node and component references) of a custom component so that it can be saved and loaded
 class VehicleDemo : public Sample
 {
     OBJECT(VehicleDemo);

+ 4 - 4
Source/Samples/20_HugeObjectCount/HugeObjectCount.h

@@ -34,11 +34,11 @@ class Scene;
 
 /// Huge object count example.
 ///  This sample demonstrates:
-///     - Creating a scene with 250 x 250 simple objects;
+///     - Creating a scene with 250 x 250 simple objects
 ///     - Competing with http://yosoygames.com.ar/wp/2013/07/ogre-2-0-is-up-to-3x-faster/ :)
-///     - Allowing examination of performance hotspots in the rendering code;
-///     - Using the profiler to measure the time taken to animate the scene;
-///     - Optionally speeding up rendering by grouping the objects using StaticModelGroup component;
+///     - Allowing examination of performance hotspots in the rendering code
+///     - Using the profiler to measure the time taken to animate the scene
+///     - Optionally speeding up rendering by grouping objects with the StaticModelGroup component
 class HugeObjectCount : public Sample
 {
     OBJECT(HugeObjectCount);