From e605957afbdda695a026378b91b1fd9dcc5d70a8 Mon Sep 17 00:00:00 2001 From: Clement Balea Date: Sat, 26 Oct 2024 00:06:48 +0300 Subject: [PATCH] fix animations (#62) --- README.md | 14 ++++++++++++++ package.json | 2 +- tests/mocks.js | 4 ++-- wow_model_viewer.js | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0da9e54..a1ba220 100644 --- a/README.md +++ b/README.md @@ -456,6 +456,20 @@ if you are useing Vulpera(race=35) ,`face` `furColor` `ears` `snout` options is if you use dracthyr(race=45) `primaryColor` `secondaryColorStrength` `secondaryColor` `bodySize` `horns` `hornColor` options is reqiured. +# Animations outdated +Due to the minified version of `ZamModelViewer` the following is regularly outdated +```js +getListAnimations() { + return [...new Set(this.renderer.models[0].aq.map(e => e.l))] +} +``` +to fix this outdated function in +`%2Fmodelviewer%2Fclassic%2Fviewer%2Fviewer.min.js` or `%2Fmodelviewer%2Flive%2Fviewer%2Fviewer.min.js` +search for `getAnimation` somewhere you should have something like: +```js +getNumAnimations(){const t=this.k?this.k:this;return t.aq?t.aq.length+1:0}getAnimation(t) +``` +replace the `aq` by the new var name in the library # Contribute diff --git a/package.json b/package.json index bfa65b7..18fa943 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wow-model-viewer", - "version": "1.5.0", + "version": "1.5.1", "description": "Generate World of Warcraft 3D model with body parts customization and items.", "engines": { "node": ">=16.0.0 <19.0.0" diff --git a/tests/mocks.js b/tests/mocks.js index a6394c2..6bea081 100644 --- a/tests/mocks.js +++ b/tests/mocks.js @@ -2,7 +2,7 @@ class ZamModelViewer { constructor() { this.renderer = { models: [{ - am: [{ + aq: [{ l: `animation1` }, { l: `animation2` @@ -10,7 +10,7 @@ class ZamModelViewer { l: `animation3` }], setAnimation: function (val) { - if (!this.am.find(e => e.l === val)) { + if (!this.aq.find(e => e.l === val)) { // nothing } }, diff --git a/wow_model_viewer.js b/wow_model_viewer.js index 6cf4220..11d1e9c 100644 --- a/wow_model_viewer.js +++ b/wow_model_viewer.js @@ -9,7 +9,7 @@ class WowModelViewer extends ZamModelViewer { */ getListAnimations() { console.log(`getListAnimations`) - return [...new Set(this.renderer.models[0].am.map(e => e.l))] + return [...new Set(this.renderer.models[0].aq.map(e => e.l))] } /**