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