Accidentally did a commit when I wanted to revert... (ignore my last revision)
[blender-staging.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_H__
34 #define __KX_GAMEOBJECT_H__
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 compatible 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         void    NodeSetWorldScale(      const MT_Vector3& scale );
479
480         void    NodeSetRelativeScale(   const MT_Vector3& scale );
481
482         // adapt local position so that world position is set to desired position
483         void    NodeSetWorldPosition(const MT_Point3& trans);
484
485                 void                                            
486         NodeUpdateGS(
487                 double time
488         );
489
490         const MT_Matrix3x3& NodeGetWorldOrientation(  ) const;
491         const MT_Vector3& NodeGetWorldScaling(  ) const;
492         const MT_Point3& NodeGetWorldPosition(  ) const;
493
494         const MT_Matrix3x3& NodeGetLocalOrientation(  ) const;
495         const MT_Vector3& NodeGetLocalScaling(  ) const;
496         const MT_Point3& NodeGetLocalPosition(  ) const;
497
498         /**
499          * \section scene graph node accessor functions.
500          */
501
502         SG_Node*        GetSGNode(      ) 
503         { 
504                 return m_pSGNode;
505         }
506
507         const   SG_Node* GetSGNode(     ) const 
508         { 
509                 return m_pSGNode;
510         }
511
512         /**
513          * \section blender object accessor functions.
514          */
515
516         struct Object* GetBlenderObject( )
517         {
518                 return m_pBlenderObject;
519         }
520
521         void SetBlenderObject(struct Object* obj)
522         {
523                 m_pBlenderObject = obj;
524         }
525
526         struct Object* GetBlenderGroupObject( )
527         {
528                 return m_pBlenderGroupObject;
529         }
530
531         void SetBlenderGroupObject(struct Object* obj)
532         {
533                 m_pBlenderGroupObject = obj;
534         }
535         
536         bool IsDupliGroup()
537         { 
538                 return (m_pBlenderObject &&
539                                 (m_pBlenderObject->transflag & OB_DUPLIGROUP) &&
540                                 m_pBlenderObject->dup_group != NULL) ? true : false;
541         }
542
543         /**
544          * Set the Scene graph node for this game object.
545          * warning - it is your responsibility to make sure
546          * all controllers look at this new node. You must
547          * also take care of the memory associated with the
548          * old node. This class takes ownership of the new
549          * node.
550          */
551                 void    SetSGNode(SG_Node* node )
552                 { 
553                         m_pSGNode = node; 
554                 }
555         
556         //Is it a dynamic/physics object ?
557         bool    IsDynamic() const 
558         { 
559                 return m_bDyna; 
560         }
561
562         /**
563          * Check if this object has a vertex parent relationship
564          */
565         bool IsVertexParent( )
566         {
567                 return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
568         }
569
570         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
571         bool NeedRayCast(KX_ClientObjectInfo* client);
572
573
574         /**
575          * \section Physics accessors for this node.
576          *
577          * All these calls get passed directly to the physics controller 
578          * owned by this object.
579          * This is real interface bloat. Why not just use the physics controller
580          * directly? I think this is because the python interface is in the wrong
581          * place.
582          */
583
584                 void                                            
585         ApplyForce(
586                 const MT_Vector3& force,        bool local
587         );
588
589                 void                                            
590         ApplyTorque(
591                 const MT_Vector3& torque,
592                 bool local
593         );
594
595                 void                                            
596         ApplyRotation(
597                 const MT_Vector3& drot,
598                 bool local
599         );
600
601                 void                                            
602         ApplyMovement(
603                 const MT_Vector3& dloc,
604                 bool local
605         );
606
607                 void                                            
608         addLinearVelocity(
609                 const MT_Vector3& lin_vel,
610                 bool local
611         );
612
613                 void                                            
614         setLinearVelocity(
615                 const MT_Vector3& lin_vel,
616                 bool local
617         );
618
619                 void                                            
620         setAngularVelocity(
621                 const MT_Vector3& ang_vel,
622                 bool local
623         );
624
625         /**     
626          * Update the physics object transform based upon the current SG_Node
627          * position.
628          */
629                 void
630         UpdateTransform(
631         );
632
633         static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene);
634
635         /**
636          * only used for sensor objects
637          */
638         void SynchronizeTransform();
639
640         static void SynchronizeTransformFunc(SG_IObject* node, void* gameobj, void* scene);
641
642         /**
643          * Function to set IPO option at start of IPO
644          */ 
645                 void    
646         InitIPO(
647                 bool ipo_as_force,
648                 bool ipo_add,
649                 bool ipo_local
650         );
651
652         /**
653          * Odd function to update an ipo. ???
654          */ 
655                 void    
656         UpdateIPO(
657                 float curframetime,
658                 bool recurse
659         );
660         /**
661          * Updates Material Ipo data 
662          */
663                 void 
664         UpdateMaterialData(
665                 dword matname_hash,
666                 MT_Vector4 rgba,
667                 MT_Vector3 specrgb,
668                 MT_Scalar hard,
669                 MT_Scalar spec,
670                 MT_Scalar ref,
671                 MT_Scalar emit,
672                 MT_Scalar alpha
673         );
674
675         /**
676          * \section Mesh accessor functions.
677          */
678
679         /**     
680          * Update buckets to indicate that there is a new
681          * user of this object's meshes.
682          */
683                 void                                            
684         AddMeshUser(
685         );
686         
687         /**     
688          * Update buckets with data about the mesh after
689          * creating or duplicating the object, changing
690          * visibility, object color, .. .
691          */
692                 void                                            
693         UpdateBuckets(
694                 bool recursive
695         );
696
697         /**
698          * Clear the meshes associated with this class
699          * and remove from the bucketing system.
700          * Don't think this actually deletes any of the meshes.
701          */
702                 void                                            
703         RemoveMeshes(
704         );
705
706         /**
707          * Add a mesh to the set of meshes associated with this
708          * node. Meshes added in this way are not deleted by this class.
709          * Make sure you call RemoveMeshes() before deleting the
710          * mesh though,
711          */
712                 void                                            
713         AddMesh(
714                 RAS_MeshObject* mesh
715         ) {
716                 m_meshes.push_back(mesh);
717         }
718
719         /**
720          * Pick out a mesh associated with the integer 'num'.
721          */
722                 RAS_MeshObject*                         
723         GetMesh(
724                 int num
725         ) const { 
726                 return m_meshes[num]; 
727         }
728
729         /**
730          * Return the number of meshes currently associated with this
731          * game object.
732          */
733                 int                                                     
734         GetMeshCount(
735         ) const { 
736                 return m_meshes.size(); 
737         }
738         
739         /**     
740          * Set the debug color of the meshes associated with this
741          * class. Does this still work?
742          */
743                 void                                            
744         SetDebugColor(
745                 unsigned int bgra
746         );
747
748         /** 
749          * Reset the debug color of meshes associated with this class.
750          */
751                 void                                            
752         ResetDebugColor(
753         );
754
755         /**
756          * Was this object marked visible? (only for the explicit
757          * visibility system).
758          */
759                 bool
760         GetVisible(
761                 void
762         );
763
764         /**
765          * Set visibility flag of this object
766          */
767                 void
768         SetVisible(
769                 bool b,
770                 bool recursive
771         );
772
773         /**
774          * Was this object culled?
775          */
776         inline bool
777         GetCulled(
778                 void
779         ) { return m_bCulled; }
780
781         /**
782          * Set culled flag of this object
783          */
784         inline void
785         SetCulled(
786                 bool c
787         ) { m_bCulled = c; }
788         
789         /**
790          * Is this object an occluder?
791          */
792         inline bool
793         GetOccluder(
794                 void
795         ) { return m_bOccluder; }
796
797         /**
798          * Set occluder flag of this object
799          */
800         void
801         SetOccluder(
802                 bool v,
803                 bool recursive
804         );
805         
806         /**
807          * Change the layer of the object (when it is added in another layer
808          * than the original layer)
809          */
810                 void
811         SetLayer(
812                 int l
813         );
814
815         /**
816          * Get the object layer
817          */
818                 int
819         GetLayer(
820                 void
821         );
822                 
823         /**
824          * Get the negative scaling state
825          */
826                 bool
827         IsNegativeScaling(
828                 void
829         ) { return m_bIsNegativeScaling; }
830
831         /**
832          * \section Logic bubbling methods.
833          */
834
835         /**
836          * Stop making progress
837          */
838         void Suspend(void);
839
840         /**
841          * Resume making progress
842          */
843         void Resume(void);
844         
845         void SuspendDynamics(void) {
846                 if (m_bSuspendDynamics)
847                 {
848                         return;
849                 }
850         
851                 if (m_pPhysicsController1)
852                 {
853                         m_pPhysicsController1->SuspendDynamics();
854                 }
855                 m_bSuspendDynamics = true;
856         }
857         
858         void RestoreDynamics(void) {    
859                 if (!m_bSuspendDynamics)
860                 {
861                         return;
862                 }
863         
864                 if (m_pPhysicsController1)
865                 {
866                         m_pPhysicsController1->RestoreDynamics();
867                 }
868                 m_bSuspendDynamics = false;
869         }
870
871         void RegisterObstacle(KX_ObstacleSimulation* obstacleSimulation)
872         {
873                 m_pObstacleSimulation = obstacleSimulation;
874         }
875
876         void UnregisterObstacle()
877         {
878                 m_pObstacleSimulation = NULL;
879         }
880         
881         KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
882         
883         CListValue* GetChildren();
884         CListValue* GetChildrenRecursive();
885
886 #ifdef WITH_PYTHON
887         /**
888          * \section Python interface functions.
889          */
890         virtual PyObject* py_repr(void)
891         {
892                 return PyUnicode_From_STR_String(GetName());
893         }
894
895         KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
896         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
897         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
898         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
899         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
900         KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
901         KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
902         KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
903         KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
904         KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
905
906         KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
907
908
909         KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
910         KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
911         KX_PYMETHOD_VARARGS(KX_GameObject,SetOcclusion);
912         KX_PYMETHOD_NOARGS(KX_GameObject,GetState);
913         KX_PYMETHOD_O(KX_GameObject,SetState);
914         KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect);
915         KX_PYMETHOD_O(KX_GameObject,GetAxisVect);
916         KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics);
917         KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics);
918         KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody);
919         KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody);
920         KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse);
921         KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin);
922         KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
923         KX_PYMETHOD_VARARGS(KX_GameObject,SetParent);
924         KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
925         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);
926         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
927         KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
928         KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
929         KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames);
930         KX_PYMETHOD_VARARGS(KX_GameObject,ReplaceMesh);
931         KX_PYMETHOD_NOARGS(KX_GameObject,EndObject);
932         KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
933         KX_PYMETHOD_DOC(KX_GameObject,rayCast);
934         KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo);
935         KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
936         KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage);
937         KX_PYMETHOD_VARARGS(KX_GameObject, ReinstancePhysicsMesh);
938
939         KX_PYMETHOD_DOC(KX_GameObject, playAction);
940         KX_PYMETHOD_DOC(KX_GameObject, stopAction);
941         KX_PYMETHOD_DOC(KX_GameObject, getActionFrame);
942         KX_PYMETHOD_DOC(KX_GameObject, setActionFrame);
943         KX_PYMETHOD_DOC(KX_GameObject, isPlayingAction);
944         
945         /* Dict access */
946         KX_PYMETHOD_VARARGS(KX_GameObject,get);
947         
948         /* attributes */
949         static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
950         static PyObject*        pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
951
952         static PyObject*        pyattr_get_life(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
953         static PyObject*        pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
954         static int                      pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
955         static PyObject*        pyattr_get_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
956         static int                      pyattr_set_lin_vel_min(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
957         static PyObject*        pyattr_get_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
958         static int                      pyattr_set_lin_vel_max(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
959         static PyObject*        pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
960         static int                      pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
961         static PyObject*        pyattr_get_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
962         static int                      pyattr_set_worldPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
963         static PyObject*        pyattr_get_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
964         static int                      pyattr_set_localPosition(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
965         static PyObject*        pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
966         static int                      pyattr_set_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
967         static PyObject*        pyattr_get_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
968         static int                      pyattr_set_worldOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
969         static PyObject*        pyattr_get_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
970         static int                      pyattr_set_localOrientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
971         static PyObject*        pyattr_get_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
972         static int                      pyattr_set_worldScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
973         static PyObject*        pyattr_get_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
974         static int                      pyattr_set_localScaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
975         static PyObject*        pyattr_get_localTransform(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
976         static int                      pyattr_set_localTransform(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
977         static PyObject*        pyattr_get_worldTransform(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
978         static int                      pyattr_set_worldTransform(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
979         static PyObject*        pyattr_get_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
980         static int                      pyattr_set_worldLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
981         static PyObject*        pyattr_get_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
982         static int                      pyattr_set_localLinearVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
983         static PyObject*        pyattr_get_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
984         static int                      pyattr_set_worldAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
985         static PyObject*        pyattr_get_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
986         static int                      pyattr_set_localAngularVelocity(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);      
987         static PyObject*        pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
988         static int                      pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
989         static PyObject*        pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
990         static int                      pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
991         static PyObject*        pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
992         static PyObject*        pyattr_get_children(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
993         static PyObject*        pyattr_get_children_recursive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
994         static PyObject*        pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
995         static PyObject*        pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
996         static int                      pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
997         
998         /* Experimental! */
999         static PyObject*        pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
1000         static PyObject*        pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
1001         static PyObject*        pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
1002         
1003         /* getitem/setitem */
1004         static PyMappingMethods Mapping;
1005         static PySequenceMethods        Sequence;
1006 #endif
1007 };
1008
1009
1010
1011 #endif //__KX_GAMEOBJECT_H__
1012