Skip to content

Commit

Permalink
fix animations (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miorey authored Oct 25, 2024
1 parent 7f1f833 commit e605957
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ class ZamModelViewer {
constructor() {
this.renderer = {
models: [{
am: [{
aq: [{
l: `animation1`
}, {
l: `animation2`
}, {
l: `animation3`
}],
setAnimation: function (val) {
if (!this.am.find(e => e.l === val)) {
if (!this.aq.find(e => e.l === val)) {
// nothing
}
},
Expand Down
2 changes: 1 addition & 1 deletion wow_model_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
}

/**
Expand Down

0 comments on commit e605957

Please sign in to comment.