Ver Fonte

Add write only property.

Aster Jian há 12 anos atrás
pai
commit
85b9268cba

+ 2 - 1
Bin/Data/LuaScripts/01_HelloWorld.lua

@@ -23,7 +23,8 @@ function HelloWorld:CreateText()
 
     local cache = GetCache()
     helloText:SetFont(cache:GetFont("Fonts/Anonymous Pro.ttf"), 30)
-    helloText:SetColor(Color(0.0, 1.0, 0.0))
+    
+    helloText.color = Color(0.0, 1.0, 0.0)
     
     helloText.horizontalAlignment = HA_CENTER;
     helloText.verticalAlignment = VA_CENTER;

+ 2 - 2
Extras/LuaScript/LuaScript.cpp

@@ -98,7 +98,8 @@ LuaScript::LuaScript(Context* context) :
 
 LuaScript::~LuaScript()
 {
-    lua_close(luaState_);
+    if (luaState_)
+        lua_close(luaState_);
 }
 
 bool LuaScript::ExecuteFile(const String& fileName)
@@ -321,7 +322,6 @@ void LuaScript::HandleConsoleCommand(StringHash eventType, VariantMap& eventData
     ExecuteString(eventData[P_COMMAND].GetString().CString());
 }
 
-
 Context* GetContext()
 {
     return currentContext_;

+ 1 - 1
Extras/LuaScript/LuaScript.h

@@ -40,7 +40,7 @@ class LuaScript : public Object
 public:
     /// Construct.
     LuaScript(Context* context);
-    /// Destruct. Release the AngelLuna engine.
+    /// Destruct.
     ~LuaScript();
 
     /// Execute script file.

+ 28 - 0
Extras/LuaScript/pkgs/Graphics/ParticleEmitter.pkg

@@ -106,6 +106,7 @@ class ParticleEmitter : public BillboardSet
     TextureFrame* GetTextureFrame(unsigned index);
     
     tolua_property__get_set unsigned numParticles;
+    tolua_property__get_set float emissionRate; // Write only property.
     tolua_property__is_set bool emitting;
     tolua_property__get_set bool updateInvisible;
     tolua_property__get_set float minEmissionRate;
@@ -114,16 +115,21 @@ class ParticleEmitter : public BillboardSet
     tolua_property__get_set Vector3& emitterSize;
     tolua_property__get_set float activeTime;
     tolua_property__get_set float inactiveTime;
+    tolua_property__get_set float timeToLive; // Write only property.
     tolua_property__get_set float minTimeToLive;
     tolua_property__get_set float maxTimeToLive;
+    tolua_property__get_set Vector2& particleSize; // Write only property.
     tolua_property__get_set Vector2& minParticleSize;
     tolua_property__get_set Vector2& maxParticleSize;
     tolua_property__get_set Vector3& minDirection;
     tolua_property__get_set Vector3& maxDirection;
+    tolua_property__get_set float velocity; // Write only property.
     tolua_property__get_set float minVelocity;
     tolua_property__get_set float maxVelocity;
+    tolua_property__get_set float rotation; // Write only property.
     tolua_property__get_set float minRotation;
     tolua_property__get_set float maxRotation;
+    tolua_property__get_set float rotationSpeed; // Write only property.
     tolua_property__get_set float minRotationSpeed;
     tolua_property__get_set float maxRotationSpeed;
     tolua_property__get_set Vector3& constantForce;
@@ -133,3 +139,25 @@ class ParticleEmitter : public BillboardSet
     tolua_property__get_set unsigned numColors;
     tolua_property__get_set unsigned numTextureFrames;
 };
+
+${
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_emissionRate
+#define tolua_get_ParticleEmitter_emissionRate NULL
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_timeToLive
+#define tolua_get_ParticleEmitter_timeToLive NULL
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_particleSize_ref
+#define tolua_get_ParticleEmitter_particleSize_ref NULL
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_velocity
+#define tolua_get_ParticleEmitter_velocity NULL
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_rotation
+#define tolua_get_ParticleEmitter_rotation NULL
+
+#define TOLUA_DISABLE_tolua_get_ParticleEmitter_rotationSpeed
+#define tolua_get_ParticleEmitter_rotationSpeed NULL
+
+$}

+ 12 - 0
Extras/LuaScript/pkgs/Physics/Constraint.pkg

@@ -49,8 +49,10 @@ class Constraint : public Component
     tolua_property__get_set RigidBody* otherBody;
     tolua_property__get_set Vector3& position;
     tolua_property__get_set Quaternion& rotation;
+    tolua_property__get_set Vector3& axis; // Write only property.
     tolua_property__get_set Vector3& otherPosition;
     tolua_property__get_set Quaternion& otherRotation;
+    tolua_property__get_set Vector3& otherAxis; // Write only property.
     tolua_property__get_set Vector3 worldPosition;
     tolua_property__get_set Vector2& highLimit;
     tolua_property__get_set Vector2& lowLimit;
@@ -58,3 +60,13 @@ class Constraint : public Component
     tolua_property__get_set float CFM;
     tolua_property__get_set bool disableCollision;
 };
+
+${
+
+#define TOLUA_DISABLE_tolua_get_Constraint_axis_ref
+#define tolua_get_Constraint_axis_ref NULL
+
+#define TOLUA_DISABLE_tolua_get_Constraint_otherAxis_ref
+#define tolua_get_Constraint_otherAxis_ref NULL
+
+$}

+ 8 - 1
Extras/LuaScript/pkgs/UI/Text3D.pkg

@@ -59,6 +59,7 @@ class Text3D : public Drawable
     tolua_property__get_set float rowSpacing;
     tolua_property__get_set bool wordwrap;
     tolua_property__get_set int width;
+    tolua_property__get_set Color& color; // Write only property.
     tolua_readonly tolua_property__get_set int rowHeight;
     tolua_readonly tolua_property__get_set unsigned numRows;
     tolua_property__get_set float opacity;
@@ -68,4 +69,10 @@ class Text3D : public Drawable
     tolua_readonly tolua_property__get_set Color& colorAttr;
 };
 
-$#define SetColorAttr SetColor
+${
+
+#define SetColorAttr SetColor
+#define TOLUA_DISABLE_tolua_get_Text3D_color_ref
+#define tolua_get_Text3D_color_ref NULL
+
+$}

+ 4 - 0
Extras/LuaScript/pkgs/UI/UIElement.pkg

@@ -248,6 +248,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 int priority;
     tolua_property__get_set float opacity;
     tolua_readonly tolua_property__get_set float derivedOpacity;
@@ -298,4 +299,7 @@ static UIElement* UIElementGetChild2(const UIElement* element, const char* key,
 
 #define GetStyle GetAppliedStyle
 
+#define TOLUA_DISABLE_tolua_get_UIElement_color_ref
+#define tolua_get_UIElement_color_ref NULL
+
 $}