diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-04 12:55:54 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-04 12:55:54 +0400 |
commit | 2f7cd19ff520ff5a1a0f80a55cc5e68c802b7df5 (patch) | |
tree | d679af8428bb91e59c4cd92fd154a598618f0258 /source/gameengine/Expressions/PyObjectPlus.cpp | |
parent | 9248da811e7e0c1e8945d85a6520e74678d9e6c0 (diff) |
print BGE Py api warnings only once to avoid flooding the terminal and slowing the game down too much, resets on loading scenes/blendfiles and restarting the game engine.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.cpp')
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 107b12b7159..82f67a9b007 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -908,15 +908,16 @@ PyObject *PyObjectPlus::NewProxy_Ext(PyObjectPlus *self, PyTypeObject *tp, bool /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /* deprecation warning management */ + bool PyObjectPlus::m_ignore_deprecation_warnings(false); void PyObjectPlus::SetDeprecationWarnings(bool ignoreDeprecationWarnings) { m_ignore_deprecation_warnings = ignoreDeprecationWarnings; } -void PyObjectPlus::ShowDeprecationWarning(const char* old_way,const char* new_way) +void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* new_way) { - if (!m_ignore_deprecation_warnings) { + { printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way); // import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno) @@ -955,6 +956,30 @@ void PyObjectPlus::ShowDeprecationWarning(const char* old_way,const char* new_wa } } +void PyObjectPlus::ClearDeprecationWarning() +{ + WarnLink *wlink_next; + WarnLink *wlink = GetDeprecationWarningLinkFirst(); + + while(wlink) + { + wlink->warn_done= false; /* no need to NULL the link, its cleared before adding to the list next time round */ + wlink_next= reinterpret_cast<WarnLink *>(wlink->link); + wlink->link= NULL; + wlink= wlink_next; + } + NullDeprecationWarning(); +} + +WarnLink* m_base_wlink_first= NULL; +WarnLink* m_base_wlink_last= NULL; + +WarnLink* PyObjectPlus::GetDeprecationWarningLinkFirst(void) {return m_base_wlink_first;} +WarnLink* PyObjectPlus::GetDeprecationWarningLinkLast(void) {return m_base_wlink_last;} +void PyObjectPlus::SetDeprecationWarningFirst(WarnLink* wlink) {m_base_wlink_first= wlink;} +void PyObjectPlus::SetDeprecationWarningLinkLast(WarnLink* wlink) {m_base_wlink_last= wlink;} +void PyObjectPlus::NullDeprecationWarning() {m_base_wlink_first= m_base_wlink_last= NULL;} + #endif //NO_EXP_PYTHON_EMBEDDING |