-
Notifications
You must be signed in to change notification settings - Fork 159
/
Copy pathThreePipe.js
34 lines (28 loc) · 948 Bytes
/
ThreePipe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import AssetActionPlugin from "../AssetActionPlugin";
import URI from 'urijs';
import i18n from "../../i18n";
// obj & ply files are usually with mime-type text/plain
const THREEPIPE_SUPPORTED_TYPES = [
'model/gltf-binary',
'model/gltf+json',
'application/fbx',
];
// below is usually text/plain
const THREEPIPE_SUPPORTED_FILEEXTS = ['obj', 'ply', 'fbx', 'glb', 'gltf', 'stl', 'usdz'];
export default class ThreePipe extends AssetActionPlugin {
get show() {
const suffix = URI(this.asset.href).suffix();
return this.component.isBrowserProtocol && (
THREEPIPE_SUPPORTED_TYPES.includes(this.asset.type)
|| THREEPIPE_SUPPORTED_FILEEXTS.some(ext => (suffix === ext))
);
}
get uri() {
let uri = new URI("https://threepipe.org/examples/tweakpane-editor");
uri.addQuery("model", this.component.href);
return uri;
}
get text() {
return i18n.t('actions.openIn', {service: 'ThreePipe'});
}
}