@oasis-engine/ark
Advanced tools
Comparing version 0.0.20 to 0.7.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('oasis-engine')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'oasis-engine'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.oasisArk = {}, global.oasisEngine)); | ||
})(this, (function (exports, oasisEngine) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('oasis-engine')) : | ||
typeof define === 'function' && define.amd ? define(['oasis-engine'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.oasisArk = factory(global.oasisEngine)); | ||
})(this, (function (oasisEngine) { 'use strict'; | ||
@@ -179,2 +179,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -1059,2 +1060,41 @@ _this._hairEntity = void 0; | ||
} | ||
}, { | ||
key: "blendShapes", | ||
get: function get() { | ||
return this._blendShapes; | ||
}, | ||
set: function set(str) { | ||
var _this9 = this; | ||
this._blendShapes = str; | ||
if (this._setModelPromise) { | ||
this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18() { | ||
var json, index, _json$index, name, value; | ||
return regeneratorRuntime.wrap(function _callee18$(_context18) { | ||
while (1) { | ||
switch (_context18.prev = _context18.next) { | ||
case 0: | ||
try { | ||
json = JSON.parse(str); | ||
_this9.resetBlendShape(); | ||
for (index in json) { | ||
_json$index = json[index], name = _json$index.name, value = _json$index.value; | ||
_this9.editBlendShape(name, value); | ||
} | ||
} catch (e) {} | ||
case 1: | ||
case "end": | ||
return _context18.stop(); | ||
} | ||
} | ||
}, _callee18); | ||
}))); | ||
} | ||
} | ||
/** | ||
@@ -1112,2 +1152,29 @@ * ------------- end: editor config ------------- | ||
/** | ||
* All blendShape name/value list in current 3D model. | ||
*/ | ||
}, { | ||
key: "blendShapeNameValueList", | ||
get: function get() { | ||
var arr = []; | ||
var renderers = this._bsRenderers; | ||
for (var rendererIndex in renderers) { | ||
var renderer = renderers[rendererIndex]; | ||
var blendShapeWeights = renderer.blendShapeWeights; | ||
var mesh = renderer.mesh; | ||
for (var weightIndex in blendShapeWeights) { | ||
var name = mesh.getBlendShapeName ? mesh.getBlendShapeName(Number(weightIndex)) : weightIndex + ""; | ||
var value = blendShapeWeights[weightIndex]; | ||
arr.push({ | ||
name: name, | ||
value: value | ||
}); | ||
} | ||
} | ||
return JSON.stringify(arr); | ||
} | ||
/** | ||
* A hook to call back when loading is complete | ||
@@ -1126,10 +1193,4 @@ */ | ||
oasisEngine.Parser.registerComponents("o3", { | ||
"ark-custom-component": ArkComponent | ||
}); | ||
return ArkComponent; | ||
exports.ArkComponent = ArkComponent; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); |
@@ -1,2 +0,2 @@ | ||
import { Shader, Layer, Camera, PrimitiveMesh, MeshRenderer, BaseMaterial, Texture2D, RenderTarget, Component, Parser, AssetType, Logger, SkinnedMeshRenderer, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, Animator } from 'oasis-engine'; | ||
import { Shader, Layer, Camera, PrimitiveMesh, MeshRenderer, BaseMaterial, Texture2D, RenderTarget, Component, AssetType, Logger, SkinnedMeshRenderer, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, Animator } from 'oasis-engine'; | ||
@@ -175,2 +175,3 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -1055,2 +1056,41 @@ _this._hairEntity = void 0; | ||
} | ||
}, { | ||
key: "blendShapes", | ||
get: function get() { | ||
return this._blendShapes; | ||
}, | ||
set: function set(str) { | ||
var _this9 = this; | ||
this._blendShapes = str; | ||
if (this._setModelPromise) { | ||
this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18() { | ||
var json, index, _json$index, name, value; | ||
return regeneratorRuntime.wrap(function _callee18$(_context18) { | ||
while (1) { | ||
switch (_context18.prev = _context18.next) { | ||
case 0: | ||
try { | ||
json = JSON.parse(str); | ||
_this9.resetBlendShape(); | ||
for (index in json) { | ||
_json$index = json[index], name = _json$index.name, value = _json$index.value; | ||
_this9.editBlendShape(name, value); | ||
} | ||
} catch (e) {} | ||
case 1: | ||
case "end": | ||
return _context18.stop(); | ||
} | ||
} | ||
}, _callee18); | ||
}))); | ||
} | ||
} | ||
/** | ||
@@ -1108,2 +1148,29 @@ * ------------- end: editor config ------------- | ||
/** | ||
* All blendShape name/value list in current 3D model. | ||
*/ | ||
}, { | ||
key: "blendShapeNameValueList", | ||
get: function get() { | ||
var arr = []; | ||
var renderers = this._bsRenderers; | ||
for (var rendererIndex in renderers) { | ||
var renderer = renderers[rendererIndex]; | ||
var blendShapeWeights = renderer.blendShapeWeights; | ||
var mesh = renderer.mesh; | ||
for (var weightIndex in blendShapeWeights) { | ||
var name = mesh.getBlendShapeName ? mesh.getBlendShapeName(Number(weightIndex)) : weightIndex + ""; | ||
var value = blendShapeWeights[weightIndex]; | ||
arr.push({ | ||
name: name, | ||
value: value | ||
}); | ||
} | ||
} | ||
return JSON.stringify(arr); | ||
} | ||
/** | ||
* A hook to call back when loading is complete | ||
@@ -1122,6 +1189,2 @@ */ | ||
Parser.registerComponents("o3", { | ||
"ark-custom-component": ArkComponent | ||
}); | ||
export { ArkComponent }; | ||
export { ArkComponent as default }; |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var miniprogram = require('oasis-engine/dist/miniprogram'); | ||
@@ -179,2 +177,3 @@ | ||
_this._clothUrl = void 0; | ||
_this._blendShapes = void 0; | ||
_this._modelEntity = void 0; | ||
@@ -1059,2 +1058,41 @@ _this._hairEntity = void 0; | ||
} | ||
}, { | ||
key: "blendShapes", | ||
get: function get() { | ||
return this._blendShapes; | ||
}, | ||
set: function set(str) { | ||
var _this9 = this; | ||
this._blendShapes = str; | ||
if (this._setModelPromise) { | ||
this._setModelPromise.then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18() { | ||
var json, index, _json$index, name, value; | ||
return regeneratorRuntime.wrap(function _callee18$(_context18) { | ||
while (1) { | ||
switch (_context18.prev = _context18.next) { | ||
case 0: | ||
try { | ||
json = JSON.parse(str); | ||
_this9.resetBlendShape(); | ||
for (index in json) { | ||
_json$index = json[index], name = _json$index.name, value = _json$index.value; | ||
_this9.editBlendShape(name, value); | ||
} | ||
} catch (e) {} | ||
case 1: | ||
case "end": | ||
return _context18.stop(); | ||
} | ||
} | ||
}, _callee18); | ||
}))); | ||
} | ||
} | ||
/** | ||
@@ -1112,2 +1150,29 @@ * ------------- end: editor config ------------- | ||
/** | ||
* All blendShape name/value list in current 3D model. | ||
*/ | ||
}, { | ||
key: "blendShapeNameValueList", | ||
get: function get() { | ||
var arr = []; | ||
var renderers = this._bsRenderers; | ||
for (var rendererIndex in renderers) { | ||
var renderer = renderers[rendererIndex]; | ||
var blendShapeWeights = renderer.blendShapeWeights; | ||
var mesh = renderer.mesh; | ||
for (var weightIndex in blendShapeWeights) { | ||
var name = mesh.getBlendShapeName ? mesh.getBlendShapeName(Number(weightIndex)) : weightIndex + ""; | ||
var value = blendShapeWeights[weightIndex]; | ||
arr.push({ | ||
name: name, | ||
value: value | ||
}); | ||
} | ||
} | ||
return JSON.stringify(arr); | ||
} | ||
/** | ||
* A hook to call back when loading is complete | ||
@@ -1126,6 +1191,2 @@ */ | ||
miniprogram.Parser.registerComponents("o3", { | ||
"ark-custom-component": ArkComponent | ||
}); | ||
exports.ArkComponent = ArkComponent; | ||
module.exports = ArkComponent; |
{ | ||
"version": "0.0.20", | ||
"version": "0.7.0", | ||
"name": "@oasis-engine/ark", | ||
@@ -38,4 +38,4 @@ "browser": "dist/index.browser.js", | ||
"peerDependencies": { | ||
"oasis-engine": "^0.8.0-beta" | ||
"oasis-engine": "^0.7.0" | ||
} | ||
} |
@@ -15,2 +15,3 @@ import { Animator, Color, Component, Entity } from "oasis-engine"; | ||
private _clothUrl; | ||
private _blendShapes; | ||
private _modelEntity; | ||
@@ -47,2 +48,4 @@ private _hairEntity; | ||
set animationUrl(url: string); | ||
get blendShapes(): string; | ||
set blendShapes(str: string); | ||
/** | ||
@@ -64,2 +67,6 @@ * ------------- end: editor config ------------- | ||
/** | ||
* All blendShape name/value list in current 3D model. | ||
*/ | ||
get blendShapeNameValueList(): string; | ||
/** | ||
* A hook to call back when loading is complete | ||
@@ -144,2 +151,2 @@ */ | ||
} | ||
export { ArkComponent }; | ||
export default ArkComponent; |
121089
3159