aframe-extras.object-model
Advanced tools
Comparing version 3.13.1 to 4.0.0
@@ -20,3 +20,3 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
*/ | ||
module.exports = { | ||
module.exports = AFRAME.registerComponent('object-model', { | ||
schema: { | ||
@@ -32,4 +32,4 @@ src: { type: 'asset' }, | ||
update: function () { | ||
var loader, | ||
data = this.data; | ||
let loader; | ||
const data = this.data; | ||
if (!data.src) return; | ||
@@ -40,6 +40,6 @@ | ||
if (data.crossorigin) loader.setCrossOrigin(data.crossorigin); | ||
loader.load(data.src, function(object) { | ||
loader.load(data.src, (object) => { | ||
// Enable skinning, if applicable. | ||
object.traverse(function(o) { | ||
object.traverse((o) => { | ||
if (o instanceof THREE.SkinnedMesh && o.material) { | ||
@@ -51,3 +51,3 @@ o.material.skinning = !!((o.geometry && o.geometry.bones) || []).length; | ||
this.load(object); | ||
}.bind(this)); | ||
}); | ||
}, | ||
@@ -64,4 +64,4 @@ | ||
} | ||
}; | ||
}); | ||
},{}]},{},[1]); |
@@ -1,1 +0,1 @@ | ||
!function e(t,r,o){function n(s,a){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var f=new Error("Cannot find module '"+s+"'");throw f.code="MODULE_NOT_FOUND",f}var m=r[s]={exports:{}};t[s][0].call(m.exports,function(e){var r=t[s][1][e];return n(r||e)},m,m.exports,e,t,r,o)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<o.length;s++)n(o[s]);return n}({1:[function(e,t,r){AFRAME.registerComponent("object-model",e("./tmp/aframe-extras.object-model/index.js"))},{"./tmp/aframe-extras.object-model/index.js":2}],2:[function(e,t,r){t.exports={schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){var e,t=this.data;t.src&&(this.remove(),e=new THREE.ObjectLoader,t.crossorigin&&e.setCrossOrigin(t.crossorigin),e.load(t.src,function(e){e.traverse(function(e){e instanceof THREE.SkinnedMesh&&e.material&&(e.material.skinning=!!(e.geometry&&e.geometry.bones||[]).length)}),this.load(e)}.bind(this)))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}}},{}]},{},[1]); | ||
!function e(t,o,r){function n(s,a){if(!o[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var m=new Error("Cannot find module '"+s+"'");throw m.code="MODULE_NOT_FOUND",m}var l=o[s]={exports:{}};t[s][0].call(l.exports,function(e){var o=t[s][1][e];return n(o||e)},l,l.exports,e,t,o,r)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,o){AFRAME.registerComponent("object-model",e("./tmp/aframe-extras.object-model/index.js"))},{"./tmp/aframe-extras.object-model/index.js":2}],2:[function(e,t,o){t.exports=AFRAME.registerComponent("object-model",{schema:{src:{type:"asset"},crossorigin:{default:""}},init:function(){this.model=null},update:function(){let e;const t=this.data;t.src&&(this.remove(),e=new THREE.ObjectLoader,t.crossorigin&&e.setCrossOrigin(t.crossorigin),e.load(t.src,e=>{e.traverse(e=>{e instanceof THREE.SkinnedMesh&&e.material&&(e.material.skinning=!!(e.geometry&&e.geometry.bones||[]).length)}),this.load(e)}))},load:function(e){this.model=e,this.el.setObject3D("mesh",e),this.el.emit("model-loaded",{format:"json",model:e})},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},{}]},{},[1]); |
14
index.js
@@ -13,3 +13,3 @@ /** | ||
*/ | ||
module.exports = { | ||
module.exports = AFRAME.registerComponent('object-model', { | ||
schema: { | ||
@@ -25,4 +25,4 @@ src: { type: 'asset' }, | ||
update: function () { | ||
var loader, | ||
data = this.data; | ||
let loader; | ||
const data = this.data; | ||
if (!data.src) return; | ||
@@ -33,6 +33,6 @@ | ||
if (data.crossorigin) loader.setCrossOrigin(data.crossorigin); | ||
loader.load(data.src, function(object) { | ||
loader.load(data.src, (object) => { | ||
// Enable skinning, if applicable. | ||
object.traverse(function(o) { | ||
object.traverse((o) => { | ||
if (o instanceof THREE.SkinnedMesh && o.material) { | ||
@@ -44,3 +44,3 @@ o.material.skinning = !!((o.geometry && o.geometry.bones) || []).length; | ||
this.load(object); | ||
}.bind(this)); | ||
}); | ||
}, | ||
@@ -57,2 +57,2 @@ | ||
} | ||
}; | ||
}); |
{ | ||
"name": "aframe-extras.object-model", | ||
"version": "3.13.1", | ||
"version": "4.0.0", | ||
"description": "Loader for THREE.ObjectLoader-compatible models.", | ||
@@ -13,3 +13,3 @@ "author": "Don McCurdy <dm@donmccurdy.com>", | ||
"peerDependencies": { | ||
"aframe": ">=0.5.0" | ||
"aframe": "*" | ||
}, | ||
@@ -16,0 +16,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5431