Merge of itasc branch. Project files, scons and cmake should be working. Makefile...
[blender.git] / source / gameengine / Converter / KX_ConvertSensors.cpp
index 0b395cf..99a2ec3 100644 (file)
@@ -28,6 +28,7 @@
  * Conversion of Blender data blocks to KX sensor system
  */
 
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -63,6 +64,7 @@ probably misplaced */
 #include "KX_NearSensor.h"
 #include "KX_RadarSensor.h"
 #include "KX_MouseFocusSensor.h"
+#include "KX_ArmatureSensor.h"
 #include "SCA_JoystickSensor.h"
 #include "KX_NetworkMessageSensor.h"
 #include "SCA_ActuatorSensor.h"
@@ -94,7 +96,6 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                           SCA_LogicManager* logicmgr,
                                           KX_Scene* kxscene,
                                           KX_KetsjiEngine* kxengine,
-                                          SCA_IInputDevice* keydev,
                                           int activeLayerBitInfo,
                                           bool isInActiveLayer,
                                           RAS_ICanvas* canvas,
@@ -302,7 +303,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                case  SENS_ALWAYS:
                        {
                                
-                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::ALWAYS_EVENTMGR);
+                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
                                if (eventmgr)
                                {
                                        gamesensor = new SCA_AlwaysSensor(eventmgr, gameobj);
@@ -314,7 +315,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                case  SENS_DELAY:
                        {
                                // we can reuse the Always event manager for the delay sensor
-                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::ALWAYS_EVENTMGR);
+                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
                                if (eventmgr)
                                {
                                        bDelaySensor* delaysensor = (bDelaySensor*)sens->data;
@@ -444,9 +445,8 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                blendernearsensor->dist,
                                                blendernearsensor->resetdist,
                                                bFindMaterial,
-                                               nearpropertyname,kxscene,
-                                               physCtrl
-                                               );
+                                               nearpropertyname,
+                                               physCtrl);
                                        
                                }
                                break;
@@ -537,6 +537,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                        starty,
                                                        keytype,
                                                        trackfocus,
+                                                       (bmouse->flag & SENS_MOUSE_FOCUS_PULSE) ? true:false,
                                                        kxscene,
                                                        kxengine,
                                                        gameobj); 
@@ -550,7 +551,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                        {
                                bPropertySensor* blenderpropsensor = (bPropertySensor*) sens->data;
                                SCA_EventManager* eventmgr 
-                                       = logicmgr->FindEventManager(SCA_EventManager::PROPERTY_EVENTMGR);
+                                       = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
                                if (eventmgr)
                                {
                                        STR_String propname=blenderpropsensor->name;
@@ -601,6 +602,21 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                break;
                        }
                        
+               case SENS_ARMATURE:
+                       {
+                               bArmatureSensor* blenderarmsensor = (bArmatureSensor*) sens->data;
+                               // we will reuse the property event manager, there is nothing special with this sensor
+                               SCA_EventManager* eventmgr 
+                                       = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
+                               if (eventmgr)
+                               {
+                                       STR_String bonename=blenderarmsensor->posechannel;
+                                       STR_String constraintname=blenderarmsensor->constraint;
+                                       gamesensor = new KX_ArmatureSensor(eventmgr,gameobj,bonename,constraintname, blenderarmsensor->type, blenderarmsensor->value);
+                               }
+                               break;
+                       }
+
                case SENS_RADAR:
                        {
                                
@@ -648,8 +664,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                smallmargin,
                                                largemargin,
                                                bFindMaterial,
-                                               radarpropertyname,
-                                               kxscene);
+                                               radarpropertyname);
                                                
                                }
                        
@@ -660,7 +675,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                bRaySensor* blenderraysensor = (bRaySensor*) sens->data;
                                
                                //blenderradarsensor->angle;
-                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::RAY_EVENTMGR);
+                               SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
                                if (eventmgr)
                                {
                                        bool bFindMaterial = (blenderraysensor->mode & SENS_COLLISION_MATERIAL);
@@ -692,7 +707,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                // some files didn't write randomsensor, avoid crash now for NULL ptr's
                                if (blenderrndsensor)
                                {
-                                       SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::RANDOM_EVENTMGR);
+                                       SCA_EventManager* eventmgr = logicmgr->FindEventManager(SCA_EventManager::BASIC_EVENTMGR);
                                        if (eventmgr)
                                        {
                                                int randomSeed = blenderrndsensor->seed;