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® FBX® / FBX SDK / Merging 2 scenes
  RSS 2.0 ATOM  

Merging 2 scenes
Rate this thread
 
48346
 
Permlink of this thread  
avatar
  • Total Posts: 15
  • Joined: 29 September 2010 03:25 PM

Hi!

I want to do is merge the scene hierarchy from two different FBXs into a single FBX.  What’s the right way to do that?

So,

Let file1.fbx be
root1
|---child11
|---child12
|--child13
and let file2.fbx be
root2
|---child21
|---child22
|--child23

What is the right thing to do, such that I can have a file with say either a dummy root

root
|-root1
|   |---child11
|   |---child12
|   |--child13
|-root2
    
|---child21
    
|---child22
    
|--child23


Or just this:

|-root1
|   |---child11
|   |---child12
|   |--child13
|-root2
    
|---child21
    
|---child22
    
|--child23

I do not need the code, just pointers to how to do it will be very very helpful!
Please help!
Thanks a lot in advance,
Arjun



Replies: 0
avatar

Always check the FAQ before asking questions! :)

I still wanted to ask, that my source scenes are modified, isnt it? Can I not do something such that it is not destroyed?

InitializeSdkObjects(mAnimShapeFamily.getSDKManager(), mAnimSceneFBX);
 
KFbxNode *allRoot mAnimSceneFBX->GetRootNode();
 for(
unsigned int i0 0i0 opModels->size(); i0++)
 
{
 o_3dModel 
*model = (*opModels)[i0];
 
KFbxScene *testScn model->getFBXScene();
 
// Move node tree to reference scene.
 
int lNbChildren testScn->GetRootNode()->GetSrcObjectCount();
 for (
int i 0lNbChildreni++)
 
{
 KFbxNode
lChildNode testScn->GetRootNode()->GetChild(i);
 
// Attach child node to ref scene's root node.
 
lChildNode->ConnectDstObject(mAnimSceneFBX->GetRootNode());
 
}
 
// Detach all children from root node
 
testScn->GetRootNode()->DisconnectAllSrcObject();
 
// Move other objects to reference scene
 
int lNbSceneObj testScn->GetSrcObjectCount();
 for (
int i 0lNbSceneObji++)
 
{
 KFbxObject
lObj testScn->GetSrcObject(i);
 if (
lObj == testScn->GetRootNode() || *lObj == testScn->GetGlobalSettings())
 
{
 
// Don't move root node or global settings: these objects are created for every scene.
 
continue;
 
}
 
// Attach object to ref scene.
 
lObj->ConnectDstObject(mAnimSceneFBX);
 
}
 testScn
->DisconnectAllSrcObject(); // Disconnect all scene objects.
 
}
 SaveScene
(mAnimShapeFamily.getSDKManager(), mAnimSceneFBX"data/tmp/allScene.fbx");


Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

How about create a new scene and when you move nodes from file1 and file2 to this new scene, always clone a copy of the nodes, and do not touch the original nodes in file1 and file2?

I did not test it myself, just some idea here. :)

Author: Jiayang Xu

Replied: 13 October 2010 11:26 PM