forked from jd-cg/Unreal-Custom-Camera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildPlugin.bat
More file actions
387 lines (315 loc) · 9.49 KB
/
BuildPlugin.bat
File metadata and controls
387 lines (315 loc) · 9.49 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
@echo off
REM ============================================
REM Asymmetric Camera Plugin Build Manager
REM ============================================
setlocal enabledelayedexpansion
REM ============================================
REM Configuration
REM ============================================
REM Set your Unreal Engine 5.4 installation path here
REM If not set, script will try to auto-detect
set "UE5_PATH="
REM Project configuration
set "PROJECT_ROOT=%~dp0"
set "PROJECT_NAME=MyCustomCam"
set "PROJECT_FILE=%PROJECT_ROOT%%PROJECT_NAME%.uproject"
set "PLUGIN_NAME=AsymmetricCamera"
set "PLUGIN_PATH=%PROJECT_ROOT%Plugins\%PLUGIN_NAME%"
REM ============================================
REM Auto-detect UE5 Path
REM ============================================
if "%UE5_PATH%"=="" (
echo Attempting to auto-detect Unreal Engine 5.4 installation...
REM Common installation paths
if exist "D:\Ue\UE\UE_5.4\Engine\Build\BatchFiles\Build.bat" (
set "UE5_PATH=D:\Ue\UE\UE_5.4"
echo Found UE5.4 at: !UE5_PATH!
) else if exist "C:\Program Files\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat" (
set "UE5_PATH=C:\Program Files\Epic Games\UE_5.4"
echo Found UE5.4 at: !UE5_PATH!
) else if exist "D:\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat" (
set "UE5_PATH=D:\Epic Games\UE_5.4"
echo Found UE5.4 at: !UE5_PATH!
) else if exist "C:\Epic Games\UE_5.4\Engine\Build\BatchFiles\Build.bat" (
set "UE5_PATH=C:\Epic Games\UE_5.4"
echo Found UE5.4 at: !UE5_PATH!
) else (
echo ERROR: Could not auto-detect Unreal Engine 5.4 installation
echo Please set UE5_PATH variable in this script
pause
exit /b 1
)
)
REM Set tool paths
set "UBT=%UE5_PATH%\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe"
set "UAT=%UE5_PATH%\Engine\Build\BatchFiles\RunUAT.bat"
set "GENPROJ=%UE5_PATH%\Engine\Build\BatchFiles\GenerateProjectFiles.bat"
REM ============================================
REM Main Menu
REM ============================================
:menu
cls
echo ============================================
echo Asymmetric Camera Plugin Build Manager
echo ============================================
echo.
echo Project: %PROJECT_NAME%
echo Plugin: %PLUGIN_NAME%
echo UE5: %UE5_PATH%
echo.
echo ============================================
echo Actions:
echo ============================================
echo.
echo 1. Generate Project Files
echo 2. Build Plugin (Development Editor)
echo 3. Build Plugin (Shipping)
echo 4. Rebuild Plugin (Clean + Build)
echo 5. Clean Intermediate Files
echo 6. Package Plugin
echo 7. Open Project in Editor
echo 8. Open Visual Studio Solution
echo 9. Show Plugin Info
echo 0. Exit
echo.
echo ============================================
set /p choice="Enter your choice (0-9): "
if "%choice%"=="1" goto generate
if "%choice%"=="2" goto build_dev
if "%choice%"=="3" goto build_ship
if "%choice%"=="4" goto rebuild
if "%choice%"=="5" goto clean
if "%choice%"=="6" goto package
if "%choice%"=="7" goto open_editor
if "%choice%"=="8" goto open_vs
if "%choice%"=="9" goto info
if "%choice%"=="0" goto end
echo Invalid choice. Please try again.
timeout /t 2
goto menu
REM ============================================
REM Generate Project Files
REM ============================================
:generate
echo.
echo ============================================
echo Generating Project Files...
echo ============================================
echo.
call "%GENPROJ%" -project="%PROJECT_FILE%" -game -engine
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Failed to generate project files
pause
goto menu
)
echo.
echo Project files generated successfully!
pause
goto menu
REM ============================================
REM Build Plugin - Development Editor
REM ============================================
:build_dev
echo.
echo ============================================
echo Building Plugin (Development Editor)...
echo ============================================
echo.
call "%UE5_PATH%\Engine\Build\BatchFiles\Build.bat" %PROJECT_NAME%Editor Win64 Development -Project="%PROJECT_FILE%" -WaitMutex
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Build failed
pause
goto menu
)
echo.
echo Build completed successfully!
pause
goto menu
REM ============================================
REM Build Plugin - Shipping
REM ============================================
:build_ship
echo.
echo ============================================
echo Building Plugin (Shipping)...
echo ============================================
echo.
call "%UE5_PATH%\Engine\Build\BatchFiles\Build.bat" %PROJECT_NAME% Win64 Shipping -Project="%PROJECT_FILE%" -WaitMutex
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Build failed
pause
goto menu
)
echo.
echo Build completed successfully!
pause
goto menu
REM ============================================
REM Rebuild Plugin
REM ============================================
:rebuild
echo.
echo ============================================
echo Rebuilding Plugin...
echo ============================================
echo.
echo Cleaning intermediate files...
call :clean_internal
echo.
echo Building plugin...
call "%UE5_PATH%\Engine\Build\BatchFiles\Build.bat" %PROJECT_NAME%Editor Win64 Development -Project="%PROJECT_FILE%" -WaitMutex
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Rebuild failed
pause
goto menu
)
echo.
echo Rebuild completed successfully!
pause
goto menu
REM ============================================
REM Clean Intermediate Files
REM ============================================
:clean
echo.
echo ============================================
echo Cleaning Intermediate Files...
echo ============================================
echo.
call :clean_internal
echo.
echo Clean completed!
pause
goto menu
:clean_internal
if exist "%PROJECT_ROOT%Binaries" (
echo Deleting Binaries...
rmdir /s /q "%PROJECT_ROOT%Binaries"
)
if exist "%PROJECT_ROOT%Intermediate" (
echo Deleting Intermediate...
rmdir /s /q "%PROJECT_ROOT%Intermediate"
)
if exist "%PLUGIN_PATH%\Binaries" (
echo Deleting Plugin Binaries...
rmdir /s /q "%PLUGIN_PATH%\Binaries"
)
if exist "%PLUGIN_PATH%\Intermediate" (
echo Deleting Plugin Intermediate...
rmdir /s /q "%PLUGIN_PATH%\Intermediate"
)
if exist "%PROJECT_ROOT%.vs" (
echo Deleting .vs folder...
rmdir /s /q "%PROJECT_ROOT%.vs"
)
if exist "%PROJECT_ROOT%%PROJECT_NAME%.sln" (
echo Deleting solution file...
del /q "%PROJECT_ROOT%%PROJECT_NAME%.sln"
)
echo Intermediate files cleaned!
exit /b 0
REM ============================================
REM Package Plugin
REM ============================================
:package
echo.
echo ============================================
echo Packaging Plugin...
echo ============================================
echo.
set "OUTPUT_PATH=%PROJECT_ROOT%PackagedPlugins\%PLUGIN_NAME%"
if not exist "%PROJECT_ROOT%PackagedPlugins" mkdir "%PROJECT_ROOT%PackagedPlugins"
call "%UAT%" BuildPlugin -Plugin="%PLUGIN_PATH%\%PLUGIN_NAME%.uplugin" -Package="%OUTPUT_PATH%" -CreateSubFolder
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Package failed
pause
goto menu
)
echo.
echo Plugin packaged successfully!
echo Output: %OUTPUT_PATH%
pause
goto menu
REM ============================================
REM Open Editor
REM ============================================
:open_editor
echo.
echo ============================================
echo Opening Unreal Editor...
echo ============================================
echo.
start "" "%UE5_PATH%\Engine\Binaries\Win64\UnrealEditor.exe" "%PROJECT_FILE%"
goto menu
REM ============================================
REM Open Visual Studio
REM ============================================
:open_vs
echo.
echo ============================================
echo Opening Visual Studio...
echo ============================================
echo.
if not exist "%PROJECT_ROOT%%PROJECT_NAME%.sln" (
echo Solution file not found. Generating project files first...
call :generate
)
start "" "%PROJECT_ROOT%%PROJECT_NAME%.sln"
goto menu
REM ============================================
REM Show Plugin Info
REM ============================================
:info
cls
echo ============================================
echo Plugin Information
echo ============================================
echo.
echo Plugin Name: %PLUGIN_NAME%
echo Plugin Path: %PLUGIN_PATH%
echo Project: %PROJECT_NAME%
echo Project Path: %PROJECT_ROOT%
echo UE5 Path: %UE5_PATH%
echo.
echo ============================================
echo Plugin Files:
echo ============================================
echo.
if exist "%PLUGIN_PATH%\%PLUGIN_NAME%.uplugin" (
echo [OK] Plugin descriptor found
) else (
echo [ERROR] Plugin descriptor not found!
)
if exist "%PLUGIN_PATH%\Source\%PLUGIN_NAME%" (
echo [OK] Runtime module found
) else (
echo [ERROR] Runtime module not found!
)
if exist "%PLUGIN_PATH%\Source\%PLUGIN_NAME%Editor" (
echo [OK] Editor module found
) else (
echo [ERROR] Editor module not found!
)
if exist "%PLUGIN_PATH%\README.md" (
echo [OK] Documentation found
) else (
echo [WARNING] Documentation not found
)
echo.
echo ============================================
echo Module Files:
echo ============================================
echo.
dir /b "%PLUGIN_PATH%\Source\%PLUGIN_NAME%\Public\*.h" 2>nul
dir /b "%PLUGIN_PATH%\Source\%PLUGIN_NAME%\Private\*.cpp" 2>nul
echo.
pause
goto menu
REM ============================================
REM Exit
REM ============================================
:end
echo.
echo Goodbye!
timeout /t 1
exit /b 0