Просмотр исходного кода

Add some util buttons in tweakpane-editor

master
Palash Bansal 3 лет назад
Родитель
Сommit
ed75f49bcd
Аккаунт пользователя с таким Email не найден
2 измененных файлов: 36 добавлений и 30 удалений
  1. 2
    2
      plugins/tweakpane-editor/package.json
  2. 34
    28
      plugins/tweakpane-editor/src/util-buttons.ts

+ 2
- 2
plugins/tweakpane-editor/package.json Просмотреть файл

{ {
"name": "@threepipe/plugin-tweakpane-editor", "name": "@threepipe/plugin-tweakpane-editor",
"description": "Tweakpane Editor Plugin for ThreePipe", "description": "Tweakpane Editor Plugin for ThreePipe",
"version": "0.1.0",
"version": "0.1.1",
"devDependencies": { "devDependencies": {
"tippy.js": "^6.3.7" "tippy.js": "^6.3.7"
}, },
"replace": { "replace": {
"dependencies": { "dependencies": {
"threepipe": "^0.0.8", "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 Просмотреть файл

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' import tippy, {createSingleton} from 'tippy.js'


export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<AViewerPlugin>[]) { export function createUtilButtons(viewer: ThreeViewer, allPlugins: Class<AViewerPlugin>[]) {
controls.autoRotate = !controls.autoRotate 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()
},
},
] ]
} }



Загрузка…
Отмена
Сохранить