This repository has been archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
update_proto_models.bat
95 lines (69 loc) · 1.91 KB
/
update_proto_models.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
:: TODO => USE BAZEL TO DEPLOY?
echo off
chcp 65001
setlocal
set "UNREAL_PLUGIN_DIR=D:\3D_Works\UE\MediaPipe4U"
set "INITIAL_DIR=%cd%"
set "SCRIPTS_DIR=%~dp0"
for /f "delims=#" %%i in ('prompt #$E#^&echo on^&for %%a in ^(1^) do rem') do set "ESC_CHAR=%%i"
set FN=%~p0
set FN=%FN:~0,-1%
:getfolder
FOR /F "tokens=1,* delims=\/" %%i in ("%FN%") do (
if not "%%j"=="" (
set FN=%%j
goto getfolder
)
)
echo Current folder: %FN%
FOR /F %%i in ('where python') do (
set PYTHON_EXE=%%i
goto GET_PY
)
:GET_PY
set "PYTHON_EXE=%PYTHON_EXE:\=\\%"
cd "%SCRIPTS_DIR%..\..\"
SET "ROOT=%CD%"
if not exist mediapipe ( echo "invalid directory" && exit )
if not exist bazel-bin\mediapipe\modules\face_geometry\data\geometry_pipeline_metadata_landmarks.binarypb (
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 --action_env PYTHON_BIN_PATH="%PYTHON_EXE%" mediapipe/modules/face_geometry/data:geometry_pipeline_metadata_landmarks
)
set "BIN_DIR=%ROOT%\bazel-bin"
set "FORMAT=%UNREAL_PLUGIN_DIR%\Source\MediaPipe\Private\mediapipe\framework\formats"
set "MODULES=%UNREAL_PLUGIN_DIR%\Source\MediaPipe\Private\mediapipe\modules"
set "S_FORMAT=%BIN_DIR%\mediapipe\framework\formats"
set "S_MODULES=%BIN_DIR%\mediapipe\modules"
echo off
setlocal enabledelayedexpansion
call :setESC
for /R %FORMAT% %%f in (*.*) do (
@rem echo %%f
@rem echo %%~nxf
set "EMPTY="
set "FPATH=%%f"
set "FPATH=!FPATH:%FORMAT%=%S_FORMAT%!"
set "RR=%%f"
set "RR=!RR:%FORMAT%\=!"
if exist !FPATH! (
copy /Y "!FPATH!" "%%f"
echo !RR! CPYIED
) else (
echo !ESC_CHAR![31m!RR! is not existed!ESC_CHAR![m
)
)
for /R %MODULES% %%f in (*.*) do (
@rem echo %%f
@rem echo %%~nxf
set "EMPTY="
set "FPATH=%%f"
set "FPATH=!FPATH:%MODULES%=%S_MODULES%!"
set "RR=%%f"
set "RR=!RR:%MODULES%\=!"
if exist !FPATH! (
copy /Y "!FPATH!" "%%f"
echo !RR! CPYIED
) else (
echo !ESC_CHAR![31m!RR! is not existed!ESC_CHAR![m
)
)
pause