Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ module.exports.Component = registerComponent('geometry', {

/**
* Update geometry component schema based on geometry type.
*
* @param {object} data - New data passed by Component.
*/
updateSchema: function (data) {
var currentGeometryType = this.oldData && this.oldData.primitive;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it checks for oldData rather than data

var newGeometryType = data.primitive;
var currentGeometryType = this.data && this.data.primitive;
var schema = geometries[newGeometryType] && geometries[newGeometryType].schema;

// Geometry has no schema.
Expand Down
14 changes: 10 additions & 4 deletions src/components/material.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,16 @@ module.exports.Component = registerComponent('material', {
},

updateSchema: function (data) {
var newShader = data.shader;
var currentShader = this.data && this.data.shader;
var shader = newShader || currentShader;
var schema = shaders[shader] && shaders[shader].schema;
var currentShader;
var newShader;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes test, checks for data / oldData existence

var schema;
var shader;

newShader = data && data.shader;
currentShader = this.oldData && this.oldData.shader;
shader = newShader || currentShader;
schema = shaders[shader] && shaders[shader].schema;

if (!schema) { error('Unknown shader schema ' + shader); }
if (currentShader && newShader === currentShader) { return; }
this.extendSchema(schema);
Expand Down
6 changes: 5 additions & 1 deletion src/components/obj-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ module.exports.Component = registerComponent('obj-model', {
update: function () {
var data = this.data;
if (!data.obj) { return; }
this.remove();
this.resetMesh();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to the purpose of the PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes a test

this.loadObj(data.obj, data.mtl);
},

remove: function () {
if (!this.model) { return; }
this.resetMesh();
},

resetMesh: function () {
this.el.removeObject3D('mesh');
},

Expand Down
Loading