Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Softimage® / XSI SDK / C++ API: SIObject::GetNestedObjects() Returns Nested Object Multiple Times
  RSS 2.0 ATOM  

C++ API: SIObject::GetNestedObjects() Returns Nested Object Multiple Times
Rate this thread
 
55313
 
Permlink of this thread  
avatar
  • Total Posts: 101
  • Joined: 31 August 2010 07:17 AM

Dear all,

I use Softimage to design game worlds. My Softimage scene contains Scene Models representing Game Objects. I have to assign unique ID to every Softimage Scene Model, so it can be later identified within the game.

To crawl Softimage Scene Tree, I use:

SIObject::GetNestedObjects()


This is recommended approach according to Softimage SDK.

When I build a recursive function(you can see it below) to traverse the scene tree, the same Scene Models are returned by the fucntion more times than once(usually three times). This represents problem for me: As I programatically assign unique ID to every Scene Model, I need to vist every scene model only once.

Is there a mechanism how to crawl Softimage scene tree, and be informed about every scene object only once, please?

The recursive function that is supposed to return each Scene Model only once:

void ResetGPNestedObjects_RecursiveSIObject &mySIObjectParamCRefin_ctxtLONG nIndent )
{
 Application app
;

 
// traverse only Models but skip SceneRoot
 
if ( (mySIObjectParam.IsA(siModelID)) && (mySIObjectParam != app.GetActiveSceneRoot()) ) 
 
{
 ResetGP
(mySIObjectParamin_ctxtfalse); 
 

 
 LogNestedObject
(mySIObjectParamnIndent);


 
CRefArray mySIObjects mySIObjectParam.GetNestedObjects();

 for ( 
int nSIObject 0nSIObject mySIObjects.GetCount(); nSIObject++)
 
{
 SIObject mySIObject 
mySIObjects[nSIObject];
 
ResetGPNestedObjects_RecursivemySIObjectin_ctxtnIndent );
 
}
}

I use C++ SDK and Softimage 2012.



Replies: 0
avatar

If anybody is interested in solution,

instead of SIObject::GetNestedObjects() I used:

Layer::GetExpandedMembers()

Link to Layer::GetExpandedMembers()

This way, I get the occurence of every layer member only once, and therefore I avoid repeated processing of layer members.



Replies: 0