diff --git a/src/core/actor.js b/src/core/actor.js
index e4acb87..36f326d 100644
--- a/src/core/actor.js
+++ b/src/core/actor.js
@@ -58,10 +58,10 @@ Actor.prototype.setParent = function(parent, keep_local)
parent.obj.add(this.obj);
} else {
if (this.parent) {
- THREE.SceneUtils.detach(this.obj, this.parent.obj, scene.obj);
+ scene.obj.attach(this.obj);
}
if (parent && parent !== scene) {
- THREE.SceneUtils.attach(this.obj, scene.obj, parent.obj);
+ parent.obj.attach(this.obj);
}
}
if (this.parent) {
diff --git a/src/index.html b/src/index.html
index 9901b95..3f8808c 100644
--- a/src/index.html
+++ b/src/index.html
@@ -30,7 +30,6 @@
-
diff --git a/src/views/scene-hierarchy.js b/src/views/scene-hierarchy.js
index 5d6efad..e0e93ab 100644
--- a/src/views/scene-hierarchy.js
+++ b/src/views/scene-hierarchy.js
@@ -38,8 +38,9 @@ function SceneHierarchyView(container, state)
check_callback: true,
data: self.buildHierarchy(scene),
},
- plugins: ['state', 'dnd'],
+ plugins: ['state', 'dnd', 'types'],
state: {key: 'scene-hierarchy_state'},
+ types: {'#': {max_children: 1}},
});
this.tree = this.hierarchy.jstree(true);
@@ -166,7 +167,7 @@ SceneHierarchyView.prototype.onNodeMove = function(event, data)
if (data.parent != data.old_parent) {
let node = data.node;
let actor = scene.getActor(node.id);
- let parent = scene.getActor(data.parent);
+ let parent = scene.getActor(data.parent) || scene;
actor.setParent(parent);
for (let sibling of this.tree.get_siblings(node)) {
if (sibling.data.order > node.data.order) {