Skip to content

Commit

Permalink
Check that model-loaded event originates from controls entity (#5415)
Browse files Browse the repository at this point in the history
Co-authored-by: Noeri Huisman <[email protected]>
  • Loading branch information
mrxz and mrxz authored Dec 17, 2023
1 parent e0c4ec6 commit e0f0372
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/oculus-go-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ module.exports.Component = registerComponent('oculus-go-controls', {
var controllerObject3D = evt.detail.model;
var buttonMeshes;

if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }
buttonMeshes = this.buttonMeshes = {};
buttonMeshes.trigger = controllerObject3D.getObjectByName('oculus_go_button_trigger');
buttonMeshes.trackpad = controllerObject3D.getObjectByName('oculus_go_touchpad');
Expand Down
2 changes: 1 addition & 1 deletion src/components/oculus-touch-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
},

onModelLoaded: function (evt) {
if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }
if (this.isTouchV3orPROorPlus) {
this.onTouchV3orPROorPlusModelLoaded(evt);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/components/pico-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ module.exports.Component = registerComponent('pico-controls', {
},

onModelLoaded: function (evt) {
if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }

this.el.emit('controllermodelready', {
name: 'pico-controls',
Expand Down
2 changes: 1 addition & 1 deletion src/components/valve-index-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ module.exports.Component = registerComponent('valve-index-controls', {
var controllerObject3D = evt.detail.model;
var self = this;

if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }

// Store button meshes object to be able to change their colors.
buttonMeshes = this.buttonMeshes = {};
Expand Down
2 changes: 1 addition & 1 deletion src/components/vive-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ module.exports.Component = registerComponent('vive-controls', {
var controllerObject3D = evt.detail.model;
var self = this;

if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }

// Store button meshes object to be able to change their colors.
buttonMeshes = this.buttonMeshes = {};
Expand Down
2 changes: 1 addition & 1 deletion src/components/vive-focus-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports.Component = registerComponent('vive-focus-controls', {
var controllerObject3D = evt.detail.model;
var buttonMeshes;

if (!this.data.model) { return; }
if (evt.target !== this.el || !this.data.model) { return; }
buttonMeshes = this.buttonMeshes = {};
buttonMeshes.trigger = controllerObject3D.getObjectByName('BumperKey');
buttonMeshes.triggerPressed = controllerObject3D.getObjectByName('BumperKey_Press');
Expand Down
2 changes: 2 additions & 0 deletions src/components/windows-motion-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ module.exports.Component = registerComponent('windows-motion-controls', {
var mesh;
var meshInfo;

if (evt.target !== this.el) { return; }

debug('Processing model');

// Reset the caches
Expand Down

0 comments on commit e0f0372

Please sign in to comment.