PDA

View Full Version : LWItemInfo next function and clones



Anti-Distinctly
02-01-2009, 08:23 PM
I seem to be having some issues with the LWItemInfo's functions for getting the scene's objects, if those objects are clones.



LWItemID iid = ii.first(LWI_OBJECT, LWITEM_NULL); /*select the first item*/
while( iid != LWITEM_NULL ) /*cycle through all objects */
{
if( iid == oimi->first ) /*oimi is a std::map iterator and they key is the object ID*/
break;
iid = ii.next(LWI_OBJECT);
}


Now, there's nothing particularly complex about this...but the code only acts as if the original mesh is in the scene and seems to ignore the clones entirely. If the functions to iterate the scene items do not work on clones, then what does? How do I access those objects?

Jarno
02-01-2009, 09:05 PM
How are you getting the object ID used for the key?
Each clones will have different item ID from the original. I think you can match a clone to its original through comparing the filename in the object info.

---JvdL---

Sensei
02-02-2009, 12:46 AM
Where did you get these C++ wrappers? Is it from LW internal beta?
Normally LWItemInfo->Next() takes older LWItemID as argument, not type of object..

Anti-Distinctly
02-02-2009, 04:53 AM
Where did you get these C++ wrappers? Is it from LW internal beta?


Sorry - I really should've mentioned that I'm using Lightwolf's lwpp wrapper. The next() function just calls the next() function of a global pointer internal to the lwpp::ItemInfo object.


Normally LWItemInfo->Next() takes older LWItemID as argument, not type of object..

I'll give that a whirl, it as 3am when I was trying this :)

Anti-Distinctly
02-02-2009, 05:14 AM
All sorted now, I was just being retarded. Thank you very much for your replies gentlemen. For completion the code I'm now using is:



lwpp::LWItem Item(LWI_OBJECT); /*select the first item*/
while( Item.GetID() ) /*cycle through all objects */
{
if( Item.GetID() == oimi->first )
break;
Item.Next();
}
if( !Item.GetID() ) /*object wasn't found if true*/
objectIDToInteriorMap.erase(oimi);