9c7dda5e3947b7434c7e4a10ffc954463bb01f5e
[blender.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
55 //Forward declarations.
56 struct KX_ClientObjectInfo;
57 class KX_RayCast;
58 class RAS_MeshObject;
59 class KX_IPhysicsController;
60 class PHY_IGraphicController;
61 class PHY_IPhysicsEnvironment;
62 struct Object;
63
64 /**
65  * KX_GameObject is the main class for dynamic objects.
66  */
67 class KX_GameObject : public SCA_IObject
68 {
69         Py_Header;
70 protected:
71
72         bool                                                            m_bDyna;
73         KX_ClientObjectInfo*                            m_pClient_info;
74         STR_String                                                      m_name;
75         STR_String                                                      m_text;
76         int                                                                     m_layer;
77         std::vector<RAS_MeshObject*>            m_meshes;
78         struct Object*                                          m_pBlenderObject;
79         struct Object*                                          m_pBlenderGroupObject;
80         
81         bool                                                            m_bSuspendDynamics;
82         bool                                                            m_bUseObjectColor;
83         bool                                                            m_bIsNegativeScaling;
84         MT_Vector4                                                      m_objectColor;
85
86         // visible = user setting
87         // culled = while rendering, depending on camera
88         bool                                                            m_bVisible; 
89         bool                                                            m_bCulled; 
90
91         KX_IPhysicsController*                          m_pPhysicsController1;
92         PHY_IGraphicController*                         m_pGraphicController;
93         // used for ray casting
94         PHY_IPhysicsEnvironment*                        m_pPhysicsEnvironment;
95         STR_String                                                      m_testPropName;
96         bool                                                            m_xray;
97         KX_GameObject*                                          m_pHitObject;
98
99         SG_Node*                                                        m_pSGNode;
100
101         MT_CmMatrix4x4                                          m_OpenGL_4x4Matrix;
102         
103 public:
104         bool                                                            m_isDeformable;
105
106         virtual void    /* This function should be virtual - derived classed override it */
107         Relink(
108                 GEN_Map<GEN_HashedPtr, void*> *map
109         );
110
111         /**
112          * Compute an OpenGl compatable 4x4 matrix. Has the
113          * side effect of storing the result internally. The
114          * memory for the matrix remains the property of this class.
115          */ 
116                 double*                                         
117         GetOpenGLMatrix(
118         );
119
120         /**
121          * Return a pointer to a MT_CmMatrix4x4 storing the 
122          * opengl transformation for this object. This is updated
123          * by a call to GetOpenGLMatrix(). This class owns the 
124          * memory for the returned matrix.
125          */
126
127                 MT_CmMatrix4x4*                         
128         GetOpenGLMatrixPtr(
129         ) { 
130                 return &m_OpenGL_4x4Matrix;
131         };
132
133         /** 
134          * Get a pointer to the game object that is the parent of 
135          * this object. Or NULL if there is no parent. The returned
136          * object is part of a reference counting scheme. Calling
137          * this function ups the reference count on the returned 
138          * object. It is the responsibility of the caller to decrement
139          * the reference count when you have finished with it.
140          */
141                 KX_GameObject*                          
142         GetParent(
143         );
144
145         /** 
146          * Sets the parent of this object to a game object
147          */                     
148         void SetParent(KX_Scene *scene, KX_GameObject *obj);
149
150         /** 
151          * Removes the parent of this object to a game object
152          */                     
153         void RemoveParent(KX_Scene *scene);
154
155         /**
156          * Construct a game object. This class also inherits the 
157          * default constructors - use those with care!
158          */
159
160         KX_GameObject(
161                 void* sgReplicationInfo,
162                 SG_Callbacks callbacks,
163                 PyTypeObject* T=&Type
164         );
165
166         virtual 
167         ~KX_GameObject(
168         );
169
170                 CValue*                         
171         AddRef() { 
172                 /* temporarily to find memleaks */ return CValue::AddRef(); 
173         }
174
175         /** 
176          * @section Stuff which is here due to poor design.
177          * Inherited from CValue and needs an implementation. 
178          * Do not expect these functions do to anything sensible.
179          */
180
181         /**
182          * Inherited from CValue -- does nothing!
183          */
184                 CValue*                         
185         Calc(
186                 VALUE_OPERATOR op,
187                 CValue *val
188         );
189
190         /**
191          * Inherited from CValue -- does nothing!
192          */
193                 CValue*                         
194         CalcFinal(
195                 VALUE_DATA_TYPE dtype,
196                 VALUE_OPERATOR op,
197                 CValue *val
198         );
199
200         /**
201          * Inherited from CValue -- does nothing!
202          */
203         const 
204                 STR_String &    
205         GetText(
206         );
207
208         /**
209          * Inherited from CValue -- does nothing!
210          */
211                 float                           
212         GetNumber(
213         );
214
215         /**
216          * @section Inherited from CValue. These are the useful
217          * part of the CValue interface that this class implements. 
218          */
219
220         /**
221          * Inherited from CValue -- returns the name of this object.
222          */
223                 STR_String                      
224         GetName(
225         );
226
227         /**
228          * Inherited from CValue -- set the name of this object.
229          */
230                 void                            
231         SetName(
232                 STR_String name
233         );
234
235         /**
236          * Inherited from CValue -- does nothing.
237          */
238                 void                            
239         ReplicaSetName(
240                 STR_String name
241         );
242
243         /** 
244          * Inherited from CValue -- return a new copy of this
245          * instance allocated on the heap. Ownership of the new 
246          * object belongs with the caller.
247          */
248         virtual CValue*                         
249         GetReplica(
250         );
251         
252         /**
253          * Inherited from CValue -- Makes sure any internal 
254          * data owned by this class is deep copied. Called internally
255          */
256         virtual void                            
257         ProcessReplica(
258                 KX_GameObject* replica
259         );
260
261         /** 
262          * Return the linear velocity of the game object.
263          */
264                 MT_Vector3 
265         GetLinearVelocity(
266                 bool local=false
267         );
268
269         /** 
270          * Return the linear velocity of a given point in world coordinate
271          * but relative to center of object ([0,0,0]=center of object)
272          */
273                 MT_Vector3 
274         GetVelocity(
275                 const MT_Point3& position
276         );
277
278         /**
279          * Return the mass of the object
280          */
281                 MT_Scalar       
282         GetMass();
283
284         /** 
285          * Return the angular velocity of the game object.
286          */
287                 MT_Vector3 
288         GetAngularVelocity(
289                 bool local=false
290         );
291
292         /** 
293          * Align the object to a given normal.
294          */
295                 void 
296         AlignAxisToVect(
297                 const MT_Vector3& vect,
298                 int axis = 2,
299                 float fac = 1.0
300         );
301
302         /** 
303          * Quick'n'dirty obcolor ipo stuff
304          */
305
306                 void                            
307         SetObjectColor(
308                 const MT_Vector4& rgbavec
309         );
310
311
312                 void 
313         ResolveCombinedVelocities(
314                 const MT_Vector3 & lin_vel,
315                 const MT_Vector3 & ang_vel,
316                 bool lin_vel_local,
317                 bool ang_vel_local
318         );
319
320
321         /**
322          * @return a pointer to the physics environment in use during the game, for rayCasting
323          */
324         PHY_IPhysicsEnvironment* GetPhysicsEnvironment()
325         {
326                 return m_pPhysicsEnvironment;
327         }
328
329         void SetPhysicsEnvironment(PHY_IPhysicsEnvironment* physicsEnvironment)
330         {
331                 m_pPhysicsEnvironment = physicsEnvironment;
332         }
333
334         /**
335          * @return a pointer to the physics controller owned by this class.
336          */
337
338         KX_IPhysicsController* GetPhysicsController() ;
339
340         void    SetPhysicsController(KX_IPhysicsController*     physicscontroller,bool isDynamic) 
341         { 
342                 m_bDyna = isDynamic;
343                 m_pPhysicsController1 = physicscontroller;
344         }
345
346         virtual class RAS_Deformer* GetDeformer()
347         {
348                 return 0;
349         }
350         virtual void    SetDeformer(class RAS_Deformer* deformer)
351         {
352
353         }
354
355         /**
356          * @return a pointer to the graphic controller owner by this class 
357          */
358         PHY_IGraphicController* GetGraphicController()
359         {
360                 return m_pGraphicController;
361         }
362
363         void SetGraphicController(PHY_IGraphicController* graphiccontroller) 
364         { 
365                 m_pGraphicController = graphiccontroller;
366         }
367
368         /**
369          * @section Coordinate system manipulation functions
370          */
371
372         void    NodeSetLocalPosition(const MT_Point3& trans     );
373
374         void    NodeSetLocalOrientation(const MT_Matrix3x3& rot );
375
376         void    NodeSetLocalScale(      const MT_Vector3& scale );
377
378         void    NodeSetRelativeScale(   const MT_Vector3& scale );
379
380         // adapt local position so that world position is set to desired position
381         void    NodeSetWorldPosition(const MT_Point3& trans);
382
383                 void                                            
384         NodeUpdateGS(
385                 double time
386         );
387
388         const 
389                 MT_Matrix3x3&                   
390         NodeGetWorldOrientation(
391         ) const;
392
393         const 
394                 MT_Vector3&                     
395         NodeGetWorldScaling(
396         ) const;
397
398         const 
399                 MT_Point3&                      
400         NodeGetWorldPosition(
401         ) const;
402
403
404         /**
405          * @section scene graph node accessor functions.
406          */
407
408         SG_Node*        GetSGNode(      ) 
409         { 
410                 return m_pSGNode;
411         }
412
413         const   SG_Node* GetSGNode(     ) const 
414         { 
415                 return m_pSGNode;
416         }
417
418         /**
419          * @section blender object accessor functions.
420          */
421
422         struct Object* GetBlenderObject( )
423         {
424                 return m_pBlenderObject;
425         }
426
427         void SetBlenderObject( struct Object* obj)
428         {
429                 m_pBlenderObject = obj;
430         }
431
432         struct Object* GetBlenderGroupObject( )
433         {
434                 return m_pBlenderGroupObject;
435         }
436
437         void SetBlenderGroupObject( struct Object* obj)
438         {
439                 m_pBlenderGroupObject = obj;
440         }
441         
442         bool IsDupliGroup()
443         { 
444                 return (m_pBlenderObject &&
445                                 (m_pBlenderObject->transflag & OB_DUPLIGROUP) &&
446                                 m_pBlenderObject->dup_group != NULL) ? true : false;
447         }
448
449         /**
450          * Set the Scene graph node for this game object.
451          * warning - it is your responsibility to make sure
452          * all controllers look at this new node. You must
453          * also take care of the memory associated with the
454          * old node. This class takes ownership of the new
455          * node.
456          */
457                 void    SetSGNode(SG_Node* node )
458                 { 
459                         m_pSGNode = node; 
460                 }
461         
462         //Is it a dynamic/physics object ?
463         bool    IsDynamic() const 
464         { 
465                 return m_bDyna; 
466         }
467
468         /**
469          * Check if this object has a vertex parent relationship
470          */
471         bool IsVertexParent( )
472         {
473                 return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
474         }
475
476         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
477         bool NeedRayCast(KX_ClientObjectInfo* client);
478
479
480         /**
481          * @section Physics accessors for this node.
482          *
483          * All these calls get passed directly to the physics controller 
484          * owned by this object.
485          * This is real interface bloat. Why not just use the physics controller
486          * directly? I think this is because the python interface is in the wrong
487          * place.
488          */
489
490                 void                                            
491         ApplyForce(
492                 const MT_Vector3& force,        bool local
493         );
494
495                 void                                            
496         ApplyTorque(
497                 const MT_Vector3& torque,
498                 bool local
499         );
500
501                 void                                            
502         ApplyRotation(
503                 const MT_Vector3& drot,
504                 bool local
505         );
506
507                 void                                            
508         ApplyMovement(
509                 const MT_Vector3& dloc,
510                 bool local
511         );
512
513                 void                                            
514         addLinearVelocity(
515                 const MT_Vector3& lin_vel,
516                 bool local
517         );
518
519                 void                                            
520         setLinearVelocity(
521                 const MT_Vector3& lin_vel,
522                 bool local
523         );
524
525                 void                                            
526         setAngularVelocity(
527                 const MT_Vector3& ang_vel,
528                 bool local
529         );
530
531         /**     
532          * Update the physics object transform based upon the current SG_Node
533          * position.
534          */
535                 void
536         UpdateTransform(
537         );
538
539         static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene);
540
541         /**
542          * Function to set IPO option at start of IPO
543          */ 
544                 void    
545         InitIPO(
546                 bool ipo_as_force,
547                 bool ipo_add,
548                 bool ipo_local
549         );
550
551         /**
552          * Odd function to update an ipo. ???
553          */ 
554                 void    
555         UpdateIPO(
556                 float curframetime,
557                 bool recurse
558         );
559         /**
560          * Updates Material Ipo data 
561          */
562                 void 
563         UpdateMaterialData(
564                 dword matname_hash,
565                 MT_Vector4 rgba,
566                 MT_Vector3 specrgb,
567                 MT_Scalar hard,
568                 MT_Scalar spec,
569                 MT_Scalar ref,
570                 MT_Scalar emit,
571                 MT_Scalar alpha
572         );
573
574         /**
575          * @section Mesh accessor functions.
576          */
577
578         /**     
579          * Update buckets to indicate that there is a new
580          * user of this object's meshes.
581          */
582                 void                                            
583         AddMeshUser(
584         );
585         
586         /**     
587          * Update buckets with data about the mesh after
588          * creating or duplicating the object, changing
589          * visibility, object color, .. .
590          */
591                 void                                            
592         UpdateBuckets(
593                 bool recursive
594         );
595
596         /**
597          * Clear the meshes associated with this class
598          * and remove from the bucketing system.
599          * Don't think this actually deletes any of the meshes.
600          */
601                 void                                            
602         RemoveMeshes(
603         );
604
605         /**
606          * Add a mesh to the set of meshes associated with this
607          * node. Meshes added in this way are not deleted by this class.
608          * Make sure you call RemoveMeshes() before deleting the
609          * mesh though,
610          */
611                 void                                            
612         AddMesh(
613                 RAS_MeshObject* mesh
614         ){ 
615                 m_meshes.push_back(mesh);
616         }
617
618         /**
619          * Pick out a mesh associated with the integer 'num'.
620          */
621                 RAS_MeshObject*                         
622         GetMesh(
623                 int num
624         ) const { 
625                 return m_meshes[num]; 
626         }
627
628         /**
629          * Return the number of meshes currently associated with this
630          * game object.
631          */
632                 int                                                     
633         GetMeshCount(
634         ) const { 
635                 return m_meshes.size(); 
636         }
637         
638         /**     
639          * Set the debug color of the meshes associated with this
640          * class. Does this still work?
641          */
642                 void                                            
643         SetDebugColor(
644                 unsigned int bgra
645         );
646
647         /** 
648          * Reset the debug color of meshes associated with this class.
649          */
650                 void                                            
651         ResetDebugColor(
652         );
653
654         /**
655          * Was this object marked visible? (only for the explicit
656          * visibility system).
657          */
658                 bool
659         GetVisible(
660                 void
661         );
662
663         /**
664          * Set visibility flag of this object
665          */
666                 void
667         SetVisible(
668                 bool b,
669                 bool recursive
670         );
671
672         /**
673          * Was this object culled?
674          */
675                 bool
676         GetCulled(
677                 void
678         );
679
680         /**
681          * Set culled flag of this object
682          */
683                 void
684         SetCulled(
685                 bool c
686         );
687
688         /**
689          * Change the layer of the object (when it is added in another layer
690          * than the original layer)
691          */
692                 void
693         SetLayer(
694                 int l
695         );
696
697         /**
698          * Get the object layer
699          */
700                 int
701         GetLayer(
702                 void
703         );
704                 
705         /**
706          * Get the negative scaling state
707          */
708                 bool
709         IsNegativeScaling(
710                 void
711         ) { return m_bIsNegativeScaling; }
712
713         /**
714          * Is this a light?
715          */
716                 virtual bool
717         IsLight(
718                 void
719         ) { return false; }
720
721         /**
722          * @section Logic bubbling methods.
723          */
724
725         /**
726          * Stop making progress
727          */
728         void Suspend(void);
729
730         /**
731          * Resume making progress
732          */
733         void Resume(void);
734         
735         void SuspendDynamics(void) {
736                 if (m_bSuspendDynamics)
737                 {
738                         return;
739                 }
740         
741                 if (m_pPhysicsController1)
742                 {
743                         m_pPhysicsController1->SuspendDynamics();
744                 }
745                 m_bSuspendDynamics = true;
746         }
747         
748         void RestoreDynamics(void) {    
749                 if (!m_bSuspendDynamics)
750                 {
751                         return;
752                 }
753         
754                 if (m_pPhysicsController1)
755                 {
756                         m_pPhysicsController1->RestoreDynamics();
757                 }
758                 m_bSuspendDynamics = false;
759         }
760         
761         KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
762         /**
763          * @section Python interface functions.
764          */
765
766         virtual PyObject* py_getattro(PyObject *attr);
767         virtual int py_setattro(PyObject *attr, PyObject *value);               // py_setattro method
768         virtual PyObject* py_repr(void) { return PyString_FromString(GetName().ReadPtr()); }
769         
770         KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
771         KX_PYMETHOD_O(KX_GameObject,SetPosition);
772         KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
773         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
774         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
775         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
776         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
777         KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
778         KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
779         KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
780         KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
781         KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
782         KX_PYMETHOD_NOARGS(KX_GameObject,GetMass);
783         KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
784         KX_PYMETHOD_NOARGS(KX_GameObject,GetOrientation);
785         KX_PYMETHOD_O(KX_GameObject,SetOrientation);
786         KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
787         KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
788         KX_PYMETHOD_NOARGS(KX_GameObject,GetState);
789         KX_PYMETHOD_O(KX_GameObject,SetState);
790         KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect);
791         KX_PYMETHOD_O(KX_GameObject,GetAxisVect);
792         KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics);
793         KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics);
794         KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody);
795         KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody);
796         KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse);
797         KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin);
798         KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
799         KX_PYMETHOD_O(KX_GameObject,SetParent);
800         KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
801         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);  
802         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
803         KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
804         KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
805         KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames);
806         KX_PYMETHOD_O(KX_GameObject,ReplaceMesh);
807         KX_PYMETHOD_NOARGS(KX_GameObject,EndObject);
808         KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
809         KX_PYMETHOD_DOC(KX_GameObject,rayCast);
810         KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo);
811         KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
812
813         /* attributes */
814         static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
815         static PyObject*        pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
816
817         static PyObject*        pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
818         static int                      pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
819         static PyObject*        pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
820         static int                      pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
821         static PyObject*        pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
822         static int                      pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
823         static PyObject*        pyattr_get_orientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
824         static int                      pyattr_set_orientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
825         static PyObject*        pyattr_get_scaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
826         static int                      pyattr_set_scaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
827         static PyObject*        pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
828         static int                      pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
829         static PyObject*        pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
830         static int                      pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
831         static PyObject*        pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
832         
833         /* for dir(), python3 uses __dir__() */
834         static PyObject*        pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
835         
836         /* Experemental! */
837         static PyObject*        pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
838         static PyObject*        pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
839         static PyObject*        pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
840         
841         /* getitem/setitem */
842         static Py_ssize_t                       Map_Len(PyObject* self);
843         static PyMappingMethods Mapping;
844         static PyObject*                        Map_GetItem(PyObject *self_v, PyObject *item);
845         static int                                      Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val);
846         
847         
848 private :
849
850         /**     
851          * Random internal function to convert python function arguments
852          * to 2 vectors.
853          * @return true if conversion was possible.
854          */
855
856                 bool                                            
857         ConvertPythonVectorArgs(
858                 PyObject* args,
859                 MT_Vector3& pos,
860                 MT_Vector3& pos2
861         );      
862
863 };
864
865 /* utility conversion function */
866 bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok);
867
868 #endif //__KX_GAMEOBJECT
869