| 715 | // gets a flattened list of all models of a certain type. e.g. "path/subpath/modelname" |
| 716 | // use the filter to search for all models having a certain name. |
| 717 | function getAllModelPathes(type, filter = "") { |
| 718 | function f(tree, prefix) { |
| 719 | if (tree == undefined) { |
| 720 | return [] |
| 721 | } |
| 722 | let result = [] |
| 723 | tree.forEach((e) => { |
| 724 | if (typeof e == "object") { |
| 725 | result = result.concat(f(e[1], prefix + e[0] + "/")) |
| 726 | } else { |
| 727 | if (filter == "" || e == filter) { |
| 728 | result.push(prefix + e) |
| 729 | } |
| 730 | } |
| 731 | }) |
| 732 | return result |
| 733 | } |
| 734 | return f(modelsOptions[type], "") |
| 735 | } |
| 736 | |
| 737 | function onUseAsThumbnailClick(req, img) { |
| 738 | let scale = 1 |