diff options
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 4 | ||||
-rw-r--r-- | source/gameengine/Converter/KX_ConvertSensors.cpp | 1 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyEventManager.h | 11 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 10 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_MouseFocusSensor.cpp | 8 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_MouseFocusSensor.h | 9 | ||||
-rw-r--r-- | source/gameengine/PyDoc/GameTypes.py | 4 |
7 files changed, 33 insertions, 14 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 6cb4e980a3d..ed03bb0bdd5 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -2485,10 +2485,10 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } } if (occlusion) - kxscene->SetDbvtOcclusionRes(blenderscene->world->occlusionRes); + kxscene->SetDbvtOcclusionRes(blenderscene->gm.occlusionRes); } if (blenderscene->world) - kxscene->GetPhysicsEnvironment()->setNumTimeSubSteps(blenderscene->world->physubstep); + kxscene->GetPhysicsEnvironment()->setNumTimeSubSteps(blenderscene->gm.physubstep); // now that the scenegraph is complete, let's instantiate the deformers. // We need that to create reusable derived mesh and physic shapes diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp index eb77e087de5..09027f18844 100644 --- a/source/gameengine/Converter/KX_ConvertSensors.cpp +++ b/source/gameengine/Converter/KX_ConvertSensors.cpp @@ -536,6 +536,7 @@ void BL_ConvertSensors(struct Object* blenderobject, starty, keytype, trackfocus, + (bmouse->flag & SENS_MOUSE_FOCUS_PULSE) ? true:false, kxscene, kxengine, gameobj); diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h index 011f3285f63..a9692377df8 100644 --- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h +++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.h @@ -40,16 +40,17 @@ class SCA_PropertyEventManager : public SCA_EventManager class SCA_LogicManager* m_logicmgr; public: + SCA_PropertyEventManager(class SCA_LogicManager* logicmgr); + virtual ~SCA_PropertyEventManager(); + virtual void NextFrame(); + //SCA_LogicManager* GetLogicManager() { return m_logicmgr;} + #ifdef WITH_CXX_GUARDEDALLOC +public: void *operator new( unsigned int num_bytes) { return MEM_mallocN(num_bytes, "GE:SCA_PropertyEventManager"); } void operator delete( void *mem ) { MEM_freeN(mem); } #endif - - SCA_PropertyEventManager(class SCA_LogicManager* logicmgr); - virtual ~SCA_PropertyEventManager(); - virtual void NextFrame(); - //SCA_LogicManager* GetLogicManager() { return m_logicmgr;} }; #endif //__KX_PROPERTYEVENTMANAGER diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 13643e3a1ac..4117e493322 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -382,12 +382,12 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo) m_firstframe = true; m_bInitialized = true; // there is always one scene enabled at startup - World* world = m_scenes[0]->GetBlenderScene()->world; - if (world) + Scene* scene = m_scenes[0]->GetBlenderScene(); + if (scene) { - m_ticrate = world->ticrate ? world->ticrate : DEFAULT_LOGIC_TIC_RATE; - m_maxLogicFrame = world->maxlogicstep ? world->maxlogicstep : 5; - m_maxPhysicsFrame = world->maxphystep ? world->maxlogicstep : 5; + m_ticrate = scene->gm.ticrate ? scene->gm.ticrate : DEFAULT_LOGIC_TIC_RATE; + m_maxLogicFrame = scene->gm.maxlogicstep ? scene->gm.maxlogicstep : 5; + m_maxPhysicsFrame = scene->gm.maxphystep ? scene->gm.maxlogicstep : 5; } else { diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp index 58053e1038d..7d351924744 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp @@ -61,11 +61,13 @@ KX_MouseFocusSensor::KX_MouseFocusSensor(SCA_MouseManager* eventmgr, int starty, short int mousemode, int focusmode, + bool bTouchPulse, KX_Scene* kxscene, KX_KetsjiEngine *kxengine, SCA_IObject* gameobj) : SCA_MouseSensor(eventmgr, startx, starty, mousemode, gameobj), m_focusmode(focusmode), + m_bTouchPulse(bTouchPulse), m_kxscene(kxscene), m_kxengine(kxengine) { @@ -77,6 +79,7 @@ void KX_MouseFocusSensor::Init() m_mouse_over_in_previous_frame = (m_invert)?true:false; m_positive_event = false; m_hitObject = 0; + m_hitObject_Last = NULL; m_reset = true; m_hitPosition.setValue(0,0,0); @@ -108,6 +111,9 @@ bool KX_MouseFocusSensor::Evaluate() if (!m_mouse_over_in_previous_frame) { result = true; } + else if(m_bTouchPulse && (m_hitObject != m_hitObject_Last)) { + result = true; + } } if (reset) { // force an event @@ -123,6 +129,7 @@ bool KX_MouseFocusSensor::Evaluate() } m_mouse_over_in_previous_frame = obHasFocus; + m_hitObject_Last = (void *)m_hitObject; return result; } @@ -378,6 +385,7 @@ PyAttributeDef KX_MouseFocusSensor::Attributes[] = { KX_PYATTRIBUTE_RO_FUNCTION("hitObject", KX_MouseFocusSensor, pyattr_get_hit_object), KX_PYATTRIBUTE_RO_FUNCTION("hitPosition", KX_MouseFocusSensor, pyattr_get_hit_position), KX_PYATTRIBUTE_RO_FUNCTION("hitNormal", KX_MouseFocusSensor, pyattr_get_hit_normal), + KX_PYATTRIBUTE_BOOL_RW("usePulseFocus", KX_MouseFocusSensor,m_bTouchPulse), { NULL } //Sentinel }; diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h index dfada7a59cc..89ac012c068 100644 --- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h +++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h @@ -49,11 +49,12 @@ class KX_MouseFocusSensor : public SCA_MouseSensor public: - KX_MouseFocusSensor(class SCA_MouseManager* keybdmgr, + KX_MouseFocusSensor(class SCA_MouseManager* eventmgr, int startx, int starty, short int mousemode, int focusmode, + bool bTouchPulse, KX_Scene* kxscene, KX_KetsjiEngine* kxengine, SCA_IObject* gameobj); @@ -107,6 +108,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor /* --------------------------------------------------------------------- */ SCA_IObject* m_hitObject; + void* m_hitObject_Last; /* only use for comparison, never access */ private: /** @@ -120,6 +122,11 @@ class KX_MouseFocusSensor : public SCA_MouseSensor bool m_mouse_over_in_previous_frame; /** + * Flags whether changes in hit object should trigger a pulse + */ + bool m_bTouchPulse; + + /** * Flags whether the previous test evaluated positive. */ bool m_positive_event; diff --git a/source/gameengine/PyDoc/GameTypes.py b/source/gameengine/PyDoc/GameTypes.py index 054b2cb4daf..c82623e6409 100644 --- a/source/gameengine/PyDoc/GameTypes.py +++ b/source/gameengine/PyDoc/GameTypes.py @@ -2419,6 +2419,8 @@ class KX_MouseFocusSensor(SCA_MouseSensor): @type hitPosition: list (vector of 3 floats) @ivar hitNormal: the worldspace normal from the face at point of intersection. @type hitNormal: list (normalized vector of 3 floats) + @ivar usePulseFocus: When enabled, moving the mouse over a different object generates a pulse. (only used when the 'Mouse Over Any' sensor option is set) + @type usePulseFocus: bool """ #{ Deprecated def getHitNormal(): @@ -2480,7 +2482,7 @@ class KX_TouchSensor(SCA_ISensor): @ivar useMaterial: Determines if the sensor is looking for a property or material. KX_True = Find material; KX_False = Find property @type useMaterial: boolean - @ivar usePulseCollision: The last collided object. + @ivar usePulseCollision: When enabled, changes to the set of colliding objects generate a pulse. @type usePulseCollision: bool @ivar hitObject: The last collided object. (read-only) @type hitObject: L{KX_GameObject} or None |