[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15695] trunk/blender/source/gameengine/ Ketsji/KX_GameObject.cpp: BGE patch: update KX_GameObject::getChildren() to use CListValue instead of python list ( allows name search keep refcount consistent)
Benoit Bolsee
benoit.bolsee at online.be
Tue Jul 22 18:44:41 CEST 2008
Revision: 15695
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15695
Author: ben2610
Date: 2008-07-22 18:44:35 +0200 (Tue, 22 Jul 2008)
Log Message:
-----------
BGE patch: update KX_GameObject::getChildren() to use CListValue instead of python list (allows name search keep refcount consistent)
Modified Paths:
--------------
trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-22 16:38:50 UTC (rev 15694)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp 2008-07-22 16:44:35 UTC (rev 15695)
@@ -1306,18 +1306,18 @@
}
-static void walk_children(SG_Node* node, PyObject *list, bool recursive)
+static void walk_children(SG_Node* node, CListValue* list, bool recursive)
{
NodeList& children = node->GetSGChildren();
for (NodeList::iterator childit = children.begin();!(childit==children.end());++childit)
{
SG_Node* childnode = (*childit);
- KX_GameObject* childobj = (KX_GameObject*)childnode->GetSGClientObject();
+ CValue* childobj = (CValue*)childnode->GetSGClientObject();
if (childobj != NULL) // This is a GameObject
{
// add to the list
- PyList_Append(list, (PyObject *)childobj);
+ list->Add(childobj->AddRef());
}
// if the childobj is NULL then this may be an inverse parent link
@@ -1330,14 +1330,14 @@
PyObject* KX_GameObject::PyGetChildren(PyObject* self)
{
- PyObject * list = PyList_New(0);
+ CListValue* list = new CListValue();
walk_children(m_pSGNode, list, 0);
return list;
}
PyObject* KX_GameObject::PyGetChildrenRecursive(PyObject* self)
{
- PyObject * list = PyList_New(0);
+ CListValue* list = new CListValue();
walk_children(m_pSGNode, list, 1);
return list;
}
More information about the Bf-blender-cvs
mailing list