+bool Scene::merge(Scene *scn)
+{
+ if(walk_mesh) {
+ if(scn->walk_mesh) {
+ walk_mesh->append(*scn->walk_mesh);
+ delete scn->walk_mesh;
+ scn->walk_mesh = 0;
+ }
+ } else {
+ walk_mesh = scn->walk_mesh;
+ scn->walk_mesh = 0;
+ }
+
+ int nmeshes = scn->meshes.size();
+ for(int i=0; i<nmeshes; i++) {
+ meshes.push_back(scn->meshes[i]);
+ }
+ scn->meshes.clear();
+
+ int nobj = scn->objects.size();
+ for(int i=0; i<nobj; i++) {
+ objects.push_back(scn->objects[i]);
+ }
+ scn->objects.clear();
+
+ if(nodes) {
+ int nchildren = scn->nodes ? scn->nodes->get_num_children() : 0;
+ for(int i=0; i<nchildren; i++) {
+ SceneNode *n = scn->nodes->get_child(i);
+ scn->nodes->remove_child(n);
+ nodes->add_child(n);
+ }
+ if(scn->nodes && scn->nodes->get_num_objects() > 0) {
+ warning_log("merging with scene which has objects in its root node. these objects will not be merged!\n");
+ }
+ delete scn->nodes;
+ } else {
+ nodes = scn->nodes;
+ }
+ scn->nodes = 0;
+
+ return true;
+}
+