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/Ketsji/KX_Scene.cpp
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/Ketsji/KX_Scene.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 13fb168221d..c12fda8912e 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -59,6 +59,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"
@@ -73,6 +74,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"
@@ -438,6 +440,21 @@ void KX_Scene::EnableZBufferClearing(bool isclearingZbuffer)
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;
@@ -561,6 +578,8 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal
// 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();
@@ -972,6 +991,9 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
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,
*
@@ -1911,6 +1933,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
{
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 */
}