Browse Source

Add property support in Engine, Navigable, Physics.

Aster Jian 12 years ago
parent
commit
9edef1996a

+ 10 - 0
Extras/LuaScript/pkgs/Engine/Console.pkg

@@ -4,6 +4,7 @@ $#include "Console.h"
 class Console
 {
 public:
+    // Methods:
     /// Set UI elements' style from an XML file.
     void SetDefaultStyle(XMLFile* style);
 
@@ -45,4 +46,13 @@ public:
     
     /// Return history row at index.
     const String& GetHistoryRow(unsigned index) const;
+    
+    // Properties:
+    tolua_property__get_set XMLFile* defaultStyle;
+    tolua_property__is_set bool visible;
+    tolua_property__get_set unsigned numRows;
+    tolua_property__get_set unsigned numHistoryRows;
+    tolua_readonly tolua_property__get_set unsigned historyPosition;
+    tolua_readonly tolua_property__get_set BorderImage* background;
+    tolua_readonly tolua_property__get_set LineEdit* lineEdit;
 };

+ 10 - 0
Extras/LuaScript/pkgs/Engine/DebugHud.pkg

@@ -69,4 +69,14 @@ public:
     
     /// Clear all application-specific stats.
     void ClearAppStats();
+    
+    // Properties:
+    tolua_property__get_set XMLFile* defaultStyle;
+    tolua_property__get_set unsigned mode;
+    tolua_property__get_set unsigned profilerMaxDepth;
+    tolua_property__get_set float profilerInterval;
+    tolua_property__get_set bool useRendererStats;
+    tolua_readonly tolua_property__get_set Text* statsText;
+    tolua_readonly tolua_property__get_set Text* modeText;
+    tolua_readonly tolua_property__get_set Text* profilerText;
 };

+ 10 - 0
Extras/LuaScript/pkgs/Engine/Engine.pkg

@@ -63,4 +63,14 @@ public:
     
     /// Return whether the engine has been created in headless mode.
     bool IsHeadless() const;
+    
+    // Properties:
+    tolua_property__get_set int minFps;
+    tolua_property__get_set int maxFps;
+    tolua_property__get_set int maxInactiveFps;
+    tolua_property__get_set bool pauseMinimized;
+    tolua_property__get_set bool autoExit;
+    tolua_readonly tolua_property__is_set bool initialized;
+    tolua_readonly tolua_property__is_set bool exiting;
+    tolua_readonly tolua_property__is_set bool headless;
 };

+ 3 - 0
Extras/LuaScript/pkgs/Navigation/Navigable.pkg

@@ -8,4 +8,7 @@ public:
     void SetRecursive(bool enable);
     /// Return whether geometry is automatically collected from child nodes.
     bool IsRecursive() const { return recursive_; }
+    
+    // Properties:
+    tolua_property__is_set bool recursive;
 };

+ 20 - 0
Extras/LuaScript/pkgs/Navigation/NavigationMesh.pkg

@@ -99,6 +99,26 @@ public:
     BoundingBox GetWorldBoundingBox() const;
     /// Return number of tiles.
     IntVector2 GetNumTiles() const { return IntVector2(numTilesX_, numTilesZ_); }
+    
+    // Properties:
+    tolua_property__get_set int tileSize;
+    tolua_property__get_set float cellSize;
+    tolua_property__get_set float cellHeight;
+    tolua_property__get_set float agentHeight;
+    tolua_property__get_set float agentRadius;
+    tolua_property__get_set float agentMaxClimb;
+    tolua_property__get_set float agentMaxSlope;
+    tolua_property__get_set float regionMinSize;
+    tolua_property__get_set float regionMergeSize;
+    tolua_property__get_set float edgeMaxLength;
+    tolua_property__get_set float edgeMaxError;
+    tolua_property__get_set float detailSampleDistance;
+    tolua_property__get_set float detailSampleMaxError;
+    tolua_property__get_set const Vector3& padding;
+    tolua_readonly tolua_property__is_set bool initialized;
+    tolua_readonly tolua_property__get_set const BoundingBox& boundingBox;
+    tolua_readonly tolua_property__get_set BoundingBox worldBoundingBox;
+    tolua_readonly tolua_property__get_set IntVector2 numTiles;
 };
 
 ${

+ 5 - 0
Extras/LuaScript/pkgs/Navigation/OffMeshConnection.pkg

@@ -17,4 +17,9 @@ public:
     float GetRadius() const { return radius_; }
     /// Return whether is bidirectional.
     bool IsBidirectional() const { return bidirectional_; }
+    
+    // Properties:
+    tolua_property__get_set Node* endPoint;
+    tolua_property__get_set float radius;
+    tolua_property__is_set bool bidirectional;
 };

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

@@ -80,4 +80,14 @@ public:
     ResourceRef GetModelAttr() const;
     /// Release the collision shape.
     void ReleaseShape();
+    
+    // Properties:
+    tolua_property__get_set ShapeType shapeType;
+    tolua_property__get_set const Vector3& size;
+    tolua_property__get_set const Vector3& position;
+    tolua_property__get_set const Quaternion& rotation;
+    tolua_property__get_set float margin;
+    tolua_property__get_set Model* model;
+    tolua_property__get_set unsigned lodLevel;
+    tolua_readonly tolua_property__get_set BoundingBox worldBoundingBox;
 };

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

@@ -75,4 +75,19 @@ public:
     void ReleaseConstraint();
     /// Apply constraint frames.
     void ApplyFrames();    
+    
+    // Properties:
+    tolua_property__get_set ConstraintType constraintType;
+    tolua_property__get_set const Vector3& position;
+    tolua_property__get_set const Quaternion& rotation;
+    tolua_property__get_set const Vector3& otherPosition;
+    tolua_property__get_set const Quaternion& otherRotation;
+    tolua_property__get_set const Vector3& worldPosition;
+    tolua_property__get_set const Vector2& highLimit;
+    tolua_property__get_set const Vector2& lowLimit;
+    tolua_property__get_set float ERP;
+    tolua_property__get_set float CFM;
+    tolua_property__get_set bool disableCollision;
+    tolua_readonly tolua_property__get_set RigidBody* ownBody;
+    tolua_property__get_set RigidBody* otherBody;
 };

+ 9 - 1
Extras/LuaScript/pkgs/Physics/PhysicsWorld.pkg

@@ -4,7 +4,7 @@ $#include "PhysicsWorld.h"
 struct PhysicsRaycastResult
 {
     PhysicsRaycastResult();
-	
+    
     /// Hit position.
     Vector3 position_ @ position;
     /// Hit normal.
@@ -99,4 +99,12 @@ public:
     void SetApplyingTransforms(bool enable);
     /// Return whether node dirtying should be disregarded.
     bool IsApplyingTransforms() const;
+    
+    // Properties:
+    tolua_property__get_set Vector3 gravity;
+    tolua_property__get_set int numIterations;
+    tolua_property__get_set int fps;
+    tolua_property__get_set bool interpolation;
+    tolua_property__get_set bool internalEdge;
+    tolua_property__get_set bool splitImpulse;
 };

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

@@ -152,4 +152,31 @@ public:
     void RemoveConstraint(Constraint* constraint);
     /// Remove the rigid body.
     void ReleaseBody();
+    
+    // Properties:
+    tolua_property__get_set float mass;
+    tolua_property__get_set const Vector3& position;
+    tolua_property__get_set const Quaternion& rotation;
+    tolua_property__get_set const Vector3& linearVelocity;
+    tolua_property__get_set const Vector3& linearFactor;
+    tolua_property__get_set float linearRestThreshold;
+    tolua_property__get_set float linearDamping;
+    tolua_property__get_set const Vector3& angularVelocity;
+    tolua_property__get_set const Vector3& angularFactor;
+    tolua_property__get_set float angularRestThreshold;
+    tolua_property__get_set float angularDamping;
+    tolua_property__get_set float friction;
+    tolua_property__get_set float restitution;
+    tolua_property__get_set float contactProcessingThreshold;
+    tolua_property__get_set float ccdRadius;
+    tolua_property__get_set float ccdMotionThreshold;
+    tolua_property__get_set bool useGravity;
+    tolua_property__get_set const Vector3& gravityOverride;
+    tolua_readonly tolua_property__get_set const Vector3& centerOfMass;
+    tolua_property__is_set bool kinematic;
+    tolua_property__is_set bool phantom;
+    tolua_readonly tolua_property__is_set bool active;
+    tolua_property__get_set unsigned collisionLayer;
+    tolua_property__get_set unsigned collisionMask;
+    tolua_property__get_set CollisionEventMode collisionEventMode;
 };

+ 13 - 0
Extras/LuaScript/pkgs/basic.lua

@@ -21,6 +21,19 @@ function write(a)
     end
 end
 
+
+function get_property_methods_hook(ptype, name)
+    if ptype == "get_set" then
+        local Name = string.upper(string.sub(name, 1, 1))..string.sub(name, 2)
+        return "Get"..Name, "Set"..Name
+    end
+    
+    if ptype == "is_set" then
+        local Name = string.upper(string.sub(name, 1, 1))..string.sub(name, 2)
+        return "Is"..Name, "Set"..Name
+    end
+end
+
 function post_output_hook(package)
     local result = table.concat(toWrite)
     local function replace(pattern, replacement)