From 848ec5e77022d0a2a8ca7277b7de2154da55bde9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 7 Jun 2011 09:28:38 +0000 Subject: [PATCH] Added the return of the index position of the added UserObject --- src/osg/Object.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/osg/Object.cpp b/src/osg/Object.cpp index 124c20519..b66e2a6a9 100644 --- a/src/osg/Object.cpp +++ b/src/osg/Object.cpp @@ -58,7 +58,7 @@ const Referenced* Object::getUserData() const return _userDataContainer.valid() ? _userDataContainer->_userData.get() : 0; } -void Object::addUserObject(Object* obj) +unsigned int Object::addUserObject(Object* obj) { // make sure the UserDataContainer exists getOrCreateUserDataContainer(); @@ -68,11 +68,15 @@ void Object::addUserObject(Object* obj) if (i<_userDataContainer->_objectList.size()) { // object already in container so just return. - return; + return i; } + unsigned int pos = _userDataContainer->_objectList.size(); + // object not already on user data container so add it in. _userDataContainer->_objectList.push_back(obj); + + return pos; } void Object::removeUserObject(unsigned int i)