BGE patch #18350: Add sendMessage() to GameLogic. Added sendMessage to both GameLogic...
[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 local inertia vector of the object
286          */
287                 MT_Vector3
288         GetLocalInertia();
289
290         /** 
291          * Return the angular velocity of the game object.
292          */
293                 MT_Vector3 
294         GetAngularVelocity(
295                 bool local=false
296         );
297
298         /** 
299          * Align the object to a given normal.
300          */
301                 void 
302         AlignAxisToVect(
303                 const MT_Vector3& vect,
304                 int axis = 2,
305                 float fac = 1.0
306         );
307
308         /** 
309          * Quick'n'dirty obcolor ipo stuff
310          */
311
312                 void                            
313         SetObjectColor(
314                 const MT_Vector4& rgbavec
315         );
316
317
318                 void 
319         ResolveCombinedVelocities(
320                 const MT_Vector3 & lin_vel,
321                 const MT_Vector3 & ang_vel,
322                 bool lin_vel_local,
323                 bool ang_vel_local
324         );
325
326
327         /**
328          * @return a pointer to the physics environment in use during the game, for rayCasting
329          */
330         PHY_IPhysicsEnvironment* GetPhysicsEnvironment()
331         {
332                 return m_pPhysicsEnvironment;
333         }
334
335         void SetPhysicsEnvironment(PHY_IPhysicsEnvironment* physicsEnvironment)
336         {
337                 m_pPhysicsEnvironment = physicsEnvironment;
338         }
339
340         /**
341          * @return a pointer to the physics controller owned by this class.
342          */
343
344         KX_IPhysicsController* GetPhysicsController() ;
345
346         void    SetPhysicsController(KX_IPhysicsController*     physicscontroller,bool isDynamic) 
347         { 
348                 m_bDyna = isDynamic;
349                 m_pPhysicsController1 = physicscontroller;
350         }
351
352         virtual class RAS_Deformer* GetDeformer()
353         {
354                 return 0;
355         }
356         virtual void    SetDeformer(class RAS_Deformer* deformer)
357         {
358
359         }
360
361         /**
362          * @return a pointer to the graphic controller owner by this class 
363          */
364         PHY_IGraphicController* GetGraphicController()
365         {
366                 return m_pGraphicController;
367         }
368
369         void SetGraphicController(PHY_IGraphicController* graphiccontroller) 
370         { 
371                 m_pGraphicController = graphiccontroller;
372         }
373
374         /**
375          * @section Coordinate system manipulation functions
376          */
377
378         void    NodeSetLocalPosition(const MT_Point3& trans     );
379
380         void    NodeSetLocalOrientation(const MT_Matrix3x3& rot );
381
382         void    NodeSetLocalScale(      const MT_Vector3& scale );
383
384         void    NodeSetRelativeScale(   const MT_Vector3& scale );
385
386         // adapt local position so that world position is set to desired position
387         void    NodeSetWorldPosition(const MT_Point3& trans);
388
389                 void                                            
390         NodeUpdateGS(
391                 double time
392         );
393
394         const 
395                 MT_Matrix3x3&                   
396         NodeGetWorldOrientation(
397         ) const;
398
399         const 
400                 MT_Vector3&                     
401         NodeGetWorldScaling(
402         ) const;
403
404         const 
405                 MT_Point3&                      
406         NodeGetWorldPosition(
407         ) const;
408
409
410         /**
411          * @section scene graph node accessor functions.
412          */
413
414         SG_Node*        GetSGNode(      ) 
415         { 
416                 return m_pSGNode;
417         }
418
419         const   SG_Node* GetSGNode(     ) const 
420         { 
421                 return m_pSGNode;
422         }
423
424         /**
425          * @section blender object accessor functions.
426          */
427
428         struct Object* GetBlenderObject( )
429         {
430                 return m_pBlenderObject;
431         }
432
433         void SetBlenderObject( struct Object* obj)
434         {
435                 m_pBlenderObject = obj;
436         }
437
438         struct Object* GetBlenderGroupObject( )
439         {
440                 return m_pBlenderGroupObject;
441         }
442
443         void SetBlenderGroupObject( struct Object* obj)
444         {
445                 m_pBlenderGroupObject = obj;
446         }
447         
448         bool IsDupliGroup()
449         { 
450                 return (m_pBlenderObject &&
451                                 (m_pBlenderObject->transflag & OB_DUPLIGROUP) &&
452                                 m_pBlenderObject->dup_group != NULL) ? true : false;
453         }
454
455         /**
456          * Set the Scene graph node for this game object.
457          * warning - it is your responsibility to make sure
458          * all controllers look at this new node. You must
459          * also take care of the memory associated with the
460          * old node. This class takes ownership of the new
461          * node.
462          */
463                 void    SetSGNode(SG_Node* node )
464                 { 
465                         m_pSGNode = node; 
466                 }
467         
468         //Is it a dynamic/physics object ?
469         bool    IsDynamic() const 
470         { 
471                 return m_bDyna; 
472         }
473
474         /**
475          * Check if this object has a vertex parent relationship
476          */
477         bool IsVertexParent( )
478         {
479                 return (m_pSGNode && m_pSGNode->GetSGParent() && m_pSGNode->GetSGParent()->IsVertexParent());
480         }
481
482         bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
483         bool NeedRayCast(KX_ClientObjectInfo* client);
484
485
486         /**
487          * @section Physics accessors for this node.
488          *
489          * All these calls get passed directly to the physics controller 
490          * owned by this object.
491          * This is real interface bloat. Why not just use the physics controller
492          * directly? I think this is because the python interface is in the wrong
493          * place.
494          */
495
496                 void                                            
497         ApplyForce(
498                 const MT_Vector3& force,        bool local
499         );
500
501                 void                                            
502         ApplyTorque(
503                 const MT_Vector3& torque,
504                 bool local
505         );
506
507                 void                                            
508         ApplyRotation(
509                 const MT_Vector3& drot,
510                 bool local
511         );
512
513                 void                                            
514         ApplyMovement(
515                 const MT_Vector3& dloc,
516                 bool local
517         );
518
519                 void                                            
520         addLinearVelocity(
521                 const MT_Vector3& lin_vel,
522                 bool local
523         );
524
525                 void                                            
526         setLinearVelocity(
527                 const MT_Vector3& lin_vel,
528                 bool local
529         );
530
531                 void                                            
532         setAngularVelocity(
533                 const MT_Vector3& ang_vel,
534                 bool local
535         );
536
537         /**     
538          * Update the physics object transform based upon the current SG_Node
539          * position.
540          */
541                 void
542         UpdateTransform(
543         );
544
545         static void UpdateTransformFunc(SG_IObject* node, void* gameobj, void* scene);
546
547         /**
548          * Function to set IPO option at start of IPO
549          */ 
550                 void    
551         InitIPO(
552                 bool ipo_as_force,
553                 bool ipo_add,
554                 bool ipo_local
555         );
556
557         /**
558          * Odd function to update an ipo. ???
559          */ 
560                 void    
561         UpdateIPO(
562                 float curframetime,
563                 bool recurse
564         );
565         /**
566          * Updates Material Ipo data 
567          */
568                 void 
569         UpdateMaterialData(
570                 dword matname_hash,
571                 MT_Vector4 rgba,
572                 MT_Vector3 specrgb,
573                 MT_Scalar hard,
574                 MT_Scalar spec,
575                 MT_Scalar ref,
576                 MT_Scalar emit,
577                 MT_Scalar alpha
578         );
579
580         /**
581          * @section Mesh accessor functions.
582          */
583
584         /**     
585          * Update buckets to indicate that there is a new
586          * user of this object's meshes.
587          */
588                 void                                            
589         AddMeshUser(
590         );
591         
592         /**     
593          * Update buckets with data about the mesh after
594          * creating or duplicating the object, changing
595          * visibility, object color, .. .
596          */
597                 void                                            
598         UpdateBuckets(
599                 bool recursive
600         );
601
602         /**
603          * Clear the meshes associated with this class
604          * and remove from the bucketing system.
605          * Don't think this actually deletes any of the meshes.
606          */
607                 void                                            
608         RemoveMeshes(
609         );
610
611         /**
612          * Add a mesh to the set of meshes associated with this
613          * node. Meshes added in this way are not deleted by this class.
614          * Make sure you call RemoveMeshes() before deleting the
615          * mesh though,
616          */
617                 void                                            
618         AddMesh(
619                 RAS_MeshObject* mesh
620         ){ 
621                 m_meshes.push_back(mesh);
622         }
623
624         /**
625          * Pick out a mesh associated with the integer 'num'.
626          */
627                 RAS_MeshObject*                         
628         GetMesh(
629                 int num
630         ) const { 
631                 return m_meshes[num]; 
632         }
633
634         /**
635          * Return the number of meshes currently associated with this
636          * game object.
637          */
638                 int                                                     
639         GetMeshCount(
640         ) const { 
641                 return m_meshes.size(); 
642         }
643         
644         /**     
645          * Set the debug color of the meshes associated with this
646          * class. Does this still work?
647          */
648                 void                                            
649         SetDebugColor(
650                 unsigned int bgra
651         );
652
653         /** 
654          * Reset the debug color of meshes associated with this class.
655          */
656                 void                                            
657         ResetDebugColor(
658         );
659
660         /**
661          * Was this object marked visible? (only for the explicit
662          * visibility system).
663          */
664                 bool
665         GetVisible(
666                 void
667         );
668
669         /**
670          * Set visibility flag of this object
671          */
672                 void
673         SetVisible(
674                 bool b,
675                 bool recursive
676         );
677
678         /**
679          * Was this object culled?
680          */
681                 bool
682         GetCulled(
683                 void
684         );
685
686         /**
687          * Set culled flag of this object
688          */
689                 void
690         SetCulled(
691                 bool c
692         );
693
694         /**
695          * Change the layer of the object (when it is added in another layer
696          * than the original layer)
697          */
698                 void
699         SetLayer(
700                 int l
701         );
702
703         /**
704          * Get the object layer
705          */
706                 int
707         GetLayer(
708                 void
709         );
710                 
711         /**
712          * Get the negative scaling state
713          */
714                 bool
715         IsNegativeScaling(
716                 void
717         ) { return m_bIsNegativeScaling; }
718
719         /**
720          * Is this a light?
721          */
722                 virtual bool
723         IsLight(
724                 void
725         ) { return false; }
726
727         /**
728          * @section Logic bubbling methods.
729          */
730
731         /**
732          * Stop making progress
733          */
734         void Suspend(void);
735
736         /**
737          * Resume making progress
738          */
739         void Resume(void);
740         
741         void SuspendDynamics(void) {
742                 if (m_bSuspendDynamics)
743                 {
744                         return;
745                 }
746         
747                 if (m_pPhysicsController1)
748                 {
749                         m_pPhysicsController1->SuspendDynamics();
750                 }
751                 m_bSuspendDynamics = true;
752         }
753         
754         void RestoreDynamics(void) {    
755                 if (!m_bSuspendDynamics)
756                 {
757                         return;
758                 }
759         
760                 if (m_pPhysicsController1)
761                 {
762                         m_pPhysicsController1->RestoreDynamics();
763                 }
764                 m_bSuspendDynamics = false;
765         }
766         
767         KX_ClientObjectInfo* getClientInfo() { return m_pClient_info; }
768         /**
769          * @section Python interface functions.
770          */
771
772         virtual PyObject* py_getattro(PyObject *attr);
773         virtual int py_setattro(PyObject *attr, PyObject *value);               // py_setattro method
774         virtual PyObject* py_repr(void) { return PyString_FromString(GetName().ReadPtr()); }
775         
776         KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
777         KX_PYMETHOD_O(KX_GameObject,SetPosition);
778         KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
779         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
780         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
781         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
782         KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
783         KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
784         KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
785         KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);
786         KX_PYMETHOD_VARARGS(KX_GameObject,SetAngularVelocity);
787         KX_PYMETHOD_VARARGS(KX_GameObject,GetVelocity);
788         KX_PYMETHOD_NOARGS(KX_GameObject,GetMass);
789         KX_PYMETHOD_NOARGS(KX_GameObject,GetReactionForce);
790         KX_PYMETHOD_NOARGS(KX_GameObject,GetOrientation);
791         KX_PYMETHOD_O(KX_GameObject,SetOrientation);
792         KX_PYMETHOD_NOARGS(KX_GameObject,GetVisible);
793         KX_PYMETHOD_VARARGS(KX_GameObject,SetVisible);
794         KX_PYMETHOD_NOARGS(KX_GameObject,GetState);
795         KX_PYMETHOD_O(KX_GameObject,SetState);
796         KX_PYMETHOD_VARARGS(KX_GameObject,AlignAxisToVect);
797         KX_PYMETHOD_O(KX_GameObject,GetAxisVect);
798         KX_PYMETHOD_NOARGS(KX_GameObject,SuspendDynamics);
799         KX_PYMETHOD_NOARGS(KX_GameObject,RestoreDynamics);
800         KX_PYMETHOD_NOARGS(KX_GameObject,EnableRigidBody);
801         KX_PYMETHOD_NOARGS(KX_GameObject,DisableRigidBody);
802         KX_PYMETHOD_VARARGS(KX_GameObject,ApplyImpulse);
803         KX_PYMETHOD_O(KX_GameObject,SetCollisionMargin);
804         KX_PYMETHOD_NOARGS(KX_GameObject,GetParent);
805         KX_PYMETHOD_O(KX_GameObject,SetParent);
806         KX_PYMETHOD_NOARGS(KX_GameObject,RemoveParent);
807         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildren);  
808         KX_PYMETHOD_NOARGS(KX_GameObject,GetChildrenRecursive);
809         KX_PYMETHOD_VARARGS(KX_GameObject,GetMesh);
810         KX_PYMETHOD_NOARGS(KX_GameObject,GetPhysicsId);
811         KX_PYMETHOD_NOARGS(KX_GameObject,GetPropertyNames);
812         KX_PYMETHOD_O(KX_GameObject,ReplaceMesh);
813         KX_PYMETHOD_NOARGS(KX_GameObject,EndObject);
814         KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
815         KX_PYMETHOD_DOC(KX_GameObject,rayCast);
816         KX_PYMETHOD_DOC_O(KX_GameObject,getDistanceTo);
817         KX_PYMETHOD_DOC_O(KX_GameObject,getVectTo);
818         KX_PYMETHOD_DOC_VARARGS(KX_GameObject, sendMessage);
819         /* attributes */
820         static PyObject*        pyattr_get_name(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
821         static PyObject*        pyattr_get_parent(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
822
823         static PyObject*        pyattr_get_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
824         static int                      pyattr_set_mass(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
825         static PyObject*        pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
826         static int                      pyattr_set_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
827         static PyObject*        pyattr_get_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
828         static int                      pyattr_set_position(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
829         static PyObject*        pyattr_get_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
830         static int                      pyattr_set_localInertia(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
831         static PyObject*        pyattr_get_orientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
832         static int                      pyattr_set_orientation(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
833         static PyObject*        pyattr_get_scaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
834         static int                      pyattr_set_scaling(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
835         static PyObject*        pyattr_get_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
836         static int                      pyattr_set_timeOffset(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
837         static PyObject*        pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
838         static int                      pyattr_set_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
839         static PyObject*        pyattr_get_meshes(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
840         
841         /* for dir(), python3 uses __dir__() */
842         static PyObject*        pyattr_get_dir_dict(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
843         
844         /* Experemental! */
845         static PyObject*        pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
846         static PyObject*        pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
847         static PyObject*        pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
848         
849         /* getitem/setitem */
850         static Py_ssize_t                       Map_Len(PyObject* self);
851         static PyMappingMethods Mapping;
852         static PyObject*                        Map_GetItem(PyObject *self_v, PyObject *item);
853         static int                                      Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val);
854         
855         
856 private :
857
858         /**     
859          * Random internal function to convert python function arguments
860          * to 2 vectors.
861          * @return true if conversion was possible.
862          */
863
864                 bool                                            
865         ConvertPythonVectorArgs(
866                 PyObject* args,
867                 MT_Vector3& pos,
868                 MT_Vector3& pos2
869         );      
870
871 };
872
873 /* utility conversion function */
874 bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok);
875
876 #endif //__KX_GAMEOBJECT
877