Index: Converter/KX_ConvertProperties.cpp =================================================================== --- Converter/KX_ConvertProperties.cpp (revision 50280) +++ Converter/KX_ConvertProperties.cpp (working copy) @@ -65,7 +65,6 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) { - bProperty* prop = (bProperty*)object->prop.first; CValue* propval; bool show_debug_info; @@ -132,7 +131,7 @@ if (propval) { - if (show_debug_info) + if (show_debug_info && isInActiveLayer) { scene->AddDebugProperty(gameobj,STR_String(prop->name)); } @@ -160,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__")); @@ -237,7 +236,7 @@ } } - if (propval) { + if (propval){ propval->Release(); } } Index: GameLogic/CMakeLists.txt =================================================================== --- GameLogic/CMakeLists.txt (revision 50280) +++ GameLogic/CMakeLists.txt (working copy) @@ -28,7 +28,9 @@ ../Expressions ../Rasterizer ../SceneGraph + ../Ketsji ../../blender/blenlib + ../../blender/makesdna ../../../intern/container ../../../intern/moto/include ../../../intern/string Index: GameLogic/SCA_IScene.cpp =================================================================== --- GameLogic/SCA_IScene.cpp (revision 50280) +++ GameLogic/SCA_IScene.cpp (working copy) @@ -29,9 +29,12 @@ * \ingroup gamelogic */ +#include "DNA_property_types.h" +/* end of blender include block */ #include "SCA_IScene.h" #include "Value.h" +#include "KX_GameObject.h" SCA_DebugProp::SCA_DebugProp(): m_obj(NULL) { @@ -45,6 +48,7 @@ SCA_IScene::SCA_IScene() { + m_ListLenghtMax = 100; } void SCA_IScene::RemoveAllDebugProperties() @@ -70,13 +74,55 @@ } - 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.capacity() < m_ListLenghtMax) + { + SCA_DebugProp* dprop = new SCA_DebugProp(); + dprop->m_obj = debugprop; + debugprop->AddRef(); + dprop->m_name = name; + m_debugList.push_back(dprop); + } } + + +void SCA_IScene::AddObjectDebugProperties(class KX_GameObject* gameobj) +{ + Object* blenderobject = gameobj->GetBlenderObject(); + bProperty* prop = (bProperty*)blenderobject->prop.first; + + while(prop) + { + if (bool (prop->flag & PROP_DEBUG)) + { + AddDebugProperty(gameobj,STR_String(prop->name)); + } + prop = prop->next; + } + + if (blenderobject->scaflag & OB_DEBUGSTATE) + { + AddDebugProperty(gameobj,STR_String("__state__")); + } +} + + +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: GameLogic/SCA_IScene.h =================================================================== --- GameLogic/SCA_IScene.h (revision 50280) +++ GameLogic/SCA_IScene.h (working copy) @@ -52,6 +52,7 @@ class SCA_IScene { std::vector m_debugList; + int m_ListLenghtMax; public: SCA_IScene(); virtual ~SCA_IScene(); @@ -65,9 +66,12 @@ 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 AddObjectDebugProperties(class KX_GameObject* gameobj); + 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: GameLogic/SConscript =================================================================== --- GameLogic/SConscript (revision 50280) +++ GameLogic/SConscript (working copy) @@ -7,6 +7,8 @@ incs += ' #/source/gameengine/Expressions #/intern/moto/include' incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph' incs += ' #/source/blender/blenlib' +incs += ' #/source/gameengine/Ketsji' +incs += ' #/source/blender/makesdna' defs = [] Index: Ketsji/KX_KetsjiEngine.cpp =================================================================== --- Ketsji/KX_KetsjiEngine.cpp (revision 50280) +++ Ketsji/KX_KetsjiEngine.cpp (working copy) @@ -132,8 +132,6 @@ m_keyboarddevice(NULL), m_mousedevice(NULL), - m_propertiesPresent(false), - m_bInitialized(false), m_activecam(0), m_bFixedTime(false), @@ -507,7 +505,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(); } @@ -1382,7 +1380,6 @@ { m_scenes.push_back(scene); PostProcessScene(scene); - SceneListsChanged(); } @@ -1490,7 +1487,7 @@ } /* Property display*/ - if (m_show_debug_properties && m_propertiesPresent) + if (m_show_debug_properties) { KX_SceneList::iterator sceneit; for (sceneit = m_scenes.begin();sceneit != m_scenes.end() ; sceneit++) @@ -1498,7 +1495,7 @@ KX_Scene* scene = *sceneit; /* the 'normal' debug props */ vector& debugproplist = scene->GetDebugProperties(); - + for (vector::iterator it = debugproplist.begin(); !(it==debugproplist.end());it++) { @@ -1895,28 +1892,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: Ketsji/KX_KetsjiEngine.h =================================================================== --- Ketsji/KX_KetsjiEngine.h (revision 50280) +++ Ketsji/KX_KetsjiEngine.h (working copy) @@ -430,7 +430,6 @@ /** * This method is invoked when the scene lists have changed. */ - void SceneListsChanged(void); void RemoveScheduledScenes(void); void AddScheduledScenes(void); Index: Ketsji/KX_Scene.cpp =================================================================== --- Ketsji/KX_Scene.cpp (revision 50280) +++ Ketsji/KX_Scene.cpp (working copy) @@ -97,7 +97,9 @@ #include "KX_Light.h" #include +#include "SCA_IScene.h" + void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) { KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj); @@ -926,6 +928,13 @@ { DupliGroupRecurse(*git, 0); } + + // add property to debug list + for (git = m_logicHierarchicalGameObjects.begin();!(git==m_logicHierarchicalGameObjects.end());++git) + { + AddObjectDebugProperties(*git); + } + // don't release replica here because we are returning it, not done with it... return replica; } @@ -966,6 +975,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, * @@ -1017,7 +1029,7 @@ m_timemgr->RemoveTimeProperty(propval); } } - + newobj->RemoveMeshes(); ret = 1; if (newobj->GetGameObjectType()==SCA_IObject::OBJ_LIGHT && m_lightlist->RemoveValue(newobj)) @@ -1053,9 +1065,8 @@ if (m_sceneConverter) m_sceneConverter->UnregisterGameObject(newobj); #endif - + // return value will be 0 if the object is actually deleted (all reference gone) - return ret; } @@ -1866,6 +1877,7 @@ { KX_GameObject* gameobj = (KX_GameObject*)other->GetObjectList()->GetValue(i); MergeScene_GameObject(gameobj, this, other); + AddObjectDebugProperties(gameobj); gameobj->UpdateBuckets(false); /* only for active objects */ }