Browse Source

Lua API Update.

aster2013 12 years ago
parent
commit
4b13c8598e

+ 1 - 1
Source/Engine/LuaScript/pkgs/Graphics/Animation.pkg

@@ -41,7 +41,7 @@ class Animation : public Resource
     const AnimationTrack* GetTrack(StringHash nameHash) const;
     unsigned GetNumTriggers() const;
     
-    tolua_readonly tolua_property__get_set String& animationName;
+    tolua_readonly tolua_property__get_set String animationName;
     tolua_readonly tolua_property__get_set StringHash animationNameHash;
     tolua_readonly tolua_property__get_set float length;
     tolua_readonly tolua_property__get_set unsigned numTracks;

+ 1 - 1
Source/Engine/LuaScript/pkgs/Graphics/Skeleton.pkg

@@ -22,7 +22,7 @@ class Skeleton
 {
     unsigned GetNumBones() const;
     Bone* GetRootBone();
-    Bone* GetBone(String& name);
+    Bone* GetBone(const String name);
     Bone* GetBone(unsigned index);
     
     tolua_readonly tolua_property__get_set unsigned numBones;

+ 1 - 1
Source/Engine/LuaScript/pkgs/IO/Deserializer.pkg

@@ -48,7 +48,7 @@ class Deserializer
     unsigned ReadNetID();
     String ReadLine();
     
-    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set unsigned checksum;
     tolua_readonly tolua_property__get_set unsigned position;
     tolua_readonly tolua_property__get_set unsigned size;

+ 1 - 1
Source/Engine/LuaScript/pkgs/IO/File.pkg

@@ -118,7 +118,7 @@ class File : public Object
     tolua_readonly tolua_property__is_set bool packaged;
     
     // From Deserializer
-    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set unsigned checksum;
     tolua_readonly tolua_property__get_set unsigned position;
     tolua_readonly tolua_property__get_set unsigned size;

+ 1 - 1
Source/Engine/LuaScript/pkgs/IO/PackageFile.pkg

@@ -25,7 +25,7 @@ class PackageFile : public Object
     unsigned GetChecksum() const;
     bool IsCompressed() const;
 
-    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set StringHash nameHash;
     tolua_readonly tolua_property__get_set unsigned numFiles;
     tolua_readonly tolua_property__get_set unsigned totalSize;

+ 1 - 1
Source/Engine/LuaScript/pkgs/IO/VectorBuffer.pkg

@@ -107,7 +107,7 @@ class VectorBuffer
     bool WriteLine(const String value);
     
     // From Deserializer
-    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set unsigned checksum;
     tolua_readonly tolua_property__get_set unsigned position;
     tolua_readonly tolua_property__get_set unsigned size;

+ 1 - 1
Source/Engine/LuaScript/pkgs/Network/Connection.pkg

@@ -61,6 +61,6 @@ class Connection : public Object
     tolua_readonly tolua_property__get_set String address;
     tolua_readonly tolua_property__get_set unsigned short port;
     tolua_readonly tolua_property__get_set unsigned numDownloads;
-    tolua_readonly tolua_property__get_set String& downloadName;
+    tolua_readonly tolua_property__get_set String downloadName;
     tolua_readonly tolua_property__get_set float downloadProgress;
 };

+ 2 - 2
Source/Engine/LuaScript/pkgs/Network/Network.pkg

@@ -29,7 +29,7 @@ class Network
     
     void UnregisterAllRemoteEvents();
     void SetPackageCacheDir(const String path);
-    SharedPtr<HttpRequest> MakeHttpRequest(const String& url, const String& verb = String::EMPTY, const Vector<String>& headers = Vector<String>(), const String& postData = String::EMPTY);
+    SharedPtr<HttpRequest> MakeHttpRequest(const String url, const String verb = String::EMPTY, const Vector<String>& headers = Vector<String>(), const String postData = String::EMPTY);
     
     int GetUpdateFps() const;
     Connection* GetServerConnection() const;
@@ -42,5 +42,5 @@ class Network
     tolua_property__get_set int updateFps;
     tolua_readonly tolua_property__get_set Connection* serverConnection;
     tolua_readonly tolua_property__is_set bool serverRunning;
-    tolua_property__get_set String& packageCacheDir;
+    tolua_property__get_set String packageCacheDir;
 };

+ 1 - 1
Source/Engine/LuaScript/pkgs/Resource/Image.pkg

@@ -19,7 +19,7 @@ class Image : public Resource
     ~Image();
     
     bool LoadColorLUT(Deserializer& source);
-    tolua_outside bool ImageLoadColorLUT @ LoadColorLUT(const String& fileName);
+    tolua_outside bool ImageLoadColorLUT @ LoadColorLUT(const String fileName);
 
     void FlipVertical();
     bool SaveBMP(const String fileName);

+ 1 - 1
Source/Engine/LuaScript/pkgs/Resource/Resource.pkg

@@ -12,7 +12,7 @@ class Resource
     StringHash GetNameHash() const;
     unsigned GetMemoryUse() const;
     
-    tolua_readonly tolua_property__get_set String& name;
+    tolua_readonly tolua_property__get_set String name;
     tolua_readonly tolua_property__get_set StringHash nameHash;
     tolua_readonly tolua_property__get_set unsigned memoryUse;
 };

+ 1 - 1
Source/Engine/LuaScript/pkgs/Scene/Node.pkg

@@ -188,7 +188,7 @@ class Node : public Serializable
     void AddComponent(Component* component, unsigned id, CreateMode mode);
 
     tolua_property__get_set unsigned ID;
-    tolua_property__get_set String& name;
+    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;

+ 0 - 4
Source/Engine/LuaScript/pkgs/UI/BorderImage.pkg

@@ -23,16 +23,12 @@ class BorderImage : public UIElement
     BlendMode GetBlendMode() const;
     bool IsTiled() const;
     
-    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;
 };
 
 ${

+ 3 - 3
Source/Engine/LuaScript/pkgs/UI/DropDownList.pkg

@@ -18,8 +18,10 @@ class DropDownList : public Menu
    
     unsigned GetNumItems() const;
     UIElement* GetItem(unsigned index) const;
+    
     // PODVector<UIElement*> GetItems() const;
     tolua_outside const PODVector<UIElement*>& DropDownListGetItems @ GetItems() const;
+    
     unsigned GetSelection() const;
     UIElement* GetSelectedItem() const;
     ListView* GetListView() const;
@@ -27,14 +29,12 @@ class DropDownList : public Menu
     const String GetPlaceholderText() const;
     bool GetResizePopup() const;
     
-    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;
     tolua_readonly tolua_property__get_set ListView* listView;
     tolua_readonly tolua_property__get_set UIElement* placeholder;
-    tolua_property__get_set String& placeholderText;
+    tolua_property__get_set String placeholderText;
     tolua_property__get_set bool resizePopup;
 };
 

+ 4 - 4
Source/Engine/LuaScript/pkgs/UI/FileSelector.pkg

@@ -48,10 +48,10 @@ class FileSelector : public Object
     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;
-    tolua_readonly tolua_property__get_set String& filter;
+    tolua_property__get_set String title;
+    tolua_property__get_set String path;
+    tolua_property__get_set String fileName;
+    tolua_readonly tolua_property__get_set String filter;
     tolua_readonly tolua_property__get_set unsigned filterIndex;
     tolua_property__get_set bool directoryMode;
 };

+ 1 - 1
Source/Engine/LuaScript/pkgs/UI/LineEdit.pkg

@@ -26,7 +26,7 @@ class LineEdit : public BorderImage
     Text* GetTextElement() const;
     BorderImage* GetCursor() const;
 
-    tolua_property__get_set String& text;
+    tolua_property__get_set String text;
     tolua_property__get_set unsigned cursorPosition;
     tolua_property__get_set float cursorBlinkRate;
     tolua_property__get_set unsigned maxLength;

+ 4 - 0
Source/Engine/LuaScript/pkgs/UI/ListView.pkg

@@ -38,14 +38,18 @@ class ListView : public ScrollView
     
     unsigned GetNumItems() const;
     UIElement* GetItem(unsigned index) const;
+    
     // PODVector<UIElement*> GetItems() const;
     tolua_outside const PODVector<UIElement*>& ListViewGetItems @ GetItems() const;
+    
     unsigned FindItem(UIElement* item) const;
     unsigned GetSelection() const;
     const PODVector<unsigned>& GetSelections() const;
     UIElement* GetSelectedItem() const;
+    
     // PODVector<UIElement*> GetSelectedItems() const;
     tolua_outside const PODVector<UIElement*>& ListViewGetSelectedItems @ GetSelectedItems() const;
+    
     bool IsSelected(unsigned index) const;
     bool IsExpanded(unsigned index) const;
     HighlightMode GetHighlightMode() const;

+ 25 - 127
Source/Engine/LuaScript/pkgs/UI/MessageBox.pkg

@@ -2,23 +2,22 @@ $#include "MessageBox.h"
 
 class MessageBox : public Object
 {
-    MessageBox(const String& messageString = String::EMPTY, const String& titleString = String::EMPTY, XMLFile* layoutFile = 0, XMLFile* styleFile = 0);
+    MessageBox(const String messageString = String::EMPTY, const String titleString = String::EMPTY, XMLFile* layoutFile = 0, XMLFile* styleFile = 0);
     virtual ~MessageBox();
 
-    void SetTitle(const String& text);
-    void SetMessage(const String& text);
+    void SetTitle(const String text);
+    void SetMessage(const String text);
 
     const String GetTitle() const;
     const String GetMessage() const;
     UIElement* GetWindow() const;
 
-    tolua_property__get_set String& title;
-    tolua_property__get_set String& message;
+    tolua_property__get_set String title;
+    tolua_property__get_set String message;
     tolua_readonly tolua_property__get_set UIElement* window;
 };
 
 ${
-/* method: new of class  MessageBox */
 #define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new00
 static int tolua_UILuaAPI_MessageBox_new00(lua_State* tolua_S)
 {
@@ -26,14 +25,22 @@ static int tolua_UILuaAPI_MessageBox_new00(lua_State* tolua_S)
  tolua_Error tolua_err;
  if (
  !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,2,&tolua_err)
+ !tolua_isurho3dstring(tolua_S,2,1,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
  )
  goto tolua_lerror;
  else
 #endif
  {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,String::EMPTY));
+  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,String::EMPTY));
+  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
+  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
  {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S)));
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
  }
  }
@@ -45,7 +52,6 @@ static int tolua_UILuaAPI_MessageBox_new00(lua_State* tolua_S)
 #endif
 }
 
-/* method: new_local of class  MessageBox */
 #define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new00_local
 static int tolua_UILuaAPI_MessageBox_new00_local(lua_State* tolua_S)
 {
@@ -53,14 +59,22 @@ static int tolua_UILuaAPI_MessageBox_new00_local(lua_State* tolua_S)
  tolua_Error tolua_err;
  if (
  !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,2,&tolua_err)
+ !tolua_isurho3dstring(tolua_S,2,1,&tolua_err) ||
+ !tolua_isurho3dstring(tolua_S,3,1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
+ !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,6,&tolua_err)
  )
  goto tolua_lerror;
  else
 #endif
  {
+  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,String::EMPTY));
+  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,String::EMPTY));
+  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
+  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
  {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S)));
+  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
  tolua_register_gc(tolua_S,lua_gettop(tolua_S));
  }
@@ -72,120 +86,4 @@ static int tolua_UILuaAPI_MessageBox_new00_local(lua_State* tolua_S)
  return 0;
 #endif
 }
-
-/* method: new of class  MessageBox */
-#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new01
-static int tolua_UILuaAPI_MessageBox_new01(lua_State* tolua_S)
-{
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
-  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
- {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString));
-  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
- tolua_pushurho3dstring(tolua_S,(const char*)messageString);
- }
- }
- return 2;
-tolua_lerror:
- return tolua_UILuaAPI_MessageBox_new00(tolua_S);
-}
-
-/* method: new_local of class  MessageBox */
-#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new01_local
-static int tolua_UILuaAPI_MessageBox_new01_local(lua_State* tolua_S)
-{
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isnoobj(tolua_S,3,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
-  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
- {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString));
-  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
- tolua_register_gc(tolua_S,lua_gettop(tolua_S));
- tolua_pushurho3dstring(tolua_S,(const char*)messageString);
- }
- }
- return 2;
-tolua_lerror:
- return tolua_UILuaAPI_MessageBox_new00_local(tolua_S);
-}
-
-/* method: new of class  MessageBox */
-#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new02
-static int tolua_UILuaAPI_MessageBox_new02(lua_State* tolua_S)
-{
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
- !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
- !tolua_isnoobj(tolua_S,6,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
-  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
-  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
-  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
-  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
- {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
-  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
- tolua_pushurho3dstring(tolua_S,(const char*)messageString);
- tolua_pushurho3dstring(tolua_S,(const char*)titleString);
- }
- }
- return 3;
-tolua_lerror:
- return tolua_UILuaAPI_MessageBox_new01(tolua_S);
-}
-
-/* method: new_local of class  MessageBox */
-#define TOLUA_DISABLE_tolua_UILuaAPI_MessageBox_new02_local
-static int tolua_UILuaAPI_MessageBox_new02_local(lua_State* tolua_S)
-{
- tolua_Error tolua_err;
- if (
- !tolua_isusertable(tolua_S,1,"MessageBox",0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,2,0,&tolua_err) ||
- !tolua_isurho3dstring(tolua_S,3,0,&tolua_err) ||
- !tolua_isusertype(tolua_S,4,"XMLFile",1,&tolua_err) ||
- !tolua_isusertype(tolua_S,5,"XMLFile",1,&tolua_err) ||
- !tolua_isnoobj(tolua_S,6,&tolua_err)
- )
- goto tolua_lerror;
- else
- {
-  const String messageString = ((const String)  tolua_tourho3dstring(tolua_S,2,0));
-  const String titleString = ((const String)  tolua_tourho3dstring(tolua_S,3,0));
-  XMLFile* layoutFile = ((XMLFile*)  tolua_tousertype(tolua_S,4,0));
-  XMLFile* styleFile = ((XMLFile*)  tolua_tousertype(tolua_S,5,0));
- {
-  MessageBox* tolua_ret = (MessageBox*)  Mtolua_new((MessageBox)(GetContext(tolua_S),messageString,titleString,layoutFile,styleFile));
-  tolua_pushusertype(tolua_S,(void*)tolua_ret,"MessageBox");
- tolua_register_gc(tolua_S,lua_gettop(tolua_S));
- tolua_pushurho3dstring(tolua_S,(const char*)messageString);
- tolua_pushurho3dstring(tolua_S,(const char*)titleString);
- }
- }
- return 3;
-tolua_lerror:
- return tolua_UILuaAPI_MessageBox_new01_local(tolua_S);
-}
 $}

+ 0 - 2
Source/Engine/LuaScript/pkgs/UI/ScrollView.pkg

@@ -22,8 +22,6 @@ class ScrollView : public UIElement
     float GetScrollStep() const;
     float GetPageStep() const;
     
-    void SetViewPositionAttr(const IntVector2& value);
-    
     tolua_property__get_set IntVector2& viewPosition;
     tolua_property__get_set UIElement* contentElement;
     tolua_readonly tolua_property__get_set ScrollBar* horizontalScrollBar;

+ 0 - 3
Source/Engine/LuaScript/pkgs/UI/Sprite.pkg

@@ -27,8 +27,6 @@ class Sprite : public UIElement
     Texture* GetTexture() const;
     const IntRect& GetImageRect() const;
     BlendMode GetBlendMode() const;
-    void SetTextureAttr(ResourceRef value);
-    ResourceRef GetTextureAttr() const;
     const Matrix3x4& GetTransform() const;
     
     tolua_property__get_set Vector2& position;
@@ -38,7 +36,6 @@ class Sprite : public UIElement
     tolua_property__get_set Texture* texture;
     tolua_property__get_set IntRect& imageRect;
     tolua_property__get_set BlendMode blendMode;
-    tolua_property__get_set ResourceRef textureAttr;
     tolua_readonly tolua_property__get_set Matrix3x4& transform;
 };
 

+ 1 - 4
Source/Engine/LuaScript/pkgs/UI/Text.pkg

@@ -47,12 +47,10 @@ class Text : public UIElement
     
     void SetEffectDepthBias(float bias);
     float GetEffectDepthBias() const;
-    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;
+    tolua_property__get_set String text;
     tolua_property__get_set HorizontalAlignment textAlignment;
     tolua_property__get_set float rowSpacing;
     tolua_property__get_set bool wordwrap;
@@ -64,7 +62,6 @@ class Text : public UIElement
     tolua_property__get_set Color& effectColor;
     tolua_readonly tolua_property__get_set int rowHeight;
     tolua_readonly tolua_property__get_set unsigned numRows;
-    tolua_property__get_set ResourceRef fontAttr;
 };
 
 ${

+ 1 - 12
Source/Engine/LuaScript/pkgs/UI/Text3D.pkg

@@ -7,7 +7,6 @@ class Text3D : public Drawable
     
     bool SetFont(const String fontName, int size = DEFAULT_FONT_SIZE);
     bool SetFont(Font* font, int size = DEFAULT_FONT_SIZE);
-    bool SetFont(Font* font);
     
     void SetMaterial(Material* material);
     
@@ -48,16 +47,10 @@ class Text3D : public Drawable
     float GetOpacity() const;
     bool GetFaceCamera() const;
     
-    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;
-    tolua_property__get_set String& text;
+    tolua_property__get_set String text;
     tolua_property__get_set HorizontalAlignment textAlignment;
     tolua_property__get_set HorizontalAlignment horizontalAlignment;
     tolua_property__get_set VerticalAlignment verticalAlignment;
@@ -72,9 +65,6 @@ class Text3D : public Drawable
     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;
 };
 
 ${
@@ -90,7 +80,6 @@ static int tolua_UILuaAPI_Text3D_new00_local(lua_State* tolua_S)
     return ToluaNewObjectGC<Text3D>(tolua_S);
 }
 
-#define SetColorAttr SetColor
 #define TOLUA_DISABLE_tolua_get_Text3D_color_ref
 #define tolua_get_Text3D_color_ref NULL
 $}

+ 1 - 1
Source/Engine/LuaScript/pkgs/UI/UI.pkg

@@ -56,7 +56,7 @@ class UI : public Object
     tolua_readonly tolua_property__get_set UIElement* frontElement;
     tolua_readonly tolua_property__get_set UIElement* dragElement;
 
-    tolua_property__get_set String& clipBoardText;
+    tolua_property__get_set String clipBoardText;
     tolua_property__get_set float doubleClickInterval;
     tolua_property__get_set float dragBeginInterval;
     tolua_property__get_set int dragBeginDistance;

+ 34 - 9
Source/Engine/LuaScript/pkgs/UI/UIElement.pkg

@@ -1,3 +1,4 @@
+$#include "File.h"
 $#include "UIElement.h"
 
 enum HorizontalAlignment
@@ -64,6 +65,9 @@ class UIElement : public Serializable
 
     bool LoadXML(Deserializer& source);
     bool SaveXML(Serializer& dest) const;
+    tolua_outside bool UIElementLoadXML @ LoadXML(const String fileName);
+    tolua_outside bool UIElementSaveXML @ SaveXML(const String fileName) const;
+
     bool FilterAttributes(XMLElement& dest) const;
 
     void SetName(const String name);
@@ -130,7 +134,7 @@ class UIElement : public Serializable
     void AddChild(UIElement* element);
     void InsertChild(unsigned index, UIElement* element);
     void RemoveChild(UIElement* element, unsigned index = 0);
-    void RemoveChildAtIndex @ RemoveChild(unsigned index);
+    void RemoveChildAtIndex(unsigned index);
     void RemoveAllChildren();
     void Remove();
     unsigned FindChild(UIElement* element) const;
@@ -205,13 +209,13 @@ class UIElement : public Serializable
     int GetIndentWidth() const;
     void SetChildOffset(const IntVector2& offset);
     void SetHovering(bool enable);
-    const Color& GetColorAttr() const;
+    const Color& GetColorAttr @ GetColor() const;
     TraversalMode GetTraversalMode() const;
     bool IsElementEventSender() const;
     UIElement* GetElementEventSender() const;
     
     tolua_readonly tolua_property__get_set IntVector2& screenPosition;
-    tolua_property__get_set String& name;
+    tolua_property__get_set String name;
     tolua_property__get_set IntVector2& position;
     tolua_property__get_set IntVector2 size;
     tolua_property__get_set int width;
@@ -229,7 +233,7 @@ class UIElement : public Serializable
     tolua_property__get_set HorizontalAlignment horizontalAlignment;
     tolua_property__get_set VerticalAlignment verticalAlignment;
     tolua_property__get_set IntRect clipBorder;
-    tolua_property__get_set Color& color; // Write only property.
+    tolua_property__get_set Color& colorAttr @ color;
     tolua_property__get_set int priority;
     tolua_property__get_set float opacity;
     tolua_readonly tolua_property__get_set float derivedOpacity;
@@ -248,7 +252,7 @@ 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 String& style;
+    tolua_property__get_set String style;
     tolua_property__get_set XMLFile* defaultStyle;
     tolua_property__get_set LayoutMode layoutMode;
     tolua_property__get_set int layoutSpacing;
@@ -262,7 +266,6 @@ class UIElement : public Serializable
     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;
 };
@@ -280,6 +283,30 @@ static int tolua_UILuaAPI_UIElement_new00_local(lua_State* tolua_S)
     return ToluaNewObjectGC<UIElement>(tolua_S);
 }
 
+static bool UIElementLoadXML(UIElement* element, const String& fileName)
+{
+    if (!element)
+        return false;
+
+    File file(element->GetContext());
+    if (!file.Open(fileName, FILE_READ))
+        return false;
+
+    return element->LoadXML(file);
+}
+
+static bool UIElementSaveXML(const UIElement* element, const String& fileName)
+{
+    if (!element)
+        return false;
+
+    File file(element->GetContext());
+    if (!file.Open(fileName, FILE_WRITE))
+        return false;
+
+    return element->SaveXML(file);
+}
+
 // Disable generated CreateChild function.
 #define TOLUA_DISABLE_tolua_UILuaAPI_UIElement_CreateChild00
 
@@ -386,7 +413,5 @@ tolua_lerror:
 }
 
 #define GetStyle GetAppliedStyle
-
-#define TOLUA_DISABLE_tolua_get_UIElement_color_ref
-#define tolua_get_UIElement_color_ref NULL
+#define SetColorAttr SetColor
 $}