Index: source/gameengine/Converter/KX_ConvertProperties.cpp =================================================================== --- source/gameengine/Converter/KX_ConvertProperties.cpp (revision 57570) +++ source/gameengine/Converter/KX_ConvertProperties.cpp (working copy) @@ -131,7 +131,7 @@ if (propval) { - if (show_debug_info) + if (show_debug_info && isInActiveLayer) { scene->AddDebugProperty(gameobj,STR_String(prop->name)); } @@ -159,7 +159,7 @@ prop = prop->next; } // check if state needs to be debugged - if (object->scaflag & OB_DEBUGSTATE) + if (object->scaflag & OB_DEBUGSTATE && isInActiveLayer) { // reserve name for object state scene->AddDebugProperty(gameobj,STR_String("__state__")); Index: source/gameengine/GameLogic/SCA_IScene.cpp =================================================================== --- source/gameengine/GameLogic/SCA_IScene.cpp (revision 57570) +++ source/gameengine/GameLogic/SCA_IScene.cpp (working copy) @@ -74,9 +74,28 @@ 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::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; + } +} + Index: source/gameengine/GameLogic/SCA_IScene.h =================================================================== --- source/gameengine/GameLogic/SCA_IScene.h (revision 57570) +++ source/gameengine/GameLogic/SCA_IScene.h (working copy) @@ -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 @@ virtual void ReplaceMesh(class CValue* gameobj, void* meshobj, bool use_gfx, bool use_phys)=0; std::vector& GetDebugProperties(); + void RemoveAllDebugProperties(); void AddDebugProperty(class CValue* debugprop, const STR_String &name); - void RemoveAllDebugProperties(); + void RemoveObjectDebugProperties(class CValue* gameobj); + virtual void Update2DFilter(std::vector& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text) {} Index: source/gameengine/Ketsji/KX_KetsjiEngine.cpp =================================================================== --- source/gameengine/Ketsji/KX_KetsjiEngine.cpp (revision 57570) +++ source/gameengine/Ketsji/KX_KetsjiEngine.cpp (working copy) @@ -130,8 +130,6 @@ m_keyboarddevice(NULL), m_mousedevice(NULL), - m_propertiesPresent(false), - m_bInitialized(false), m_activecam(0), m_bFixedTime(false), @@ -516,7 +514,7 @@ // Show profiling info m_logger->StartLog(tc_overhead, m_kxsystem->GetTimeInSeconds(), true); - if (m_show_framerate || m_show_profile || (m_show_debug_properties && m_propertiesPresent)) + if (m_show_framerate || m_show_profile || (m_show_debug_properties)) { RenderDebugProperties(); } @@ -1401,7 +1399,6 @@ { m_scenes.push_back(scene); PostProcessScene(scene); - SceneListsChanged(); } @@ -1545,7 +1542,7 @@ ycoord += title_y_top_margin; /* Property display*/ - if (m_show_debug_properties && m_propertiesPresent) { + if (m_show_debug_properties) { /* Title for debugging("Debug properties") */ m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, @@ -1560,18 +1557,22 @@ // Add the title indent afterwards ycoord += title_y_bottom_margin; + /* Calculate amount of properties that can displayed. */ + unsigned propsAct = 0; + unsigned propsMax = (m_canvas->GetHeight() - ycoord) / const_ysize; + KX_SceneList::iterator sceneit; for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) { KX_Scene* scene = *sceneit; /* the 'normal' debug props */ vector& debugproplist = scene->GetDebugProperties(); - for (vector::iterator it = debugproplist.begin(); - !(it==debugproplist.end());it++) + for (unsigned i=0; i < debugproplist.size() && propsAct < propsMax; i++) { - CValue *propobj = (*it)->m_obj; + CValue *propobj = debugproplist[i]->m_obj; STR_String objname = propobj->GetName(); - STR_String propname = (*it)->m_name; + STR_String propname = debugproplist[i]->m_name; + propsAct++; if (propname == "__state__") { // reserve name for object state KX_GameObject* gameobj = static_cast(propobj); @@ -1955,28 +1956,10 @@ ReplaceScheduledScenes(); RemoveScheduledScenes(); AddScheduledScenes(); - - // Notify - SceneListsChanged(); } } - -void KX_KetsjiEngine::SceneListsChanged(void) -{ - m_propertiesPresent = false; - KX_SceneList::iterator sceneit = m_scenes.begin(); - while ((sceneit != m_scenes.end()) && (!m_propertiesPresent)) - { - KX_Scene* scene = *sceneit; - vector& debugproplist = scene->GetDebugProperties(); - m_propertiesPresent = !debugproplist.empty(); - sceneit++; - } -} - - void KX_KetsjiEngine::SetHideCursor(bool hideCursor) { m_hideCursor = hideCursor; Index: source/gameengine/Ketsji/KX_KetsjiEngine.h =================================================================== --- source/gameengine/Ketsji/KX_KetsjiEngine.h (revision 57570) +++ source/gameengine/Ketsji/KX_KetsjiEngine.h (working copy) @@ -438,7 +438,6 @@ /** * This method is invoked when the scene lists have changed. */ - void SceneListsChanged(void); void RemoveScheduledScenes(void); void AddScheduledScenes(void); Index: source/gameengine/Ketsji/KX_Scene.cpp =================================================================== --- source/gameengine/Ketsji/KX_Scene.cpp (revision 57570) +++ source/gameengine/Ketsji/KX_Scene.cpp (working copy) @@ -58,6 +58,7 @@ #include "SCA_JoystickManager.h" #include "KX_PyMath.h" #include "RAS_MeshObject.h" +#include "SCA_IScene.h" #include "RAS_IRasterizer.h" #include "RAS_BucketManager.h" @@ -72,6 +73,7 @@ #include "SG_Tree.h" #include "DNA_group_types.h" #include "DNA_scene_types.h" +#include "DNA_property_types.h" #include "KX_SG_NodeRelationships.h" @@ -442,6 +444,21 @@ m_isclearingZbuffer = isclearingZbuffer; } +void KX_Scene::AddObjectDebugProperties(class KX_GameObject* gameobj) +{ + Object* blenderobject = gameobj->GetBlenderObject(); + bProperty* prop = (bProperty*)blenderobject->prop.first; + + while(prop) { + if (prop->flag & PROP_DEBUG) + AddDebugProperty(gameobj,STR_String(prop->name)); + prop = prop->next; + } + + if (blenderobject->scaflag & OB_DEBUGSTATE) + AddDebugProperty(gameobj,STR_String("__state__")); +} + void KX_Scene::RemoveNodeDestructObject(class SG_IObject* node,class CValue* gameobj) { KX_GameObject* orgobj = (KX_GameObject*)gameobj; @@ -565,6 +582,8 @@ // SCA_IObject::ReParentLogic(), make sure it preserves the order of the bricks. void KX_Scene::ReplicateLogic(KX_GameObject* newobj) { + /* add properties to debug list, for added objects and DupliGroups */ + AddObjectDebugProperties(newobj); // also relink the controller to sensors/actuators SCA_ControllerList& controllers = newobj->GetControllers(); //SCA_SensorList& sensors = newobj->GetSensors(); @@ -976,6 +995,9 @@ int ret; KX_GameObject* newobj = (KX_GameObject*) gameobj; + /* remove property to debug list */ + RemoveObjectDebugProperties(newobj); + /* Invalidate the python reference, since the object may exist in script lists * its possible that it wont be automatically invalidated, so do it manually here, * @@ -1906,6 +1928,7 @@ { KX_GameObject* gameobj = (KX_GameObject*)other->GetObjectList()->GetValue(i); MergeScene_GameObject(gameobj, this, other); + AddObjectDebugProperties(gameobj); // add properties to debug list for LibLoad objects gameobj->UpdateBuckets(false); /* only for active objects */ } Index: source/gameengine/Ketsji/KX_Scene.h =================================================================== --- source/gameengine/Ketsji/KX_Scene.h (revision 57570) +++ source/gameengine/Ketsji/KX_Scene.h (working copy) @@ -324,6 +324,7 @@ return (m_groupGameObjects.empty() || m_groupGameObjects.find(gameobj) != m_groupGameObjects.end()); } + void AddObjectDebugProperties(class KX_GameObject* gameobj); SCA_IObject* AddReplicaObject(CValue* gameobj, CValue* locationobj, int lifespan=0);