Browse Source

Update Navigation, Network, Physics, Resource, Scene, UI Lua API.

Aster Jian 12 years ago
parent
commit
8d10c165ed
33 changed files with 315 additions and 561 deletions
  1. 1 7
      Extras/LuaScript/pkgs/Navigation/NavigationMesh.pkg
  2. 1 8
      Extras/LuaScript/pkgs/Network/Connection.pkg
  3. 1 11
      Extras/LuaScript/pkgs/Network/Network.pkg
  4. 0 30
      Extras/LuaScript/pkgs/Physics/CollisionShape.pkg
  5. 22 4
      Extras/LuaScript/pkgs/Physics/PhysicsWorld.pkg
  6. 0 4
      Extras/LuaScript/pkgs/Physics/RigidBody.pkg
  7. 14 20
      Extras/LuaScript/pkgs/Resource/Image.pkg
  8. 7 7
      Extras/LuaScript/pkgs/Resource/Resource.pkg
  9. 20 16
      Extras/LuaScript/pkgs/Resource/ResourceCache.pkg
  10. 50 39
      Extras/LuaScript/pkgs/Resource/XMLElement.pkg
  11. 1 2
      Extras/LuaScript/pkgs/Resource/XMLFile.pkg
  12. 6 14
      Extras/LuaScript/pkgs/Scene/Component.pkg
  13. 91 233
      Extras/LuaScript/pkgs/Scene/Node.pkg
  14. 21 54
      Extras/LuaScript/pkgs/Scene/Scene.pkg
  15. 4 1
      Extras/LuaScript/pkgs/UI/BorderImage.pkg
  16. 2 3
      Extras/LuaScript/pkgs/UI/Button.pkg
  17. 0 3
      Extras/LuaScript/pkgs/UI/CheckBox.pkg
  18. 0 1
      Extras/LuaScript/pkgs/UI/Cursor.pkg
  19. 5 3
      Extras/LuaScript/pkgs/UI/DropDownList.pkg
  20. 9 4
      Extras/LuaScript/pkgs/UI/FileSelector.pkg
  21. 0 1
      Extras/LuaScript/pkgs/UI/Font.pkg
  22. 2 3
      Extras/LuaScript/pkgs/UI/LineEdit.pkg
  23. 0 11
      Extras/LuaScript/pkgs/UI/ListView.pkg
  24. 0 3
      Extras/LuaScript/pkgs/UI/Menu.pkg
  25. 0 3
      Extras/LuaScript/pkgs/UI/ScrollBar.pkg
  26. 0 1
      Extras/LuaScript/pkgs/UI/ScrollView.pkg
  27. 0 3
      Extras/LuaScript/pkgs/UI/Slider.pkg
  28. 0 3
      Extras/LuaScript/pkgs/UI/Sprite.pkg
  29. 7 9
      Extras/LuaScript/pkgs/UI/Text.pkg
  30. 15 5
      Extras/LuaScript/pkgs/UI/Text3D.pkg
  31. 3 2
      Extras/LuaScript/pkgs/UI/UI.pkg
  32. 33 51
      Extras/LuaScript/pkgs/UI/UIElement.pkg
  33. 0 2
      Extras/LuaScript/pkgs/UI/Window.pkg

+ 1 - 7
Extras/LuaScript/pkgs/Navigation/NavigationMesh.pkg

@@ -31,19 +31,13 @@ public:
     
     // void FindPath(PODVector<Vector3>& dest, const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
     tolua_outside PODVector<Vector3> NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
-    tolua_outside PODVector<Vector3> NavigationMeshFindPath @ FindPath(const Vector3& start, const Vector3& end);
     
     Vector3 GetRandomPoint();
     
     Vector3 GetRandomPointInCircle(const Vector3& center, float radius, const Vector3& extents = Vector3::ONE);
-    Vector3 GetRandomPointInCircle(const Vector3& center, float radius);
-    
     float GetDistanceToWall(const Vector3& point, float radius, const Vector3& extents = Vector3::ONE);
-    float GetDistanceToWall(const Vector3& point, float radius);
-    
     Vector3 Raycast(const Vector3& start, const Vector3& end, const Vector3& extents = Vector3::ONE);
-    Vector3 Raycast(const Vector3& start, const Vector3& end);
-
+    
     int GetTileSize() const;
     float GetCellSize() const;
     float GetCellHeight() const;

+ 1 - 8
Extras/LuaScript/pkgs/Network/Connection.pkg

@@ -11,20 +11,13 @@ struct RemoteEvent
 class Connection : public Object
 {
     void SendMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg, unsigned contentID = 0);
-    void SendMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg);
-    
     void SendMessage(int msgID, bool reliable, bool inOrder, const unsigned char* data, unsigned numBytes, unsigned contentID = 0);
-    void SendMessage(int msgID, bool reliable, bool inOrder, const unsigned char* data, unsigned numBytes);
-
+    
     void SendRemoteEvent(StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void SendRemoteEvent(StringHash eventType, bool inOrder);
     void SendRemoteEvent(const char* eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void SendRemoteEvent(const char* eventType, bool inOrder);
     
     void SendRemoteEvent(Node* node, StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void SendRemoteEvent(Node* node, StringHash eventType, bool inOrder);
     void SendRemoteEvent(Node* node, const char* eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void SendRemoteEvent(Node* node, const char* eventType, bool inOrder);
     
     void SetScene(Scene* newScene);
     void SetIdentity(const VariantMap& identity);

+ 1 - 11
Extras/LuaScript/pkgs/Network/Network.pkg

@@ -3,34 +3,24 @@ $#include "Network.h"
 class Network
 {
     bool Connect(const String& address, unsigned short port, Scene* scene, const VariantMap& identity = Variant::emptyVariantMap);
-    bool Connect(const String& address, unsigned short port, Scene* scene);
     bool Connect(const char* address, unsigned short port, Scene* scene, const VariantMap& identity = Variant::emptyVariantMap);
-    bool Connect(const char* address, unsigned short port, Scene* scene);
     
     void Disconnect(int waitMSec = 0);
-    void Disconnect();
     bool StartServer(unsigned short port);
     void StopServer();
     
     void BroadcastMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg, unsigned contentID = 0);
-    void BroadcastMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg);
-    
+
     // void BroadcastMessage(int msgID, bool reliable, bool inOrder, const unsigned char* data, unsigned numBytes, unsigned contentID = 0);
     
     void BroadcastRemoteEvent(StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(StringHash eventType, bool inOrder);
     void BroadcastRemoteEvent(const char* eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(const char* eventType, bool inOrder);
     
     void BroadcastRemoteEvent(Scene* scene, StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(Scene* scene, StringHash eventType, bool inOrder);
     void BroadcastRemoteEvent(Scene* scene, const char* eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(Scene* scene, const char* eventType, bool inOrder);
     
     void BroadcastRemoteEvent(Node* node, StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(Node* node, StringHash eventType, bool inOrder);
     void BroadcastRemoteEvent(Node* node, const char* eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
-    void BroadcastRemoteEvent(Node* node, const char* eventType, bool inOrder);
     
     void SetUpdateFps(int fps);
     

+ 0 - 30
Extras/LuaScript/pkgs/Physics/CollisionShape.pkg

@@ -16,41 +16,13 @@ enum ShapeType
 class CollisionShape : public Component
 {
     void SetBox(const Vector3& size, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetBox(const Vector3& size, const Vector3& position = Vector3::ZERO);
-    void SetBox(const Vector3& size);
-    
     void SetSphere(float diameter, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetSphere(float diameter, const Vector3& position = Vector3::ZERO);
-    void SetSphere(float diameter);
-    
     void SetStaticPlane(const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetStaticPlane(const Vector3& position = Vector3::ZERO);
-    void SetStaticPlane();
-    
     void SetCylinder(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetCylinder(float diameter, float height, const Vector3& position = Vector3::ZERO);
-    void SetCylinder(float diameter, float height);
-    
     void SetCapsule(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetCapsule(float diameter, float height, const Vector3& position = Vector3::ZERO);
-    void SetCapsule(float diameter, float height);
-    
     void SetCone(float diameter, float height, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetCone(float diameter, float height, const Vector3& position = Vector3::ZERO);
-    void SetCone(float diameter, float height);
-    
     void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO);
-    void SetTriangleMesh(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE);
-    void SetTriangleMesh(Model* model, unsigned lodLevel = 0);
-    void SetTriangleMesh(Model* model);
-    
     void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
-    void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE, const Vector3& position = Vector3::ZERO);
-    void SetConvexHull(Model* model, unsigned lodLevel = 0, const Vector3& scale = Vector3::ONE);
-    void SetConvexHull(Model* model, unsigned lodLevel = 0);
-    void SetConvexHull(Model* model);
-    
     void SetTerrain();
     void SetShapeType(ShapeType type);
     void SetSize(const Vector3& size);
@@ -72,14 +44,12 @@ class CollisionShape : public Component
     BoundingBox GetWorldBoundingBox() const;
     
     void NotifyRigidBody(bool updateMass = true);
-    void NotifyRigidBody();
     
     void SetModelAttr(ResourceRef value);
     ResourceRef GetModelAttr() const;
     
     void ReleaseShape();
     
-    // Properties:
     tolua_readonly tolua_property__get_set PhysicsWorld* physicsWorld;
     tolua_property__get_set ShapeType shapeType;
     tolua_property__get_set Vector3& size;

+ 22 - 4
Extras/LuaScript/pkgs/Physics/PhysicsWorld.pkg

@@ -29,11 +29,11 @@ class PhysicsWorld : public Component
     void SetSplitImpulse(bool enable);
     void SetMaxNetworkAngularVelocity(float velocity);
 
-    void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
-    void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance);
+    // void RaycastSingle(PhysicsRaycastResult& result, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
+    tolua_outside PhysicsRaycastResult PhysicsWorldRaycastSingle @ RaycastSingle(const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
     
-    void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
-    void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance);
+    / void SphereCast(PhysicsRaycastResult& result, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
+    tolua_outside PhysicsRaycastResult PhysicsWorldSphereCast @ SphereCast(const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED);
     
     Vector3 GetGravity() const;
     int GetNumIterations() const;
@@ -68,3 +68,21 @@ class PhysicsWorld : public Component
     tolua_property__get_set float maxNetworkAngularVelocity;
     tolua_property__is_set bool applyingTransforms;
 };
+
+${
+
+static PhysicsRaycastResult PhysicsWorldRaycastSingle(PhysicsWorld* physicsWorld, const Ray& ray, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED)
+{
+    PhysicsRaycastResult result;
+    physicsWorld->RaycastSingle(result, ray, maxDistance, collisionMask);
+    return result;
+}
+
+PhysicsRaycastResult PhysicsWorldSphereCast(PhysicsWorld* physicsWorld, const Ray& ray, float radius, float maxDistance, unsigned collisionMask = M_MAX_UNSIGNED)
+{
+    PhysicsRaycastResult result;
+    physicsWorld->SphereCast(result, ray, radius, maxDistance, collisionMask);
+    return result;
+}
+
+$}

+ 0 - 4
Extras/LuaScript/pkgs/Physics/RigidBody.pkg

@@ -54,12 +54,10 @@ class RigidBody : public Component
     Vector3 GetVelocityAtPoint(const Vector3& position) const;
     float GetLinearRestThreshold() const;
     float GetLinearDamping() const;
-    // float GetLinearDampingScale() const;
     Vector3 GetAngularVelocity() const;
     Vector3 GetAngularFactor() const;
     float GetAngularRestThreshold() const;
     float GetAngularDamping() const;
-    // float GetAngularDampingScale() const;
     float GetFriction() const;
     float GetRestitution() const;
     float GetContactProcessingThreshold() const;
@@ -90,12 +88,10 @@ class RigidBody : public Component
     tolua_property__get_set Vector3 linearFactor;
     tolua_property__get_set float linearRestThreshold;
     tolua_property__get_set float linearDamping;
-    // tolua_readonly tolua_property__get_set float linearDampingScale;
     tolua_property__get_set Vector3 angularVelocity;
     tolua_property__get_set Vector3 angularFactor;
     tolua_property__get_set float angularRestThreshold;
     tolua_property__get_set float angularDamping;
-    // tolua_readonly tolua_property__get_set float angularDampingScale;
     tolua_property__get_set float friction;
     tolua_property__get_set float restitution;
     tolua_property__get_set float contactProcessingThreshold;

+ 14 - 20
Extras/LuaScript/pkgs/Resource/Image.pkg

@@ -1,6 +1,5 @@
 $#include "Image.h"
 
-/// Supported compressed image formats.
 enum CompressedFormat
 {
     CF_NONE = 0,
@@ -14,31 +13,26 @@ enum CompressedFormat
     CF_PVRTC_RGBA_4BPP,
 };
 
-/// %Image resource.
 class Image : public Resource
 {
-public:
-    /// Flip image vertically.
     void FlipVertical();
-    /// Save in BMP format. Return true if successful.
     bool SaveBMP(const char* fileName);
-    /// Save in PNG format. Return true if successful.
     bool SavePNG(const char* fileName);
-    /// Save in TGA format. Return true if successful.
     bool SaveTGA(const char* fileName);
-    /// Save in JPG format with compression quality. Return true if successful.
     bool SaveJPG(const char* fileName, int quality);
     
-    /// Return width.
-    int GetWidth() const { return width_; }
-    /// Return height.
-    int GetHeight() const { return height_; }
-    /// Return number of color components.
-    unsigned GetComponents() const { return components_; }
-    /// Return whether is compressed.
-    bool IsCompressed() const { return compressedFormat_ != CF_NONE; }
-    /// Return compressed format.
-    CompressedFormat GetCompressedFormat() const { return compressedFormat_; }
-    /// Return number of compressed mip levels.
-    unsigned GetNumCompressedLevels() const { return numCompressedLevels_; }
+    int GetWidth() const;
+    int GetHeight() const;
+    unsigned GetComponents() const;
+    bool IsCompressed() const;
+    CompressedFormat GetCompressedFormat() const;
+    unsigned GetNumCompressedLevels() const;
+    CompressedLevel GetCompressedLevel(unsigned index) const;
+    
+    tolua_readonly tolua_property__get_set int width;
+    tolua_readonly tolua_property__get_set int height;
+    tolua_readonly tolua_property__get_set unsigned components;
+    tolua_readonly tolua_property__is_set bool compressed;
+    tolua_readonly tolua_property__get_set CompressedFormat compressedFormat;
+    tolua_readonly tolua_property__get_set unsigned numCompressedLevels;
 };

+ 7 - 7
Extras/LuaScript/pkgs/Resource/Resource.pkg

@@ -1,13 +1,13 @@
 $#include "Resource.h"
 
-/// Base class for resources.
 class Resource
 {    
 public:
-    /// Return name.
-    const String& GetName() const { return name_; }
-    /// Return name hash.
-    StringHash GetNameHash() const { return nameHash_; }
-    /// Return memory use in bytes, possibly approximate.
-    unsigned GetMemoryUse() const { return memoryUse_; }
+    const String& GetName() const;
+    StringHash GetNameHash() const;
+    unsigned GetMemoryUse() const;
+    
+    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set StringHash nameHash;
+    tolua_readonly tolua_property__get_set unsigned memoryUse;
 };

+ 20 - 16
Extras/LuaScript/pkgs/Resource/ResourceCache.pkg

@@ -10,21 +10,29 @@ $#include "Texture2D.h"
 $#include "TextureCube.h"
 $#include "XMLFile.h"
 
-/// %Resource cache subsystem. Loads resources on demand and stores them for later access.
 class ResourceCache
 {    
-public:
-    /// Release all resources.
     void ReleaseAllResources(bool force = false);
-    /// Reload a resource. Return false and release it if fails.
     bool ReloadResource(Resource* resource);
-    /// Set memory budget for a specific resource type, default 0 is unlimited.
+    
     void SetMemoryBudget(ShortStringHash type, unsigned budget);
-    /// Enable or disable automatic reloading of resources as files are modified.
+    void SetMemoryBudget(const char* type, unsigned budget);
+    
     void SetAutoReloadResources(bool enable);
     
-    /// Template version of returning a resource by name.
-    // template <class T> T* GetResource(const char* name);    
+    // template <class T> T* GetResource(const String& name);
+    Animation* GetResource<Animation> @ GetAnimation(const String& name);
+    Font* GetResource<Font> @ GetFont(const String& name);
+    Image* GetResource<Image> @ GetImage(const String& name);
+    Material* GetResource<Material> @ GetMaterial(const String& name);
+    Model* GetResource<Model> @ GetModel(const String& name);
+    Sound* GetResource<Sound> @ GetSound(const String& name);
+    Technique* GetResource<Technique> @ GetTechnique(const String& name);
+    Texture2D* GetResource<Texture2D> @ GetTexture2D(const String& name);
+    TextureCube* GetResource<TextureCube> @ GetTextureCube(const String& name);
+    XMLFile* GetResource<XMLFile> @ GetXMLFile(const String& name);
+    
+    // template <class T> T* GetResource(const char* name);
     Animation* GetResource<Animation> @ GetAnimation(const char* name);
     Font* GetResource<Font> @ GetFont(const char* name);
     Image* GetResource<Image> @ GetImage(const char* name);
@@ -36,20 +44,16 @@ public:
     TextureCube* GetResource<TextureCube> @ GetTextureCube(const char* name);
     XMLFile* GetResource<XMLFile> @ GetXMLFile(const char* name);
     
-    /// Return whether a file exists by name.
     bool Exists(const String& name) const;
-    /// Return whether a file exists by name hash.
     bool Exists(StringHash nameHash) const;
-    /// Return memory budget for a resource type.
     unsigned GetMemoryBudget(ShortStringHash type) const;
-    /// Return total memory use for a resource type.
     unsigned GetMemoryUse(ShortStringHash type) const;
-    /// Return total memory use for all resources.
     unsigned GetTotalMemoryUse() const;
-    /// Return resource name from hash, or empty if not found.
     const String& GetResourceName(StringHash nameHash) const;
-    /// Return full absolute file name of resource if possible.
     String GetResourceFileName(const String& name) const;
-    /// Return whether automatic resource reloading is enabled.
+    
     bool GetAutoReloadResources() const;
+    
+    tolua_readonly tolua_property__get_set unsigned totalMemoryUse;
+    tolua_readonly tolua_property__get_set bool autoReloadResources;
 };

+ 50 - 39
Extras/LuaScript/pkgs/Resource/XMLElement.pkg

@@ -1,71 +1,82 @@
 $#include "XMLElement.h"
 
-/// Element in an XML file.
 class XMLElement
 {
-public:
-    /// Return whether does not refer to an element or an XPath node.
     bool IsNull() const;
-    /// Return whether refers to an element or an XPath node.
     bool NotNull() const;
-    /// Return true if refers to an element or an XPath node.
     operator bool () const;
-    /// Return element name (or attribute name if it is an attribute only XPath query result).
     String GetName() const;
-    /// Return whether has a child element.
+    
+    bool HasChild(const String& name) const;
     bool HasChild(const char* name) const;
-    /// Return whether has a child element.
-    bool HasChild(const char* name) const;
-    /// Return child element, or null if missing.
-    XMLElement GetChild(const char* name) const;
-    /// Return child element, or null if missing.
+    
+    XMLElement GetChild(const String& name = String::EMPTY) const;
     XMLElement GetChild(const char* name) const;
-    /// Return next sibling element.
+    
+    XMLElement GetNext(const String& name = String::EMPTY) const;
     XMLElement GetNext(const char* name) const;
-    /// Return next sibling element.
-    XMLElement GetNext(const char* name) const;
-    /// Return parent element.
+    
     XMLElement GetParent() const;
-    /// Return number of attributes.
+    
     unsigned GetNumAttributes() const;
-    /// Return whether has an attribute.
-    bool HasAttribute(const char* name) const;
-    /// Return whether has an attribute.
+    bool HasAttribute(const String& name) const;
     bool HasAttribute(const char* name) const;
-    /// Return bool attribute, or false if missing.
+    
     bool GetBool(const char* name) const;
-    /// Return bounding box attribute, or empty if missing.
+    
     BoundingBox GetBoundingBox() const;
-    /// Return a color attribute, or default if missing.
+    
+    Color GetColor(const String& name) const;
     Color GetColor(const char* name) const;
-    /// Return a float attribute, or zero if missing.
+    
+    float GetFloat(const String& name) const;
     float GetFloat(const char* name) const;
-    /// Return an unsigned integer attribute, or zero if missing.
+    
+    unsigned GetUInt(const String& name) const;
     unsigned GetUInt(const char* name) const;
-    /// Return an integer attribute, or zero if missing.
+    
+    int GetInt(const String& name) const;
     int GetInt(const char* name) const;
-    /// Return an IntRect attribute, or default if missing.
+    
+    IntRect GetIntRect(const String& name) const;
     IntRect GetIntRect(const char* name) const;
-    /// Return an IntVector2 attribute, or default if missing.
+    
+    IntVector2 GetIntVector2(const String& name) const;
     IntVector2 GetIntVector2(const char* name) const;
-    /// Return a Rect attribute, or default if missing.
+    
+    Rect GetRect(const String& name) const;
     Rect GetRect(const char* name) const;
-    /// Return a quaternion attribute, or default if missing.
+    
+    Quaternion GetQuaternion(const String& name) const;
     Quaternion GetQuaternion(const char* name) const;
-    /// Return a resource reference attribute, or empty if missing.
+    
+    Variant GetVariant() const;
+    Variant GetVariantValue(VariantType type) const;
+    
     ResourceRef GetResourceRef() const;
-    /// Return a resource reference list attribute, or empty if missing.
     ResourceRefList GetResourceRefList() const;
-    /// Return a Vector2 attribute, or default if missing.
+    
+    VariantMap GetVariantMap() const;
+    
+    Vector2 GetVector2(const String& name) const;
     Vector2 GetVector2(const char* name) const;
-    /// Return a Vector3 attribute, or default if missing.
+    
+    Vector3 GetVector3(const String& name) const;
     Vector3 GetVector3(const char* name) const;
-    /// Return a Vector4 attribute, or default if missing.
+    
+    Vector4 GetVector4(const String& name) const;
     Vector4 GetVector4(const char* name) const;
-    /// Return any Vector attribute as Vector4. Missing coordinates will be zero.
+    
+    Vector4 GetVector(const String& name) const;
     Vector4 GetVector(const char* name) const;
-    /// Return XML file.
-    XMLFile* GetFile() const;    
-    /// Empty XMLElement.
+    
+    XMLFile* GetFile() const;
+    
     static const XMLElement EMPTY;
+    
+    tolua_readonly tolua_property__is_set bool null;
+    tolua_readonly tolua_property__get_set String name;
+    tolua_readonly tolua_property__get_set XMLElement parent;
+    tolua_readonly tolua_property__get_set unsigned numAttributes;
+    tolua_readonly tolua_property__get_set XMLFile* file;
 };

+ 1 - 2
Extras/LuaScript/pkgs/Resource/XMLFile.pkg

@@ -1,9 +1,8 @@
 $#include "XMLFile.h"
 
-/// XML document resource.
 class XMLFile : public Resource
 {
 public:
-    /// Return the root element, with optionally specified name. Return null element if not found.
     XMLElement GetRoot(const String& name = String::EMPTY);
+    XMLElement GetRoot(const char* name);
 };

+ 6 - 14
Extras/LuaScript/pkgs/Scene/Component.pkg

@@ -1,24 +1,16 @@
 $#include "Component.h"
 
-/// Base class for components. Components can be created to scene nodes.
 class Component : public Serializable
-{    
-public:
-    /// Set enabled/disabled state.
+{
     void SetEnabled(bool enable);
-    /// Remove from the scene node. If no other shared pointer references exist, causes immediate deletion.
     void Remove();
     
-    /// Return ID.
-    unsigned GetID() const { return id_; }
-    /// Return scene node.
-    Node* GetNode() const { return node_; }
-    /// Return the scene the node belongs to.
+    unsigned GetID() const;
+    Node* GetNode() const;
     Scene* GetScene() const;
-    /// Return whether is enabled.
-    bool IsEnabled() const { return enabled_; }
-    /// Return whether is effectively enabled (node is also enabled.)
+    bool IsEnabled() const;
     bool IsEnabledEffective() const;
-    /// Return component in the same scene node by type. If there are several, returns the first.
+  
     Component* GetComponent(ShortStringHash type) const;
+    Component* GetComponent(const char* type) const;
 };

+ 91 - 233
Extras/LuaScript/pkgs/Scene/Node.pkg

@@ -22,291 +22,132 @@ $#include "StaticModel.h"
 $#include "Terrain.h"
 $#include "Zone.h"
 
-/// Component and child node creation mode for networking.
 enum CreateMode
 {
     REPLICATED = 0,
     LOCAL = 1
 };
 
-/// %Scene node that may contain components and child nodes.
-class Node
+class Node : public Serializable
 {
-public:
-    /// Construct.
     Node(Context* context);
-    /// Destruct. Any child nodes are detached.
     virtual ~Node();
-    
-    /// Set name.
+
+    bool SaveXML(Serializer& dest) const;
     void SetName(const String& name);
-    /// Set position relative to parent node.
     void SetPosition(const Vector3& position);
-    /// Set rotation relative to parent node.
     void SetRotation(const Quaternion& rotation);
-    /// Set direction relative to parent node. Positive Z equals identity.
     void SetDirection(const Vector3& direction);
-    /// Set uniform scale relative to parent node.
     void SetScale(float scale);
-    /// Set scale relative to parent node.
     void SetScale(const Vector3& scale);
-    /// Set transform relative to parent node.
     void SetTransform(const Vector3& position, const Quaternion& rotation);
-    /// Set transform relative to parent node.
     void SetTransform(const Vector3& position, const Quaternion& rotation, float scale);
-    /// Set transform relative to parent node.
     void SetTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
-    /// Set position relative to world space.
     void SetWorldPosition(const Vector3& position);
-    /// Set rotation relative to world space.
     void SetWorldRotation(const Quaternion& rotation);
-    /// Set direction relative to world space.
     void SetWorldDirection(const Vector3& direction);
-    /// Set uniform scale relative to world space.
     void SetWorldScale(float scale);
-    /// Set scale relative to world space.
     void SetWorldScale(const Vector3& scale);
-    /// Set transform relative to world space.
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation);
-    /// Set transform relative to world space.
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, float scale);
-    /// Set transform relative to world space.
     void SetWorldTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
-    /// Move the scene node.
     void Translate(const Vector3& delta);
-    /// Move the scene node relative to its rotation.
     void TranslateRelative(const Vector3& delta);
-    /// Rotate the scene node.
+    
     void Rotate(const Quaternion& delta, bool fixedAxis = false);
-    /// Rotate around the X axis.
     void Pitch(float angle, bool fixedAxis = false);
-    /// Rotate around the Y axis.
     void Yaw(float angle, bool fixedAxis = false);
-    /// Rotate around the Z axis.
     void Roll(float angle, bool fixedAxis = false);
-    /// Look at a target world position.
     void LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP);
-    /// Modify scale uniformly.
+    
     void Scale(float scale);
-    /// Modify scale.
     void Scale(const Vector3& scale);
-    /// Set enabled/disabled state without recursion. Components in a disabled node become effectively disabled regardless of their own enable/disable state.
     void SetEnabled(bool enable);
-    /// Set enabled/disabled state with optional recursion.
     void SetEnabled(bool enable, bool recursive);
-    /// Set owner connection for networking.
     void SetOwner(Connection* owner);
-    /// Mark node and child nodes to need world transform recalculation. Notify listener components.
     void MarkDirty();
-    /// Create a child scene node (with specified ID if provided).
+    
     Node* CreateChild(const String& name = String::EMPTY, CreateMode mode = REPLICATED, unsigned id = 0);
-    /// Add a child scene node.
+    
     void AddChild(Node* node);
-    /// Remove a child scene node.
     void RemoveChild(Node* node);
-    /// Remove all child scene nodes.
     void RemoveAllChildren();
-    /// Create a component to this node (with specified ID if provided).
-    Component* CreateComponent(ShortStringHash type, CreateMode mode = REPLICATED, unsigned id = 0);
-    /// Create a component to this node if it does not exist already.
-    Component* GetOrCreateComponent(ShortStringHash type, CreateMode mode = REPLICATED, unsigned id = 0);
-    
-    /// Remove a component from this node.
     void RemoveComponent(Component* component);
-    /// Remove the first component of specific type from this node.
-    // void RemoveComponent(ShortStringHash type);
-    tolua_outside void NodeRemoveComponent @ RemoveComponent(const char* type);
-    /// Remove all components from this node.
+    void RemoveComponent(ShortStringHash type);
+    void RemoveComponent(const char* type);
+    
     void RemoveAllComponents();
-    /// Clone scene node, components and child nodes. Return the clone.
+    
     Node* Clone(CreateMode mode = REPLICATED);
-    /// Remove from the parent node. If no other shared pointer references exist, causes immediate deletion.
+    
     void Remove();
-    /// Set parent scene node. Retains the world transform.
     void SetParent(Node* parent);
-    /// Set a user variable.
     void SetVar(ShortStringHash key, const Variant& value);
-    /// Add listener component that is notified of node being dirtied. Can either be in the same node or another.
     void AddListener(Component* component);
-    /// Remove listener component.
     void RemoveListener(Component* component);
     
-    /// Template version of creating a component.
     // template <class T> T* CreateComponent(CreateMode mode = REPLICATED, unsigned id = 0);
-    
-    AnimationController* CreateComponent<AnimationController> @ CreateAnimationController();
-    AnimatedModel* CreateComponent<AnimatedModel> @ CreateAnimatedModel();
-    Camera* CreateComponent<Camera> @ CreateCamera();
-    CollisionShape* CreateComponent<CollisionShape> @ CreateCollisionShape();
-    Constraint* CreateComponent<Constraint> @ CreateConstraint();
-    DebugRenderer* CreateComponent<DebugRenderer> @ CreateDebugRenderer();
-    DecalSet* CreateComponent<DecalSet> @ CreateDecalSet();
-    Drawable* CreateComponent<Drawable> @ CreateDrawable();
-    Light* CreateComponent<Light> @ CreateLight();
-    Navigable* CreateComponent<Navigable> @ CreateNavigable();
-    NavigationMesh* CreateComponent<NavigationMesh> @ CreateNavigationMesh();
-    NetworkPriority* CreateComponent<NetworkPriority> @ CreateNetworkPriority();
-    Octree* CreateComponent<Octree> @ CreateOctree();
-    OffMeshConnection* CreateComponent<OffMeshConnection> @ CreateOffMeshConnection();
-    PhysicsWorld* CreateComponent<PhysicsWorld> @ CreatePhysicsWorld();
-    RigidBody* CreateComponent<RigidBody> @ CreateRigidBody();
-    SmoothedTransform* CreateComponent<SmoothedTransform> @ CreateSmoothedTransform();
-    SoundListener* CreateComponent<SoundListener> @ CreateSoundListener();
-    SoundSource* CreateComponent<SoundSource> @ CreateSoundSource();
-    StaticModel* CreateComponent<StaticModel> @ CreateStaticModel();
-    Terrain* CreateComponent<Terrain> @ CreateTerrain();
-    Zone* CreateComponent<Zone> @ CreateZone();
-    
-    AnimationController* CreateComponent<AnimationController> @ CreateAnimationController(CreateMode mode);
-    AnimatedModel* CreateComponent<AnimatedModel> @ CreateAnimatedModel(CreateMode mode);
-    Camera* CreateComponent<Camera> @ CreateCamera(CreateMode mode);
-    CollisionShape* CreateComponent<CollisionShape> @ CreateCollisionShape(CreateMode mode);
-    Constraint* CreateComponent<Constraint> @ CreateConstraint(CreateMode mode);
-    DebugRenderer* CreateComponent<DebugRenderer> @ CreateDebugRenderer(CreateMode mode);
-    DecalSet* CreateComponent<DecalSet> @ CreateDecalSet(CreateMode mode);
-    Drawable* CreateComponent<Drawable> @ CreateDrawable(CreateMode mode);
-    Light* CreateComponent<Light> @ CreateLight(CreateMode mode);
-    Navigable* CreateComponent<Navigable> @ CreateNavigable(CreateMode mode);
-    NavigationMesh* CreateComponent<NavigationMesh> @ CreateNavigationMesh(CreateMode mode);
-    NetworkPriority* CreateComponent<NetworkPriority> @ CreateNetworkPriority(CreateMode mode);
-    Octree* CreateComponent<Octree> @ CreateOctree(CreateMode mode);
-    OffMeshConnection* CreateComponent<OffMeshConnection> @ CreateOffMeshConnection(CreateMode mode);
-    PhysicsWorld* CreateComponent<PhysicsWorld> @ CreatePhysicsWorld(CreateMode mode);
-    RigidBody* CreateComponent<RigidBody> @ CreateRigidBody(CreateMode mode);
-    SmoothedTransform* CreateComponent<SmoothedTransform> @ CreateSmoothedTransform(CreateMode mode);
-    SoundListener* CreateComponent<SoundListener> @ CreateSoundListener(CreateMode mode);
-    SoundSource* CreateComponent<SoundSource> @ CreateSoundSource(CreateMode mode);
-    StaticModel* CreateComponent<StaticModel> @ CreateStaticModel(CreateMode mode);
-    Terrain* CreateComponent<Terrain> @ CreateTerrain(CreateMode mode);
-    Zone* CreateComponent<Zone> @ CreateZone(CreateMode mode);
-    
-    AnimationController* CreateComponent<AnimationController> @ CreateAnimationController(CreateMode mode, unsigned id);
-    AnimatedModel* CreateComponent<AnimatedModel> @ CreateAnimatedModel(CreateMode mode, unsigned id);
-    Camera* CreateComponent<Camera> @ CreateCamera(CreateMode mode, unsigned id);
-    CollisionShape* CreateComponent<CollisionShape> @ CreateCollisionShape(CreateMode mode, unsigned id);
-    Constraint* CreateComponent<Constraint> @ CreateConstraint(CreateMode mode, unsigned id);
-    DebugRenderer* CreateComponent<DebugRenderer> @ CreateDebugRenderer(CreateMode mode, unsigned id);
-    DecalSet* CreateComponent<DecalSet> @ CreateDecalSet(CreateMode mode, unsigned id);
-    Drawable* CreateComponent<Drawable> @ CreateDrawable(CreateMode mode, unsigned id);
-    Light* CreateComponent<Light> @ CreateLight(CreateMode mode, unsigned id);
-    Navigable* CreateComponent<Navigable> @ CreateNavigable(CreateMode mode, unsigned id);
-    NavigationMesh* CreateComponent<NavigationMesh> @ CreateNavigationMesh(CreateMode mode, unsigned id);
-    NetworkPriority* CreateComponent<NetworkPriority> @ CreateNetworkPriority(CreateMode mode, unsigned id);
-    Octree* CreateComponent<Octree> @ CreateOctree(CreateMode mode, unsigned id);
-    OffMeshConnection* CreateComponent<OffMeshConnection> @ CreateOffMeshConnection(CreateMode mode, unsigned id);
-    PhysicsWorld* CreateComponent<PhysicsWorld> @ CreatePhysicsWorld(CreateMode mode, unsigned id);
-    RigidBody* CreateComponent<RigidBody> @ CreateRigidBody(CreateMode mode, unsigned id);
-    SmoothedTransform* CreateComponent<SmoothedTransform> @ CreateSmoothedTransform(CreateMode mode, unsigned id);
-    SoundListener* CreateComponent<SoundListener> @ CreateSoundListener(CreateMode mode, unsigned id);
-    SoundSource* CreateComponent<SoundSource> @ CreateSoundSource(CreateMode mode, unsigned id);
-    StaticModel* CreateComponent<StaticModel> @ CreateStaticModel(CreateMode mode, unsigned id);
-    Terrain* CreateComponent<Terrain> @ CreateTerrain(CreateMode mode, unsigned id);
-    Zone* CreateComponent<Zone> @ CreateZone(CreateMode mode, unsigned id);
-
-    /// Template version of getting or creating a component.
-    // template <class T> T* GetOrCreateComponent(CreateMode mode = REPLICATED, unsigned id = 0);
-    
-    /// Return ID.
-    unsigned GetID() const { return id_; }
-    /// Return name.
-    const String& GetName() const { return name_; }
-    /// Return name hash.
-    StringHash GetNameHash() const { return nameHash_; }
-    /// Return parent scene node.
-    Node* GetParent() const { return parent_; }
-    /// Return scene.
-    Scene* GetScene() const { return scene_; }
-    /// Return whether is enabled. Disables nodes effectively disable all their components.
-    bool IsEnabled() const { return enabled_; }
-    /// Return owner connection in networking.
-    Connection* GetOwner() const { return owner_; }
-    /// Return position relative to parent node.
-    const Vector3& GetPosition() const { return position_; }
-    /// Return rotation relative to parent node.
-    const Quaternion& GetRotation() const { return rotation_; }
-    /// Return direction relative to parent node. Identity rotation equals positive Z.
-    Vector3 GetDirection() const { return rotation_ * Vector3::FORWARD; }
-    /// Return scale relative to parent node.
-    const Vector3& GetScale() const { return scale_; }
-    /// Return transform matrix relative to parent node.
-    Matrix3x4 GetTransform() const { return Matrix3x4(position_, rotation_, scale_); }
-
-    /// Return position in world space.
-    Vector3 GetWorldPosition() const
-    {
-        if (dirty_)
-            UpdateWorldTransform();
-        
-        return worldTransform_.Translation();
-    }
+    AnimationController* CreateComponent<AnimationController> @ CreateAnimationController(CreateMode mode = REPLICATED, unsigned id = 0);
+    AnimatedModel* CreateComponent<AnimatedModel> @ CreateAnimatedModel(CreateMode mode = REPLICATED, unsigned id = 0);
+    Camera* CreateComponent<Camera> @ CreateCamera(CreateMode mode = REPLICATED, unsigned id = 0);
+    CollisionShape* CreateComponent<CollisionShape> @ CreateCollisionShape(CreateMode mode = REPLICATED, unsigned id = 0);
+    Constraint* CreateComponent<Constraint> @ CreateConstraint(CreateMode mode = REPLICATED, unsigned id = 0);
+    DebugRenderer* CreateComponent<DebugRenderer> @ CreateDebugRenderer(CreateMode mode = REPLICATED, unsigned id = 0);
+    DecalSet* CreateComponent<DecalSet> @ CreateDecalSet(CreateMode mode = REPLICATED, unsigned id = 0);
+    Drawable* CreateComponent<Drawable> @ CreateDrawable(CreateMode mode = REPLICATED, unsigned id = 0);
+    Light* CreateComponent<Light> @ CreateLight(CreateMode mode = REPLICATED, unsigned id = 0);
+    Navigable* CreateComponent<Navigable> @ CreateNavigable(CreateMode mode = REPLICATED, unsigned id = 0);
+    NavigationMesh* CreateComponent<NavigationMesh> @ CreateNavigationMesh(CreateMode mode = REPLICATED, unsigned id = 0);
+    NetworkPriority* CreateComponent<NetworkPriority> @ CreateNetworkPriority(CreateMode mode = REPLICATED, unsigned id = 0);
+    Octree* CreateComponent<Octree> @ CreateOctree(CreateMode mode = REPLICATED, unsigned id = 0);
+    OffMeshConnection* CreateComponent<OffMeshConnection> @ CreateOffMeshConnection(CreateMode mode = REPLICATED, unsigned id = 0);
+    PhysicsWorld* CreateComponent<PhysicsWorld> @ CreatePhysicsWorld(CreateMode mode = REPLICATED, unsigned id = 0);
+    RigidBody* CreateComponent<RigidBody> @ CreateRigidBody(CreateMode mode = REPLICATED, unsigned id = 0);
+    SmoothedTransform* CreateComponent<SmoothedTransform> @ CreateSmoothedTransform(CreateMode mode = REPLICATED, unsigned id = 0);
+    SoundListener* CreateComponent<SoundListener> @ CreateSoundListener(CreateMode mode = REPLICATED, unsigned id = 0);
+    SoundSource* CreateComponent<SoundSource> @ CreateSoundSource(CreateMode mode = REPLICATED, unsigned id = 0);
+    StaticModel* CreateComponent<StaticModel> @ CreateStaticModel(CreateMode mode = REPLICATED, unsigned id = 0);
+    Terrain* CreateComponent<Terrain> @ CreateTerrain(CreateMode mode = REPLICATED, unsigned id = 0);
+    Zone* CreateComponent<Zone> @ CreateZone(CreateMode mode = REPLICATED, unsigned id = 0);
 
-    /// Return rotation in world space.
-    Quaternion GetWorldRotation() const
-    {
-        if (dirty_)
-            UpdateWorldTransform();
-        
-        return worldRotation_;
-    }
+    unsigned GetID() const;
+    const String& GetName() const;
+    StringHash GetNameHash() const;
+    Node* GetParent() const;
+    Scene* GetScene() const;
+    bool IsEnabled() const;
+    Connection* GetOwner() const;
+    const Vector3& GetPosition() const;
+    const Quaternion& GetRotation() const;
+    Vector3 GetDirection() const;
+    const Vector3& GetScale() const;
+    Matrix3x4 GetTransform() const;
 
-    /// Return direction in world space.
-    Vector3 GetWorldDirection() const
-    {
-        if (dirty_)
-            UpdateWorldTransform();
-        
-        return worldRotation_ * Vector3::FORWARD;
-    }
-
-    /// Return scale in world space.
-    Vector3 GetWorldScale() const
-    {
-        if (dirty_)
-            UpdateWorldTransform();
-        
-        return worldTransform_.Scale();
-    }
-
-    /// Return transform matrix in world space.
-    const Matrix3x4& GetWorldTransform() const
-    {
-        if (dirty_)
-            UpdateWorldTransform();
-        
-        return worldTransform_;
-    }
-
-    /// Convert a local space position to world space.
+    Vector3 GetWorldPosition() const;
+    Quaternion GetWorldRotation() const;
+    Vector3 GetWorldDirection() const;
+    Vector3 GetWorldScale() const;
+    const Matrix3x4& GetWorldTransform() const;
     Vector3 LocalToWorld(const Vector3& position) const;
-    /// Convert a local space position or rotation to world space.
     Vector3 LocalToWorld(const Vector4& vector) const;
-    /// Convert a world space position to local space.
     Vector3 WorldToLocal(const Vector3& position) const;
-    /// Convert a world space position or rotation to local space.
     Vector3 WorldToLocal(const Vector4& vector) const;
-    /// Return whether transform has changed and world transform needs recalculation.
-    bool IsDirty() const { return dirty_; }
-    /// Return number of child scene nodes.
+    bool IsDirty() const;
+    
     unsigned GetNumChildren(bool recursive = false) const;
-    /// Return child scene node by index.
     Node* GetChild(unsigned index) const;
-    /// Return child scene node by name.
     Node* GetChild(const String& name, bool recursive = false) const;
-    /// Return child scene node by name.
     Node* GetChild(const char* name, bool recursive = false) const;
-    /// Return child scene node by name hash.
     Node* GetChild(StringHash nameHash, bool recursive = false) const;
-    /// Return number of components.
-    unsigned GetNumComponents() const { return components_.Size(); }
-    /// Return number of non-local components.
+    
+    unsigned GetNumComponents() const;
     unsigned GetNumNetworkComponents() const;
-    /// Return component by type. If there are several, returns the first.
-    // Component* GetComponent(ShortStringHash type) const;
-    /// Return whether has a specific component.
-    // bool HasComponent(ShortStringHash type) const;
-    tolua_outside bool NodeHasComponent @ HasComponent(const char* type) const;
     
-    /// Template version of returning a component by type.
+    bool HasComponent(ShortStringHash type) const;
+    bool HasComponent(const char* type) const;
+    
+    const Variant& GetVar(ShortStringHash key) const;
+    const VariantMap& GetVars() const;
     // template <class T> T* GetComponent() const;
     AnimationController* GetComponent<AnimationController> @ GetAnimationController() const;
     AnimatedModel* GetComponent<AnimatedModel> @ GetAnimatedModel() const;
@@ -330,18 +171,35 @@ public:
     StaticModel* GetComponent<StaticModel> @ GetStaticModel() const;
     Terrain* GetComponent<Terrain> @ GetTerrain() const;
     Zone* GetComponent<Zone> @ GetZone() const;
-};
-
-${
-
-void NodeRemoveComponent(Node* node, const char* type)
-{
-	return node->RemoveComponent(ShortStringHash(type));
-}
-
-bool NodeHasComponent(const Node* node, const char* type)
-{
-	return node->HasComponent(ShortStringHash(type));
-}
+    
+    void SetID(unsigned id);
+    void SetScene(Scene* scene);
+    void ResetScene();
+    
+    bool Load(Deserializer& source, SceneResolver& resolver, bool loadChildren = true, bool rewriteIDs = false, CreateMode mode = REPLICATED);
+    bool LoadXML(const XMLElement& source, SceneResolver& resolver, bool loadChildren = true, bool rewriteIDs = false, CreateMode mode = REPLICATED);
 
-$}
+    Node* CreateChild(unsigned id, CreateMode mode);
+    void AddComponent(Component* component, unsigned id, CreateMode mode);
+    
+    tolua_property__get_set unsigned ID;
+    tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set StringHash nameHash;
+    tolua_property__get_set Node* parent;
+    tolua_property__get_set Scene* scene;
+    tolua_property__is_set bool enabled;
+    tolua_property__get_set Connection* owner;
+    tolua_property__get_set Vector3& position;
+    tolua_property__get_set Quaternion& rotation;
+    tolua_property__get_set Vector3 direction;
+    tolua_property__get_set Vector3& scale;
+    tolua_readonly tolua_property__get_set Matrix3x4 transform;
+    tolua_property__get_set Vector3 worldPosition;
+    tolua_property__get_set Quaternion worldRotation;
+    tolua_property__get_set Vector3 worldDirection;
+    tolua_property__get_set Vector3 worldScale;
+    tolua_readonly tolua_property__get_set Matrix3x4& worldTransform;
+    tolua_readonly tolua_property__is_set bool dirty;
+    tolua_readonly tolua_property__get_set unsigned numComponents;
+    tolua_readonly tolua_property__get_set unsigned numNetworkComponents;
+};

+ 21 - 54
Extras/LuaScript/pkgs/Scene/Scene.pkg

@@ -5,97 +5,64 @@ static const unsigned LAST_REPLICATED_ID;
 static const unsigned FIRST_LOCAL_ID;
 static const unsigned LAST_LOCAL_ID;
 
-/// Root scene node, represents the whole scene.
 class Scene : public Node
 {
-public:
-    /// Construct.
     Scene(Context* context);
-    /// Destruct.
     virtual ~Scene();
     
-    /// Load from an XML file. Return true if successful.
     bool LoadXML(Deserializer& source);
-    /// Save to an XML file. Return true if successful.
     bool SaveXML(Serializer& dest) const;
-    /// Load from a binary file asynchronously. Return true if started successfully.
     bool LoadAsync(File* file);
-    /// Load from an XML file asynchronously. Return true if started successfully.
     bool LoadAsyncXML(File* file);
-    /// Stop asynchronous loading.
     void StopAsyncLoading();
-    /// Clear.
     void Clear();
-    /// Enable or disable scene update.
     void SetUpdateEnabled(bool enable);
-    /// Set update time scale. 1.0 = real time (default.)
     void SetTimeScale(float scale);
-    /// Set elapsed time in seconds. This can be used to prevent inaccuracy in the timer if the scene runs for a long time.
     void SetElapsedTime(float time);
-    /// Set network client motion smoothing constant.
     void SetSmoothingConstant(float constant);
-    /// Set network client motion smoothing snap threshold.
     void SetSnapThreshold(float threshold);
     
-    /// Return node from the whole scene by ID, or null if not found.
     Node* GetNode(unsigned id) const;
-    /// Return component from the whole scene by ID, or null if not found.
     Component* GetComponent(unsigned id) const;
-    /// Return whether updates are enabled.
-    bool IsUpdateEnabled() const { return updateEnabled_; }
-    /// Return asynchronous loading flag.
-    bool IsAsyncLoading() const { return asyncLoading_; }
-    /// Return asynchronous loading progress between 0.0 and 1.0, or 1.0 if not in progress.
+    bool IsUpdateEnabled() const;
+    bool IsAsyncLoading() const;
     float GetAsyncProgress() const;
-    /// Return source file name.
-    const String& GetFileName() const { return fileName_; }
-    /// Return source file checksum.
-    unsigned GetChecksum() const { return checksum_; }
-    /// Return update time scale.
-    float GetTimeScale() const { return timeScale_; }
-    /// Return elapsed time in seconds.
-    float GetElapsedTime() const { return elapsedTime_; }
-    /// Return motion smoothing constant.
-    float GetSmoothingConstant() const { return smoothingConstant_; }
-    /// Return motion smoothing snap threshold.
-    float GetSnapThreshold() const { return snapThreshold_; }
-    /// Return a node user variable name, or empty if not registered.
+    const String& GetFileName() const;
+    unsigned GetChecksum() const;
+    float GetTimeScale() const;
+    float GetElapsedTime() const;
+    float GetSmoothingConstant() const;
+    float GetSnapThreshold() const;
     const String& GetVarName(ShortStringHash hash) const;
 
-    /// Update scene. Called by HandleUpdate.
     void Update(float timeStep);
-    /// Begin a threaded update. During threaded update components can choose to delay dirty processing.
     void BeginThreadedUpdate();
-    /// End a threaded update. Notify components that marked themselves for delayed dirty processing.
     void EndThreadedUpdate();
-    /// Add a component to the delayed dirty notify queue. Is thread-safe.
     void DelayedMarkedDirty(Component* component);
-    /// Return threaded update flag.
-    bool IsThreadedUpdate() const { return threadedUpdate_; }
-    /// Get free node ID, either non-local or local.
+    bool IsThreadedUpdate() const;
     unsigned GetFreeNodeID(CreateMode mode);
-    /// Get free component ID, either non-local or local.
     unsigned GetFreeComponentID(CreateMode mode);
-    /// Node added. Assign scene pointer and add to ID map.
     void NodeAdded(Node* node);
-    /// Node removed. Remove from ID map.
     void NodeRemoved(Node* node);
-    /// Component added. Add to ID map.
     void ComponentAdded(Component* component);
-    /// Component removed. Remove from ID map.
     void ComponentRemoved(Component* component);
-    /// Set node user variable reverse mappings.
     void SetVarNamesAttr(String value);
-    /// Return node user variable reverse mappings.
     String GetVarNamesAttr() const;
-    /// Prepare network update by comparing attributes and marking replication states dirty as necessary.
     void PrepareNetworkUpdate();
-    /// Clean up all references to a network connection that is about to be removed.
     void CleanupConnection(Connection* connection);
-    /// Mark a node for attribute check on the next network update.
     void MarkNetworkUpdate(Node* node);
-    /// Mark a comoponent for attribute check on the next network update.
     void MarkNetworkUpdate(Component* component);
-    /// Mark a node dirty in scene replication states. The node does not need to have own replication state yet.
     void MarkReplicationDirty(Node* node);
+    
+    tolua_property__is_set bool updateEnabled;
+    tolua_readonly tolua_property__is_set bool asyncLoading;
+    tolua_readonly tolua_property__get_set float asyncProgress;
+    tolua_property__get_set const String& fileName;
+    tolua_readonly tolua_property__get_set unsigned checksum;
+    tolua_property__get_set float timeScale;
+    tolua_property__get_set float elapsedTime;
+    tolua_property__get_set float smoothingConstant;
+    tolua_property__get_set float snapThreshold;
+    tolua_readonly tolua_property__is_set bool threadedUpdate;
+    tolua_property__get_set String varNamesAttr;
 };

+ 4 - 1
Extras/LuaScript/pkgs/UI/BorderImage.pkg

@@ -23,11 +23,14 @@ class BorderImage : public UIElement
     BlendMode GetBlendMode() const;
     bool IsTiled() const;
     
-    // Properties:
+    void SetTextureAttr(ResourceRef value);
+    ResourceRef GetTextureAttr() const;
+    
     tolua_property__get_set Texture* texture;
     tolua_property__get_set IntRect& imageRect;
     tolua_property__get_set IntRect& border;
     tolua_property__get_set IntVector2& hoverOffset;
     tolua_property__get_set BlendMode blendMode;
     tolua_property__is_set bool tiled;
+    tolua_property__get_set ResourceRef textureAttr;
 };

+ 2 - 3
Extras/LuaScript/pkgs/UI/Button.pkg

@@ -2,8 +2,6 @@ $#include "Button.h"
 
 class Button : public BorderImage
 {
-public:
-    // Methods:
     Button(Context* context);
     virtual ~Button();
     
@@ -19,10 +17,11 @@ public:
     const IntVector2& GetLabelOffset() const;
     float GetRepeatDelay() const;
     float GetRepeatRate() const;
+    bool IsPressed() const;
     
-    // Properties:
     tolua_property__get_set IntVector2& pressedOffset;
     tolua_property__get_set IntVector2& labelOffset;
     tolua_property__get_set float repeatDelay;
     tolua_property__get_set float repeatRate;
+    tolua_readonly tolua_property__is_set bool pressed;
 };

+ 0 - 3
Extras/LuaScript/pkgs/UI/CheckBox.pkg

@@ -2,8 +2,6 @@ $#include "CheckBox.h"
 
 class CheckBox : public BorderImage
 {
-public:
-    // Methods:
     CheckBox(Context* context);
     virtual ~CheckBox();
     
@@ -14,7 +12,6 @@ public:
     bool IsChecked() const;
     const IntVector2& GetCheckedOffset() const;
     
-    // Properties:
     tolua_property__is_set bool checked;
     tolua_property__get_set IntVector2& checkedOffset;
 };

+ 0 - 1
Extras/LuaScript/pkgs/UI/Cursor.pkg

@@ -19,7 +19,6 @@ class Cursor : public BorderImage
     virtual ~Cursor();
     
     void DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot, bool osMouseVisible = false);
-    void DefineShape(CursorShape shape, Image* image, const IntRect& imageRect, const IntVector2& hotSpot);
     
     void SetShape(CursorShape shape);
     CursorShape GetShape() const;

+ 5 - 3
Extras/LuaScript/pkgs/UI/DropDownList.pkg

@@ -2,8 +2,6 @@ $#include "DropDownList.h"
 
 class DropDownList : public Menu
 {
-public:
-    // Methods:
     DropDownList(Context* context);
     ~DropDownList();
     
@@ -13,7 +11,10 @@ public:
     void RemoveItem(unsigned index);
     void RemoveAllItems();
     void SetSelection(unsigned index);
+    
     void SetPlaceholderText(const String& text);
+    void SetPlaceholderText(const const char* text);
+    
     void SetResizePopup(bool enable);
    
     unsigned GetNumItems() const;
@@ -25,7 +26,8 @@ public:
     const String& GetPlaceholderText() const;
     bool GetResizePopup() const;
     
-    // Properties:
+    void SetSelectionAttr(unsigned index);
+    
     tolua_readonly tolua_property__get_set unsigned numItems;
     tolua_property__get_set unsigned selection;
     tolua_readonly tolua_property__get_set UIElement* selectedItem;

+ 9 - 4
Extras/LuaScript/pkgs/UI/FileSelector.pkg

@@ -8,16 +8,23 @@ struct FileSelectorEntry
 
 class FileSelector : public Object
 {
-public:
-    // Methods:
     FileSelector(Context* context);
     virtual ~FileSelector();
 
     void SetDefaultStyle(XMLFile* style);
+    
     void SetTitle(const String& text);
+    void SetTitle(const char* text);
+    
     void SetButtonTexts(const String& okText, const String& cancelText);
+    void SetButtonTexts(const char* okText, const char* cancelText);
+    
     void SetPath(const String& path);
+    void SetPath(const char* path);
+    
     void SetFileName(const String& fileName);
+    void SetFileName(const char* fileName);
+    
     void SetFilters(const Vector<String>& filters, unsigned defaultIndex);
     void SetDirectoryMode(bool enable);
     void UpdateElements();
@@ -39,7 +46,6 @@ public:
     unsigned GetFilterIndex() const;
     bool GetDirectoryMode() const;
     
-    // Properties:
     tolua_property__get_set XMLFile* defaultStyle;
     tolua_readonly tolua_property__get_set Window* window;
     tolua_readonly tolua_property__get_set Text* titleText;
@@ -50,7 +56,6 @@ public:
     tolua_readonly tolua_property__get_set Button* OKButton;
     tolua_readonly tolua_property__get_set Button* cancelButton;
     tolua_readonly tolua_property__get_set Button* closeButton;
-    
     tolua_property__get_set String& title;
     tolua_property__get_set String& path;
     tolua_property__get_set String& fileName;

+ 0 - 1
Extras/LuaScript/pkgs/UI/Font.pkg

@@ -2,5 +2,4 @@ $#include "Font.h"
 
 class Font : public Resource
 {
-public:
 };

+ 2 - 3
Extras/LuaScript/pkgs/UI/LineEdit.pkg

@@ -2,12 +2,12 @@ $#include "LineEdit.h"
 
 class LineEdit : public BorderImage
 {
-public:
-    // Methods:
     LineEdit(Context* context);
     virtual ~LineEdit();
     
     void SetText(const String& text);
+    void SetText(const char* text);
+    
     void SetCursorPosition(unsigned position);
     void SetCursorBlinkRate(float rate);
     void SetMaxLength(unsigned length);
@@ -29,7 +29,6 @@ public:
     BorderImage* GetCursor() const;
     float GetDoubleClickInterval() const;
     
-    // Properties:
     tolua_property__get_set String& text;
     tolua_property__get_set unsigned cursorPosition;
     tolua_property__get_set float cursorBlinkRate;

+ 0 - 11
Extras/LuaScript/pkgs/UI/ListView.pkg

@@ -9,18 +9,13 @@ enum HighlightMode
 
 class ListView : public ScrollView
 {
-public:
-    // Methods:
     ListView(Context* context);
     virtual ~ListView();
     
     void AddItem(UIElement* item);
     
     void InsertItem(unsigned index, UIElement* item, UIElement* parentItem = 0);
-    void InsertItem(unsigned index, UIElement* item);
-    
     void RemoveItem(UIElement* item, unsigned index = 0);
-    void RemoveItem(UIElement* item);
     
     void RemoveItem(unsigned index);
     void RemoveAllItems();
@@ -30,8 +25,6 @@ public:
     void ToggleSelection(unsigned index);
     
     void ChangeSelection(int delta, bool additive = false);
-    void ChangeSelection(int delta);
-    
     void ClearSelection();
     void SetHighlightMode(HighlightMode mode);
     void SetMultiselect(bool enable);
@@ -41,10 +34,7 @@ public:
     void SetDoubleClickInterval(float interval);
 
     void Expand(unsigned index, bool enable, bool recursive = false);
-    void Expand(unsigned index, bool enable);
-    
     void ToggleExpand(unsigned index, bool recursive = false);
-    void ToggleExpand(unsigned index);
     
     unsigned GetNumItems() const;
     UIElement* GetItem(unsigned index) const;
@@ -60,7 +50,6 @@ public:
     int GetBaseIndent() const;
     float GetDoubleClickInterval() const;
     
-    // Properties:
     tolua_readonly tolua_property__get_set unsigned numItems;
     tolua_property__get_set unsigned selection;
     tolua_readonly tolua_property__get_set UIElement* selectedItem;

+ 0 - 3
Extras/LuaScript/pkgs/UI/Menu.pkg

@@ -2,8 +2,6 @@ $#include "Menu.h"
 
 class Menu : public Button
 {
-public:
-    // Methods:
     Menu(Context* context);
     virtual ~Menu();
     
@@ -19,7 +17,6 @@ public:
     int GetAcceleratorKey() const;
     int GetAcceleratorQualifiers() const;
     
-    // Properties:
     tolua_property__get_set UIElement* popup;
     tolua_property__get_set IntVector2& popupOffset;
     tolua_property__get_set bool showPopup;

+ 0 - 3
Extras/LuaScript/pkgs/UI/ScrollBar.pkg

@@ -2,8 +2,6 @@ $#include "ScrollBar.h"
 
 class ScrollBar : public UIElement
 {
-public:
-    // Methods:
     ScrollBar(Context* context);
     virtual ~ScrollBar();
     
@@ -26,7 +24,6 @@ public:
     Button* GetForwardButton() const;
     Slider* GetSlider() const;
     
-    // Properties:
     tolua_property__get_set Orientation orientation;
     tolua_property__get_set float range;
     tolua_property__get_set float value;

+ 0 - 1
Extras/LuaScript/pkgs/UI/ScrollView.pkg

@@ -26,7 +26,6 @@ public:
     
     void SetViewPositionAttr(const IntVector2& value);
     
-    // Properties:
     tolua_property__get_set IntVector2& viewPosition;
     tolua_property__get_set UIElement* contentElement;
     tolua_readonly tolua_property__get_set ScrollBar* horizontalScrollBar;

+ 0 - 3
Extras/LuaScript/pkgs/UI/Slider.pkg

@@ -2,8 +2,6 @@ $#include "Slider.h"
 
 class Slider : public BorderImage
 {
-public:
-    // Methods:
     Slider(Context* context);
     virtual ~Slider();
     
@@ -19,7 +17,6 @@ public:
     BorderImage* GetKnob() const;
     float GetRepeatRate() const;
     
-    // Properties:
     tolua_property__get_set Orientation orientation;
     tolua_property__get_set float range;
     tolua_property__get_set float value;

+ 0 - 3
Extras/LuaScript/pkgs/UI/Sprite.pkg

@@ -4,8 +4,6 @@ enum BlendMode{};
 
 class Sprite : public UIElement
 {
-public:
-    // Methods:
     Sprite(Context* context);
     virtual ~Sprite();
     
@@ -33,7 +31,6 @@ public:
     ResourceRef GetTextureAttr() const;
     const Matrix3x4& GetTransform() const;
     
-    // Properties:
     tolua_property__get_set Vector2& position;
     tolua_property__get_set IntVector2& hotSpot;
     tolua_property__get_set Vector2& scale;

+ 7 - 9
Extras/LuaScript/pkgs/UI/Text.pkg

@@ -2,25 +2,20 @@ $#include "Text.h"
 
 class Text : public UIElement
 {
-public:
-    // Methods:
     Text(Context* context);
     virtual ~Text();
 
     bool SetFont(const String& fontName, int size = DEFAULT_FONT_SIZE);
-    bool SetFont(const String& fontName);
-    
+    bool SetFont(const char* fontName, int size = DEFAULT_FONT_SIZE);
     bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
-    bool SetFont(Font* font);
     
     void SetText(const String& text);
+    void SetText(const char* text);
+    
     void SetTextAlignment(HorizontalAlignment align);
     void SetRowSpacing(float spacing);
     void SetWordwrap(bool enable);
-    
     void SetSelection(unsigned start, unsigned length = M_MAX_UNSIGNED);
-    void SetSelection(unsigned start);
-    
     void ClearSelection();
     void SetSelectionColor(const Color& color);
     void SetHoverColor(const Color& color);
@@ -38,7 +33,9 @@ public:
     int GetRowHeight() const;
     unsigned GetNumRows() const;
     
-    // Properties:
+    void SetFontAttr(ResourceRef value);
+    ResourceRef GetFontAttr() const;
+    
     tolua_property__get_set Font* font;
     tolua_readonly tolua_property__get_set int fontSize;
     tolua_property__get_set String& text;
@@ -51,4 +48,5 @@ public:
     tolua_property__get_set Color& hoverColor;
     tolua_readonly tolua_property__get_set int rowHeight;
     tolua_readonly tolua_property__get_set unsigned numRows;
+    tolua_property__get_set ResourceRef fontAttr;
 };

+ 15 - 5
Extras/LuaScript/pkgs/UI/Text3D.pkg

@@ -2,19 +2,19 @@ $#include "Text3D.h"
 
 class Text3D : public Drawable
 {
-public:
-    // Methods:
     Text3D(Context* context);
     ~Text3D();
     
     bool SetFont(const String& fontName, int size = DEFAULT_FONT_SIZE);
-    bool SetFont(const String& fontName);
-    
+    bool SetFont(const char* fontName, int size = DEFAULT_FONT_SIZE);
     bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
     bool SetFont(Font* font);
     
     void SetMaterial(Material* material);
+    
     void SetText(const String& text);
+    void SetText(const char* text);
+    
     void SetAlignment(HorizontalAlignment hAlign, VerticalAlignment vAlign);
     void SetHorizontalAlignment(HorizontalAlignment align);
     void SetVerticalAlignment(VerticalAlignment align);
@@ -43,7 +43,12 @@ public:
     float GetOpacity() const;
     bool GetFaceCamera() const;
     
-    // Properties:
+    void SetFontAttr(ResourceRef value);
+    ResourceRef GetFontAttr() const;
+    void SetMaterialAttr(ResourceRef value);
+    ResourceRef GetMaterialAttr() const;
+    const Color& GetColorAttr() const;
+    
     tolua_property__get_set Font* font;
     tolua_property__get_set Material* material;
     tolua_readonly tolua_property__get_set int fontSize;
@@ -58,4 +63,9 @@ public:
     tolua_readonly tolua_property__get_set unsigned numRows;
     tolua_property__get_set float opacity;
     tolua_property__get_set bool faceCamera;
+    tolua_property__get_set ResourceRef fontAttr;
+    tolua_property__get_set ResourceRef materialAttr;
+    tolua_readonly tolua_property__get_set Color& colorAttr;
 };
+
+$#define SetColorAttr SetColor

+ 3 - 2
Extras/LuaScript/pkgs/UI/UI.pkg

@@ -11,7 +11,10 @@ class UI : public Object
     void Render();
     void DebugDraw(UIElement* element);
     bool SaveLayout(Serializer& dest, UIElement* element);
+    
     void SetClipBoardText(const String& text);
+    void SetClipBoardText(const char* text);
+    
     void SetNonFocusedMouseWheel(bool nonFocusedMouseWheel);
     
     UIElement* GetRoot() const;
@@ -19,9 +22,7 @@ class UI : public Object
     Cursor* GetCursor() const;
     
     UIElement* GetElementAt(const IntVector2& position, bool enabledOnly = true);
-    UIElement* GetElementAt(const IntVector2& position);
     UIElement* GetElementAt(int x, int y, bool enabledOnly = true);
-    UIElement* GetElementAt(int x, int y);
     
     UIElement* GetFocusElement() const;
     UIElement* GetFrontElement() const;

+ 33 - 51
Extras/LuaScript/pkgs/UI/UIElement.pkg

@@ -62,46 +62,41 @@ class UIElement : public Serializable
 
     virtual const IntVector2& GetScreenPosition() const;
 
+    bool LoadXML(Deserializer& source);
+    bool SaveXML(Serializer& dest) const;
+    bool FilterAttributes(XMLElement& dest) const;
+
     void SetName(const String& name);
+    void SetName(const char* name);
     
     void SetPosition(const IntVector2& position);
     void SetPosition(int x, int y);
-    
     void SetSize(const IntVector2& size);
     void SetSize(int width, int height);
     void SetWidth(int width);
     void SetHeight(int height);
-    
     void SetMinSize(const IntVector2& minSize);
     void SetMinSize(int width, int height);
     void SetMinWidth(int width);
     void SetMinHeight(int height);
-    
     void SetMaxSize(const IntVector2& maxSize);
     void SetMaxSize(int width, int height);
     void SetMaxWidth(int width);
     void SetMaxHeight(int height);
-    
     void SetFixedSize(const IntVector2& size);
     void SetFixedSize(int width, int height);
     void SetFixedWidth(int width);
     void SetFixedHeight(int height);
-    
     void SetAlignment(HorizontalAlignment hAlign, VerticalAlignment vAlign);
     void SetHorizontalAlignment(HorizontalAlignment align);
     void SetVerticalAlignment(VerticalAlignment align);
-    
     void SetClipBorder(const IntRect& rect);
-    
     void SetColor(const Color& color);
     void SetColor(Corner corner, const Color& color);
-    
     void SetPriority(int priority);
     void SetOpacity(float opacity);
-    
     void SetBringToFront(bool enable);
     void SetBringToBack(bool enable);
-    
     void SetClipChildren(bool enable);
     void SetSortChildren(bool enable);
     void SetUseDerivedOpacity(bool enable);
@@ -113,16 +108,13 @@ class UIElement : public Serializable
     void SetDragDropMode(unsigned mode);
 
     bool SetStyle(const String& styleName, XMLFile* file = 0);
-    bool SetStyle(const String& styleName);
+    bool SetStyle(const char* styleName, XMLFile* file = 0);
     
     bool SetStyle(const XMLElement& element);
     bool SetStyleAuto(XMLFile* file = 0);
-    bool SetStyleAuto();
     void SetDefaultStyle(XMLFile* style);
     
     void SetLayout(LayoutMode mode, int spacing = 0, const IntRect& border = IntRect::ZERO);
-    void SetLayout(LayoutMode mode, int spacing = 0);
-    void SetLayout(LayoutMode mode);
     
     void SetLayoutMode(LayoutMode mode);
     void SetLayoutSpacing(int spacing);
@@ -135,24 +127,22 @@ class UIElement : public Serializable
     void BringToFront();
     
     UIElement* CreateChild(ShortStringHash type, const String& name = String::EMPTY, unsigned index = M_MAX_UNSIGNED);
-    UIElement* CreateChild(ShortStringHash type, const String& name = String::EMPTY);
-    UIElement* CreateChild(ShortStringHash type);
+    UIElement* CreateChild(const char* type, const char* name = 0, unsigned index = M_MAX_UNSIGNED);
     
     void AddChild(UIElement* element);
     void InsertChild(unsigned index, UIElement* element);
     void RemoveChild(UIElement* element, unsigned index = 0);
-    void RemoveChild(UIElement* element);
     void RemoveChildAtIndex @ RemoveChild(unsigned index);
     void RemoveAllChildren();
     void Remove();
     unsigned FindChild(UIElement* element) const;
     void SetParent(UIElement* parent, unsigned index = M_MAX_UNSIGNED);
-    void SetParent(UIElement* parent);
-    
     void SetInternal(bool enable);
     void SetTraversalMode(TraversalMode traversalMode);
     void SetElementEventSender(bool flag);
-    
+
+    // template <class T> T* CreateChild(const String& name = String::EMPTY, unsigned index = M_MAX_UNSIGNED);
+
     const String& GetName() const;
     const IntVector2& GetPosition() const;
     const IntVector2& GetSize() const;
@@ -164,11 +154,9 @@ class UIElement : public Serializable
     const IntVector2& GetMaxSize() const;
     int GetMaxWidth() const;
     int GetMaxHeight() const;
-    
     bool IsFixedSize() const;
     bool IsFixedWidth() const;
     bool IsFixedHeight() const;
-    
     const IntVector2& GetChildOffset() const;
     HorizontalAlignment GetHorizontalAlignment() const;
     VerticalAlignment GetVerticalAlignment() const;
@@ -192,52 +180,41 @@ class UIElement : public Serializable
     FocusMode GetFocusMode() const;
     unsigned GetDragDropMode() const;
     const String& GetAppliedStyle() const;
-    
     XMLFile* GetDefaultStyle(bool recursiveUp = true) const;
-    XMLFile* GetDefaultStyle() const;
-    
     LayoutMode GetLayoutMode() const;
     int GetLayoutSpacing() const;
     const IntRect& GetLayoutBorder() const;
-    
     unsigned GetNumChildren(bool recursive = false) const;
-    unsigned GetNumChildren() const;
-    
     UIElement* GetChild(unsigned index) const;
     
     UIElement* GetChild(const String& name, bool recursive = false) const;
-    UIElement* GetChild(const String& name) const;
     tolua_outside UIElement* UIElementGetChild @ GetChild(const char* name, bool recursive = false) const;
-    tolua_outside UIElement* UIElementGetChild @ GetChild(const char* name) const;
     
     UIElement* GetChild(const ShortStringHash& key, const Variant& value = Variant::EMPTY, bool recursive = false) const;
-    UIElement* GetChild(const ShortStringHash& key, const Variant& value = Variant::EMPTY) const;
-    UIElement* GetChild(const ShortStringHash& key) const;
+    tolua_outside UIElement* UIElementGetChild2 @ GetChild(const char* key, const Variant& value = Variant::EMPTY, bool recursive = false) const;
     
     UIElement* GetParent() const;
     UIElement* GetRoot() const;
     const Color& GetDerivedColor() const;
-    
     IntVector2 ScreenToElement(const IntVector2& screenPosition);
     IntVector2 ElementToScreen(const IntVector2& position);
-    
     bool IsInside(IntVector2 position, bool isScreen);
     bool IsInsideCombined(IntVector2 position, bool isScreen);
-    
+
     IntRect GetCombinedScreenRect();
     void SortChildren();
     int GetLayoutMinSize() const;
-    
     int GetIndent() const;
     int GetIndentSpacing() const;
     int GetIndentWidth() const;
     void SetChildOffset(const IntVector2& offset);
     void SetHovering(bool enable);
+    const Color& GetColorAttr() const;
     TraversalMode GetTraversalMode() const;
     bool IsElementEventSender() const;
     UIElement* GetElementEventSender() const;
     
-    tolua_property__get_set String& style;
+    tolua_readonly tolua_property__get_set IntVector2& screenPosition;
     tolua_property__get_set String& name;
     tolua_property__get_set IntVector2& position;
     tolua_property__get_set IntVector2 size;
@@ -249,23 +226,23 @@ class UIElement : public Serializable
     tolua_property__get_set IntVector2 maxSize;
     tolua_property__get_set int maxWidth;
     tolua_property__get_set int maxHeight;
-    
     tolua_readonly tolua_property__is_set bool fixedSize;
     tolua_readonly tolua_property__is_set bool fixedWidth;
     tolua_readonly tolua_property__is_set bool fixedHeight;
-    
+    tolua_property__get_set IntVector2& childOffset;
     tolua_property__get_set HorizontalAlignment horizontalAlignment;
     tolua_property__get_set VerticalAlignment verticalAlignment;
     tolua_property__get_set IntRect clipBorder;
     tolua_property__get_set int priority;
     tolua_property__get_set float opacity;
+    tolua_readonly tolua_property__get_set float derivedOpacity;
     tolua_property__get_set bool bringToFront;
     tolua_property__get_set bool bringToBack;
     tolua_property__get_set bool clipChildren;
     tolua_property__get_set bool sortChildren;
     tolua_property__get_set bool useDerivedOpacity;
-    tolua_property__is_set bool enabled;
     tolua_property__has_set bool focus;
+    tolua_property__is_set bool enabled;
     tolua_property__is_set bool selected;
     tolua_property__is_set bool visible;
     tolua_property__is_set bool hovering;
@@ -273,30 +250,35 @@ class UIElement : public Serializable
     tolua_readonly tolua_property__has_set bool colorGradient;
     tolua_property__get_set FocusMode focusMode;
     tolua_property__get_set unsigned dragDropMode;
-    tolua_property__get_set TraversalMode traversalMode;
+    tolua_property__get_set String& style;
     tolua_property__get_set XMLFile* defaultStyle;
     tolua_property__get_set LayoutMode layoutMode;
     tolua_property__get_set int layoutSpacing;
     tolua_property__get_set IntRect& layoutBorder;
-    
-    tolua_property__get_set int indent;
-    tolua_property__get_set int indentSpacing;
-    tolua_readonly tolua_property__get_set int indentWidth;
-    tolua_property__get_set IntVector2& childOffset;
-    tolua_property__is_set bool elementEventSender;
     tolua_readonly tolua_property__get_set unsigned numChildren;
     tolua_property__get_set UIElement* parent;
     tolua_readonly tolua_property__get_set UIElement* root;
-    tolua_readonly tolua_property__get_set IntVector2& screenPosition;
+    tolua_readonly tolua_property__get_set Color& derivedColor;
     tolua_readonly tolua_property__get_set IntRect combinedScreenRect;
-    tolua_readonly tolua_property__get_set float derivedOpacity;
+    tolua_readonly tolua_property__get_set int layoutMinSize;
+    tolua_property__get_set int indent;
+    tolua_property__get_set int indentSpacing;
+    tolua_readonly tolua_property__get_set int indentWidth;
+    tolua_property__get_set Color& colorAttr;
+    tolua_property__get_set TraversalMode traversalMode;
+    tolua_property__is_set bool elementEventSender;
 };
 
 ${
 
-UIElement* UIElementGetChild(const UIElement* uiElement, const char* name, bool recursive = false)
+static UIElement* UIElementGetChild(const UIElement* element, const char* name, bool recursive = false)
+{
+    return element->GetChild(String(name), recursive);
+}
+
+static UIElement* UIElementGetChild2(const UIElement* element, const char* key, const Variant& value = Variant::EMPTY, bool recursive = false)
 {
-    return uiElement->GetChild(String(name), recursive);
+    return element->GetChild(ShortStringHash(key), value, recursive);
 }
 
 #define GetStyle GetAppliedStyle

+ 0 - 2
Extras/LuaScript/pkgs/UI/Window.pkg

@@ -16,7 +16,6 @@ enum WindowDragMode
 
 class Window : public BorderImage
 {
-public:
     Window(Context* context);
     virtual ~Window();
     
@@ -36,7 +35,6 @@ public:
     const Color& GetModalFrameColor() const;
     const IntVector2& GetModalFrameSize() const;
     
-    // Properties:
     tolua_property__is_set bool movable;
     tolua_property__is_set bool resizable;
     tolua_property__get_set IntRect& resizeBorder;