Skip to content

Commit 12b9bda

Browse files
committed
recovers camera with UUID
1 parent 4ec57f5 commit 12b9bda

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

editor/js/Editor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,16 @@ Editor.prototype = {
659659
var loader = new THREE.ObjectLoader();
660660
var camera = await loader.parseAsync( json.camera );
661661

662+
const existingUuid = this.camera.uuid;
663+
const incomingUuid = camera.uuid;
664+
665+
// copy all properties, including uuid
662666
this.camera.copy( camera );
667+
this.camera.uuid = incomingUuid;
668+
669+
delete this.cameras[ existingUuid ]; // remove old entry [existingUuid, this.camera]
670+
this.cameras[ incomingUuid ] = this.camera; // add new entry [incomingUuid, this.camera]
671+
663672
this.signals.cameraResetted.dispatch();
664673

665674
this.history.fromJSON( json.history );

0 commit comments

Comments
 (0)