Skip to content

Commit

Permalink
recovers camera with UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
ycw committed May 12, 2024
1 parent 4ec57f5 commit 12b9bda
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions editor/js/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,16 @@ Editor.prototype = {
var loader = new THREE.ObjectLoader();
var camera = await loader.parseAsync( json.camera );

const existingUuid = this.camera.uuid;
const incomingUuid = camera.uuid;

// copy all properties, including uuid
this.camera.copy( camera );
this.camera.uuid = incomingUuid;

delete this.cameras[ existingUuid ]; // remove old entry [existingUuid, this.camera]
this.cameras[ incomingUuid ] = this.camera; // add new entry [incomingUuid, this.camera]

this.signals.cameraResetted.dispatch();

this.history.fromJSON( json.history );
Expand Down

0 comments on commit 12b9bda

Please sign in to comment.