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.
This commit is contained in:
		@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user