Merged 15170:15635 from trunk (no conflicts or even merges)
[blender.git] / source / gameengine / Converter / KX_ConvertSensors.cpp
index 80fa3838d60f0be5602df4fe3f6139ba194895be..7c9df688d45ca4819915b8071b2b5cdb4db09b47 100644 (file)
@@ -64,6 +64,7 @@ probably misplaced */
 #include "KX_MouseFocusSensor.h"
 #include "SCA_JoystickSensor.h"
 #include "KX_NetworkMessageSensor.h"
+#include "SCA_ActuatorSensor.h"
 
 
 #include "SCA_PropertySensor.h"
@@ -251,6 +252,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
        bool neg_pulsemode = false;
        int frequency = 0;
        bool invert = false;
+       bool level = false;
        
        while(sens)
        {
@@ -263,7 +265,8 @@ void BL_ConvertSensors(struct Object* blenderobject,
                
                frequency = sens->freq;
                invert    = !(sens->invert == 0);
-               
+               level     = !(sens->level == 0);
+
                switch (sens->type)
                {
                case  SENS_ALWAYS:
@@ -536,6 +539,19 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                
                                break;
                        }
+               case SENS_ACTUATOR:
+                       {
+                               bActuatorSensor* blenderactsensor = (bActuatorSensor*) sens->data;
+                               // we will reuse the property event manager, there is nothing special with this sensor
+                               SCA_EventManager* eventmgr 
+                                       = logicmgr->FindEventManager(SCA_EventManager::ACTUATOR_EVENTMGR);
+                               if (eventmgr)
+                               {
+                                       STR_String propname=blenderactsensor->name;
+                                       gamesensor = new SCA_ActuatorSensor(eventmgr,gameobj,propname);
+                               }
+                               break;
+                       }
                        
                case SENS_RADAR:
                        {
@@ -711,6 +727,7 @@ void BL_ConvertSensors(struct Object* blenderobject,
                                                                         neg_pulsemode, 
                                                                         frequency);
                        gamesensor->SetInvert(invert);
+                       gamesensor->SetLevel(level);
                        gamesensor->SetName(STR_String(sens->name));                    
                        
                        gameobj->AddSensor(gamesensor);