cc078e96e643bd6b02f09c9f59d91e4ca3bf80f1
[blender.git] / source / gameengine / Ketsji / KX_GameObject.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file KX_GameObject.h
29  *  \ingroup ketsji
30  *  \brief General KX game object.
31  */
32
33 #ifndef __KX_GAMEOBJECT
34 #define __KX_GAMEOBJECT
35
36 #if defined(WIN32) && !defined(FREE_WINDOWS)
37 // get rid of this stupid "warning 'this' used in initialiser list", generated by VC when including Solid/Sumo
38 #pragma warning (disable : 4355) 
39 #endif 
40
41 #include <stddef.h>
42
43 #include "ListValue.h"
44 #include "SCA_IObject.h"
45 #include "SG_Node.h"
46 #include "MT_Transform.h"
47 #include "MT_CmMatrix4x4.h"
48 #include "CTR_Map.h"
49 #include "CTR_HashedPtr.h"
50 #include "KX_Scene.h"
51 #include "KX_KetsjiEngine.h" /* for m_anim_framerate */
52 #include "KX_IPhysicsController.h" /* for suspend/resume */
53 #include "DNA_object_types.h"
54 #include "SCA_LogicManager.h" /* for ConvertPythonToGameObject to search object names */
55 #define KX_OB_DYNAMIC 1
56
57 //Forward declarations.
58 struct KX_ClientObjectInfo;
59 class KX_RayCast;
60 class RAS_MeshObject;
61 class KX_IPhysicsController;
62 class PHY_IGraphicController;
63 class PHY_IPhysicsEnvironment;
64 class BL_ActionManager;
65 struct Object;
66 class KX_ObstacleSimulation;
67 struct bAction;
68
69 #ifdef WITH_PYTHON
70 /* utility conversion function */
71 bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix);
72 #endif
73
74 #ifdef USE_MATHUTILS
75 void KX_GameObject_Mathutils_Callback_Init(void);
76 #endif
77
78 /**
79  * KX_GameObject is the main class for dynamic objects.
80  */
81 class KX_GameObject : public SCA_IObject
82 {
83         Py_Header
84 protected:
85
86         bool                                                            m_bDyna;
87         KX_ClientObjectInfo*                            m_pClient_info;
88         STR_String                                                      m_name;
89         STR_String                                                      m_text;
90         int                                                                     m_layer;
91         std::vector<RAS_MeshObject*>            m_meshes;
92         SG_QList                                                        m_meshSlots;    // head of mesh slots of this 
93         struct Object*                                          m_pBlenderObject;
94         struct Object*                                          m_pBlenderGroupObject;
95         
96         bool                                                            m_bSuspendDynamics;
97         bool                                                            m_bUseObjectColor;
98         bool                                                            m_bIsNegativeScaling;
99         MT_Vector4                                                      m_objectColor;
100
101         // visible = user setting
102         // culled = while rendering, depending on camera
103         bool                                                            m_bVisible; 
104         bool                                                            m_bCulled; 
105         bool                                                            m_bOccluder;
106
107         KX_IPhysicsController*                          m_pPhysicsController1;
108         PHY_IGraphicController*                         m_pGraphicController;
109         STR_String                                                      m_testPropName;
110         bool                                                            m_xray;
111         KX_GameObject*                                          m_pHitObject;
112
113         SG_Node*                                                        m_pSGNode;
114
115         MT_CmMatrix4x4                                          m_OpenGL_4x4Matrix;
116
117         KX_ObstacleSimulation*                          m_pObstacleSimulation;
118
119
120         // The action manager is used to play/stop/update actions
121         BL_ActionManager*                               m_actionManager;
122
123         BL_ActionManager* GetActionManager();
124         
125 public:
126         bool                                                            m_isDeformable;
127
128         /**
129          * Helper function for modules that can't include KX_ClientObjectInfo.h
130          */
131         static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info);
132
133 #ifdef WITH_PYTHON
134         // Python attributes that wont convert into CValue
135         // 
136         // there are 2 places attributes can be stored, in the CValue,
137         // where attributes are converted into BGE's CValue types
138         // these can be used with property actuators
139         //
140         // For the python API, For types that cannot be converted into CValues (lists, dicts, GameObjects)
141         // these will be put into "m_attr_dict", logic bricks cannot access them.
142         // 
143         // rules for setting attributes.
144         // 
145         // * there should NEVER be a CValue and a m_attr_dict attribute with matching names. get/sets make sure of this.
146         // * if CValue conversion fails, use a PyObject in "m_attr_dict"
147         // * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue
148         // 
149         PyObject*                                                       m_attr_dict; 
150 #endif
151
152         virtual void    /* This function should be virtual - derived classed override it */
153         Relink(
154                 CTR_Map<CTR_HashedPtr, void*> *map
155         );
156
157         /**
158          * Compute an OpenGl compatable 4x4 matrix. Has the
159          * side effect of storing the result internally. The
160          * memory for the matrix remains the property of this class.
161          */ 
162                 double*                                         
163         GetOpenGLMatrix(
164         );
165
166         /**
167          * Return a pointer to a MT_CmMatrix4x4 storing the 
168          * opengl transformation for this object. This is updated
169          * by a call to GetOpenGLMatrix(). This class owns the 
170          * memory for the returned matrix.
171          */
172
173                 MT_CmMatrix4x4*                         
174         GetOpenGLMatrixPtr(
175         ) { 
176                 return &m_OpenGL_4x4Matrix;
177         };
178
179         /**
180          * Update the blender object obmat field from the object world position
181          * if blendobj is NULL, update the object pointed by m_pBlenderObject
182          * The user must take action to restore the matrix before leaving the GE.
183          * Used in Armature evaluation
184          */
185                 void
186         UpdateBlenderObjectMatrix(Object* blendobj=NULL);
187
188         /** 
189          * Get a pointer to the game object that is the parent of 
190          * this object. Or NULL if there is no parent. The returned
191          * object is part of a reference counting scheme. Calling
192          * this function ups the reference count on the returned 
193          * object. It is the responsibility of the caller to decrement
194          * the reference count when you have finished with it.
195          */
196                 KX_GameObject*                          
197         GetParent(
198         );
199
200         /** 
201          * Sets the parent of this object to a game object
202          */                     
203         void SetParent(KX_Scene *scene, KX_GameObject *obj, bool addToCompound=true, bool ghost=true);
204
205         /** 
206          * Removes the parent of this object to a game object
207          */                     
208         void RemoveParent(KX_Scene *scene);
209
210         /*********************************
211          * Animation API
212          *********************************/
213
214         /**
215          * Adds an action to the object's action manager
216          */
217         bool PlayAction(const char* name,
218                                         float start,
219                                         float end,
220                                         short layer=0,
221                                         short priority=0,
222                                         float blendin=0.f,
223                                         short play_mode=0,
224                                         float layer_weight=0.f,
225                                         short ipo_flags=0,
226                                         float playback_speed=1.f);
227
228         /**
229          * Gets the current frame of an action
230          */
231         float GetActionFrame(short layer);
232
233         /**
234          * Sets the current frame of an action
235          */
236         void SetActionFrame(short layer, float frame);
237
238         /**
239          * Gets the currently running action on the given layer
240          */
241         bAction *GetCurrentAction(short layer);
242
243         /**
244          * Sets play mode of the action on the given layer
245          */
246         void SetPlayMode(short layer, short mode);
247
248         /**
249          * Sets the start and end times of the action on the given layer
250          */
251         void SetTimes(short layer, float start, float end);
252
253         /**
254          * Stop playing the action on the given layer
255          */
256         void StopAction(short layer);
257
258         /**
259          * Check if an action has finished playing
260          */
261         bool IsActionDone(short layer);
262
263         /**
264          * Kick the object's action manager
265          */
266         void UpdateActionManager(float curtime);
267
268         /*********************************
269          * End Animation API
270          *********************************/
271
272         /**
273          * Construct a game object. This class also inherits the 
274          * default constructors - use those with care!
275          */
276
277         KX_GameObject(
278                 void* sgReplicationInfo,
279                 SG_Callbacks callbacks
280         );
281
282         virtual 
283         ~KX_GameObject(
284         );
285
286         /** 
287          * @section Stuff which is here due to poor design.
288          * Inherited from CValue and needs an implementation. 
289          * Do not expect these functions do to anything sensible.
290          */
291
292         /**
293          * Inherited from CValue -- does nothing!
294          */
295                 CValue*                         
296         Calc(
297                 VALUE_OPERATOR op,
298                 CValue *val
299         );
300
301         /**
302          * Inherited from CValue -- does nothing!
303          */
304                 CValue*                         
305         CalcFinal(
306                 VALUE_DATA_TYPE dtype,
307                 VALUE_OPERATOR op,
308                 CValue *val
309         );
310
311         /**
312          * Inherited from CValue -- does nothing!
313          */
314         const 
315                 STR_String &    
316         GetText(
317         );
318
319         /**
320          * Inherited from CValue -- does nothing!
321          */
322                 double
323         GetNumber(
324         );
325
326         /**
327          * @section Inherited from CValue. These are the useful
328          * part of the CValue interface that this class implements. 
329          */
330
331         /**
332          * Inherited from CValue -- returns the name of this object.
333          */
334                 STR_String&                     
335         GetName(
336         );
337
338         /**
339          * Inherited from CValue -- set the name of this object.
340          */
341                 void                            
342         SetName(
343                 const char *name
344         );
345
346         /** 
347          * Inherited from CValue -- return a new copy of this
348          * instance allocated on the heap. Ownership of the new 
349          * object belongs with the caller.
350          */
351         virtual CValue*                         
352         GetReplica(
353         );
354         
355         /**
356          * Inherited from CValue -- Makes sure any internal 
357          * data owned by this class is deep copied. Called internally
358          */
359         virtual void                            
360         ProcessReplica();
361
362         /** 
363          * Return the linear velocity of the game object.
364          */
365                 MT_Vector3 
366         GetLinearVelocity(
367                 bool local=false
368         );
369
370         /** 
371          * Return the linear velocity of a given point in world coordinate
372          * but relative to center of object ([0,0,0]=center of object)
373          */
374                 MT_Vector3 
375         GetVelocity(
376                 const MT_Point3& position
377         );
378
379         /**
380          * Return the mass of the object
381          */
382                 MT_Scalar       
383         GetMass();
384
385         /**
386          * Return the local inertia vector of the object
387          */
388                 MT_Vector3
389         GetLocalInertia();
390
391         /** 
392          * Return the angular velocity of the game object.
393          */
394                 MT_Vector3 
395         GetAngularVelocity(
396                 bool local=false
397         );
398
399         /** 
400          * Align the object to a given normal.
401          */
402                 void 
403         AlignAxisToVect(
404                 const MT_Vector3& vect,
405                 int axis = 2,
406                 float fac = 1.0
407         );
408
409         /** 
410          * Quick'n'dirty obcolor ipo stuff
411          */
412
413                 void                            
414         SetObjectColor(
415                 const MT_Vector4& rgbavec
416         );
417
418                 const MT_Vector4&
419         GetObjectColor();
420
421
422                 void 
423         ResolveCombinedVelocities(
424                 const MT_Vector3 & lin_vel,
425                 const MT_Vector3 & ang_vel,
426                 bool lin_vel_local,
427                 bool ang_vel_local
428         );
429
430         /**
431          * @return a pointer to the physics controller owned by this class.
432          */
433
434         KX_IPhysicsController* GetPhysicsController() ;
435
436         void    SetPhysicsController(KX_IPhysicsController*     physicscontroller,bool isDynamic) 
437         { 
438                 m_bDyna = isDynamic;
439                 m_pPhysicsController1 = physicscontroller;
440         }
441
442         virtual class RAS_Deformer* GetDeformer()
443         {
444                 return 0;
445         }
446         virtual void    SetDeformer(class RAS_Deformer* deformer)
447         {
448
449         }
450
451         /**
452          * @return a pointer to the graphic controller owner by this class 
453          */
454         PHY_IGraphicController* GetGraphicController()
455         {
456                 return m_pGraphicController;
457         }
458
459         void SetGraphicController(PHY_IGraphicController* graphiccontroller) 
460         { 
461                 m_pGraphicController = graphiccontroller;
462         }
463         /*
464          * @add/remove the graphic controller to the physic system
465          */
466         void ActivateGraphicController(bool recurse);
467
468         /**
469          * @section Coordinate system manipulation functions
470          */
471
472         void    NodeSetLocalPosition(const MT_Point3& trans     );
473
474         void    NodeSetLocalOrientation(const MT_Matrix3x3& rot );
475         void    NodeSetGlobalOrientation(const MT_Matrix3x3& rot        );
476
477         void    NodeSetLocalScale(      const MT_Vector3& scale );
478
479         void    NodeSetRelativeScale(   const MT_Vector3& scale );
480
481         // adapt local position so that world position is set to desired position
482         void    NodeSetWorldPosition(const MT_Point3& trans);
483
484                 void                                            
485         NodeUpdateGS(
486                 double time
487         );
488
489         const MT_Matrix3x3& NodeGetWorldOrientation(  ) const;
490         const MT_Vector3& NodeGetWorldScaling(  ) const;
491         const MT_Point3& NodeGetWorldPosition(  ) const;
492
493         const MT_Matrix3x3& NodeGetLocalOrientation(  ) const;
494         const MT_Vector3& NodeGetLocalScaling(  ) const;
495         const MT_Point3& NodeGetLocalPosition(  ) const;
496
497         /**
498          * @section scene graph node accessor functions.
499          */
500
501         SG_Node*        GetSGNode(      ) 
502         { 
503                 return m_pSGNode;
504         }
505
506         const   SG_Node* GetSGNode(     ) const 
507         { 
508                 return m_pSGNode;
509         }
510
511         /**
512          * @section blender object accessor functions.
513          */
514
515         struct Object* GetBlenderObject( )
516         {
517                 return m_pBlenderObject;
518         }
519
520         void SetBlenderObject( struct Object* obj)
521         {
522                 m_pBlenderObject = obj;
523         }
524
525         struct Object* GetBlenderGroupObject( )
526         {
527                 return m_pBlenderGroupObject;
528         }
529
530         void SetBlenderGroupObject( struct Object* obj)
531         {
532                 m_pBlenderGroupObject = obj;
533         }
534         
535         bool IsDupliGroup()
536         { 
537                 return (m_pBlenderObject &&
538                                 (m_pBlenderObject->transflag & OB_DUPLIGROUP) &&
539                                 m_pBlenderObject->dup_group != NULL) ? true : false;
540         }
541
542         /**
543          * Set the Scene graph node for this game object.
544          * warning - it is your responsibility to make sure
545          * all controllers look at this new node. You must
546          * also take care of the memory associated with the
547          * old node. This class takes ownership of the new
548          * node.
549          */
550                 void    SetSGNode(SG_Node* node )
551                 { 
552                         m_pSGNode = node; 
553                 }
554         
555         //Is it a dynamic/physics object ?
556         bool    IsDynamic() const 
557         { 
558                 return m_bDyna; 
559         }
560
561         /**
562          * Check if this object has a vertex parent relationship
563          */
564         bool IsVertexParent( )
565         {
566                 return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
567         }
568
569         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
570         bool NeedRayCast(KX_ClientObjectInfo* client);
571
572
573         /**
574          * @section Physics accessors for this node.
575          *
576          * All these calls get passed directly to the physics controller 
577          * owned by this object.
578          * This is real interface bloat. Why not just use the physics controller
579          * directly? I think this is because the python interface is in the wrong
580          * place.
581          */
582
583                 void                                            
584         ApplyForce(
585                 const MT_Vector3& force,        bool local
586         );
587
588                 void                                            
589         ApplyTorque(
590                 const MT_Vector3& torque,
591                 bool local
592         );
593
594                 void                                            
595         ApplyRotation(
596                 const MT_Vector3& drot,
597                 bool local
598         );
599
600                 void                                            
601         ApplyMovement(
602                 const MT_Vector3& dloc,
603                 bool local
604         );
605
606                 void                                            
607         addLinearVelocity(
608                 const MT_Vector3& lin_vel,
609                 bool local
610         );
611
612                 void                                            
613         setLinearVelocity(
614                 const MT_Vector3& lin_vel,
615                 bool local
616         );
617
618                 void                                            
619         setAngularVelocity(
620                 const MT_Vector3& ang_vel,
621                 bool local
622         );
623
624         /**     
625          * Update the physics object transform based upon the current SG_Node
626          * position.
627          */
628                 void
629         UpdateTransform(
630         );
631
632         static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene);
633
634         /**
635          * only used for sensor objects
636          */
637         void SynchronizeTransform();
638
639         static void SynchronizeTransformFunc(SG_IObject* node, void* gameobj, void* scene);
640
641         /**
642          * Function to set IPO option at start of IPO
643          */ 
644                 void    
645         InitIPO(
646                 bool ipo_as_force,
647                 bool ipo_add,
648                 bool ipo_local
649         );
650
651         /**
652          * Odd function to update an ipo. ???
653          */ 
654                 void    
655         UpdateIPO(
656                 float curframetime,
657                 bool recurse
658         );
659         /**
660          * Updates Material Ipo data 
661          */
662                 void 
663         UpdateMaterialData(
664                 dword matname_hash,
665                 MT_Vector4 rgba,
666                 MT_Vector3 specrgb,
667                 MT_Scalar hard,
668                 MT_Scalar spec,
669                 MT_Scalar ref,
670                 MT_Scalar emit,
671                 MT_Scalar alpha
672         );
673
674         /**
675          * @section Mesh accessor functions.
676          */
677
678         /**     
679          * Update buckets to indicate that there is a new
680          * user of this object's meshes.
681          */
682                 void                                            
683         AddMeshUser(
684         );
685         
686         /**     
687          * Update buckets with data about the mesh after
688          * creating or duplicating the object, changing
689          * visibility, object color, .. .
690          */
691                 void                                            
692         UpdateBuckets(
693                 bool recursive
694         );
695
696         /**
697          * Clear the meshes associated with this class
698          * and remove from the bucketing system.
699          * Don't think this actually deletes any of the meshes.
700          */
701                 void                                            
702         RemoveMeshes(
703         );
704
705         /**
706          * Add a mesh to the set of meshes associated with this
707          * node. Meshes added in this way are not deleted by this class.
708          * Make sure you call RemoveMeshes() before deleting the
709          * mesh though,
710          */
711                 void                                            
712         AddMesh(
713                 RAS_MeshObject* mesh
714         ){ 
715                 m_meshes.push_back(mesh);
716         }
717
718         /**
719          * Pick out a mesh associated with the integer 'num'.
720          */
721                 RAS_MeshObject*                         
722         GetMesh(
723                 int num
724         ) const { 
725                 return m_meshes[num]; 
726         }
727
728         /**
729          * Return the number of meshes currently associated with this
730          * game object.
731          */
732                 int                                                     
733         GetMeshCount(
734         ) const { 
735                 return m_meshes.size(); 
736         }
737         
738         /**     
739          * Set the debug color of the meshes associated with this
740          * class. Does this still work?
741          */
742                 void                                            
743         SetDebugColor(
744                 unsigned int bgra
745         );
746
747         /** 
748          * Reset the debug color of meshes associated with this class.
749          */
750                 void                                            
751         ResetDebugColor(
752         );
753
754         /**
755          * Was this object marked visible? (only for the explicit
756          * visibility system).
757          */
758                 bool
759         GetVisible(
760                 void
761         );
762
763         /**
764          * Set visibility flag of this object
765          */
766                 void
767         SetVisible(
768                 bool b,
769                 bool recursive
770         );
771
772         /**
773          * Was this object culled?
774          */
775         inline bool
776         GetCulled(
777                 void
778         ) { return m_bCulled; }
779
780         /**
781          * Set culled flag of this object
782          */
783         inline void
784         SetCulled(
785                 bool c
786         ) { m_bCulled = c; }
787         
788         /**
789          * Is this object an occluder?
790          */
791         inline bool
792         GetOccluder(
793                 void
794         ) { return m_bOccluder; }
795
796         /**
797          * Set occluder flag of this object
798          */
799         void
800         SetOccluder(
801                 bool v,
802                 bool recursive
803         );
804         
805         /**
806          * Change the layer of the object (when it is added in another layer
807          * than the original layer)
808          */
809                 void
810         SetLayer(
811                 int l
812         );
813
814         /**
815          * Get the object layer
816          */
817                 int
818         GetLayer(
819                 void
820         );
821                 
822         /**
823          * Get the negative scaling state
824          */
825                 bool
826         IsNegativeScaling(
827                 void
828         ) { return m_bIsNegativeScaling; }
829
830         /**
831          * @section Logic bubbling methods.
832          */
833
834         /**
835          * Stop making progress
836          */
837         void Suspend(void);
838
839         /**
840          * Resume making progress
841          */
842         void Resume(void);
843         
844         void SuspendDynamics(void) {
845                 if (m_bSuspendDynamics)
846                 {
847                         return;
848                 }
849         
850                 if (m_pPhysicsController1)
851                 {
852                         m_pPhysicsController1->SuspendDynamics();
853                 }
854                 m_bSuspendDynamics = true;
855         }
856         
857         void RestoreDynamics(void) {    
858                 if (!m_bSuspendDynamics)
859                 {
860                         return;
861                 }
862         
863                 if (m_pPhysicsController1)
864                 {
865                         m_pPhysicsController1->RestoreDynamics();
866                 }
867                 m_bSuspendDynamics = false;
868         }
869
870         void RegisterObstacle(KX_ObstacleSimulation* obstacleSimulation)
871         {
872                 m_pObstacleSimulation = obstacleSimulation;
873         }
874
875         void UnregisterObstacle()
876         {
877                 m_pObstacleSimulation = NULL;
878         }
879         
880         KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
881         
882         CListValue* GetChildren();
883         CListValue* GetChildrenRecursive();
884
885 #ifdef WITH_PYTHON
886         /**
887          * @section Python interface functions.
888          */
889         virtual PyObject* py_repr(void)
890         {
891                 return PyUnicode_From_STR_String(GetName());
892         }
893
894         KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
895         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
896         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
897         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
898         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
899         KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
900         KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
901         KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
902         KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
903         KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
904
905         KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
906
907
908         KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
909         KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
910         KX_PYMETHOD_VARARGS(KX_GameObject,SetOcclusion);
911         KX_PYMETHOD_NOARGS(KX_GameObject,GetState);
912         KX_PYMETHOD_O(KX_GameObject,SetState);
913         KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect);
914         KX_PYMETHOD_O(KX_GameObject,GetAxisVect);
915         KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics);
916         KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics);
917         KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody);
918         KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody);
919         KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse);
920         KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin);
921         KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
922         KX_PYMETHOD_VARARGS(KX_GameObject,SetParent);
923         KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
924         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);
925         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
926         KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
927         KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
928         KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames);
929         KX_PYMETHOD_VARARGS(KX_GameObject,ReplaceMesh);
930         KX_PYMETHOD_NOARGS(KX_GameObject,EndObject);
931         KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
932         KX_PYMETHOD_DOC(KX_GameObject,rayCast);
933         KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo);
934         KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
935         KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage);
936         KX_PYMETHOD_VARARGS(KX_GameObject, ReinstancePhysicsMesh);
937
938         KX_PYMETHOD_DOC(KX_GameObject, playAction);
939         KX_PYMETHOD_DOC(KX_GameObject, stopAction);
940         KX_PYMETHOD_DOC(KX_GameObject, getActionFrame);
941         KX_PYMETHOD_DOC(KX_GameObject, setActionFrame);
942         KX_PYMETHOD_DOC(KX_GameObject, isPlayingAction);
943         
944         /* Dict access */
945         KX_PYMETHOD_VARARGS(KX_GameObject,get);
946         
947         /* attributes */
948         static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
949         static PyObject*        pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
950
951         static PyObject*        pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
952         static PyObject*        pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
953         static int                      pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
954         static PyObject*        pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
955         static int                      pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
956         static PyObject*        pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
957         static int                      pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
958         static PyObject*        pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
959         static int                      pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
960         static PyObject*        pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
961         static int                      pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
962         static PyObject*        pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
963         static int                      pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
964         static PyObject*        pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
965         static int                      pyattr_set_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
966         static PyObject*        pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
967         static int                      pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
968         static PyObject*        pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
969         static int                      pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
970         static PyObject*        pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
971         static PyObject*        pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
972         static int                      pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
973         static PyObject*        pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
974         static int                      pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
975         static PyObject*        pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
976         static int                      pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
977         static PyObject*        pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
978         static int                      pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
979         static PyObject*        pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
980         static int                      pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);      
981         static PyObject*        pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
982         static int                      pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
983         static PyObject*        pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
984         static int                      pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
985         static PyObject*        pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
986         static PyObject*        pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
987         static PyObject*        pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
988         static PyObject*        pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
989         static PyObject*        pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
990         static int                      pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
991         
992         /* Experemental! */
993         static PyObject*        pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
994         static PyObject*        pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
995         static PyObject*        pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
996         
997         /* getitem/setitem */
998         static PyMappingMethods Mapping;
999         static PySequenceMethods        Sequence;
1000 #endif
1001 };
1002
1003
1004
1005 #endif //__KX_GAMEOBJECT
1006