unreal-engine-mcp-server 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/.dockerignore +57 -0
  2. package/.env.production +25 -0
  3. package/.eslintrc.json +54 -0
  4. package/.github/workflows/publish-mcp.yml +75 -0
  5. package/Dockerfile +54 -0
  6. package/LICENSE +21 -0
  7. package/Public/icon.png +0 -0
  8. package/README.md +209 -0
  9. package/claude_desktop_config_example.json +13 -0
  10. package/dist/cli.d.ts +3 -0
  11. package/dist/cli.js +7 -0
  12. package/dist/index.d.ts +31 -0
  13. package/dist/index.js +484 -0
  14. package/dist/prompts/index.d.ts +14 -0
  15. package/dist/prompts/index.js +38 -0
  16. package/dist/python-utils.d.ts +29 -0
  17. package/dist/python-utils.js +54 -0
  18. package/dist/resources/actors.d.ts +13 -0
  19. package/dist/resources/actors.js +83 -0
  20. package/dist/resources/assets.d.ts +23 -0
  21. package/dist/resources/assets.js +245 -0
  22. package/dist/resources/levels.d.ts +17 -0
  23. package/dist/resources/levels.js +94 -0
  24. package/dist/tools/actors.d.ts +51 -0
  25. package/dist/tools/actors.js +459 -0
  26. package/dist/tools/animation.d.ts +196 -0
  27. package/dist/tools/animation.js +579 -0
  28. package/dist/tools/assets.d.ts +21 -0
  29. package/dist/tools/assets.js +304 -0
  30. package/dist/tools/audio.d.ts +170 -0
  31. package/dist/tools/audio.js +416 -0
  32. package/dist/tools/blueprint.d.ts +144 -0
  33. package/dist/tools/blueprint.js +652 -0
  34. package/dist/tools/build_environment_advanced.d.ts +66 -0
  35. package/dist/tools/build_environment_advanced.js +484 -0
  36. package/dist/tools/consolidated-tool-definitions.d.ts +2598 -0
  37. package/dist/tools/consolidated-tool-definitions.js +607 -0
  38. package/dist/tools/consolidated-tool-handlers.d.ts +2 -0
  39. package/dist/tools/consolidated-tool-handlers.js +1050 -0
  40. package/dist/tools/debug.d.ts +185 -0
  41. package/dist/tools/debug.js +265 -0
  42. package/dist/tools/editor.d.ts +88 -0
  43. package/dist/tools/editor.js +365 -0
  44. package/dist/tools/engine.d.ts +30 -0
  45. package/dist/tools/engine.js +36 -0
  46. package/dist/tools/foliage.d.ts +155 -0
  47. package/dist/tools/foliage.js +525 -0
  48. package/dist/tools/introspection.d.ts +98 -0
  49. package/dist/tools/introspection.js +683 -0
  50. package/dist/tools/landscape.d.ts +158 -0
  51. package/dist/tools/landscape.js +375 -0
  52. package/dist/tools/level.d.ts +110 -0
  53. package/dist/tools/level.js +362 -0
  54. package/dist/tools/lighting.d.ts +159 -0
  55. package/dist/tools/lighting.js +1179 -0
  56. package/dist/tools/materials.d.ts +34 -0
  57. package/dist/tools/materials.js +146 -0
  58. package/dist/tools/niagara.d.ts +145 -0
  59. package/dist/tools/niagara.js +289 -0
  60. package/dist/tools/performance.d.ts +163 -0
  61. package/dist/tools/performance.js +412 -0
  62. package/dist/tools/physics.d.ts +189 -0
  63. package/dist/tools/physics.js +784 -0
  64. package/dist/tools/rc.d.ts +110 -0
  65. package/dist/tools/rc.js +363 -0
  66. package/dist/tools/sequence.d.ts +112 -0
  67. package/dist/tools/sequence.js +675 -0
  68. package/dist/tools/tool-definitions.d.ts +4919 -0
  69. package/dist/tools/tool-definitions.js +891 -0
  70. package/dist/tools/tool-handlers.d.ts +47 -0
  71. package/dist/tools/tool-handlers.js +830 -0
  72. package/dist/tools/ui.d.ts +171 -0
  73. package/dist/tools/ui.js +337 -0
  74. package/dist/tools/visual.d.ts +29 -0
  75. package/dist/tools/visual.js +67 -0
  76. package/dist/types/env.d.ts +10 -0
  77. package/dist/types/env.js +18 -0
  78. package/dist/types/index.d.ts +323 -0
  79. package/dist/types/index.js +28 -0
  80. package/dist/types/tool-types.d.ts +274 -0
  81. package/dist/types/tool-types.js +13 -0
  82. package/dist/unreal-bridge.d.ts +126 -0
  83. package/dist/unreal-bridge.js +992 -0
  84. package/dist/utils/cache-manager.d.ts +64 -0
  85. package/dist/utils/cache-manager.js +176 -0
  86. package/dist/utils/error-handler.d.ts +66 -0
  87. package/dist/utils/error-handler.js +243 -0
  88. package/dist/utils/errors.d.ts +133 -0
  89. package/dist/utils/errors.js +256 -0
  90. package/dist/utils/http.d.ts +26 -0
  91. package/dist/utils/http.js +135 -0
  92. package/dist/utils/logger.d.ts +12 -0
  93. package/dist/utils/logger.js +32 -0
  94. package/dist/utils/normalize.d.ts +17 -0
  95. package/dist/utils/normalize.js +49 -0
  96. package/dist/utils/response-validator.d.ts +34 -0
  97. package/dist/utils/response-validator.js +121 -0
  98. package/dist/utils/safe-json.d.ts +4 -0
  99. package/dist/utils/safe-json.js +97 -0
  100. package/dist/utils/stdio-redirect.d.ts +2 -0
  101. package/dist/utils/stdio-redirect.js +20 -0
  102. package/dist/utils/validation.d.ts +50 -0
  103. package/dist/utils/validation.js +173 -0
  104. package/mcp-config-example.json +14 -0
  105. package/package.json +63 -0
  106. package/server.json +60 -0
  107. package/src/cli.ts +7 -0
  108. package/src/index.ts +543 -0
  109. package/src/prompts/index.ts +51 -0
  110. package/src/python/editor_compat.py +181 -0
  111. package/src/python-utils.ts +57 -0
  112. package/src/resources/actors.ts +92 -0
  113. package/src/resources/assets.ts +251 -0
  114. package/src/resources/levels.ts +83 -0
  115. package/src/tools/actors.ts +480 -0
  116. package/src/tools/animation.ts +713 -0
  117. package/src/tools/assets.ts +305 -0
  118. package/src/tools/audio.ts +548 -0
  119. package/src/tools/blueprint.ts +736 -0
  120. package/src/tools/build_environment_advanced.ts +526 -0
  121. package/src/tools/consolidated-tool-definitions.ts +619 -0
  122. package/src/tools/consolidated-tool-handlers.ts +1093 -0
  123. package/src/tools/debug.ts +368 -0
  124. package/src/tools/editor.ts +360 -0
  125. package/src/tools/engine.ts +32 -0
  126. package/src/tools/foliage.ts +652 -0
  127. package/src/tools/introspection.ts +778 -0
  128. package/src/tools/landscape.ts +523 -0
  129. package/src/tools/level.ts +410 -0
  130. package/src/tools/lighting.ts +1316 -0
  131. package/src/tools/materials.ts +148 -0
  132. package/src/tools/niagara.ts +312 -0
  133. package/src/tools/performance.ts +549 -0
  134. package/src/tools/physics.ts +924 -0
  135. package/src/tools/rc.ts +437 -0
  136. package/src/tools/sequence.ts +791 -0
  137. package/src/tools/tool-definitions.ts +907 -0
  138. package/src/tools/tool-handlers.ts +941 -0
  139. package/src/tools/ui.ts +499 -0
  140. package/src/tools/visual.ts +60 -0
  141. package/src/types/env.ts +27 -0
  142. package/src/types/index.ts +414 -0
  143. package/src/types/tool-types.ts +343 -0
  144. package/src/unreal-bridge.ts +1118 -0
  145. package/src/utils/cache-manager.ts +213 -0
  146. package/src/utils/error-handler.ts +320 -0
  147. package/src/utils/errors.ts +312 -0
  148. package/src/utils/http.ts +184 -0
  149. package/src/utils/logger.ts +30 -0
  150. package/src/utils/normalize.ts +54 -0
  151. package/src/utils/response-validator.ts +145 -0
  152. package/src/utils/safe-json.ts +112 -0
  153. package/src/utils/stdio-redirect.ts +18 -0
  154. package/src/utils/validation.ts +212 -0
  155. package/tsconfig.json +33 -0
@@ -0,0 +1,185 @@
1
+ import { UnrealBridge } from '../unreal-bridge.js';
2
+ export declare class DebugVisualizationTools {
3
+ private bridge;
4
+ constructor(bridge: UnrealBridge);
5
+ private _executeCommand;
6
+ private pyDraw;
7
+ drawDebugLine(params: {
8
+ start: [number, number, number];
9
+ end: [number, number, number];
10
+ color?: [number, number, number, number];
11
+ duration?: number;
12
+ thickness?: number;
13
+ }): Promise<{
14
+ success: boolean;
15
+ error?: undefined;
16
+ } | {
17
+ success: boolean;
18
+ error: string;
19
+ }>;
20
+ drawDebugBox(params: {
21
+ center: [number, number, number];
22
+ extent: [number, number, number];
23
+ color?: [number, number, number, number];
24
+ rotation?: [number, number, number];
25
+ duration?: number;
26
+ thickness?: number;
27
+ }): Promise<{
28
+ success: boolean;
29
+ error?: undefined;
30
+ } | {
31
+ success: boolean;
32
+ error: string;
33
+ }>;
34
+ drawDebugSphere(params: {
35
+ center: [number, number, number];
36
+ radius: number;
37
+ segments?: number;
38
+ color?: [number, number, number, number];
39
+ duration?: number;
40
+ thickness?: number;
41
+ }): Promise<{
42
+ success: boolean;
43
+ error?: undefined;
44
+ } | {
45
+ success: boolean;
46
+ error: string;
47
+ }>;
48
+ drawDebugCapsule(params: {
49
+ center: [number, number, number];
50
+ halfHeight: number;
51
+ radius: number;
52
+ rotation?: [number, number, number];
53
+ color?: [number, number, number, number];
54
+ duration?: number;
55
+ }): Promise<{
56
+ success: boolean;
57
+ error?: undefined;
58
+ } | {
59
+ success: boolean;
60
+ error: string;
61
+ }>;
62
+ drawDebugCone(params: {
63
+ origin: [number, number, number];
64
+ direction: [number, number, number];
65
+ length: number;
66
+ angleWidth: number;
67
+ angleHeight: number;
68
+ numSides?: number;
69
+ color?: [number, number, number, number];
70
+ duration?: number;
71
+ }): Promise<{
72
+ success: boolean;
73
+ error?: undefined;
74
+ } | {
75
+ success: boolean;
76
+ error: string;
77
+ }>;
78
+ drawDebugString(params: {
79
+ location: [number, number, number];
80
+ text: string;
81
+ color?: [number, number, number, number];
82
+ duration?: number;
83
+ fontSize?: number;
84
+ }): Promise<{
85
+ success: boolean;
86
+ error?: undefined;
87
+ } | {
88
+ success: boolean;
89
+ error: string;
90
+ }>;
91
+ drawDebugArrow(params: {
92
+ start: [number, number, number];
93
+ end: [number, number, number];
94
+ arrowSize?: number;
95
+ color?: [number, number, number, number];
96
+ duration?: number;
97
+ thickness?: number;
98
+ }): Promise<{
99
+ success: boolean;
100
+ error?: undefined;
101
+ } | {
102
+ success: boolean;
103
+ error: string;
104
+ }>;
105
+ drawDebugPoint(params: {
106
+ location: [number, number, number];
107
+ size?: number;
108
+ color?: [number, number, number, number];
109
+ duration?: number;
110
+ }): Promise<{
111
+ success: boolean;
112
+ error?: undefined;
113
+ } | {
114
+ success: boolean;
115
+ error: string;
116
+ }>;
117
+ drawDebugCoordinateSystem(params: {
118
+ location: [number, number, number];
119
+ rotation?: [number, number, number];
120
+ scale?: number;
121
+ duration?: number;
122
+ thickness?: number;
123
+ }): Promise<any>;
124
+ drawDebugFrustum(params: {
125
+ origin: [number, number, number];
126
+ rotation: [number, number, number];
127
+ fov: number;
128
+ aspectRatio?: number;
129
+ nearPlane?: number;
130
+ farPlane?: number;
131
+ color?: [number, number, number, number];
132
+ duration?: number;
133
+ }): Promise<{
134
+ success: boolean;
135
+ error?: undefined;
136
+ } | {
137
+ success: boolean;
138
+ error: string;
139
+ }>;
140
+ clearDebugDrawings(): Promise<any>;
141
+ showCollision(params: {
142
+ enabled: boolean;
143
+ type?: 'Simple' | 'Complex' | 'Both';
144
+ }): Promise<{
145
+ success: boolean;
146
+ message: string;
147
+ }>;
148
+ showBounds(params: {
149
+ enabled: boolean;
150
+ }): Promise<any>;
151
+ setViewMode(params: {
152
+ mode: 'Lit' | 'Unlit' | 'Wireframe' | 'DetailLighting' | 'LightingOnly' | 'LightComplexity' | 'ShaderComplexity' | 'LightmapDensity' | 'StationaryLightOverlap' | 'ReflectionOverride' | 'CollisionPawn' | 'CollisionVisibility';
153
+ }): Promise<any>;
154
+ showDebugInfo(params: {
155
+ category: 'AI' | 'Animation' | 'Audio' | 'Collision' | 'Camera' | 'Game' | 'Hitboxes' | 'Input' | 'Net' | 'Physics' | 'Slate' | 'Streaming' | 'Particles' | 'Navigation';
156
+ enabled: boolean;
157
+ }): Promise<any>;
158
+ showActorNames(params: {
159
+ enabled: boolean;
160
+ }): Promise<any>;
161
+ drawDebugPath(params: {
162
+ points: Array<[number, number, number]>;
163
+ color?: [number, number, number, number];
164
+ duration?: number;
165
+ thickness?: number;
166
+ }): Promise<{
167
+ success: boolean;
168
+ message: string;
169
+ }>;
170
+ showNavigationMesh(params: {
171
+ enabled: boolean;
172
+ }): Promise<any>;
173
+ enableOnScreenMessages(params: {
174
+ enabled: boolean;
175
+ key?: number;
176
+ message?: string;
177
+ duration?: number;
178
+ color?: [number, number, number, number];
179
+ }): Promise<any>;
180
+ showSkeletalMeshBones(params: {
181
+ actorName: string;
182
+ enabled: boolean;
183
+ }): Promise<any>;
184
+ }
185
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1,265 @@
1
+ export class DebugVisualizationTools {
2
+ bridge;
3
+ constructor(bridge) {
4
+ this.bridge = bridge;
5
+ }
6
+ // Execute console command (kept for legacy operations)
7
+ async _executeCommand(command) {
8
+ return this.bridge.httpCall('/remote/object/call', 'PUT', {
9
+ objectPath: '/Script/Engine.Default__KismetSystemLibrary',
10
+ functionName: 'ExecuteConsoleCommand',
11
+ parameters: {
12
+ WorldContextObject: null,
13
+ Command: command,
14
+ SpecificPlayer: null
15
+ },
16
+ generateTransaction: false
17
+ });
18
+ }
19
+ // Helper to draw via Python SystemLibrary with the editor world
20
+ async pyDraw(scriptBody) {
21
+ const script = `
22
+ import unreal
23
+ # Use modern UnrealEditorSubsystem instead of deprecated EditorLevelLibrary
24
+ ues = unreal.get_editor_subsystem(unreal.UnrealEditorSubsystem)
25
+ if ues:
26
+ world = ues.get_editor_world()
27
+ else:
28
+ # Fallback to deprecated API if subsystem not available
29
+ world = unreal.EditorLevelLibrary.get_editor_world()
30
+ ${scriptBody}
31
+ `.trim()
32
+ .replace(/\r?\n/g, '\n');
33
+ try {
34
+ await this.bridge.executePython(script);
35
+ return { success: true };
36
+ }
37
+ catch (e) {
38
+ return { success: false, error: String(e) };
39
+ }
40
+ }
41
+ // Draw debug line using Python SystemLibrary
42
+ async drawDebugLine(params) {
43
+ const color = params.color || [255, 0, 0, 255];
44
+ const duration = params.duration ?? 5.0;
45
+ const thickness = params.thickness ?? 1.0;
46
+ const [sr, sg, sb, sa] = color;
47
+ const [sx, sy, sz] = params.start;
48
+ const [ex, ey, ez] = params.end;
49
+ const script = `
50
+ start = unreal.Vector(${sx}, ${sy}, ${sz})
51
+ end = unreal.Vector(${ex}, ${ey}, ${ez})
52
+ color = unreal.LinearColor(${sr}/255.0, ${sg}/255.0, ${sb}/255.0, ${sa}/255.0)
53
+ unreal.SystemLibrary.draw_debug_line(world, start, end, color, ${duration}, ${thickness})
54
+ `;
55
+ return this.pyDraw(script);
56
+ }
57
+ // Draw debug box using Python SystemLibrary
58
+ async drawDebugBox(params) {
59
+ const color = params.color || [0, 255, 0, 255];
60
+ const rotation = params.rotation || [0, 0, 0];
61
+ const duration = params.duration ?? 5.0;
62
+ const thickness = params.thickness ?? 1.0;
63
+ const [cr, cg, cb, ca] = color;
64
+ const [cx, cy, cz] = params.center;
65
+ const [ex, ey, ez] = params.extent;
66
+ const [rp, ry, rr] = rotation;
67
+ const script = `
68
+ center = unreal.Vector(${cx}, ${cy}, ${cz})
69
+ extent = unreal.Vector(${ex}, ${ey}, ${ez})
70
+ rot = unreal.Rotator(${rp}, ${ry}, ${rr})
71
+ color = unreal.LinearColor(${cr}/255.0, ${cg}/255.0, ${cb}/255.0, ${ca}/255.0)
72
+ unreal.SystemLibrary.draw_debug_box(world, center, extent, color, rot, ${duration}, ${thickness})
73
+ `;
74
+ return this.pyDraw(script);
75
+ }
76
+ // Draw debug sphere using Python SystemLibrary
77
+ async drawDebugSphere(params) {
78
+ const segments = params.segments ?? 12;
79
+ const color = params.color || [0, 0, 255, 255];
80
+ const duration = params.duration ?? 5.0;
81
+ const thickness = params.thickness ?? 1.0;
82
+ const [cr, cg, cb, ca] = color;
83
+ const [cx, cy, cz] = params.center;
84
+ const script = `
85
+ center = unreal.Vector(${cx}, ${cy}, ${cz})
86
+ color = unreal.LinearColor(${cr}/255.0, ${cg}/255.0, ${cb}/255.0, ${ca}/255.0)
87
+ unreal.SystemLibrary.draw_debug_sphere(world, center, ${params.radius}, ${segments}, color, ${duration}, ${thickness})
88
+ `;
89
+ return this.pyDraw(script);
90
+ }
91
+ // The rest keep console-command fallbacks or editor helpers as before
92
+ async drawDebugCapsule(params) {
93
+ const rotation = params.rotation || [0, 0, 0];
94
+ const color = params.color || [255, 255, 0, 255];
95
+ const duration = params.duration || 5.0;
96
+ const [cx, cy, cz] = params.center;
97
+ const [rp, ry, rr] = rotation;
98
+ const [cr, cg, cb, ca] = color;
99
+ const script = `\ncenter = unreal.Vector(${cx}, ${cy}, ${cz})\nrot = unreal.Rotator(${rp}, ${ry}, ${rr})\ncolor = unreal.LinearColor(${cr}/255.0, ${cg}/255.0, ${cb}/255.0, ${ca}/255.0)\nunreal.SystemLibrary.draw_debug_capsule(world, center, ${params.halfHeight}, ${params.radius}, rot, color, ${duration}, 1.0)\n`;
100
+ return this.pyDraw(script);
101
+ }
102
+ async drawDebugCone(params) {
103
+ const color = params.color || [255, 0, 255, 255];
104
+ const duration = params.duration || 5.0;
105
+ const [ox, oy, oz] = params.origin;
106
+ const [dx, dy, dz] = params.direction;
107
+ const [cr, cg, cb, ca] = color;
108
+ const script = `\norigin = unreal.Vector(${ox}, ${oy}, ${oz})\ndir = unreal.Vector(${dx}, ${dy}, ${dz})\ncolor = unreal.LinearColor(${cr}/255.0, ${cg}/255.0, ${cb}/255.0, ${ca}/255.0)\nunreal.SystemLibrary.draw_debug_cone(world, origin, dir, ${params.length}, ${params.angleWidth}, ${params.angleHeight}, ${params.numSides || 12}, color, ${duration}, 1.0)\n`;
109
+ return this.pyDraw(script);
110
+ }
111
+ async drawDebugString(params) {
112
+ const color = params.color || [255, 255, 255, 255];
113
+ const duration = params.duration || 5.0;
114
+ const [x, y, z] = params.location;
115
+ const [r, g, b, a] = color;
116
+ const script = `\nloc = unreal.Vector(${x}, ${y}, ${z})\ncolor = unreal.LinearColor(${r}/255.0, ${g}/255.0, ${b}/255.0, ${a}/255.0)\nunreal.SystemLibrary.draw_debug_string(world, loc, "${params.text.replace(/"/g, '\\"')}", None, color, ${duration})\n`;
117
+ return this.pyDraw(script);
118
+ }
119
+ async drawDebugArrow(params) {
120
+ const color = params.color || [0, 255, 255, 255];
121
+ const duration = params.duration || 5.0;
122
+ const thickness = params.thickness || 2.0;
123
+ const [sx, sy, sz] = params.start;
124
+ const [ex, ey, ez] = params.end;
125
+ const [r, g, b, a] = color;
126
+ const script = `\nstart = unreal.Vector(${sx}, ${sy}, ${sz})\nend = unreal.Vector(${ex}, ${ey}, ${ez})\ncolor = unreal.LinearColor(${r}/255.0, ${g}/255.0, ${b}/255.0, ${a}/255.0)\nunreal.SystemLibrary.draw_debug_arrow(world, start, end, ${params.arrowSize || 10.0}, color, ${duration}, ${thickness})\n`;
127
+ return this.pyDraw(script);
128
+ }
129
+ async drawDebugPoint(params) {
130
+ const size = params.size || 10.0;
131
+ const color = params.color || [255, 255, 255, 255];
132
+ const duration = params.duration || 5.0;
133
+ const [x, y, z] = params.location;
134
+ const [r, g, b, a] = color;
135
+ const script = `\nloc = unreal.Vector(${x}, ${y}, ${z})\ncolor = unreal.LinearColor(${r}/255.0, ${g}/255.0, ${b}/255.0, ${a}/255.0)\nunreal.SystemLibrary.draw_debug_point(world, loc, ${size}, color, ${duration})\n`;
136
+ return this.pyDraw(script);
137
+ }
138
+ async drawDebugCoordinateSystem(params) {
139
+ const rotation = params.rotation || [0, 0, 0];
140
+ const scale = params.scale || 100.0;
141
+ const duration = params.duration || 5.0;
142
+ const thickness = params.thickness || 2.0;
143
+ const command = `DrawDebugCoordinateSystem ${params.location.join(' ')} ${rotation.join(' ')} ${scale} ${duration} ${thickness}`;
144
+ return this.bridge.executeConsoleCommand(command);
145
+ }
146
+ async drawDebugFrustum(params) {
147
+ const aspectRatio = params.aspectRatio || 1.77;
148
+ const nearPlane = params.nearPlane || 10.0;
149
+ const farPlane = params.farPlane || 1000.0;
150
+ const color = params.color || [128, 128, 255, 255];
151
+ const duration = params.duration || 5.0;
152
+ const [ox, oy, oz] = params.origin;
153
+ const [rp, ry, rr] = params.rotation;
154
+ const [r, g, b, a] = color;
155
+ const script = `\norigin = unreal.Vector(${ox}, ${oy}, ${oz})\nrot = unreal.Rotator(${rp}, ${ry}, ${rr})\ncolor = unreal.LinearColor(${r}/255.0, ${g}/255.0, ${b}/255.0, ${a}/255.0)\nunreal.SystemLibrary.draw_debug_frustum(world, origin, rot, ${params.fov}, ${aspectRatio}, ${nearPlane}, ${farPlane}, color, ${duration})\n`;
156
+ return this.pyDraw(script);
157
+ }
158
+ async clearDebugDrawings() {
159
+ return this.bridge.executeConsoleCommand('FlushPersistentDebugLines');
160
+ }
161
+ async showCollision(params) {
162
+ const commands = [];
163
+ if (params.enabled) {
164
+ const typeCmd = params.type === 'Simple' ? '1' : params.type === 'Complex' ? '2' : '3';
165
+ commands.push(`show Collision ${typeCmd}`);
166
+ }
167
+ else {
168
+ commands.push('show Collision 0');
169
+ }
170
+ for (const cmd of commands) {
171
+ await this.bridge.executeConsoleCommand(cmd);
172
+ }
173
+ return { success: true, message: `Collision visualization ${params.enabled ? 'enabled' : 'disabled'}` };
174
+ }
175
+ async showBounds(params) {
176
+ const command = params.enabled ? 'show Bounds' : 'show Bounds 0';
177
+ return this.bridge.executeConsoleCommand(command);
178
+ }
179
+ async setViewMode(params) {
180
+ // Map non-viewmode requests to appropriate show flags for safety
181
+ if (params.mode === 'CollisionPawn' || params.mode === 'CollisionVisibility') {
182
+ // Use collision visualization instead of viewmode (UE doesn't have these as view modes)
183
+ await this.showCollision({ enabled: true, type: 'Both' });
184
+ return { success: true, message: 'Collision visualization enabled (use show flags, not viewmode)' };
185
+ }
186
+ const VALID_VIEWMODES = new Set([
187
+ 'Lit', 'Unlit', 'Wireframe', 'DetailLighting', 'LightingOnly', 'LightComplexity', 'ShaderComplexity', 'LightmapDensity', 'StationaryLightOverlap', 'ReflectionOverride'
188
+ ]);
189
+ if (!VALID_VIEWMODES.has(params.mode)) {
190
+ // Fallback to Lit if unknown
191
+ await this.bridge.executeConsoleCommand('viewmode Lit');
192
+ return { success: false, warning: `Unknown or unsupported viewmode '${params.mode}'. Reverted to Lit.` };
193
+ }
194
+ const UNSAFE_VIEWMODES = [
195
+ 'LightComplexity', 'ShaderComplexity', 'LightmapDensity', 'StationaryLightOverlap'
196
+ ];
197
+ if (UNSAFE_VIEWMODES.includes(params.mode)) {
198
+ console.error(`⚠️ Viewmode '${params.mode}' may be unstable in some UE configurations.`);
199
+ try {
200
+ await this.bridge.executeConsoleCommand('stop');
201
+ }
202
+ catch { }
203
+ await new Promise(resolve => setTimeout(resolve, 100));
204
+ }
205
+ try {
206
+ const command = `viewmode ${params.mode}`;
207
+ const result = await this.bridge.executeConsoleCommand(command);
208
+ if (UNSAFE_VIEWMODES.includes(params.mode)) {
209
+ setTimeout(async () => {
210
+ try {
211
+ await this.bridge.executeConsoleCommand('stat unit');
212
+ }
213
+ catch {
214
+ await this.bridge.executeConsoleCommand('viewmode Lit');
215
+ }
216
+ }, 2000);
217
+ }
218
+ return { ...result, warning: UNSAFE_VIEWMODES.includes(params.mode) ? `Viewmode '${params.mode}' applied. This mode may be unstable.` : undefined };
219
+ }
220
+ catch (error) {
221
+ await this.bridge.executeConsoleCommand('viewmode Lit');
222
+ throw new Error(`Failed to set viewmode '${params.mode}': ${error}. Reverted to Lit mode.`);
223
+ }
224
+ }
225
+ async showDebugInfo(params) {
226
+ const command = `showdebug ${params.enabled ? params.category : 'None'}`;
227
+ return this.bridge.executeConsoleCommand(command);
228
+ }
229
+ async showActorNames(params) {
230
+ const command = params.enabled ? 'show ActorNames' : 'show ActorNames 0';
231
+ return this.bridge.executeConsoleCommand(command);
232
+ }
233
+ async drawDebugPath(params) {
234
+ const color = params.color || [255, 128, 0, 255];
235
+ const duration = params.duration || 5.0;
236
+ const thickness = params.thickness || 2.0;
237
+ for (let i = 0; i < params.points.length - 1; i++) {
238
+ const start = params.points[i];
239
+ const end = params.points[i + 1];
240
+ await this.drawDebugLine({ start, end, color, duration, thickness });
241
+ }
242
+ return { success: true, message: `Debug path drawn with ${params.points.length} points` };
243
+ }
244
+ async showNavigationMesh(params) {
245
+ const command = params.enabled ? 'show Navigation' : 'show Navigation 0';
246
+ return this.bridge.executeConsoleCommand(command);
247
+ }
248
+ async enableOnScreenMessages(params) {
249
+ if (params.enabled && params.message) {
250
+ const key = params.key || -1;
251
+ const duration = params.duration || 5.0;
252
+ const color = params.color || [255, 255, 255, 255];
253
+ const command = `ke * DisplayDebugMessage ${key} "${params.message}" ${duration} ${color.join(' ')}`;
254
+ return this.bridge.executeConsoleCommand(command);
255
+ }
256
+ else {
257
+ return this.bridge.executeConsoleCommand('DisableAllScreenMessages');
258
+ }
259
+ }
260
+ async showSkeletalMeshBones(params) {
261
+ const command = params.enabled ? `ShowDebugSkelMesh ${params.actorName}` : `HideDebugSkelMesh ${params.actorName}`;
262
+ return this.bridge.executeConsoleCommand(command);
263
+ }
264
+ }
265
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1,88 @@
1
+ import { UnrealBridge } from '../unreal-bridge.js';
2
+ export declare class EditorTools {
3
+ private bridge;
4
+ constructor(bridge: UnrealBridge);
5
+ isInPIE(): Promise<boolean>;
6
+ ensureNotInPIE(): Promise<void>;
7
+ playInEditor(): Promise<{
8
+ success: boolean;
9
+ message: string;
10
+ error?: undefined;
11
+ } | {
12
+ success: boolean;
13
+ error: string;
14
+ message?: undefined;
15
+ }>;
16
+ stopPlayInEditor(): Promise<{
17
+ success: boolean;
18
+ message: string;
19
+ error?: undefined;
20
+ } | {
21
+ success: boolean;
22
+ error: string;
23
+ message?: undefined;
24
+ }>;
25
+ pausePlayInEditor(): Promise<{
26
+ success: boolean;
27
+ message: string;
28
+ error?: undefined;
29
+ } | {
30
+ success: boolean;
31
+ error: string;
32
+ message?: undefined;
33
+ }>;
34
+ pauseInEditor(): Promise<{
35
+ success: boolean;
36
+ message: string;
37
+ error?: undefined;
38
+ } | {
39
+ success: boolean;
40
+ error: string;
41
+ message?: undefined;
42
+ }>;
43
+ buildLighting(): Promise<{
44
+ success: boolean;
45
+ message: any;
46
+ error?: undefined;
47
+ } | {
48
+ success: boolean;
49
+ error: any;
50
+ message?: undefined;
51
+ }>;
52
+ setViewportCamera(location?: {
53
+ x: number;
54
+ y: number;
55
+ z: number;
56
+ } | [number, number, number] | null | undefined, rotation?: {
57
+ pitch: number;
58
+ yaw: number;
59
+ roll: number;
60
+ } | [number, number, number] | null | undefined): Promise<{
61
+ success: boolean;
62
+ message: string;
63
+ error?: undefined;
64
+ } | {
65
+ success: boolean;
66
+ error: string;
67
+ message?: undefined;
68
+ }>;
69
+ setCameraSpeed(speed: number): Promise<{
70
+ success: boolean;
71
+ message: string;
72
+ error?: undefined;
73
+ } | {
74
+ success: boolean;
75
+ error: string;
76
+ message?: undefined;
77
+ }>;
78
+ setFOV(fov: number): Promise<{
79
+ success: boolean;
80
+ message: string;
81
+ error?: undefined;
82
+ } | {
83
+ success: boolean;
84
+ error: string;
85
+ message?: undefined;
86
+ }>;
87
+ }
88
+ //# sourceMappingURL=editor.d.ts.map