This demo shows how you can import models from another scene.
Clara.io demo resources:
var baseSceneId = 'd7861e61-a55a-4d15-94fe-6d5c34c2d204';
var importSceneId = '065da178-cd3f-4fe9-bebb-91b663b16f92';
var api = claraplayer('player');
var numImports = 0;
api.sceneIO.fetchAndUse(baseSceneId).then(function() {
document.getElementById('import').onclick = importScene;
document.getElementById('baseScene').setAttribute('href','https://clara.io/view/'+baseSceneId);
document.getElementById('importScene').setAttribute('href','https://clara.io/view/'+importSceneId);
});
function importScene() {
api.sceneIO.fetch(importSceneId).then(function() {
var newObjectsIds = api.scene.find({ from: { id: importSceneId }, name: 'Objects' });
api.scene.clone(
{ from: { id: newObjectsIds }, type: ['PolyMesh', 'Null'] },
{ withNull: 'Import Null', includeDependencies: true }
).then(function(nodeMap) {
api.scene.set(
{ id: nodeMap['Import Null'], plug: 'Transform', property: 'translation' },
{ x: 0, y: numImports++ / 2, z: 0 }
);
});
});
};