Parcourir la source

Add some util buttons in tweakpane-editor

master
Palash Bansal il y a 2 ans
Parent
révision
ed75f49bcd
Aucun compte lié à l'adresse e-mail de l'auteur

+ 2
- 2
plugins/tweakpane-editor/package.json Voir le fichier

@@ -1,7 +1,7 @@
{
"name": "@threepipe/plugin-tweakpane-editor",
"description": "Tweakpane Editor Plugin for ThreePipe",
"version": "0.1.0",
"version": "0.1.1",
"devDependencies": {
"tippy.js": "^6.3.7"
},
@@ -20,7 +20,7 @@
"replace": {
"dependencies": {
"threepipe": "^0.0.8",
"@threepipe/plugin-tweakpane": "^0.1.0"
"@threepipe/plugin-tweakpane": "^0.1.1"
}
}
},

+ 34
- 28
plugins/tweakpane-editor/src/util-buttons.ts Voir le fichier

@@ -1,5 +1,5 @@
import {AViewerPlugin, Class, createDiv, FullScreenPlugin, ThreeViewer} from 'threepipe'
import {autoRotateCC, collapse, expand, resetSettings, trash} from './icons'
import {AViewerPlugin, Class, createDiv, downloadBlob, FullScreenPlugin, ThreeViewer} from 'threepipe'
import {autoRotateCC, collapse, download, expand, resetSettings, snapshot, trash} from './icons'
import tippy, {createSingleton} from 'tippy.js'

export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<AViewerPlugin>[]) {
@@ -63,32 +63,38 @@ export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<AViewer
controls.autoRotate = !controls.autoRotate
},
},
// {
// id: 'snapshot',
// icon: snapshot,
// tooltip: 'Capture Snapshot',
// onclick: async() => {
// const s = viewer.getPlugin(CanvasSnipperPlugin)
// if (!s) {
// viewer.console.error('CanvasSnipperPlugin not added')
// return
// }
// await s.downloadSnapshot()
// },
// },
// {
// id: 'glb-export',
// icon: download,
// tooltip: 'Export GLB',
// onclick: async() => {
// const exporter = viewer.getPlugin(AssetExporterPlugin)
// if (!exporter) {
// viewer.console.error('AssetExporterPlugin not added')
// return
// }
// await exporter?.downloadSceneGlb()
// },
// },
{
id: 'snapshot',
icon: snapshot,
tooltip: 'Capture Snapshot',
onclick: async() => {
const image = await viewer.getScreenshotBlob({mimeType: 'image/png'})
image && downloadBlob(image, 'screenshot.png')
// todo use this for waitForProgressive
// const s = viewer.getPlugin(CanvasSnipperPlugin)
// if (!s) {
// viewer.console.error('CanvasSnipperPlugin not added')
// return
// }
// await s.downloadSnapshot()
},
},
{
id: 'glb-export',
icon: download,
tooltip: 'Export GLB',
onclick: async() => {
const glb = await viewer.exportScene()
glb && downloadBlob(glb, 'scene.glb')
// todo use this for all export settings
// const exporter = viewer.getPlugin(AssetExporterPlugin)
// if (!exporter) {
// viewer.console.error('AssetExporterPlugin not added')
// return
// }
// await exporter?.downloadSceneGlb()
},
},
]
}


Chargement…
Annuler
Enregistrer