79f7d96db0c1df3965cb33202ee30d555cd753587788e61945460e5a2f55cd2a
Browse files- sd-webui-3d-open-pose-editor/src/i18n.ts +58 -0
- sd-webui-3d-open-pose-editor/src/locales/de.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/en.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/ja.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/sp.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/zh-CN.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/zh-HK.json +71 -0
- sd-webui-3d-open-pose-editor/src/locales/zh-TW.json +71 -0
- sd-webui-3d-open-pose-editor/src/message-test.ts +82 -0
- sd-webui-3d-open-pose-editor/src/models.ts +128 -0
- sd-webui-3d-open-pose-editor/src/pose-library.ts +38 -0
- sd-webui-3d-open-pose-editor/src/poses/data.bin +3 -0
- sd-webui-3d-open-pose-editor/src/poses/data.json +0 -0
- sd-webui-3d-open-pose-editor/src/utils/CCDIKSolver.ts +209 -0
- sd-webui-3d-open-pose-editor/src/utils/detect.ts +63 -0
- sd-webui-3d-open-pose-editor/src/utils/image.ts +16 -0
- sd-webui-3d-open-pose-editor/src/utils/loader.ts +81 -0
- sd-webui-3d-open-pose-editor/src/utils/three-utils.ts +27 -0
- sd-webui-3d-open-pose-editor/src/utils/time.ts +5 -0
- sd-webui-3d-open-pose-editor/src/utils/transfer.ts +187 -0
- sd-webui-3d-open-pose-editor/src/vite-env.d.ts +4 -0
- sd-webui-3d-open-pose-editor/style.css +11 -0
- sd-webui-3d-open-pose-editor/tools/fix-singlefile.ts +16 -0
- sd-webui-3d-open-pose-editor/tools/generate_assets.ts +51 -0
- sd-webui-3d-open-pose-editor/tools/translate.ts +42 -0
- sd-webui-3d-open-pose-editor/tsconfig.json +21 -0
- sd-webui-3d-open-pose-editor/tsconfig.node.json +9 -0
- sd-webui-3d-open-pose-editor/vite-plugin-extension.ts +77 -0
- sd-webui-3d-open-pose-editor/vite.config.ts +130 -0
- sd-webui-lora-block-weight/scripts/__pycache__/lora_block_weight.cpython-310.pyc +0 -0
- sd-webui-stablesr/scripts/__pycache__/stablesr.cpython-310.pyc +0 -0
- sd-webui-stablesr/srmodule/__pycache__/attn.cpython-310.pyc +0 -0
- sd-webui-stablesr/srmodule/__pycache__/colorfix.cpython-310.pyc +0 -0
- sd-webui-stablesr/srmodule/__pycache__/spade.cpython-310.pyc +0 -0
- sd-webui-stablesr/srmodule/__pycache__/struct_cond.cpython-310.pyc +0 -0
sd-webui-3d-open-pose-editor/src/i18n.ts
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import i18next from 'i18next'
|
2 |
+
import LanguageDetector from 'i18next-browser-languagedetector'
|
3 |
+
import commonEn from './locales/en.json'
|
4 |
+
import commonZh_CN from './locales/zh-CN.json'
|
5 |
+
import commonZh_TW from './locales/zh-TW.json'
|
6 |
+
import commonZh_HK from './locales/zh-HK.json'
|
7 |
+
import commonJa_JP from './locales/ja.json'
|
8 |
+
import commonDe from './locales/de.json'
|
9 |
+
import commonSp from './locales/sp.json'
|
10 |
+
|
11 |
+
export const resources = {
|
12 |
+
en: { common: commonEn },
|
13 |
+
zh: { common: commonZh_CN },
|
14 |
+
'zh-TW': { common: commonZh_TW },
|
15 |
+
'zh-HK': { common: commonZh_HK },
|
16 |
+
ja: { common: commonJa_JP },
|
17 |
+
de: { common: commonDe },
|
18 |
+
sp: { common: commonSp },
|
19 |
+
}
|
20 |
+
|
21 |
+
export const LanguageMapping: Record<string, string> = {
|
22 |
+
en: 'English',
|
23 |
+
zh: '简体中文',
|
24 |
+
'zh-TW': '繁體中文(台灣)',
|
25 |
+
'zh-HK': '繁體中文(香港)',
|
26 |
+
ja: '日本語',
|
27 |
+
de: 'Deutsch',
|
28 |
+
sp: 'español',
|
29 |
+
}
|
30 |
+
|
31 |
+
const options = {
|
32 |
+
order: ['querystring', 'localStorage', 'navigator'],
|
33 |
+
lookupQuerystring: 'lng',
|
34 |
+
}
|
35 |
+
|
36 |
+
i18next.use(LanguageDetector).init({
|
37 |
+
// lng: 'en', // if you're using a language detector, do not define the lng option
|
38 |
+
detection: options,
|
39 |
+
fallbackLng: 'en',
|
40 |
+
debug: true,
|
41 |
+
ns: ['common'],
|
42 |
+
defaultNS: 'common',
|
43 |
+
supportedLngs: Object.keys(resources),
|
44 |
+
interpolation: {
|
45 |
+
escapeValue: false,
|
46 |
+
},
|
47 |
+
resources: resources,
|
48 |
+
})
|
49 |
+
|
50 |
+
export function IsChina() {
|
51 |
+
return (
|
52 |
+
i18next.language === 'zh-CN' ||
|
53 |
+
window.navigator.language === 'zh-CN' ||
|
54 |
+
window.navigator.language?.includes('zh-CN')
|
55 |
+
)
|
56 |
+
}
|
57 |
+
|
58 |
+
export default i18next
|
sd-webui-3d-open-pose-editor/src/locales/de.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "Breite",
|
3 |
+
"Height": "Höhe",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "Knochenbau/Depth/Normale/Canny Bilder generieren",
|
5 |
+
"Duplicate Skeleton": "Knochenbau kopieren",
|
6 |
+
"Delete Skeleton": "Knochenbau löschen",
|
7 |
+
"Move Mode": "Verschiebungsmode",
|
8 |
+
"Show Edge Map": "Randbild zeigen",
|
9 |
+
"Camera Near": "Kamera näher schieben",
|
10 |
+
"Camera Far": "Kamera weiter ziehen",
|
11 |
+
"Camera Focal Length": "Brennweite",
|
12 |
+
"Downloading Hand Model": "Hand Modell herunterladen",
|
13 |
+
"Updates are available, please confirm!!": "Bestätigen Sie die Aktualisierung!",
|
14 |
+
"Select a scene file": "Wählen Sie eine Szene",
|
15 |
+
"Oops...": "Oops...",
|
16 |
+
"Something went wrong!": "Irgendwas hat schief gelaufen!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "Bitte melden Sie hier, um Frage zu stellen.",
|
18 |
+
"Save Scene": "Szene speichern",
|
19 |
+
"Load Scene": "Szene laden",
|
20 |
+
"Restore Last Scene": "Szene wiederherstellen",
|
21 |
+
"Set Background Image": "Hintergrundbild laden",
|
22 |
+
"Select an image": "Wählen Sie ein Bild",
|
23 |
+
"Body Parameters": "Körper Parameter",
|
24 |
+
"Shoulder Width": "Schulterbreite",
|
25 |
+
"Shoulder To Hip": "Von Schulter zu Gesäß",
|
26 |
+
"Arm Length": "Armlänge",
|
27 |
+
"Forearm": "Unterarm",
|
28 |
+
"Upper Arm": "Oberarm",
|
29 |
+
"Hand Size": "Handgröße",
|
30 |
+
"Hips": "Gesäß",
|
31 |
+
"Leg Length": "Beinlänge",
|
32 |
+
"Thigh": "Oberschenkel",
|
33 |
+
"Lower Leg": "Unterschenkel",
|
34 |
+
"Nose To Neck": "Von Nase zu Hals",
|
35 |
+
"Head Size": "Kopfgröße",
|
36 |
+
"Show Preview": "Überblick zeigen",
|
37 |
+
"Only Hand": "Nur Hände",
|
38 |
+
"Foot Size": "Fußgröße",
|
39 |
+
"Downloading Foot Model": "Fuß Modell herunterladen",
|
40 |
+
"Please select a skeleton!!": "Wählen Sie einen Knochenbau!",
|
41 |
+
"Downloading Poses Library": "Pose Bibliothek herunterladen",
|
42 |
+
"Set Random Pose": "zufällige Pose",
|
43 |
+
"Redo": "Redo",
|
44 |
+
"Undo": "Undo",
|
45 |
+
"Detect From Image": "Knochenbau von Bild erkennen",
|
46 |
+
"Downloading MediaPipe Pose Model": "MediaPipe Pose Modell herunterladen",
|
47 |
+
"Edit": "bearbeiten",
|
48 |
+
"Setting": "Einstellungen",
|
49 |
+
"Bone Thickness": "Dicke des Knochens",
|
50 |
+
"Feedback": "Problem melden",
|
51 |
+
"View": "Ansicht",
|
52 |
+
"Fix View": "Ansicht fixieren",
|
53 |
+
"Restore View": "Ansicht wiederherstellen",
|
54 |
+
"Free Mode": "Freier Modus",
|
55 |
+
"Del": "Entf",
|
56 |
+
"File": "Datei",
|
57 |
+
"Generate": "Generieren",
|
58 |
+
"Close": "Schließen",
|
59 |
+
"Update": "Aktualisieren",
|
60 |
+
"Lock View": "Ansicht sperren",
|
61 |
+
"Unlock View": "Ansicht entsperren",
|
62 |
+
"Copy Keypoint Data": "Schlüsselpunktdaten kopieren",
|
63 |
+
"Copied to Clipboard": "In die Zwischenablage kopiert",
|
64 |
+
"Generate Scene URL": "Szene-URL generieren",
|
65 |
+
"Reset Scene": "Szene zurücksetzen",
|
66 |
+
"Load Gesture": "Geste laden",
|
67 |
+
"Save Gesture": "Geste speichern",
|
68 |
+
"Please select a hand!!": "Bitte wählen Sie eine Hand aus!!",
|
69 |
+
"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.",
|
70 |
+
"Show Grid": "Gitter anzeigen"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/en.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "Width",
|
3 |
+
"Height": "Height",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "Generate Skeleton/Depth/Normal/Canny Map",
|
5 |
+
"Duplicate Skeleton": "Duplicate Skeleton",
|
6 |
+
"Delete Skeleton": "Delete Skeleton",
|
7 |
+
"Move Mode": "Move Mode",
|
8 |
+
"Show Edge Map": "Show Edge Map",
|
9 |
+
"Camera Near": "Camera Near",
|
10 |
+
"Camera Far": "Camera Far",
|
11 |
+
"Camera Focal Length": "Camera Focal Length",
|
12 |
+
"Downloading Hand Model": "Downloading Hand Model",
|
13 |
+
"Updates are available, please confirm!!": "Updates are available, please confirm!!",
|
14 |
+
"Select a scene file": "Select a scene file",
|
15 |
+
"Oops...": "Oops...",
|
16 |
+
"Something went wrong!": "Something went wrong!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "If the problem persists, please click here to ask a question.",
|
18 |
+
"Save Scene": "Save Scene",
|
19 |
+
"Generate Scene URL": "Generate Scene URL",
|
20 |
+
"Load Scene": "Load Scene",
|
21 |
+
"Restore Last Scene": "Restore Last Scene",
|
22 |
+
"Set Background Image": "Set Background Image",
|
23 |
+
"Select an image": "Select an image",
|
24 |
+
"Body Parameters": "Body Parameters",
|
25 |
+
"Shoulder Width": "Shoulder Width",
|
26 |
+
"Shoulder To Hip": "Shoulder To Hip",
|
27 |
+
"Arm Length": "Arm Length",
|
28 |
+
"Forearm": "Forearm",
|
29 |
+
"Upper Arm": "Upper Arm",
|
30 |
+
"Hand Size": "Hand Size",
|
31 |
+
"Hips": "Hips",
|
32 |
+
"Leg Length": "Leg Length",
|
33 |
+
"Thigh": "Thigh",
|
34 |
+
"Lower Leg": "Lower Leg",
|
35 |
+
"Nose To Neck": "Nose To Neck",
|
36 |
+
"Head Size": "Head Size",
|
37 |
+
"Show Preview": "Show Preview",
|
38 |
+
"Only Hand": "Only Hand",
|
39 |
+
"Foot Size": "Foot Size",
|
40 |
+
"Downloading Foot Model": "Downloading Foot Model",
|
41 |
+
"Please select a skeleton!!": "Please select a skeleton!!",
|
42 |
+
"Downloading Poses Library": "Downloading Poses Library",
|
43 |
+
"Set Random Pose": "Set Random Pose",
|
44 |
+
"Redo": "Redo",
|
45 |
+
"Undo": "Undo",
|
46 |
+
"Detect From Image": "Detect From Image",
|
47 |
+
"Downloading MediaPipe Pose Model": "Downloading MediaPipe Pose Model",
|
48 |
+
"Edit": "Edit",
|
49 |
+
"Setting": "Setting",
|
50 |
+
"Bone Thickness": "Bone Thickness",
|
51 |
+
"Feedback": "Feedback",
|
52 |
+
"View": "View",
|
53 |
+
"Fix View": "Fix View",
|
54 |
+
"Restore View": "Restore View",
|
55 |
+
"Free Mode": "Free Mode",
|
56 |
+
"Del": "Del",
|
57 |
+
"File": "File",
|
58 |
+
"Generate": "Generate",
|
59 |
+
"Close": "Close",
|
60 |
+
"Update": "Update",
|
61 |
+
"Lock View": "Lock View",
|
62 |
+
"Unlock View": "Unlock View",
|
63 |
+
"Copy Keypoint Data": "Copy Keypoint Data",
|
64 |
+
"Copied to Clipboard": "Copied to Clipboard",
|
65 |
+
"Reset Scene": "Reset Scene",
|
66 |
+
"Load Gesture": "Load Gesture",
|
67 |
+
"Save Gesture": "Save Gesture",
|
68 |
+
"Please select a hand!!": "Please select a hand!!",
|
69 |
+
"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.",
|
70 |
+
"Show Grid": "Show Grid"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/ja.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "幅",
|
3 |
+
"Height": "高さ",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "スケルトン/深度/法線/Cannyマップを生成",
|
5 |
+
"Duplicate Skeleton": "スケルトンの複製",
|
6 |
+
"Delete Skeleton": "スケルトンの削除",
|
7 |
+
"Move Mode": "移動モード",
|
8 |
+
"Show Edge Map": "エッジマップを表示",
|
9 |
+
"Camera Near": "カメラ近距離",
|
10 |
+
"Camera Far": "カメラ遠距離",
|
11 |
+
"Camera Focal Length": "カメラ焦点距離",
|
12 |
+
"Downloading Hand Model": "手のモデルをダウンロード中",
|
13 |
+
"Updates are available, please confirm!!": "アップデートが利用可能です。確認してください!",
|
14 |
+
"Select a scene file": "シーンファイルを選択",
|
15 |
+
"Oops...": "おっと...",
|
16 |
+
"Something went wrong!": "何かが間違っています!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "問題が解決しない場合は、ここをクリックして質問してください。",
|
18 |
+
"Save Scene": "シーンを保存",
|
19 |
+
"Generate Scene URL": "シーンのURLを生成",
|
20 |
+
"Load Scene": "シーンを読み込む",
|
21 |
+
"Restore Last Scene": "前回のシーンを復元",
|
22 |
+
"Set Background Image": "背景画像を設定",
|
23 |
+
"Select an image": "画像を選択",
|
24 |
+
"Body Parameters": "身体パラメータ",
|
25 |
+
"Shoulder Width": "肩幅",
|
26 |
+
"Shoulder To Hip": "肩から腰までの距離",
|
27 |
+
"Arm Length": "腕の長さ",
|
28 |
+
"Forearm": "前腕",
|
29 |
+
"Upper Arm": "上腕",
|
30 |
+
"Hand Size": "手の大きさ",
|
31 |
+
"Hips": "ヒップ",
|
32 |
+
"Leg Length": "脚の長さ",
|
33 |
+
"Thigh": "太もも",
|
34 |
+
"Lower Leg": "下腿",
|
35 |
+
"Nose To Neck": "鼻から首までの距離",
|
36 |
+
"Head Size": "頭の大きさ",
|
37 |
+
"Show Preview": "プレビューを表示",
|
38 |
+
"Only Hand": "手だけ",
|
39 |
+
"Foot Size": "足のサイズ",
|
40 |
+
"Downloading Foot Model": "足のモデルをダウンロード中",
|
41 |
+
"Please select a skeleton!!": "骨格を選択してください!",
|
42 |
+
"Downloading Poses Library": "ポーズライブラリをダウンロード中",
|
43 |
+
"Set Random Pose": "ランダムポーズを設定",
|
44 |
+
"Redo": "やり直し",
|
45 |
+
"Undo": "元に戻す",
|
46 |
+
"Detect From Image": "画像から検出",
|
47 |
+
"Downloading MediaPipe Pose Model": "MediaPipeポーズモデルをダウンロード中",
|
48 |
+
"Edit": "編集",
|
49 |
+
"Setting": "設定",
|
50 |
+
"Bone Thickness": "ボーンの太さ",
|
51 |
+
"Feedback": "フィードバック",
|
52 |
+
"View": "ビュー",
|
53 |
+
"Fix View": "ビューを固定する",
|
54 |
+
"Restore View": "ビューを復元する",
|
55 |
+
"Free Mode": "フリーモード",
|
56 |
+
"Del": "Del",
|
57 |
+
"File": "ファイル",
|
58 |
+
"Generate": "生成する",
|
59 |
+
"Close": "閉じる",
|
60 |
+
"Update": "更新する",
|
61 |
+
"Lock View": "ビューをロックする",
|
62 |
+
"Unlock View": "ビューをアンロックする",
|
63 |
+
"Copy Keypoint Data": "キーポイントデータをコピーする",
|
64 |
+
"Copied to Clipboard": "クリップボードにコピーされました",
|
65 |
+
"Reset Scene": "シーンをリセットする",
|
66 |
+
"Load Gesture": "ジェスチャーを読み込む",
|
67 |
+
"Save Gesture": "ジェスチャーを保存する",
|
68 |
+
"Please select a hand!!": "手を選択してください!!",
|
69 |
+
"If you try to detect anime characters, you may get an error. Please try again with photos.": "アニメキャラクターを検出しようとするとエラーが発生する場合があります。写真で再度お試しください。",
|
70 |
+
"Show Grid": "グリッドを表示"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/sp.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "ancho",
|
3 |
+
"Height": "altura",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "generar esqueleto/profundidad/normal/generar mapa astuto",
|
5 |
+
"Duplicate Skeleton": "copiar esqueleto",
|
6 |
+
"Delete Skeleton": "eliminar esqueleto",
|
7 |
+
"Move Mode": "modo de movimiento",
|
8 |
+
"Show Edge Map": "mostart mapa de borde",
|
9 |
+
"Camera Near": "cámera cerca",
|
10 |
+
"Camera Far": "cámera lejos",
|
11 |
+
"Camera Focal Length": "distancia focal de la cámara",
|
12 |
+
"Downloading Hand Model": "descargar el modelo de mano",
|
13 |
+
"Updates are available, please confirm!!": "confirmar la(s) actualización(es)",
|
14 |
+
"Select a scene file": "selecciona un archivo de escena",
|
15 |
+
"Oops...": "¡Uy!",
|
16 |
+
"Something went wrong!": "algo salío mal",
|
17 |
+
"If the problem persists, please click here to ask a question.": "si el problema persiste haga clic aquí oara hacer una pregunta.",
|
18 |
+
"Save Scene": "guardar escena",
|
19 |
+
"Load Scene": "cargar la escena",
|
20 |
+
"Restore Last Scene": "restaurar la última escena",
|
21 |
+
"Set Background Image": "establecer la imagen de fondo",
|
22 |
+
"Select an image": "selecciona una imagen",
|
23 |
+
"Body Parameters": "parámetros del cuepro",
|
24 |
+
"Shoulder Width": "ancho de los hombros",
|
25 |
+
"Shoulder To Hip": "de hombro a cadera",
|
26 |
+
"Arm Length": "longitud del brazo",
|
27 |
+
"Forearm": "antebrazo",
|
28 |
+
"Upper Arm": "brazo ",
|
29 |
+
"Hand Size": "tamaño de la mano",
|
30 |
+
"Hips": "caderas",
|
31 |
+
"Leg Length": "longitud de la pierna",
|
32 |
+
"Thigh": "muslo",
|
33 |
+
"Lower Leg": "parte inferior de la pierna",
|
34 |
+
"Nose To Neck": "de la nariz al cuello",
|
35 |
+
"Head Size": "tamaño de la cabeza",
|
36 |
+
"Show Preview": "mostrar vista previa",
|
37 |
+
"Only Hand": "solo manos",
|
38 |
+
"Foot Size": "tamaño del pie",
|
39 |
+
"Downloading Foot Model": "descargando el modelo de pie",
|
40 |
+
"Please select a skeleton!!": "¡selecciona un esqueleto!",
|
41 |
+
"Downloading Poses Library": "descargando la biblioteca de poses",
|
42 |
+
"Set Random Pose": "pose aletoria",
|
43 |
+
"Redo": "rehacer",
|
44 |
+
"Undo": "deshacer",
|
45 |
+
"Detect From Image": "detectar desde la imagen",
|
46 |
+
"Downloading MediaPipe Pose Model": "descargando el modelo de pose de MediaPipe",
|
47 |
+
"Edit": "editar",
|
48 |
+
"Setting": "ajustes",
|
49 |
+
"Bone Thickness": "grosor del hueso",
|
50 |
+
"Feedback": "realimentación",
|
51 |
+
"View": "Ver",
|
52 |
+
"Fix View": "Fijar Vista",
|
53 |
+
"Restore View": "Restaurar Vista",
|
54 |
+
"Free Mode": "Modo libre",
|
55 |
+
"Del": "Remoto",
|
56 |
+
"File": "Archivo",
|
57 |
+
"Generate": "Generar",
|
58 |
+
"Close": "Cerrar",
|
59 |
+
"Update": "Actualizar",
|
60 |
+
"Lock View": "Bloquear vista",
|
61 |
+
"Unlock View": "Desbloquear vista",
|
62 |
+
"Copy Keypoint Data": "Copiar datos del punto clave",
|
63 |
+
"Copied to Clipboard": "Copiado al portapapeles",
|
64 |
+
"Generate Scene URL": "Generar URL de escena",
|
65 |
+
"Reset Scene": "Restablecer escena",
|
66 |
+
"Load Gesture": "Cargar gesto",
|
67 |
+
"Save Gesture": "Guardar gesto",
|
68 |
+
"Please select a hand!!": "¡¡Por favor, seleccione una mano!!",
|
69 |
+
"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.",
|
70 |
+
"Show Grid": "Mostrar cuadrícula"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/zh-CN.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "宽度",
|
3 |
+
"Height": "高度",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "生成骨架/深度/法线/Canny图",
|
5 |
+
"Duplicate Skeleton": "复制骨架",
|
6 |
+
"Delete Skeleton": "删除骨架",
|
7 |
+
"Move Mode": "移动模式",
|
8 |
+
"Show Edge Map": "显示边缘图",
|
9 |
+
"Camera Near": "相机near",
|
10 |
+
"Camera Far": "相机far",
|
11 |
+
"Camera Focal Length": "相机焦距",
|
12 |
+
"Downloading Hand Model": "正在下载手部模型",
|
13 |
+
"Updates are available, please confirm!!": "有更新啦,请确认!!",
|
14 |
+
"Select a scene file": "选择一个场景文件",
|
15 |
+
"Oops...": "哎呀...",
|
16 |
+
"Something went wrong!": "出错了!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "如果问题一直存在,请点击此处提问。",
|
18 |
+
"Save Scene": "保存场景",
|
19 |
+
"Load Scene": "加载场景",
|
20 |
+
"Restore Last Scene": "恢复上次场景",
|
21 |
+
"Set Background Image": "设置背景图片",
|
22 |
+
"Select an image": "选择一张图片",
|
23 |
+
"Body Parameters": "身体参数",
|
24 |
+
"Shoulder Width": "肩宽",
|
25 |
+
"Shoulder To Hip": "肩到臀",
|
26 |
+
"Arm Length": "手臂长度",
|
27 |
+
"Forearm": "前臂",
|
28 |
+
"Upper Arm": "上臂",
|
29 |
+
"Hand Size": "手部尺寸",
|
30 |
+
"Hips": "臀部宽度",
|
31 |
+
"Leg Length": "腿部长度",
|
32 |
+
"Thigh": "大腿",
|
33 |
+
"Lower Leg": "小腿",
|
34 |
+
"Nose To Neck": "鼻子到颈部",
|
35 |
+
"Head Size": "头部大小",
|
36 |
+
"Show Preview": "显示预览图",
|
37 |
+
"Only Hand": "仅显示手",
|
38 |
+
"Foot Size": "脚部尺寸",
|
39 |
+
"Downloading Foot Model": "正在下载脚部模型",
|
40 |
+
"Please select a skeleton!!": "请选择骨架!",
|
41 |
+
"Downloading Poses Library": "正在下载姿势库",
|
42 |
+
"Set Random Pose": "设置随机姿势",
|
43 |
+
"Redo": "重做",
|
44 |
+
"Undo": "撤销",
|
45 |
+
"Detect From Image": "从图片中检测",
|
46 |
+
"Downloading MediaPipe Pose Model": "正在下载 MediaPipe 姿势模型",
|
47 |
+
"Edit": "编辑",
|
48 |
+
"Setting": "设置",
|
49 |
+
"Bone Thickness": "骨骼厚度",
|
50 |
+
"Feedback": "反馈",
|
51 |
+
"View": "视图",
|
52 |
+
"Fix View": "固定视图",
|
53 |
+
"Restore View": "恢复视图",
|
54 |
+
"Free Mode": "自由模式",
|
55 |
+
"Del": "Del",
|
56 |
+
"File": "文件",
|
57 |
+
"Generate": "生成",
|
58 |
+
"Close": "关闭",
|
59 |
+
"Update": "更新",
|
60 |
+
"Lock View": "锁定视图",
|
61 |
+
"Unlock View": "解除锁定视图",
|
62 |
+
"Copy Keypoint Data": "复制关键点数据",
|
63 |
+
"Copied to Clipboard": "已复制到剪贴板",
|
64 |
+
"Generate Scene URL": "生成场景URL",
|
65 |
+
"Reset Scene": "重置场景",
|
66 |
+
"Load Gesture": "加载手势",
|
67 |
+
"Save Gesture": "保存手势",
|
68 |
+
"Please select a hand!!": "请选择一只手!!",
|
69 |
+
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您尝试检测动漫角色,可能会出现错误。请使用照片再试一次。",
|
70 |
+
"Show Grid": "显示网格"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/zh-HK.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "寬度",
|
3 |
+
"Height": "高度",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "生成骨架/深度/法線/Canny圖",
|
5 |
+
"Duplicate Skeleton": "複製骨架",
|
6 |
+
"Delete Skeleton": "刪除骨架",
|
7 |
+
"Move Mode": "移動模式",
|
8 |
+
"Show Edge Map": "顯示邊緣圖",
|
9 |
+
"Camera Near": "相機near",
|
10 |
+
"Camera Far": "相機far",
|
11 |
+
"Camera Focal Length": "相機焦距",
|
12 |
+
"Downloading Hand Model": "正在下載手部模型",
|
13 |
+
"Updates are available, please confirm!!": "有更新啦,请确认!!",
|
14 |
+
"Select a scene file": "選擇場景檔案",
|
15 |
+
"Oops...": "哎呀...",
|
16 |
+
"Something went wrong!": "出現問題!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "如果問題仍然存在,請點擊此處發問。",
|
18 |
+
"Save Scene": "儲存場景",
|
19 |
+
"Load Scene": "載入場景",
|
20 |
+
"Restore Last Scene": "恢復上次場景",
|
21 |
+
"Set Background Image": "設置背景圖片",
|
22 |
+
"Select an image": "選擇圖片",
|
23 |
+
"Body Parameters": "身體參數",
|
24 |
+
"Shoulder Width": "肩寬",
|
25 |
+
"Shoulder To Hip": "肩臀長度",
|
26 |
+
"Arm Length": "手臂長度",
|
27 |
+
"Forearm": "前臂",
|
28 |
+
"Upper Arm": "上臂",
|
29 |
+
"Hand Size": "手部尺寸",
|
30 |
+
"Hips": "臀部",
|
31 |
+
"Leg Length": "腿長",
|
32 |
+
"Thigh": "大腿",
|
33 |
+
"Lower Leg": "小腿",
|
34 |
+
"Nose To Neck": "鼻子到脖子的距離",
|
35 |
+
"Head Size": "頭部尺寸",
|
36 |
+
"Show Preview": "顯示預覽",
|
37 |
+
"Only Hand": "只顯示手部",
|
38 |
+
"Foot Size": "腳部尺寸",
|
39 |
+
"Downloading Foot Model": "正在下載腳部模型",
|
40 |
+
"Please select a skeleton!!": "請選擇骨架!",
|
41 |
+
"Downloading Poses Library": "下載姿勢庫中",
|
42 |
+
"Set Random Pose": "設定隨機姿勢",
|
43 |
+
"Redo": "重做",
|
44 |
+
"Undo": "撤銷",
|
45 |
+
"Detect From Image": "從圖片中偵測",
|
46 |
+
"Downloading MediaPipe Pose Model": "下載 MediaPipe 姿勢模型",
|
47 |
+
"Edit": "編輯",
|
48 |
+
"Setting": "設定",
|
49 |
+
"Bone Thickness": "骨骼厚度",
|
50 |
+
"Feedback": "回饋",
|
51 |
+
"View": "檢視",
|
52 |
+
"Fix View": "固定檢視",
|
53 |
+
"Restore View": "還原檢視",
|
54 |
+
"Free Mode": "自由模式",
|
55 |
+
"Del": "Del",
|
56 |
+
"File": "文件",
|
57 |
+
"Generate": "生成",
|
58 |
+
"Close": "關閉",
|
59 |
+
"Update": "更新",
|
60 |
+
"Lock View": "鎖定視圖",
|
61 |
+
"Unlock View": "解鎖視圖",
|
62 |
+
"Copy Keypoint Data": "複製關鍵點數據",
|
63 |
+
"Copied to Clipboard": "已複製到剪貼板",
|
64 |
+
"Generate Scene URL": "生成場景URL",
|
65 |
+
"Reset Scene": "重置場景",
|
66 |
+
"Load Gesture": "載入手勢",
|
67 |
+
"Save Gesture": "儲存手勢",
|
68 |
+
"Please select a hand!!": "請選擇一隻手!!",
|
69 |
+
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。",
|
70 |
+
"Show Grid": "顯示網格"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/locales/zh-TW.json
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"Width": "寬度",
|
3 |
+
"Height": "高度",
|
4 |
+
"Generate Skeleton/Depth/Normal/Canny Map": "產生骨架/深度/法線/Canny圖",
|
5 |
+
"Duplicate Skeleton": "複製骨架",
|
6 |
+
"Delete Skeleton": "刪除骨架",
|
7 |
+
"Move Mode": "移動模式",
|
8 |
+
"Show Edge Map": "顯示邊緣圖",
|
9 |
+
"Camera Near": "相機近端距離",
|
10 |
+
"Camera Far": "相機遠端距離",
|
11 |
+
"Camera Focal Length": "相機焦距",
|
12 |
+
"Downloading Hand Model": "下載手部模型中",
|
13 |
+
"Updates are available, please confirm!!": "有更新,請確認!!",
|
14 |
+
"Select a scene file": "選擇場景檔案",
|
15 |
+
"Oops...": "糟糕...",
|
16 |
+
"Something went wrong!": "出了些問題!",
|
17 |
+
"If the problem persists, please click here to ask a question.": "如果問題持續存在,請點擊此處發起提問。",
|
18 |
+
"Save Scene": "儲存場景",
|
19 |
+
"Load Scene": "載入場景",
|
20 |
+
"Restore Last Scene": "恢復上一個場景",
|
21 |
+
"Set Background Image": "設定背景圖片",
|
22 |
+
"Select an image": "選擇圖片",
|
23 |
+
"Body Parameters": "身體參數",
|
24 |
+
"Shoulder Width": "肩寬",
|
25 |
+
"Shoulder To Hip": "肩臀長",
|
26 |
+
"Arm Length": "手臂長",
|
27 |
+
"Forearm": "前臂",
|
28 |
+
"Upper Arm": "上臂",
|
29 |
+
"Hand Size": "手部大小",
|
30 |
+
"Hips": "臀部",
|
31 |
+
"Leg Length": "腿長",
|
32 |
+
"Thigh": "大腿",
|
33 |
+
"Lower Leg": "小腿",
|
34 |
+
"Nose To Neck": "鼻子到頸部的距離",
|
35 |
+
"Head Size": "頭部大小",
|
36 |
+
"Show Preview": "顯示預覽",
|
37 |
+
"Only Hand": "僅手部",
|
38 |
+
"Foot Size": "腳部大小",
|
39 |
+
"Downloading Foot Model": "下載腳部模型中",
|
40 |
+
"Please select a skeleton!!": "請選擇骨架!",
|
41 |
+
"Downloading Poses Library": "正在下載姿勢庫",
|
42 |
+
"Set Random Pose": "設置隨機姿勢",
|
43 |
+
"Redo": "重做",
|
44 |
+
"Undo": "撤銷",
|
45 |
+
"Detect From Image": "從圖片中偵測",
|
46 |
+
"Downloading MediaPipe Pose Model": "下載 MediaPipe 姿勢模型中",
|
47 |
+
"Edit": "編輯",
|
48 |
+
"Setting": "設定",
|
49 |
+
"Bone Thickness": "骨骼厚度",
|
50 |
+
"Feedback": "回饋",
|
51 |
+
"View": "檢視",
|
52 |
+
"Fix View": "固定檢視",
|
53 |
+
"Restore View": "還原檢視",
|
54 |
+
"Free Mode": "自由模式",
|
55 |
+
"Del": "Del",
|
56 |
+
"File": "檔案",
|
57 |
+
"Generate": "生成",
|
58 |
+
"Close": "關閉",
|
59 |
+
"Update": "更新",
|
60 |
+
"Lock View": "鎖定視圖",
|
61 |
+
"Unlock View": "解鎖視圖",
|
62 |
+
"Copy Keypoint Data": "複製關鍵點數據",
|
63 |
+
"Copied to Clipboard": "已複製到剪貼板",
|
64 |
+
"Generate Scene URL": "生成場景URL",
|
65 |
+
"Reset Scene": "重置場景",
|
66 |
+
"Load Gesture": "載入手勢",
|
67 |
+
"Save Gesture": "儲存手勢",
|
68 |
+
"Please select a hand!!": "請選擇一隻手!!",
|
69 |
+
"If you try to detect anime characters, you may get an error. Please try again with photos.": "如果您嘗試檢測動漫角色,可能會出現錯誤。請使用照片再試一次。",
|
70 |
+
"Show Grid": "顯示網格"
|
71 |
+
}
|
sd-webui-3d-open-pose-editor/src/message-test.ts
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export type IPostMessage = {
|
2 |
+
method: string
|
3 |
+
type: 'call' | 'return'
|
4 |
+
payload: any
|
5 |
+
}
|
6 |
+
|
7 |
+
const iframe = document.getElementById('open-pose-editor') as HTMLIFrameElement
|
8 |
+
|
9 |
+
const poseMessage = (message: IPostMessage) => {
|
10 |
+
iframe.contentWindow?.postMessage(message)
|
11 |
+
}
|
12 |
+
|
13 |
+
const MessageReturnHandler: Record<string, (arg: any) => void> = {}
|
14 |
+
const MessageEventHandler: Record<string, (arg: any) => void> = {}
|
15 |
+
|
16 |
+
window.addEventListener('message', (event) => {
|
17 |
+
const { data } = event
|
18 |
+
if (data && data.cmd && data.cmd == 'openpose-3d' && data.method) {
|
19 |
+
const method = data.method
|
20 |
+
console.log('Method', method, event)
|
21 |
+
if (data.type == 'return') {
|
22 |
+
MessageReturnHandler[method]?.(data.payload)
|
23 |
+
} else if (data.type == 'event') {
|
24 |
+
console.log(MessageEventHandler)
|
25 |
+
MessageEventHandler[method]?.(data.payload)
|
26 |
+
}
|
27 |
+
}
|
28 |
+
})
|
29 |
+
|
30 |
+
function InvokeOnlineOpenPose3D(method: string, ...args: any[]) {
|
31 |
+
return new Promise((resolve, reject) => {
|
32 |
+
const id = setTimeout(() => {
|
33 |
+
delete MessageReturnHandler[method]
|
34 |
+
|
35 |
+
reject({
|
36 |
+
method,
|
37 |
+
status: 'Timeout',
|
38 |
+
})
|
39 |
+
}, 1000)
|
40 |
+
|
41 |
+
const onReutrn = (arg: any) => {
|
42 |
+
clearTimeout(id)
|
43 |
+
resolve(arg)
|
44 |
+
}
|
45 |
+
MessageReturnHandler[method] = onReutrn
|
46 |
+
|
47 |
+
poseMessage({
|
48 |
+
method,
|
49 |
+
type: 'call',
|
50 |
+
payload: args,
|
51 |
+
})
|
52 |
+
})
|
53 |
+
}
|
54 |
+
function CreateClick(name: string, ...args: any[]) {
|
55 |
+
const ele = document.getElementById(name)
|
56 |
+
|
57 |
+
ele?.addEventListener('click', async () => {
|
58 |
+
console.log(name)
|
59 |
+
const value = await InvokeOnlineOpenPose3D(name, ...args)
|
60 |
+
console.log('return', value)
|
61 |
+
})
|
62 |
+
}
|
63 |
+
|
64 |
+
MessageEventHandler['MakeImages'] = (arg) => {
|
65 |
+
console.log('event', arg)
|
66 |
+
}
|
67 |
+
|
68 |
+
CreateClick('GetAPIs')
|
69 |
+
CreateClick('GetAppVersion')
|
70 |
+
CreateClick('MakeImages')
|
71 |
+
CreateClick('Pause')
|
72 |
+
CreateClick('Resume')
|
73 |
+
CreateClick('OutputWidth', 512)
|
74 |
+
CreateClick('OutputHeight', 512)
|
75 |
+
CreateClick('OnlyHand', true)
|
76 |
+
CreateClick('MoveMode', true)
|
77 |
+
CreateClick('GetWidth')
|
78 |
+
CreateClick('GetHeight')
|
79 |
+
CreateClick('GetSceneData')
|
80 |
+
CreateClick('LockView')
|
81 |
+
CreateClick('UnlockView')
|
82 |
+
CreateClick('RestoreView')
|
sd-webui-3d-open-pose-editor/src/models.ts
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import * as THREE from 'three'
|
2 |
+
import { FindObjectItem } from './utils/three-utils'
|
3 |
+
import { LoadFBXFile, LoadGLTFile, LoadObjFile } from './utils/loader'
|
4 |
+
|
5 |
+
export let HandObject: THREE.Group | null = null
|
6 |
+
export let FootObject: THREE.Group | null = null
|
7 |
+
|
8 |
+
export const HandModelInfo = {
|
9 |
+
meshName: 'shoupolySurface1',
|
10 |
+
bonePrefix: 'shoujoint',
|
11 |
+
}
|
12 |
+
export const FootModelInfo = {
|
13 |
+
meshName: 'FootObject',
|
14 |
+
bonePrefix: 'FootBone',
|
15 |
+
}
|
16 |
+
|
17 |
+
export const ExtremitiesMapping: Record<
|
18 |
+
string,
|
19 |
+
{
|
20 |
+
meshName: string
|
21 |
+
bonePrefix: string
|
22 |
+
}
|
23 |
+
> = {
|
24 |
+
left_hand: HandModelInfo,
|
25 |
+
right_hand: HandModelInfo,
|
26 |
+
left_foot: FootModelInfo,
|
27 |
+
right_foot: FootModelInfo,
|
28 |
+
}
|
29 |
+
|
30 |
+
export function IsMatchBonePrefix(name: string) {
|
31 |
+
if (name.startsWith(HandModelInfo.bonePrefix)) return true
|
32 |
+
if (name.startsWith(FootModelInfo.bonePrefix)) return true
|
33 |
+
return false
|
34 |
+
}
|
35 |
+
|
36 |
+
export async function LoadHand(
|
37 |
+
handFBXFileUrl: string,
|
38 |
+
onLoading?: (loaded: number) => void
|
39 |
+
) {
|
40 |
+
const fbx = await LoadFBXFile(handFBXFileUrl, onLoading)
|
41 |
+
|
42 |
+
// fbx.scale.multiplyScalar(10)
|
43 |
+
const mesh = FindObjectItem<THREE.SkinnedMesh>(fbx, HandModelInfo.meshName)!
|
44 |
+
mesh.material = new THREE.MeshPhongMaterial()
|
45 |
+
// this.scene.add();
|
46 |
+
// const helper = new THREE.SkeletonHelper(mesh.parent!);
|
47 |
+
// this.scene.add(helper);
|
48 |
+
|
49 |
+
// console.log(mesh.skeleton.bones)
|
50 |
+
mesh.skeleton.bones.forEach((o) => {
|
51 |
+
const point = new THREE.Mesh(
|
52 |
+
new THREE.SphereGeometry(0.2),
|
53 |
+
new THREE.MeshBasicMaterial({
|
54 |
+
color: 0xff0000,
|
55 |
+
// vertexColors: true,
|
56 |
+
depthTest: false,
|
57 |
+
opacity: 1,
|
58 |
+
transparent: true,
|
59 |
+
// depthWrite: false,
|
60 |
+
// toneMapped: false,
|
61 |
+
// transparent: true,
|
62 |
+
})
|
63 |
+
)
|
64 |
+
point.name = 'red_point'
|
65 |
+
// point.scale.setX(0.2)
|
66 |
+
// point.position.copy(o.position)
|
67 |
+
o.add(point)
|
68 |
+
})
|
69 |
+
|
70 |
+
const mask = new THREE.Mesh(
|
71 |
+
new THREE.CylinderGeometry(1, 1, 0.4, 32),
|
72 |
+
new THREE.MeshBasicMaterial({ color: 0x000000 })
|
73 |
+
)
|
74 |
+
mask.name = 'hand_mask'
|
75 |
+
mask.visible = false
|
76 |
+
mask.rotateZ(Math.PI / 2)
|
77 |
+
mesh.skeleton.bones[0].add(mask)
|
78 |
+
|
79 |
+
HandObject = fbx
|
80 |
+
return fbx
|
81 |
+
}
|
82 |
+
|
83 |
+
export async function LoadFoot(
|
84 |
+
footFBXFileUrl: string,
|
85 |
+
onLoading?: (loaded: number) => void
|
86 |
+
) {
|
87 |
+
const fbx = await LoadFBXFile(footFBXFileUrl, onLoading)
|
88 |
+
|
89 |
+
console.log(fbx)
|
90 |
+
// fbx.scale.multiplyScalar(0.001)
|
91 |
+
|
92 |
+
const mesh = FindObjectItem<THREE.SkinnedMesh>(fbx, FootModelInfo.meshName)!
|
93 |
+
mesh.material = new THREE.MeshPhongMaterial()
|
94 |
+
// this.scene.add();
|
95 |
+
// const helper = new THREE.SkeletonHelper(mesh.parent!);
|
96 |
+
// this.scene.add(helper);
|
97 |
+
|
98 |
+
console.log(mesh.skeleton.bones)
|
99 |
+
mesh.skeleton.bones.forEach((o) => {
|
100 |
+
if (o.name !== 'FootBone2') return
|
101 |
+
const point = new THREE.Mesh(
|
102 |
+
new THREE.SphereGeometry(0.1),
|
103 |
+
new THREE.MeshBasicMaterial({
|
104 |
+
color: 0xff0000,
|
105 |
+
depthTest: false,
|
106 |
+
opacity: 1,
|
107 |
+
transparent: true,
|
108 |
+
})
|
109 |
+
)
|
110 |
+
|
111 |
+
point.name = 'red_point'
|
112 |
+
// point.position.copy(o.position)
|
113 |
+
point.translateX(-0.3)
|
114 |
+
o.add(point)
|
115 |
+
})
|
116 |
+
|
117 |
+
const mask = new THREE.Mesh(
|
118 |
+
new THREE.CylinderGeometry(0.35, 0.35, 0.2, 32),
|
119 |
+
new THREE.MeshBasicMaterial({ color: 0x000000 })
|
120 |
+
)
|
121 |
+
mask.scale.setX(0.7)
|
122 |
+
mask.name = 'foot_mask'
|
123 |
+
mask.visible = false
|
124 |
+
mesh.skeleton.bones[0].add(mask)
|
125 |
+
|
126 |
+
FootObject = fbx
|
127 |
+
return fbx
|
128 |
+
}
|
sd-webui-3d-open-pose-editor/src/pose-library.ts
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { PartIndexMappingOfPoseModel } from './defines'
|
2 |
+
|
3 |
+
const PosesLibrary: [number, number, number][][] | null = []
|
4 |
+
|
5 |
+
function getRandomInt(min: number, max: number) {
|
6 |
+
min = Math.ceil(min)
|
7 |
+
max = Math.floor(max)
|
8 |
+
return Math.floor(Math.random() * (max - min + 1)) + min
|
9 |
+
}
|
10 |
+
|
11 |
+
export function GetRandomPose() {
|
12 |
+
if (PosesLibrary)
|
13 |
+
return PosesLibrary[getRandomInt(0, PosesLibrary.length - 1)]
|
14 |
+
return null
|
15 |
+
}
|
16 |
+
|
17 |
+
export async function LoadPosesLibrary(posesLibraryUrl: string) {
|
18 |
+
const response = await fetch(posesLibraryUrl)
|
19 |
+
const buffer = await response.arrayBuffer()
|
20 |
+
|
21 |
+
console.log(buffer.byteLength)
|
22 |
+
const int16Array = new Int32Array(buffer)
|
23 |
+
|
24 |
+
const num = Object.keys(PartIndexMappingOfPoseModel).length
|
25 |
+
|
26 |
+
for (let i = 0; i < int16Array.length / (num * 3); i++) {
|
27 |
+
const temp: [number, number, number][] = []
|
28 |
+
for (let j = 0; j < num; j++) {
|
29 |
+
const a = int16Array[i * (num * 3) + j * 3 + 0]
|
30 |
+
const b = int16Array[i * (num * 3) + j * 3 + 1]
|
31 |
+
const c = int16Array[i * (num * 3) + j * 3 + 2]
|
32 |
+
|
33 |
+
temp.push([a / 1000.0, b / 1000.0, c / 1000.0])
|
34 |
+
}
|
35 |
+
|
36 |
+
PosesLibrary?.push(temp)
|
37 |
+
}
|
38 |
+
}
|
sd-webui-3d-open-pose-editor/src/poses/data.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:40bf0b017283b5b2a00b78d8da1ef11e5c62ffeccdd97ab56c26c1e6f23e5684
|
3 |
+
size 945252
|
sd-webui-3d-open-pose-editor/src/poses/data.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
sd-webui-3d-open-pose-editor/src/utils/CCDIKSolver.ts
ADDED
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Matrix4, Quaternion, Vector3, Object3D } from 'three'
|
2 |
+
|
3 |
+
// tslint:disable-next-line:interface-name
|
4 |
+
export interface IKS {
|
5 |
+
effector: Object3D
|
6 |
+
iteration: number
|
7 |
+
links: Array<{
|
8 |
+
enabled: boolean
|
9 |
+
index: Object3D
|
10 |
+
limitation?: Vector3
|
11 |
+
rotationMin?: Vector3
|
12 |
+
rotationMax?: Vector3
|
13 |
+
}>
|
14 |
+
minAngle: number
|
15 |
+
maxAngle: number
|
16 |
+
target: Object3D
|
17 |
+
}
|
18 |
+
|
19 |
+
const _q = new Quaternion()
|
20 |
+
const _targetPos = new Vector3()
|
21 |
+
const _targetVec = new Vector3()
|
22 |
+
const _effectorPos = new Vector3()
|
23 |
+
const _effectorVec = new Vector3()
|
24 |
+
const _linkPos = new Vector3()
|
25 |
+
const _invLinkQ = new Quaternion()
|
26 |
+
const _linkScale = new Vector3()
|
27 |
+
const _axis = new Vector3()
|
28 |
+
const _vector = new Vector3()
|
29 |
+
const _matrix = new Matrix4()
|
30 |
+
|
31 |
+
/**
|
32 |
+
* CCD Algorithm
|
33 |
+
* - https://sites.google.com/site/auraliusproject/ccd-algorithm
|
34 |
+
*
|
35 |
+
* // ik parameter example
|
36 |
+
* //
|
37 |
+
* // target, effector, index in links are bone index in skeleton.bones.
|
38 |
+
* // the bones relation should be
|
39 |
+
* // <-- parent child -->
|
40 |
+
* // links[ n ], links[ n - 1 ], ..., links[ 0 ], effector
|
41 |
+
* iks = [ {
|
42 |
+
* target: 1,
|
43 |
+
* effector: 2,
|
44 |
+
* links: [ { index: 5, limitation: new Vector3( 1, 0, 0 ) }, { index: 4, enabled: false }, { index : 3 } ],
|
45 |
+
* iteration: 10,
|
46 |
+
* minAngle: 0.0,
|
47 |
+
* maxAngle: 1.0,
|
48 |
+
* } ];
|
49 |
+
*/
|
50 |
+
|
51 |
+
export class CCDIKSolver {
|
52 |
+
iks: IKS[]
|
53 |
+
constructor(iks: IKS[] = []) {
|
54 |
+
this.iks = iks
|
55 |
+
|
56 |
+
this._valid()
|
57 |
+
}
|
58 |
+
|
59 |
+
update() {
|
60 |
+
const iks = this.iks
|
61 |
+
|
62 |
+
for (let i = 0, il = iks.length; i < il; i++) {
|
63 |
+
this.updateOne(iks[i])
|
64 |
+
}
|
65 |
+
|
66 |
+
return this
|
67 |
+
}
|
68 |
+
|
69 |
+
updateOne(ik: IKS) {
|
70 |
+
const bones = ik.links.map((i) => i.index)
|
71 |
+
|
72 |
+
// for reference overhead reduction in loop
|
73 |
+
const math = Math
|
74 |
+
|
75 |
+
const effector = ik.effector
|
76 |
+
const target = ik.target
|
77 |
+
|
78 |
+
// don't use getWorldPosition() here for the performance
|
79 |
+
// because it calls updateMatrixWorld( true ) inside.
|
80 |
+
_targetPos.setFromMatrixPosition(target.matrixWorld)
|
81 |
+
|
82 |
+
const links = ik.links
|
83 |
+
const iteration = ik.iteration !== undefined ? ik.iteration : 1
|
84 |
+
|
85 |
+
for (let i = 0; i < iteration; i++) {
|
86 |
+
let rotated = false
|
87 |
+
|
88 |
+
for (let j = 0, jl = links.length; j < jl; j++) {
|
89 |
+
const link = bones[j]
|
90 |
+
|
91 |
+
// skip this link and following links.
|
92 |
+
// this skip is used for MMD performance optimization.
|
93 |
+
if (links[j].enabled === false) break
|
94 |
+
|
95 |
+
const limitation = links[j].limitation
|
96 |
+
const rotationMin = links[j].rotationMin
|
97 |
+
const rotationMax = links[j].rotationMax
|
98 |
+
|
99 |
+
// don't use getWorldPosition/Quaternion() here for the performance
|
100 |
+
// because they call updateMatrixWorld( true ) inside.
|
101 |
+
link.matrixWorld.decompose(_linkPos, _invLinkQ, _linkScale)
|
102 |
+
_invLinkQ.invert()
|
103 |
+
_effectorPos.setFromMatrixPosition(effector.matrixWorld)
|
104 |
+
|
105 |
+
// work in link world
|
106 |
+
_effectorVec.subVectors(_effectorPos, _linkPos)
|
107 |
+
_effectorVec.applyQuaternion(_invLinkQ)
|
108 |
+
_effectorVec.normalize()
|
109 |
+
|
110 |
+
_targetVec.subVectors(_targetPos, _linkPos)
|
111 |
+
_targetVec.applyQuaternion(_invLinkQ)
|
112 |
+
_targetVec.normalize()
|
113 |
+
|
114 |
+
let angle = _targetVec.dot(_effectorVec)
|
115 |
+
|
116 |
+
if (angle > 1.0) {
|
117 |
+
angle = 1.0
|
118 |
+
} else if (angle < -1.0) {
|
119 |
+
angle = -1.0
|
120 |
+
}
|
121 |
+
|
122 |
+
angle = math.acos(angle)
|
123 |
+
|
124 |
+
// skip if changing angle is too small to prevent vibration of bone
|
125 |
+
if (angle < 1e-5) continue
|
126 |
+
|
127 |
+
if (ik.minAngle !== undefined && angle < ik.minAngle) {
|
128 |
+
angle = ik.minAngle
|
129 |
+
}
|
130 |
+
|
131 |
+
if (ik.maxAngle !== undefined && angle > ik.maxAngle) {
|
132 |
+
angle = ik.maxAngle
|
133 |
+
}
|
134 |
+
|
135 |
+
_axis.crossVectors(_effectorVec, _targetVec)
|
136 |
+
_axis.normalize()
|
137 |
+
|
138 |
+
_q.setFromAxisAngle(_axis, angle)
|
139 |
+
link.quaternion.multiply(_q)
|
140 |
+
|
141 |
+
// TODO: re-consider the limitation specification
|
142 |
+
if (limitation !== undefined) {
|
143 |
+
let c = link.quaternion.w
|
144 |
+
|
145 |
+
if (c > 1.0) c = 1.0
|
146 |
+
|
147 |
+
const c2 = math.sqrt(1 - c * c)
|
148 |
+
link.quaternion.set(
|
149 |
+
limitation.x * c2,
|
150 |
+
limitation.y * c2,
|
151 |
+
limitation.z * c2,
|
152 |
+
c
|
153 |
+
)
|
154 |
+
}
|
155 |
+
|
156 |
+
if (rotationMin !== undefined) {
|
157 |
+
link.rotation.setFromVector3(
|
158 |
+
_vector.setFromEuler(link.rotation).max(rotationMin)
|
159 |
+
)
|
160 |
+
}
|
161 |
+
|
162 |
+
if (rotationMax !== undefined) {
|
163 |
+
link.rotation.setFromVector3(
|
164 |
+
_vector.setFromEuler(link.rotation).min(rotationMax)
|
165 |
+
)
|
166 |
+
}
|
167 |
+
|
168 |
+
link.updateMatrixWorld(true)
|
169 |
+
|
170 |
+
rotated = true
|
171 |
+
}
|
172 |
+
|
173 |
+
if (!rotated) break
|
174 |
+
}
|
175 |
+
|
176 |
+
return this
|
177 |
+
}
|
178 |
+
|
179 |
+
// private methods
|
180 |
+
|
181 |
+
_valid() {
|
182 |
+
const iks = this.iks
|
183 |
+
|
184 |
+
for (let i = 0, il = iks.length; i < il; i++) {
|
185 |
+
const ik = iks[i]
|
186 |
+
|
187 |
+
const effector = ik.effector
|
188 |
+
const links = ik.links
|
189 |
+
let link0, link1
|
190 |
+
|
191 |
+
link0 = effector
|
192 |
+
|
193 |
+
for (let j = 0, jl = links.length; j < jl; j++) {
|
194 |
+
link1 = links[j].index
|
195 |
+
|
196 |
+
if (link0.parent !== link1) {
|
197 |
+
console.warn(
|
198 |
+
'THREE.CCDIKSolver: bone ' +
|
199 |
+
link0.name +
|
200 |
+
' is not the child of bone ' +
|
201 |
+
link1.name
|
202 |
+
)
|
203 |
+
}
|
204 |
+
|
205 |
+
link0 = link1
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/detect.ts
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Class } from 'type-fest'
|
2 |
+
|
3 |
+
// https://github.com/google/mediapipe/blob/master/docs/solutions/pose.md#resources
|
4 |
+
import type { Results, Pose, PoseConfig } from '@mediapipe/pose'
|
5 |
+
import * as MediapipePose from '@mediapipe/pose'
|
6 |
+
import assets from '../assets'
|
7 |
+
|
8 |
+
// @mediapipe/pose is not an es module ??
|
9 |
+
// Extract Pose from the window to solve the problem
|
10 |
+
// To prevent optimization, just print it
|
11 |
+
console.log('@mediapipe/pose', MediapipePose)
|
12 |
+
const MyPose = import.meta.env.DEV
|
13 |
+
? MediapipePose.Pose
|
14 |
+
: ((window as any).Pose as Class<Pose, [PoseConfig]>)
|
15 |
+
console.log('MyPose', MyPose)
|
16 |
+
|
17 |
+
const AliyuncsBase =
|
18 |
+
'https://openpose-editor.oss-cn-beijing.aliyuncs.com/%40mediapipe/pose'
|
19 |
+
const JsdelivrBase = 'https://cdn.jsdelivr.net/npm/@mediapipe/pose'
|
20 |
+
|
21 |
+
let UseJsdelivrBase = true
|
22 |
+
function GetCDNBase() {
|
23 |
+
if (UseJsdelivrBase) return JsdelivrBase
|
24 |
+
else return AliyuncsBase
|
25 |
+
}
|
26 |
+
|
27 |
+
export function SetCDNBase(isJsdelivrBase: boolean) {
|
28 |
+
UseJsdelivrBase = isJsdelivrBase
|
29 |
+
}
|
30 |
+
|
31 |
+
const pose = new MyPose({
|
32 |
+
locateFile: (file) => {
|
33 |
+
if (file in assets) {
|
34 |
+
console.log('local', file)
|
35 |
+
return (assets as any)[file]
|
36 |
+
}
|
37 |
+
const url = `${GetCDNBase()}/${file}`
|
38 |
+
|
39 |
+
console.log('load pose model', url)
|
40 |
+
return url
|
41 |
+
},
|
42 |
+
})
|
43 |
+
|
44 |
+
// https://github.com/google/mediapipe/blob/master/docs/solutions/pose.md#solution-apis
|
45 |
+
pose.setOptions({
|
46 |
+
modelComplexity: 1,
|
47 |
+
smoothLandmarks: true,
|
48 |
+
enableSegmentation: true,
|
49 |
+
smoothSegmentation: true,
|
50 |
+
minDetectionConfidence: 0.5,
|
51 |
+
minTrackingConfidence: 0.5,
|
52 |
+
})
|
53 |
+
|
54 |
+
export function DetectPosefromImage(image: HTMLImageElement): Promise<Results> {
|
55 |
+
return new Promise((resolve) => {
|
56 |
+
pose.reset()
|
57 |
+
pose.send({ image: image })
|
58 |
+
pose.onResults((result) => {
|
59 |
+
console.log(result)
|
60 |
+
resolve(result)
|
61 |
+
})
|
62 |
+
})
|
63 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/image.ts
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export function getImage(url: string): Promise<HTMLImageElement> {
|
2 |
+
return new Promise((resolve, reject) => {
|
3 |
+
const image = document.createElement('img')
|
4 |
+
|
5 |
+
image.src = url
|
6 |
+
image.addEventListener('load', () => {
|
7 |
+
resolve(image)
|
8 |
+
})
|
9 |
+
image.addEventListener('abort', () => {
|
10 |
+
reject('onabort')
|
11 |
+
})
|
12 |
+
image.addEventListener('error', () => {
|
13 |
+
reject('onerror')
|
14 |
+
})
|
15 |
+
})
|
16 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/loader.ts
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader'
|
2 |
+
import { OBJLoader } from 'three/examples/jsm/loaders/OBJLoader'
|
3 |
+
import { GLTF, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'
|
4 |
+
import * as THREE from 'three'
|
5 |
+
|
6 |
+
const fbxLoader = new FBXLoader()
|
7 |
+
export async function LoadFBXFile(
|
8 |
+
url: string,
|
9 |
+
onLoading?: (loaded: number) => void
|
10 |
+
): Promise<THREE.Group> {
|
11 |
+
return new Promise((resolve, reject) => {
|
12 |
+
// load a resource
|
13 |
+
fbxLoader.load(
|
14 |
+
// resource URL
|
15 |
+
url,
|
16 |
+
// called when resource is loaded
|
17 |
+
function (object) {
|
18 |
+
resolve(object)
|
19 |
+
},
|
20 |
+
// called when loading is in progresses
|
21 |
+
function (xhr) {
|
22 |
+
console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
|
23 |
+
onLoading?.((xhr.loaded / xhr.total) * 100)
|
24 |
+
},
|
25 |
+
// called when loading has errors
|
26 |
+
function (error) {
|
27 |
+
console.log('An error happened')
|
28 |
+
reject(error)
|
29 |
+
}
|
30 |
+
)
|
31 |
+
})
|
32 |
+
}
|
33 |
+
|
34 |
+
// instantiate a loader
|
35 |
+
const loader = new OBJLoader()
|
36 |
+
|
37 |
+
export async function LoadObjFile(url: string): Promise<THREE.Group> {
|
38 |
+
return new Promise((resolve, reject) => {
|
39 |
+
// load a resource
|
40 |
+
loader.load(
|
41 |
+
// resource URL
|
42 |
+
url,
|
43 |
+
// called when resource is loaded
|
44 |
+
function (object) {
|
45 |
+
resolve(object)
|
46 |
+
},
|
47 |
+
// called when loading is in progresses
|
48 |
+
function (xhr) {
|
49 |
+
console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
|
50 |
+
},
|
51 |
+
// called when loading has errors
|
52 |
+
function (error) {
|
53 |
+
console.log('An error happened')
|
54 |
+
reject(error)
|
55 |
+
}
|
56 |
+
)
|
57 |
+
})
|
58 |
+
}
|
59 |
+
|
60 |
+
export async function LoadGLTFile(url: string): Promise<GLTF> {
|
61 |
+
return new Promise((resolve, reject) => {
|
62 |
+
// load a resource
|
63 |
+
new GLTFLoader().load(
|
64 |
+
// resource URL
|
65 |
+
url,
|
66 |
+
// called when resource is loaded
|
67 |
+
function (object) {
|
68 |
+
resolve(object)
|
69 |
+
},
|
70 |
+
// called when loading is in progresses
|
71 |
+
function (xhr) {
|
72 |
+
console.log((xhr.loaded / xhr.total) * 100 + '% loaded')
|
73 |
+
},
|
74 |
+
// called when loading has errors
|
75 |
+
function (error) {
|
76 |
+
console.log('An error happened')
|
77 |
+
reject(error)
|
78 |
+
}
|
79 |
+
)
|
80 |
+
})
|
81 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/three-utils.ts
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import * as THREE from 'three'
|
2 |
+
import { Object3D } from 'three'
|
3 |
+
|
4 |
+
export function FindObjectItem<T extends THREE.Object3D>(
|
5 |
+
object: THREE.Object3D,
|
6 |
+
name: string
|
7 |
+
): T | null {
|
8 |
+
//console.log(object);
|
9 |
+
let result = null
|
10 |
+
object.traverse((child) => {
|
11 |
+
//console.log("child", child);
|
12 |
+
if (child.name == name) {
|
13 |
+
result = child
|
14 |
+
}
|
15 |
+
})
|
16 |
+
return result
|
17 |
+
}
|
18 |
+
|
19 |
+
export function GetWorldPosition(o: Object3D) {
|
20 |
+
const pos = new THREE.Vector3()
|
21 |
+
o.getWorldPosition(pos)
|
22 |
+
return pos
|
23 |
+
}
|
24 |
+
|
25 |
+
export function GetLocalPosition(obj: Object3D, postion: THREE.Vector3) {
|
26 |
+
return obj.worldToLocal(postion.clone())
|
27 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/time.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import dayjs from 'dayjs'
|
2 |
+
|
3 |
+
export function getCurrentTime(format = 'YYYY_MM_DD_HH_mm_ss') {
|
4 |
+
return dayjs(new Date()).format(format)
|
5 |
+
}
|
sd-webui-3d-open-pose-editor/src/utils/transfer.ts
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import {
|
2 |
+
fileOpen,
|
3 |
+
fileSave,
|
4 |
+
FileWithHandle,
|
5 |
+
FirstFileOpenOptions,
|
6 |
+
} from 'browser-fs-access'
|
7 |
+
|
8 |
+
export function download(href: string, title: string) {
|
9 |
+
const a = document.createElement('a')
|
10 |
+
a.setAttribute('href', href)
|
11 |
+
a.setAttribute('download', title)
|
12 |
+
a.click()
|
13 |
+
}
|
14 |
+
|
15 |
+
export function downloadJson(data: string, fileName: string) {
|
16 |
+
const blob = new Blob([data], { type: 'text/json' })
|
17 |
+
const href = window.URL.createObjectURL(blob)
|
18 |
+
download(href, fileName)
|
19 |
+
URL.revokeObjectURL(href)
|
20 |
+
}
|
21 |
+
|
22 |
+
async function fileOpenLegacy<M extends boolean | undefined = false>(
|
23 |
+
_options: FirstFileOpenOptions<M> = {}
|
24 |
+
): Promise<FileWithHandle | FileWithHandle[]> {
|
25 |
+
let options: FirstFileOpenOptions<M>[]
|
26 |
+
if (!Array.isArray(_options)) {
|
27 |
+
options = [_options]
|
28 |
+
} else options = _options
|
29 |
+
return new Promise((resolve, reject) => {
|
30 |
+
const input = document.createElement('input') as HTMLInputElement
|
31 |
+
input.type = 'file'
|
32 |
+
const accept = [
|
33 |
+
...options.map((option) => option.mimeTypes || []),
|
34 |
+
...options.map((option) => option.extensions || []),
|
35 |
+
].join()
|
36 |
+
input.multiple = options[0].multiple || false
|
37 |
+
// Empty string allows everything.
|
38 |
+
input.accept = accept || ''
|
39 |
+
// Append to the DOM, else Safari on iOS won't fire the `change` event
|
40 |
+
// reliably.
|
41 |
+
input.style.display = 'none'
|
42 |
+
document.body.append(input)
|
43 |
+
|
44 |
+
const _reject = () => cleanupListenersAndMaybeReject?.(reject)
|
45 |
+
const _resolve = (value: FileWithHandle | FileWithHandle[]) => {
|
46 |
+
if (typeof cleanupListenersAndMaybeReject === 'function') {
|
47 |
+
cleanupListenersAndMaybeReject()
|
48 |
+
}
|
49 |
+
resolve(value)
|
50 |
+
}
|
51 |
+
// ToDo: Remove this workaround once
|
52 |
+
// https://github.com/whatwg/html/issues/6376 is specified and supported.
|
53 |
+
const cleanupListenersAndMaybeReject =
|
54 |
+
options[0].legacySetup &&
|
55 |
+
options[0].legacySetup(_resolve, _reject, input)
|
56 |
+
|
57 |
+
const cancelDetector = () => {
|
58 |
+
window.removeEventListener('focus', cancelDetector)
|
59 |
+
input.remove()
|
60 |
+
}
|
61 |
+
|
62 |
+
input.addEventListener('click', () => {
|
63 |
+
window.addEventListener('focus', cancelDetector)
|
64 |
+
})
|
65 |
+
|
66 |
+
input.addEventListener('change', () => {
|
67 |
+
window.removeEventListener('focus', cancelDetector)
|
68 |
+
input.remove()
|
69 |
+
|
70 |
+
if (input.files)
|
71 |
+
_resolve(
|
72 |
+
input.multiple ? Array.from(input.files) : input.files[0]
|
73 |
+
)
|
74 |
+
else {
|
75 |
+
_reject()
|
76 |
+
}
|
77 |
+
})
|
78 |
+
|
79 |
+
if ('showPicker' in HTMLInputElement.prototype) {
|
80 |
+
input.showPicker()
|
81 |
+
} else {
|
82 |
+
input.click()
|
83 |
+
}
|
84 |
+
})
|
85 |
+
}
|
86 |
+
|
87 |
+
export async function uploadJson() {
|
88 |
+
try {
|
89 |
+
const file = await fileOpenLegacy({
|
90 |
+
mimeTypes: ['application/json'],
|
91 |
+
legacySetup: (_, rejectionHandler) => {
|
92 |
+
const timeoutId = setTimeout(rejectionHandler, 10_000)
|
93 |
+
return (reject) => {
|
94 |
+
clearTimeout(timeoutId)
|
95 |
+
if (reject) {
|
96 |
+
console.error('reject')
|
97 |
+
reject('Failed to Open file')
|
98 |
+
}
|
99 |
+
}
|
100 |
+
},
|
101 |
+
})
|
102 |
+
|
103 |
+
return await new Promise<string>((resolve, reject) => {
|
104 |
+
const reader = new FileReader()
|
105 |
+
reader.onload = function () {
|
106 |
+
resolve(reader.result as string)
|
107 |
+
}
|
108 |
+
|
109 |
+
reader.onerror = function () {
|
110 |
+
reject(reader.error)
|
111 |
+
}
|
112 |
+
|
113 |
+
if (Array.isArray(file) == false)
|
114 |
+
reader.readAsText(file as FileWithHandle)
|
115 |
+
else reject("Don't select multiple files")
|
116 |
+
})
|
117 |
+
} catch (error) {
|
118 |
+
console.log(error)
|
119 |
+
return null
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
export async function uploadImage() {
|
124 |
+
try {
|
125 |
+
const file = await fileOpenLegacy({
|
126 |
+
mimeTypes: ['image/*'],
|
127 |
+
legacySetup: (_, rejectionHandler) => {
|
128 |
+
const timeoutId = setTimeout(rejectionHandler, 10_000)
|
129 |
+
return (reject) => {
|
130 |
+
clearTimeout(timeoutId)
|
131 |
+
console.log('reject')
|
132 |
+
if (reject) {
|
133 |
+
reject('Open file timeout')
|
134 |
+
}
|
135 |
+
}
|
136 |
+
},
|
137 |
+
})
|
138 |
+
|
139 |
+
return await new Promise<string>((resolve, reject) => {
|
140 |
+
const reader = new FileReader()
|
141 |
+
reader.onload = function () {
|
142 |
+
resolve(reader.result as string)
|
143 |
+
}
|
144 |
+
|
145 |
+
reader.onerror = function () {
|
146 |
+
reject(reader.error)
|
147 |
+
}
|
148 |
+
|
149 |
+
if (Array.isArray(file) == false)
|
150 |
+
reader.readAsDataURL(file as FileWithHandle)
|
151 |
+
else reject("Don't select multiple files")
|
152 |
+
})
|
153 |
+
} catch (error) {
|
154 |
+
console.log(error)
|
155 |
+
return null
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
export async function CopyTextToClipboard(text: string) {
|
160 |
+
try {
|
161 |
+
await navigator.clipboard.writeText(text)
|
162 |
+
} catch (error) {
|
163 |
+
// https://github.com/sudodoki/copy-to-clipboard/blob/main/index.js
|
164 |
+
const input = document.createElement('input') as HTMLInputElement
|
165 |
+
input.type = 'text'
|
166 |
+
input.style.display = 'none'
|
167 |
+
input.value = text
|
168 |
+
input.ariaHidden = 'true'
|
169 |
+
// reset user styles for span element
|
170 |
+
input.style.all = 'unset'
|
171 |
+
// prevents scrolling to the end of the page
|
172 |
+
input.style.position = 'fixed'
|
173 |
+
input.style.top = '0'
|
174 |
+
input.style.clip = 'rect(0, 0, 0, 0)'
|
175 |
+
|
176 |
+
document.body.append(input)
|
177 |
+
|
178 |
+
input.select()
|
179 |
+
const successful = document.execCommand('copy')
|
180 |
+
|
181 |
+
input.remove()
|
182 |
+
|
183 |
+
if (!successful) {
|
184 |
+
throw new Error('copy command was unsuccessful')
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
sd-webui-3d-open-pose-editor/src/vite-env.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference types="vite/client" />
|
2 |
+
|
3 |
+
declare const __APP_VERSION__: string
|
4 |
+
declare const __APP_BUILD_TIME__: number
|
sd-webui-3d-open-pose-editor/style.css
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#openpose3d_iframe {
|
2 |
+
display: block;
|
3 |
+
width: 100%;
|
4 |
+
height: calc(100vh - 150px);
|
5 |
+
min-height: 750px;
|
6 |
+
}
|
7 |
+
|
8 |
+
/* Workaround for ashen-sensored/stable-diffusion-webui-two-shot */
|
9 |
+
#openpose3d_main .output-html {
|
10 |
+
display: block;
|
11 |
+
}
|
sd-webui-3d-open-pose-editor/tools/fix-singlefile.ts
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import fs from 'fs-extra'
|
2 |
+
import { zip } from 'zip-a-folder'
|
3 |
+
import path from 'path'
|
4 |
+
|
5 |
+
async function main() {
|
6 |
+
const content = fs.readFileSync(path.join('dist', 'index.html')).toString()
|
7 |
+
|
8 |
+
fs.writeFileSync(
|
9 |
+
path.join('dist', 'index.html'),
|
10 |
+
content.replace(`type="module" crossorigin`, 'defer')
|
11 |
+
)
|
12 |
+
|
13 |
+
await zip('dist', path.join('html.zip'))
|
14 |
+
}
|
15 |
+
|
16 |
+
main()
|
sd-webui-3d-open-pose-editor/tools/generate_assets.ts
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import fs from 'fs-extra'
|
2 |
+
import path from 'path'
|
3 |
+
const list: Record<
|
4 |
+
string,
|
5 |
+
{
|
6 |
+
prefix?: string
|
7 |
+
mimetype: string
|
8 |
+
}
|
9 |
+
> = {
|
10 |
+
'models/foot.fbx': { mimetype: 'application/octet-stream' },
|
11 |
+
'models/hand.fbx': { mimetype: 'application/octet-stream' },
|
12 |
+
'src/poses/data.bin': { mimetype: 'application/octet-stream' },
|
13 |
+
'pose_landmark_full.tflite': {
|
14 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
15 |
+
mimetype: 'application/octet-stream',
|
16 |
+
},
|
17 |
+
'pose_web.binarypb': {
|
18 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
19 |
+
mimetype: 'application/octet-stream',
|
20 |
+
},
|
21 |
+
'pose_solution_packed_assets.data': {
|
22 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
23 |
+
mimetype: 'application/octet-stream',
|
24 |
+
},
|
25 |
+
'pose_solution_simd_wasm_bin.wasm': {
|
26 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
27 |
+
mimetype: 'application/wasm',
|
28 |
+
},
|
29 |
+
'pose_solution_packed_assets_loader.js': {
|
30 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
31 |
+
mimetype: 'application/javascript',
|
32 |
+
},
|
33 |
+
'pose_solution_simd_wasm_bin.js': {
|
34 |
+
prefix: 'node_modules/@mediapipe/pose/',
|
35 |
+
mimetype: 'application/javascript',
|
36 |
+
},
|
37 |
+
}
|
38 |
+
|
39 |
+
const output = Object.fromEntries(
|
40 |
+
Object.entries(list).map(([file, { prefix, mimetype }]) => [
|
41 |
+
file,
|
42 |
+
`data:${mimetype};base64,${fs
|
43 |
+
.readFileSync(path.join(prefix ?? '.', file))
|
44 |
+
.toString('base64')}`,
|
45 |
+
])
|
46 |
+
)
|
47 |
+
|
48 |
+
fs.writeFile(
|
49 |
+
'src/assets.ts',
|
50 |
+
'export default ' + JSON.stringify(output, null, 4)
|
51 |
+
)
|
sd-webui-3d-open-pose-editor/tools/translate.ts
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import fs from 'fs-extra'
|
2 |
+
import path from 'path'
|
3 |
+
|
4 |
+
const resource = {
|
5 |
+
de: {
|
6 |
+
Generate: 'Generieren',
|
7 |
+
},
|
8 |
+
en: {
|
9 |
+
Generate: 'Generate',
|
10 |
+
},
|
11 |
+
ja: {
|
12 |
+
Generate: '生成する',
|
13 |
+
},
|
14 |
+
sp: {
|
15 |
+
Generate: 'Generar',
|
16 |
+
},
|
17 |
+
'zh-CN': {
|
18 |
+
Generate: '生成',
|
19 |
+
},
|
20 |
+
'zh-HK': {
|
21 |
+
Generate: '生成',
|
22 |
+
},
|
23 |
+
'zh-TW': {
|
24 |
+
Generate: '生成',
|
25 |
+
},
|
26 |
+
}
|
27 |
+
|
28 |
+
async function main() {
|
29 |
+
Object.entries(resource).forEach(([lng, content]) => {
|
30 |
+
const file = path.join('src/locales', `${lng}.json`)
|
31 |
+
const old = fs.readJSONSync(file)
|
32 |
+
const output = {
|
33 |
+
...old,
|
34 |
+
...content,
|
35 |
+
}
|
36 |
+
fs.writeJSONSync(file, output, {
|
37 |
+
spaces: 4,
|
38 |
+
})
|
39 |
+
})
|
40 |
+
}
|
41 |
+
|
42 |
+
main()
|
sd-webui-3d-open-pose-editor/tsconfig.json
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"compilerOptions": {
|
3 |
+
"target": "ESNext",
|
4 |
+
"useDefineForClassFields": true,
|
5 |
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
6 |
+
"allowJs": false,
|
7 |
+
"skipLibCheck": true,
|
8 |
+
"esModuleInterop": false,
|
9 |
+
"allowSyntheticDefaultImports": true,
|
10 |
+
"strict": true,
|
11 |
+
"forceConsistentCasingInFileNames": true,
|
12 |
+
"module": "ESNext",
|
13 |
+
"moduleResolution": "Node",
|
14 |
+
"resolveJsonModule": true,
|
15 |
+
"isolatedModules": true,
|
16 |
+
"noEmit": true,
|
17 |
+
"jsx": "react-jsx"
|
18 |
+
},
|
19 |
+
"include": ["src"],
|
20 |
+
"references": [{ "path": "./tsconfig.node.json" }]
|
21 |
+
}
|
sd-webui-3d-open-pose-editor/tsconfig.node.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"compilerOptions": {
|
3 |
+
"composite": true,
|
4 |
+
"module": "ESNext",
|
5 |
+
"moduleResolution": "Node",
|
6 |
+
"allowSyntheticDefaultImports": true
|
7 |
+
},
|
8 |
+
"include": ["vite.config.ts", "vite-plugin-extension.ts"]
|
9 |
+
}
|
sd-webui-3d-open-pose-editor/vite-plugin-extension.ts
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { type UserConfig, type Plugin } from 'vite'
|
2 |
+
import { type OutputOptions } from 'rollup'
|
3 |
+
import { resolve } from 'path'
|
4 |
+
import { rename } from 'fs/promises'
|
5 |
+
|
6 |
+
export default function (): Plugin {
|
7 |
+
return {
|
8 |
+
name: 'extension',
|
9 |
+
async writeBundle(options, bundle) {
|
10 |
+
for (const key in bundle) {
|
11 |
+
const b = bundle[key]
|
12 |
+
const type = b.type
|
13 |
+
if (type !== 'chunk' && type !== 'asset') {
|
14 |
+
continue
|
15 |
+
}
|
16 |
+
const fileName = resolve(options.dir, b.fileName)
|
17 |
+
await rename(fileName, fileName.replace(/\?[0-9a-f]+$/, ''))
|
18 |
+
}
|
19 |
+
},
|
20 |
+
config(config, env) {
|
21 |
+
const common: UserConfig = {
|
22 |
+
base: './',
|
23 |
+
resolve: {
|
24 |
+
alias: [
|
25 |
+
{
|
26 |
+
find: /.*\/assets(\.ts)?$/,
|
27 |
+
replacement: resolve(
|
28 |
+
__dirname,
|
29 |
+
'src/environments/extension/assets.ts'
|
30 |
+
),
|
31 |
+
},
|
32 |
+
],
|
33 |
+
},
|
34 |
+
build: {
|
35 |
+
target: 'ESNext',
|
36 |
+
emptyOutDir: false,
|
37 |
+
rollupOptions: {
|
38 |
+
output: {
|
39 |
+
entryFileNames: '[name].js?[hash]',
|
40 |
+
chunkFileNames: '[name].js?[hash]',
|
41 |
+
assetFileNames: '[name][extname]?[hash]',
|
42 |
+
},
|
43 |
+
},
|
44 |
+
},
|
45 |
+
}
|
46 |
+
switch (env.mode) {
|
47 |
+
case 'extension-editor':
|
48 |
+
{
|
49 |
+
common.build.outDir = 'pages'
|
50 |
+
common.build.rollupOptions.input = {
|
51 |
+
index: resolve(__dirname, 'index.html'),
|
52 |
+
}
|
53 |
+
}
|
54 |
+
break
|
55 |
+
case 'extension-entry':
|
56 |
+
{
|
57 |
+
common.build.outDir = 'javascript'
|
58 |
+
common.build.rollupOptions.input = {
|
59 |
+
index: resolve(
|
60 |
+
__dirname,
|
61 |
+
'src/environments/extension/entry.ts'
|
62 |
+
),
|
63 |
+
}
|
64 |
+
common.publicDir = false
|
65 |
+
const output = common.build.rollupOptions
|
66 |
+
.output as OutputOptions
|
67 |
+
output.format = 'iife'
|
68 |
+
}
|
69 |
+
|
70 |
+
break
|
71 |
+
default:
|
72 |
+
throw Error(`Unknown mode: ${env.mode}`)
|
73 |
+
}
|
74 |
+
return common
|
75 |
+
},
|
76 |
+
}
|
77 |
+
}
|
sd-webui-3d-open-pose-editor/vite.config.ts
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { defineConfig, UserConfigFn } from 'vite'
|
2 |
+
import react from '@vitejs/plugin-react'
|
3 |
+
import { VitePWA } from 'vite-plugin-pwa'
|
4 |
+
import { visualizer } from 'rollup-plugin-visualizer'
|
5 |
+
import { resolve } from 'path'
|
6 |
+
import ConditionalCompile from 'vite-plugin-conditional-compiler'
|
7 |
+
import ExtensionPlugin from './vite-plugin-extension'
|
8 |
+
|
9 |
+
// https://vitejs.dev/config/
|
10 |
+
const config: UserConfigFn = ({ command, mode, ssrBuild }) => {
|
11 |
+
const pwa = VitePWA({
|
12 |
+
workbox: {
|
13 |
+
globPatterns: ['**/*.{js,css,html,ico,png,svg,mp3,obj,fbx,bin}'],
|
14 |
+
// https://vite-pwa-org.netlify.app/workbox/generate-sw.html#cache-external-resources
|
15 |
+
runtimeCaching: [
|
16 |
+
{
|
17 |
+
urlPattern: /^https:\/\/cdn\.jsdelivr\.net\/.*/i,
|
18 |
+
handler: 'CacheFirst',
|
19 |
+
options: {
|
20 |
+
cacheName: 'jsdelivr-cdn',
|
21 |
+
expiration: {
|
22 |
+
maxEntries: 10,
|
23 |
+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
24 |
+
},
|
25 |
+
cacheableResponse: {
|
26 |
+
statuses: [0, 200],
|
27 |
+
},
|
28 |
+
},
|
29 |
+
},
|
30 |
+
{
|
31 |
+
urlPattern:
|
32 |
+
/^https:\/\/openpose-editor.oss-cn-beijing\.aliyuncs\.com\/.*/i,
|
33 |
+
handler: 'CacheFirst',
|
34 |
+
options: {
|
35 |
+
cacheName: 'aliyuncs',
|
36 |
+
expiration: {
|
37 |
+
maxEntries: 10,
|
38 |
+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
39 |
+
},
|
40 |
+
cacheableResponse: {
|
41 |
+
statuses: [0, 200],
|
42 |
+
},
|
43 |
+
},
|
44 |
+
},
|
45 |
+
],
|
46 |
+
},
|
47 |
+
includeAssets: [
|
48 |
+
'favicon.ico',
|
49 |
+
'apple-touch-icon.png',
|
50 |
+
'safari-pinned-tab.svg',
|
51 |
+
],
|
52 |
+
manifest: {
|
53 |
+
name: '3D Openpose Editor',
|
54 |
+
short_name: '3D Openpose Editor',
|
55 |
+
description: '3D Openpose Editor (Yu Zhu)',
|
56 |
+
theme_color: '#ffffff',
|
57 |
+
background_color: '#ffffff',
|
58 |
+
icons: [
|
59 |
+
{
|
60 |
+
src: 'icons/icon-72x72.png',
|
61 |
+
sizes: '72x72',
|
62 |
+
type: 'image/png',
|
63 |
+
},
|
64 |
+
{
|
65 |
+
src: 'icons/icon-96x96.png',
|
66 |
+
sizes: '96x96',
|
67 |
+
type: 'image/png',
|
68 |
+
},
|
69 |
+
{
|
70 |
+
src: 'icons/icon-128x128.png',
|
71 |
+
sizes: '128x128',
|
72 |
+
type: 'image/png',
|
73 |
+
},
|
74 |
+
{
|
75 |
+
src: 'icons/icon-144x144.png',
|
76 |
+
sizes: '144x144',
|
77 |
+
type: 'image/png',
|
78 |
+
},
|
79 |
+
{
|
80 |
+
src: 'icons/icon-152x152.png',
|
81 |
+
sizes: '152x152',
|
82 |
+
type: 'image/png',
|
83 |
+
},
|
84 |
+
{
|
85 |
+
src: 'icons/icon-192x192.png',
|
86 |
+
sizes: '192x192',
|
87 |
+
type: 'image/png',
|
88 |
+
},
|
89 |
+
{
|
90 |
+
src: 'icons/icon-384x384.png',
|
91 |
+
sizes: '384x384',
|
92 |
+
type: 'image/png',
|
93 |
+
},
|
94 |
+
{
|
95 |
+
src: 'icons/icon-512x512.png',
|
96 |
+
sizes: '512x512',
|
97 |
+
type: 'image/png',
|
98 |
+
},
|
99 |
+
{
|
100 |
+
src: 'icons/icon-512x512.png',
|
101 |
+
sizes: '512x512',
|
102 |
+
type: 'image/png',
|
103 |
+
purpose: 'maskable any',
|
104 |
+
},
|
105 |
+
],
|
106 |
+
},
|
107 |
+
})
|
108 |
+
|
109 |
+
return {
|
110 |
+
base: mode === 'singlefile' ? './' : '/open-pose-editor/',
|
111 |
+
define: {
|
112 |
+
global: {},
|
113 |
+
__APP_VERSION__: JSON.stringify('0.1.18'),
|
114 |
+
__APP_BUILD_TIME__: Date.now(),
|
115 |
+
},
|
116 |
+
build: {
|
117 |
+
assetsDir: mode === 'singlefile' ? '.' : 'assets',
|
118 |
+
emptyOutDir: true,
|
119 |
+
},
|
120 |
+
plugins: [
|
121 |
+
react(),
|
122 |
+
mode === 'online' ? pwa : null,
|
123 |
+
visualizer(),
|
124 |
+
ConditionalCompile(),
|
125 |
+
mode.startsWith('extension') ? ExtensionPlugin() : null,
|
126 |
+
],
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
export default defineConfig(config)
|
sd-webui-lora-block-weight/scripts/__pycache__/lora_block_weight.cpython-310.pyc
CHANGED
Binary files a/sd-webui-lora-block-weight/scripts/__pycache__/lora_block_weight.cpython-310.pyc and b/sd-webui-lora-block-weight/scripts/__pycache__/lora_block_weight.cpython-310.pyc differ
|
|
sd-webui-stablesr/scripts/__pycache__/stablesr.cpython-310.pyc
CHANGED
Binary files a/sd-webui-stablesr/scripts/__pycache__/stablesr.cpython-310.pyc and b/sd-webui-stablesr/scripts/__pycache__/stablesr.cpython-310.pyc differ
|
|
sd-webui-stablesr/srmodule/__pycache__/attn.cpython-310.pyc
CHANGED
Binary files a/sd-webui-stablesr/srmodule/__pycache__/attn.cpython-310.pyc and b/sd-webui-stablesr/srmodule/__pycache__/attn.cpython-310.pyc differ
|
|
sd-webui-stablesr/srmodule/__pycache__/colorfix.cpython-310.pyc
CHANGED
Binary files a/sd-webui-stablesr/srmodule/__pycache__/colorfix.cpython-310.pyc and b/sd-webui-stablesr/srmodule/__pycache__/colorfix.cpython-310.pyc differ
|
|
sd-webui-stablesr/srmodule/__pycache__/spade.cpython-310.pyc
CHANGED
Binary files a/sd-webui-stablesr/srmodule/__pycache__/spade.cpython-310.pyc and b/sd-webui-stablesr/srmodule/__pycache__/spade.cpython-310.pyc differ
|
|
sd-webui-stablesr/srmodule/__pycache__/struct_cond.cpython-310.pyc
CHANGED
Binary files a/sd-webui-stablesr/srmodule/__pycache__/struct_cond.cpython-310.pyc and b/sd-webui-stablesr/srmodule/__pycache__/struct_cond.cpython-310.pyc differ
|
|