diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index fb1c27b..e5104fa 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -302,6 +302,21 @@ const MenubarDemo: React.FC<{ {i18n.t('Show Preview')} + { + editor.EnableHelper = !editor.EnableHelper + forceUpdate() + }} + > + + + + {i18n.t('Show Grid')} + diff --git a/src/editor.ts b/src/editor.ts index 7864c77..2e30d2e 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -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)) { diff --git a/src/locales/de.json b/src/locales/de.json index c0078f0..e625ad2 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -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" } diff --git a/src/locales/en.json b/src/locales/en.json index 21e5aa9..e2795a7 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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" } diff --git a/src/locales/ja.json b/src/locales/ja.json index 126fec2..3fbe08f 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -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": "グリッドを表示" } diff --git a/src/locales/sp.json b/src/locales/sp.json index 7c90e5d..d761c82 100644 --- a/src/locales/sp.json +++ b/src/locales/sp.json @@ -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" } diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index f806fe7..4e9085e 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -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": "显示网格" } diff --git a/src/locales/zh-HK.json b/src/locales/zh-HK.json index c4e8bd5..b0fabab 100644 --- a/src/locales/zh-HK.json +++ b/src/locales/zh-HK.json @@ -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": "顯示網格" } diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index 5afda7f..d9b7537 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -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": "顯示網格" } diff --git a/vite.config.ts b/vite.config.ts index 1cbd250..098c316 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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: {