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:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-09-25 20:19:07 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-09-25 20:19:07 +0400
commitc9c9b2e8332786128fa078acb598987a3b419b5c (patch)
tree3e46a8828b8836620b9ae47ce841eee04c720c54 /source/gameengine/Ketsji/KX_KetsjiEngine.cpp
parent04fa0fd8692dcf402d212245293f5082bb08d630 (diff)
BGE patch: add Debug button next to object state. The object state mask will be printed at runtime with the debug info as a comma separated list of state numbers (1..30) for each active state bit. The reserved property name __state__ is used for that purpose (users should not create a property with that name).
Diffstat (limited to 'source/gameengine/Ketsji/KX_KetsjiEngine.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp48
1 files changed, 39 insertions, 9 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index c7b0d7b3ea3..b1ab8e3e7de 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -1243,19 +1243,49 @@ void KX_KetsjiEngine::RenderDebugProperties()
CValue* propobj = (*it)->m_obj;
STR_String objname = propobj->GetName();
STR_String propname = (*it)->m_name;
- CValue* propval = propobj->GetProperty(propname);
- if (propval)
+ if (propname == "__state__")
{
- STR_String text = propval->GetText();
- debugtxt = objname + "." + propname + " = " + text;
+ // reserve name for object state
+ KX_GameObject* gameobj = static_cast<KX_GameObject*>(propobj);
+ unsigned int state = gameobj->GetState();
+ debugtxt = objname + "." + propname + " = ";
+ bool first = true;
+ for (int statenum=1;state;state >>= 1, statenum++)
+ {
+ if (state & 1)
+ {
+ if (!first)
+ {
+ debugtxt += ",";
+ }
+ debugtxt += STR_String(statenum);
+ first = false;
+ }
+ }
m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
- debugtxt.Ptr(),
- xcoord,
- ycoord,
- m_canvas->GetWidth(),
- m_canvas->GetHeight());
+ debugtxt.Ptr(),
+ xcoord,
+ ycoord,
+ m_canvas->GetWidth(),
+ m_canvas->GetHeight());
ycoord += 14;
}
+ else
+ {
+ CValue* propval = propobj->GetProperty(propname);
+ if (propval)
+ {
+ STR_String text = propval->GetText();
+ debugtxt = objname + "." + propname + " = " + text;
+ m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED,
+ debugtxt.Ptr(),
+ xcoord,
+ ycoord,
+ m_canvas->GetWidth(),
+ m_canvas->GetHeight());
+ ycoord += 14;
+ }
+ }
}
}
}