feat: control grid

main
Yu Zhu 2023-04-15 19:14:51 +08:00
parent 547cc02f9d
commit d52fa7d0dd
10 changed files with 55 additions and 12 deletions

View File

@ -302,6 +302,21 @@ const MenubarDemo: React.FC<{
</Menubar.ItemIndicator>
{i18n.t('Show Preview')}
</Menubar.CheckboxItem>
<Menubar.CheckboxItem
className={classNames(MenubarCheckboxItem, inset)}
checked={editor.EnableHelper}
onCheckedChange={() => {
editor.EnableHelper = !editor.EnableHelper
forceUpdate()
}}
>
<Menubar.ItemIndicator
className={MenubarItemIndicator}
>
<CheckIcon />
</Menubar.ItemIndicator>
{i18n.t('Show Grid')}
</Menubar.CheckboxItem>
</Menubar.Content>
</Menubar.Portal>
</Menubar.Menu>

View File

@ -243,6 +243,8 @@ export class BodyEditor {
effectSobel?: ShaderPass
enableComposer = false
enablePreview = true
enableHelper = true
paused = false
parentElem: ParentElement
@ -1152,11 +1154,23 @@ export class BodyEditor {
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {}
}
changeHelper() {
const old = {
axesHelper: this.axesHelper.visible,
gridHelper: this.gridHelper.visible,
}
this.axesHelper.visible = false
this.gridHelper.visible = false
return () => {
this.axesHelper.visible = old.axesHelper
this.gridHelper.visible = old.gridHelper
}
}
MakeImages() {
this.renderer.setClearColor(0x000000)
this.axesHelper.visible = false
this.gridHelper.visible = false
const restoreHelper = this.changeHelper()
const restoreTransfromControl = this.changeTransformControl()
const restoreView = this.changeView()
@ -1172,8 +1186,7 @@ export class BodyEditor {
/// end
this.renderer.setClearColor(0x000000, 0)
this.axesHelper.visible = true
this.gridHelper.visible = true
restoreHelper()
restoreTransfromControl()
restoreView()
@ -1377,6 +1390,14 @@ export class BodyEditor {
this.setFootVisible(!this.onlyHand)
}
get EnableHelper() {
return this.enableHelper
}
set EnableHelper(value: boolean) {
this.enableHelper = value
this.gridHelper.visible = value
this.axesHelper.visible = value
}
setFootVisible(value: boolean) {
this.traverseExtremities((o) => {
if (IsFoot(o.name)) {

View File

@ -66,5 +66,6 @@
"Load Gesture": "Geste laden",
"Save Gesture": "Geste speichern",
"Please select a hand!!": "Bitte wählen Sie eine Hand aus!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "Bei dem Versuch, Anime-Charaktere zu erkennen, kann es zu einem Fehler kommen. Bitte versuchen Sie es erneut mit Fotos."
"If you try to detect anime characters, you may get an error. Please try again with photos.": "Bei dem Versuch, Anime-Charaktere zu erkennen, kann es zu einem Fehler kommen. Bitte versuchen Sie es erneut mit Fotos.",
"Show Grid": "Gitter anzeigen"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "Load Gesture",
"Save Gesture": "Save Gesture",
"Please select a hand!!": "Please select a hand!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "If you try to detect anime characters, you may get an error. Please try again with photos."
"If you try to detect anime characters, you may get an error. Please try again with photos.": "If you try to detect anime characters, you may get an error. Please try again with photos.",
"Show Grid": "Show Grid"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "ジェスチャーを読み込む",
"Save Gesture": "ジェスチャーを保存する",
"Please select a hand!!": "手を選択してください!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "アニメキャラクターを検出しようとするとエラーが発生する場合があります。写真で再度お試しください。"
"If you try to detect anime characters, you may get an error. Please try again with photos.": "アニメキャラクターを検出しようとするとエラーが発生する場合があります。写真で再度お試しください。",
"Show Grid": "グリッドを表示"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "Cargar gesto",
"Save Gesture": "Guardar gesto",
"Please select a hand!!": "¡¡Por favor, seleccione una mano!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "Si intenta detectar personajes de anime, es posible que obtenga un error. Por favor, inténtelo de nuevo con fotos."
"If you try to detect anime characters, you may get an error. Please try again with photos.": "Si intenta detectar personajes de anime, es posible que obtenga un error. Por favor, inténtelo de nuevo con fotos.",
"Show Grid": "Mostrar cuadrícula"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "加载手势",
"Save Gesture": "保存手势",
"Please select a hand!!": "请选择一只手!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您尝试检测动漫角色,可能会出现错误。请使用照片再试一次。"
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您尝试检测动漫角色,可能会出现错误。请使用照片再试一次。",
"Show Grid": "显示网格"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "載入手勢",
"Save Gesture": "儲存手勢",
"Please select a hand!!": "請選擇一隻手!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。"
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。",
"Show Grid": "顯示網格"
}

View File

@ -66,5 +66,6 @@
"Load Gesture": "載入手勢",
"Save Gesture": "儲存手勢",
"Please select a hand!!": "請選擇一隻手!!",
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。"
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。",
"Show Grid": "顯示網格"
}

View File

@ -109,7 +109,7 @@ const config: UserConfigFn = ({ command, mode, ssrBuild }) => {
base: mode === 'singlefile' ? './' : '/open-pose-editor/',
define: {
global: {},
__APP_VERSION__: JSON.stringify('0.1.17'),
__APP_VERSION__: JSON.stringify('0.1.18'),
__APP_BUILD_TIME__: Date.now(),
},
build: {