diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2016-04-10 18:36:10 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2016-04-11 00:57:43 +0300 |
commit | 2050ecc307de9159b50c7f9798e47a366f505f2e (patch) | |
tree | edda985383ebe538858a255b5b0d68b6c54d6ead /source/gameengine/GameLogic/SCA_ILogicBrick.cpp | |
parent | 3a80d5e1d0e4952caa76f1d655429375c0da1884 (diff) |
BGE: Fix T48071: Global logic manager
Previously the logic manager was used as a global variable for SCA_ILogicBrick::m_sCurrentLogicManager,
this request to always update it before run any python script and allow call function like
ConvertPythonTo[GameObject/Mesh]. The bug showed in T48071 is that as exepted the global
m_sCurrentLogicManager is not updated with the proper scene logic manager.
Instead of trying to fix it by updating the logic manager everywhere and wait next bug report to add
a similar line. The following patch propose a different way:
- Every logic brick now contain its logic manager to SCA_ILogicBrick::m_logicManager, this value is
set and get by SCA_ILogicBrick::[Set/Get]LogicManager, It's initialized from blender conversion and
scene merging.
- Function ConvertPythonTo[GameObject/mesh] now take as first argument the logic manager to find name
coresponding object or mesh. Only ConvertPythonToCamera doesn't do that because it uses the
KX_Scene::FindCamera function.
Reviewers: moguri
Differential Revision: https://developer.blender.org/D1913
Diffstat (limited to 'source/gameengine/GameLogic/SCA_ILogicBrick.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_ILogicBrick.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp index 72a0b392447..d0a6e4540c9 100644 --- a/source/gameengine/GameLogic/SCA_ILogicBrick.cpp +++ b/source/gameengine/GameLogic/SCA_ILogicBrick.cpp @@ -35,12 +35,11 @@ #include "SCA_ILogicBrick.h" #include "EXP_PyObjectPlus.h" -SCA_LogicManager* SCA_ILogicBrick::m_sCurrentLogicManager = NULL; - SCA_ILogicBrick::SCA_ILogicBrick(SCA_IObject* gameobj) : CValue(), m_gameobj(gameobj), + m_logicManager(NULL), m_Execute_Priority(0), m_Execute_Ueber_Priority(0), m_bActive(false), @@ -143,6 +142,16 @@ bool SCA_ILogicBrick::LessComparedTo(SCA_ILogicBrick* other) (this->m_Execute_Priority < other->m_Execute_Priority)); } +void SCA_ILogicBrick::SetLogicManager(SCA_LogicManager *logicmgr) +{ + m_logicManager = logicmgr; +} + +SCA_LogicManager *SCA_ILogicBrick::GetLogicManager() +{ + return m_logicManager; +} + void SCA_ILogicBrick::RegisterEvent(CValue* eventval) { if (m_eventval) |