Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-07-10 00:06:36 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-07-10 00:06:36 +0400
commit83e9f32382810437bf113fee3b5c32881d7e67ec (patch)
tree60d1a6aef4accf267053a521a6d21ad117d64eee /source/gameengine/GameLogic
parentf6502a67f203dbd57446f5b10cbdd82a4610e84c (diff)
BGE: Committing patch #32422 "Debug properties for added objects" by HG1.
This patch allows debug properties from objects added to the scene at runtime to be displayed under the Debug Properties in the overhead display.
Diffstat (limited to 'source/gameengine/GameLogic')
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.cpp29
-rw-r--r--source/gameengine/GameLogic/SCA_IScene.h6
2 files changed, 29 insertions, 6 deletions
diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp
index c2ea8b4a8bc..60b4d19e155 100644
--- a/source/gameengine/GameLogic/SCA_IScene.cpp
+++ b/source/gameengine/GameLogic/SCA_IScene.cpp
@@ -74,9 +74,28 @@ std::vector<SCA_DebugProp*>& SCA_IScene::GetDebugProperties()
void SCA_IScene::AddDebugProperty(class CValue* debugprop,
const STR_String &name)
{
- SCA_DebugProp* dprop = new SCA_DebugProp();
- dprop->m_obj = debugprop;
- debugprop->AddRef();
- dprop->m_name = name;
- m_debugList.push_back(dprop);
+ if (m_debugList.size() < DEBUG_MAX_DISPLAY) {
+ SCA_DebugProp* dprop = new SCA_DebugProp();
+ dprop->m_obj = debugprop;
+ debugprop->AddRef();
+ dprop->m_name = name;
+ m_debugList.push_back(dprop);
+ }
}
+
+
+void SCA_IScene::RemoveObjectDebugProperties(class CValue* gameobj)
+{
+ vector<SCA_DebugProp*>::iterator it = m_debugList.begin();
+ while(it != m_debugList.end()) {
+ CValue* debugobj = (*it)->m_obj;
+
+ if (debugobj == gameobj) {
+ delete (*it);
+ m_debugList.erase(it);
+ continue;
+ }
+ ++it;
+ }
+}
+
diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h
index 997266976ad..e2e1edd4354 100644
--- a/source/gameengine/GameLogic/SCA_IScene.h
+++ b/source/gameengine/GameLogic/SCA_IScene.h
@@ -41,6 +41,8 @@
#include "MEM_guardedalloc.h"
#endif
+#define DEBUG_MAX_DISPLAY 100
+
struct SCA_DebugProp
{
class CValue* m_obj;
@@ -65,9 +67,11 @@ public:
virtual void ReplaceMesh(class CValue* gameobj,
void* meshobj, bool use_gfx, bool use_phys)=0;
std::vector<SCA_DebugProp*>& GetDebugProperties();
+ void RemoveAllDebugProperties();
void AddDebugProperty(class CValue* debugprop,
const STR_String &name);
- void RemoveAllDebugProperties();
+ void RemoveObjectDebugProperties(class CValue* gameobj);
+
virtual void Update2DFilter(std::vector<STR_String>& propNames, void* gameObj,
RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode,
int pass, STR_String& text) {}