├── .gitignore
├── Godot.sln
├── Godot
├── Godot.csproj
├── GodotDebuggerEngine.cs
├── GodotDebuggerSession.cs
├── GodotDebuggerStartInfo.cs
├── GodotExecutionCommand.cs
├── GodotProjectExtension.cs
├── GodotSoftDebuggerArgs.cs
├── Options.cs
├── Options
│ └── GlobalOptionsPanel.cs
└── Properties
│ ├── AddinInfo.cs
│ └── Godot.addin.xml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # globs
2 | Makefile.in
3 | *.userprefs
4 | *.usertasks
5 | config.make
6 | config.status
7 | aclocal.m4
8 | install-sh
9 | autom4te.cache/
10 | *.tar.gz
11 | tarballs/
12 | test-results/
13 |
14 | # Mac bundle stuff
15 | *.dmg
16 | *.app
17 |
18 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
19 | # General
20 | .DS_Store
21 | .AppleDouble
22 | .LSOverride
23 |
24 | # Icon must end with two \r
25 | Icon
26 |
27 |
28 | # Thumbnails
29 | ._*
30 |
31 | # Files that might appear in the root of a volume
32 | .DocumentRevisions-V100
33 | .fseventsd
34 | .Spotlight-V100
35 | .TemporaryItems
36 | .Trashes
37 | .VolumeIcon.icns
38 | .com.apple.timemachine.donotpresent
39 |
40 | # Directories potentially created on remote AFP share
41 | .AppleDB
42 | .AppleDesktop
43 | Network Trash Folder
44 | Temporary Items
45 | .apdisk
46 |
47 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
48 | # Windows thumbnail cache files
49 | Thumbs.db
50 | ehthumbs.db
51 | ehthumbs_vista.db
52 |
53 | # Dump file
54 | *.stackdump
55 |
56 | # Folder config file
57 | [Dd]esktop.ini
58 |
59 | # Recycle Bin used on file shares
60 | $RECYCLE.BIN/
61 |
62 | # Windows Installer files
63 | *.cab
64 | *.msi
65 | *.msix
66 | *.msm
67 | *.msp
68 |
69 | # Windows shortcuts
70 | *.lnk
71 |
72 | # content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
73 | ## Ignore Visual Studio temporary files, build results, and
74 | ## files generated by popular Visual Studio add-ons.
75 | ##
76 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
77 |
78 | # User-specific files
79 | *.suo
80 | *.user
81 | *.userosscache
82 | *.sln.docstates
83 |
84 | # User-specific files (MonoDevelop/Xamarin Studio)
85 | *.userprefs
86 |
87 | # Build results
88 | [Dd]ebug/
89 | [Dd]ebugPublic/
90 | [Rr]elease/
91 | [Rr]eleases/
92 | x64/
93 | x86/
94 | bld/
95 | [Bb]in/
96 | [Oo]bj/
97 | [Ll]og/
98 |
99 | # Visual Studio 2015/2017 cache/options directory
100 | .vs/
101 | # Uncomment if you have tasks that create the project's static files in wwwroot
102 | #wwwroot/
103 |
104 | # Visual Studio 2017 auto generated files
105 | Generated\ Files/
106 |
107 | # MSTest test Results
108 | [Tt]est[Rr]esult*/
109 | [Bb]uild[Ll]og.*
110 |
111 | # NUNIT
112 | *.VisualState.xml
113 | TestResult.xml
114 |
115 | # Build Results of an ATL Project
116 | [Dd]ebugPS/
117 | [Rr]eleasePS/
118 | dlldata.c
119 |
120 | # Benchmark Results
121 | BenchmarkDotNet.Artifacts/
122 |
123 | # .NET Core
124 | project.lock.json
125 | project.fragment.lock.json
126 | artifacts/
127 |
128 | # StyleCop
129 | StyleCopReport.xml
130 |
131 | # Files built by Visual Studio
132 | *_i.c
133 | *_p.c
134 | *_h.h
135 | *.ilk
136 | *.meta
137 | *.obj
138 | *.iobj
139 | *.pch
140 | *.pdb
141 | *.ipdb
142 | *.pgc
143 | *.pgd
144 | *.rsp
145 | *.sbr
146 | *.tlb
147 | *.tli
148 | *.tlh
149 | *.tmp
150 | *.tmp_proj
151 | *_wpftmp.csproj
152 | *.log
153 | *.vspscc
154 | *.vssscc
155 | .builds
156 | *.pidb
157 | *.svclog
158 | *.scc
159 |
160 | # Chutzpah Test files
161 | _Chutzpah*
162 |
163 | # Visual C++ cache files
164 | ipch/
165 | *.aps
166 | *.ncb
167 | *.opendb
168 | *.opensdf
169 | *.sdf
170 | *.cachefile
171 | *.VC.db
172 | *.VC.VC.opendb
173 |
174 | # Visual Studio profiler
175 | *.psess
176 | *.vsp
177 | *.vspx
178 | *.sap
179 |
180 | # Visual Studio Trace Files
181 | *.e2e
182 |
183 | # TFS 2012 Local Workspace
184 | $tf/
185 |
186 | # Guidance Automation Toolkit
187 | *.gpState
188 |
189 | # ReSharper is a .NET coding add-in
190 | _ReSharper*/
191 | *.[Rr]e[Ss]harper
192 | *.DotSettings.user
193 |
194 | # JustCode is a .NET coding add-in
195 | .JustCode
196 |
197 | # TeamCity is a build add-in
198 | _TeamCity*
199 |
200 | # DotCover is a Code Coverage Tool
201 | *.dotCover
202 |
203 | # AxoCover is a Code Coverage Tool
204 | .axoCover/*
205 | !.axoCover/settings.json
206 |
207 | # Visual Studio code coverage results
208 | *.coverage
209 | *.coveragexml
210 |
211 | # NCrunch
212 | _NCrunch_*
213 | .*crunch*.local.xml
214 | nCrunchTemp_*
215 |
216 | # MightyMoose
217 | *.mm.*
218 | AutoTest.Net/
219 |
220 | # Web workbench (sass)
221 | .sass-cache/
222 |
223 | # Installshield output folder
224 | [Ee]xpress/
225 |
226 | # DocProject is a documentation generator add-in
227 | DocProject/buildhelp/
228 | DocProject/Help/*.HxT
229 | DocProject/Help/*.HxC
230 | DocProject/Help/*.hhc
231 | DocProject/Help/*.hhk
232 | DocProject/Help/*.hhp
233 | DocProject/Help/Html2
234 | DocProject/Help/html
235 |
236 | # Click-Once directory
237 | publish/
238 |
239 | # Publish Web Output
240 | *.[Pp]ublish.xml
241 | *.azurePubxml
242 | # Note: Comment the next line if you want to checkin your web deploy settings,
243 | # but database connection strings (with potential passwords) will be unencrypted
244 | *.pubxml
245 | *.publishproj
246 |
247 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
248 | # checkin your Azure Web App publish settings, but sensitive information contained
249 | # in these scripts will be unencrypted
250 | PublishScripts/
251 |
252 | # NuGet Packages
253 | *.nupkg
254 | # The packages folder can be ignored because of Package Restore
255 | **/[Pp]ackages/*
256 | # except build/, which is used as an MSBuild target.
257 | !**/[Pp]ackages/build/
258 | # Uncomment if necessary however generally it will be regenerated when needed
259 | #!**/[Pp]ackages/repositories.config
260 | # NuGet v3's project.json files produces more ignorable files
261 | *.nuget.props
262 | *.nuget.targets
263 |
264 | # Microsoft Azure Build Output
265 | csx/
266 | *.build.csdef
267 |
268 | # Microsoft Azure Emulator
269 | ecf/
270 | rcf/
271 |
272 | # Windows Store app package directories and files
273 | AppPackages/
274 | BundleArtifacts/
275 | Package.StoreAssociation.xml
276 | _pkginfo.txt
277 | *.appx
278 |
279 | # Visual Studio cache files
280 | # files ending in .cache can be ignored
281 | *.[Cc]ache
282 | # but keep track of directories ending in .cache
283 | !*.[Cc]ache/
284 |
285 | # Others
286 | ClientBin/
287 | ~$*
288 | *~
289 | *.dbmdl
290 | *.dbproj.schemaview
291 | *.jfm
292 | *.pfx
293 | *.publishsettings
294 | orleans.codegen.cs
295 |
296 | # Including strong name files can present a security risk
297 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
298 | #*.snk
299 |
300 | # Since there are multiple workflows, uncomment next line to ignore bower_components
301 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
302 | #bower_components/
303 |
304 | # RIA/Silverlight projects
305 | Generated_Code/
306 |
307 | # Backup & report files from converting an old project file
308 | # to a newer Visual Studio version. Backup files are not needed,
309 | # because we have git ;-)
310 | _UpgradeReport_Files/
311 | Backup*/
312 | UpgradeLog*.XML
313 | UpgradeLog*.htm
314 | ServiceFabricBackup/
315 | *.rptproj.bak
316 |
317 | # SQL Server files
318 | *.mdf
319 | *.ldf
320 | *.ndf
321 |
322 | # Business Intelligence projects
323 | *.rdl.data
324 | *.bim.layout
325 | *.bim_*.settings
326 | *.rptproj.rsuser
327 |
328 | # Microsoft Fakes
329 | FakesAssemblies/
330 |
331 | # GhostDoc plugin setting file
332 | *.GhostDoc.xml
333 |
334 | # Node.js Tools for Visual Studio
335 | .ntvs_analysis.dat
336 | node_modules/
337 |
338 | # Visual Studio 6 build log
339 | *.plg
340 |
341 | # Visual Studio 6 workspace options file
342 | *.opt
343 |
344 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
345 | *.vbw
346 |
347 | # Visual Studio LightSwitch build output
348 | **/*.HTMLClient/GeneratedArtifacts
349 | **/*.DesktopClient/GeneratedArtifacts
350 | **/*.DesktopClient/ModelManifest.xml
351 | **/*.Server/GeneratedArtifacts
352 | **/*.Server/ModelManifest.xml
353 | _Pvt_Extensions
354 |
355 | # Paket dependency manager
356 | .paket/paket.exe
357 | paket-files/
358 |
359 | # FAKE - F# Make
360 | .fake/
361 |
362 | # JetBrains Rider
363 | .idea/
364 | *.sln.iml
365 |
366 | # CodeRush personal settings
367 | .cr/personal
368 |
369 | # Python Tools for Visual Studio (PTVS)
370 | __pycache__/
371 | *.pyc
372 |
373 | # Cake - Uncomment if you are using it
374 | # tools/**
375 | # !tools/packages.config
376 |
377 | # Tabs Studio
378 | *.tss
379 |
380 | # Telerik's JustMock configuration file
381 | *.jmconfig
382 |
383 | # BizTalk build output
384 | *.btp.cs
385 | *.btm.cs
386 | *.odx.cs
387 | *.xsd.cs
388 |
389 | # OpenCover UI analysis results
390 | OpenCover/
391 |
392 | # Azure Stream Analytics local run output
393 | ASALocalRun/
394 |
395 | # MSBuild Binary and Structured Log
396 | *.binlog
397 |
398 | # NVidia Nsight GPU debugger configuration file
399 | *.nvuser
400 |
401 | # MFractors (Xamarin productivity tool) working folder
402 | .mfractor/
403 |
404 | # Local History for Visual Studio
405 | .localhistory/
--------------------------------------------------------------------------------
/Godot.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Godot", "Godot\Godot.csproj", "{AD888250-5348-41CD-BCDC-3657D377398E}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {AD888250-5348-41CD-BCDC-3657D377398E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {AD888250-5348-41CD-BCDC-3657D377398E}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {AD888250-5348-41CD-BCDC-3657D377398E}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {AD888250-5348-41CD-BCDC-3657D377398E}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | EndGlobal
18 |
--------------------------------------------------------------------------------
/Godot/Godot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net471
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Godot/GodotDebuggerEngine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mono.Debugging.Client;
3 | using Mono.Debugging.Soft;
4 | using MonoDevelop.Core.Execution;
5 | using MonoDevelop.Debugger;
6 | using System.Net;
7 | using MonoDevelop.Ide;
8 | using MonoDevelop.Core;
9 |
10 | namespace Godot
11 | {
12 | public class GodotDebuggerEngine : DebuggerEngineBackend
13 | {
14 | public GodotDebuggerEngine()
15 | {
16 | IdeApp.ProjectOperations.EndBuild += ProjectOperations_EndBuild;
17 | }
18 |
19 | void ProjectOperations_EndBuild(object sender, MonoDevelop.Projects.BuildEventArgs args)
20 | {
21 | foreach (var session in DebuggingService.GetSessions())
22 | {
23 | if(session is GodotDebuggerSession godotSession)
24 | {
25 | godotSession.SendReloadScipts();
26 | }
27 | }
28 | }
29 |
30 | public override bool CanDebugCommand(ExecutionCommand cmd)
31 | {
32 | return cmd is GodotExecutionCommand;
33 | }
34 |
35 | public override DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand cmd)
36 | {
37 | var godotCmd = (GodotExecutionCommand)cmd;
38 | var godotProjectPath = godotCmd.GodotProjectPath;
39 | //TODO: Read "mono/debugger_agent/port" under [mono] from project.godot file
40 | SoftDebuggerRemoteArgs args;
41 | if (godotCmd.ExecutionType == ExecutionType.Launch)
42 | args = new SoftDebuggerListenArgs("Godot", IPAddress.Loopback, 0);
43 | else
44 | args = new SoftDebuggerConnectArgs("Godot", IPAddress.Loopback, 23685);
45 | return new GodotDebuggerStartInfo(godotCmd, args)
46 | {
47 | WorkingDirectory = godotCmd.WorkingDirectory
48 | };
49 | }
50 |
51 | public override DebuggerSession CreateSession()
52 | {
53 | return new GodotDebuggerSession();
54 | }
55 |
56 | public override bool IsDefaultDebugger(ExecutionCommand cmd)
57 | {
58 | return true;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Godot/GodotDebuggerSession.cs:
--------------------------------------------------------------------------------
1 | using Mono.Debugging.Client;
2 | using Mono.Debugging.Soft;
3 | using System.Diagnostics;
4 | using MonoDevelop.Core;
5 | using MonoDevelop.Core.Execution;
6 | using System.Threading;
7 | using System;
8 | using System.IO;
9 | using System.Net.Sockets;
10 | using System.Net;
11 | using System.Collections.Generic;
12 | using System.Threading.Tasks;
13 |
14 | namespace Godot
15 | {
16 | class GodotDebuggerSession : SoftDebuggerSession
17 | {
18 | bool attached;
19 | public void SendReloadScipts()
20 | {
21 | //32 is length, rest after [3] is GD.Var2Bytes(new Array().Add("reload_scripts"))
22 | var arr = new byte[] { 32, 0, 0, 0, 19, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 14, 0, 0, 0, 114, 101, 108, 111, 97, 100, 95, 115, 99, 114, 105, 112, 116, 115, 0, 0 };
23 | stream.Write(arr, 0, arr.Length);
24 | stream.Flush();
25 | }
26 |
27 | protected override void OnRun(DebuggerStartInfo startInfo)
28 | {
29 | var godotStartInfo = (GodotDebuggerStartInfo)startInfo;
30 | if (godotStartInfo.GodotCmd.ExecutionType == ExecutionType.Launch)
31 | {
32 | attached = false;
33 | StartListening(godotStartInfo, out var assignedDebugPort);
34 | var tcpListener = new TcpListener(IPAddress.Any, 0);
35 | tcpListener.Start();
36 | tcpListener.AcceptTcpClientAsync().ContinueWith(ProcessNewTcpClient);
37 | var psi = new ProcessStartInfo(Godot.Options.GodotExecutable)
38 | {
39 | Arguments = $"--path {startInfo.WorkingDirectory} --remote-debug 127.0.0.1:{((IPEndPoint)tcpListener.LocalEndpoint).Port}",
40 | WorkingDirectory = startInfo.WorkingDirectory,
41 | RedirectStandardOutput = true,
42 | RedirectStandardError = true,
43 | UseShellExecute = false,
44 | CreateNoWindow = true
45 | };
46 | psi.EnvironmentVariables["GODOT_MONO_DEBUGGER_AGENT"] = $"--debugger-agent=transport=dt_socket,address=127.0.0.1:{assignedDebugPort},server=n";
47 | var p = Process.Start(psi);
48 | var thread = new Thread(OutputReader);
49 | thread.Name = "Godot output reader";
50 | thread.IsBackground = true;
51 | thread.Start((false, p.StandardOutput));
52 | thread = new Thread(OutputReader);
53 | thread.Name = "Godot error reader";
54 | thread.IsBackground = true;
55 | thread.Start((true, p.StandardError));
56 | OnDebuggerOutput(false, $"Godot PID:{p.Id}{Environment.NewLine}");
57 | }
58 | else if (godotStartInfo.GodotCmd.ExecutionType == ExecutionType.Attach)
59 | {
60 | attached = true;
61 | StartConnecting(godotStartInfo);
62 | }
63 | else
64 | {
65 | throw new NotImplementedException(godotStartInfo.GodotCmd.ExecutionType.ToString());
66 | }
67 | }
68 |
69 | NetworkStream stream;
70 | private async Task ProcessNewTcpClient(Task task)
71 | {
72 | var tcp = task.Result;
73 | stream = tcp.GetStream();
74 | byte[] buffer = new byte[1000];
75 | while (tcp.Connected)
76 | {
77 | // There is no library to decode this messages, so
78 | // we just pump buffer so it doesn't go out of memory
79 | var readBytes = await stream.ReadAsync(buffer, 0, buffer.Length);
80 | }
81 | }
82 |
83 | protected override bool HandleException(Exception ex)
84 | {
85 | // When we attach to running Mono process it sends us AssemblyLoad, ThreadStart and other
86 | // delayed events, problem is, that we send VM_START command back since we have to do that on
87 | // every event, but in this case when Mono is sending delayed events when we attach
88 | // runtime is not really suspended, hence it's throwing this exceptions, just ignore...
89 | if (attached && ex is Mono.Debugger.Soft.VMNotSuspendedException)
90 | return true;
91 | return base.HandleException(ex);
92 | }
93 |
94 | protected override void OnExit()
95 | {
96 | if (attached)
97 | base.OnDetach();
98 | else
99 | base.OnExit();
100 | }
101 |
102 | void OutputReader(object args)
103 | {
104 | var (isErr, stream) = ((bool, StreamReader))args;
105 | string line;
106 | while ((line = stream.ReadLine()) != null)
107 | {
108 | try
109 | {
110 | OnTargetOutput(false, line + Environment.NewLine);
111 | }
112 | catch (Exception ex)
113 | {
114 | Console.WriteLine(ex);
115 | }
116 | }
117 | }
118 | }
119 | }
--------------------------------------------------------------------------------
/Godot/GodotDebuggerStartInfo.cs:
--------------------------------------------------------------------------------
1 | using Mono.Debugging.Client;
2 | using Mono.Debugging.Soft;
3 | using System.Net;
4 |
5 | namespace Godot
6 | {
7 | class GodotDebuggerStartInfo : SoftDebuggerStartInfo
8 | {
9 | public GodotExecutionCommand GodotCmd { get; }
10 |
11 | public GodotDebuggerStartInfo(GodotExecutionCommand godotCmd, SoftDebuggerRemoteArgs softDebuggerConnectArgs) :
12 | base(softDebuggerConnectArgs)
13 | {
14 | GodotCmd = godotCmd;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/Godot/GodotExecutionCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MonoDevelop.Core.Execution;
3 |
4 | namespace Godot
5 | {
6 | class GodotExecutionCommand : ExecutionCommand
7 | {
8 | public GodotExecutionCommand(string godotProjectPath, ExecutionType executionType, string workingDirectory)
9 | {
10 | GodotProjectPath = godotProjectPath;
11 | ExecutionType = executionType;
12 | WorkingDirectory = workingDirectory;
13 | }
14 |
15 | public string GodotProjectPath { get; }
16 | public ExecutionType ExecutionType { get; }
17 | public string WorkingDirectory { get; }
18 | }
19 |
20 | public enum ExecutionType
21 | {
22 | Launch,
23 | Attach
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Godot/GodotProjectExtension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using MonoDevelop.Core.Execution;
5 | using MonoDevelop.Projects;
6 | using MonoDevelop.Core;
7 | using System.Threading.Tasks;
8 |
9 | namespace Godot
10 | {
11 | [ExportProjectModelExtension]
12 | class GodotProjectExtension : DotNetProjectExtension
13 | {
14 | static SolutionItemRunConfiguration[] runConfigurations = new []
15 | {
16 | new ProjectRunConfiguration("Launch"),
17 | new ProjectRunConfiguration("Attach")
18 | };
19 | protected override IEnumerable OnGetRunConfigurations(OperationContext ctx)
20 | {
21 | if (IsGodotProject())
22 | return runConfigurations;
23 | return base.OnGetRunConfigurations(ctx);
24 | }
25 |
26 | protected override ExecutionCommand OnCreateExecutionCommand(ConfigurationSelector configSel, DotNetProjectConfiguration configuration, ProjectRunConfiguration runConfiguration)
27 | {
28 | if (IsGodotProject())
29 | {
30 | var runConfigurationIndex = runConfigurations.IndexOf(runConfiguration);
31 | if (runConfigurationIndex == -1)
32 | LoggingService.LogError($"Unexpected RunConfiguration {runConfiguration.Id} {runConfiguration.GetType().FullName}");
33 | var executionType = runConfigurations[0] == runConfiguration ? ExecutionType.Launch : ExecutionType.Attach;
34 | return new GodotExecutionCommand(
35 | GetGodotProjectPath(),
36 | executionType,
37 | Path.GetDirectoryName(GetGodotProjectPath()));
38 | }
39 | return base.OnCreateExecutionCommand(configSel, configuration, runConfiguration);
40 | }
41 |
42 | private string GetGodotProjectPath()
43 | {
44 | return Path.Combine(Path.GetDirectoryName(Project.FileName), "project.godot");
45 | }
46 |
47 | bool? cachedIsGodotProject;
48 | private bool IsGodotProject()
49 | {
50 | if (!cachedIsGodotProject.HasValue)
51 | cachedIsGodotProject = File.Exists(GetGodotProjectPath());
52 | return cachedIsGodotProject.Value;
53 | }
54 |
55 | protected override ProjectFeatures OnGetSupportedFeatures()
56 | {
57 | var features = base.OnGetSupportedFeatures();
58 | if (IsGodotProject())
59 | features |= ProjectFeatures.Execute;
60 | return features;
61 | }
62 |
63 | protected override bool OnGetCanExecute(ExecutionContext context, ConfigurationSelector configuration, SolutionItemRunConfiguration runConfiguration)
64 | {
65 | if (IsGodotProject())
66 | return true;
67 | return base.OnGetCanExecute(context, configuration, runConfiguration);
68 | }
69 |
70 | protected override async Task OnExecuteCommand(ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration, ExecutionCommand executionCommand)
71 | {
72 | if (executionCommand is GodotExecutionCommand godotCmd)
73 | {
74 | if (godotCmd.ExecutionType == ExecutionType.Launch)
75 | {
76 | if (!File.Exists(Options.GodotExecutable))
77 | {
78 | // Delay for 1 sec so it's not overriden by build message
79 | await Task.Delay(1000);
80 | monitor.ReportError(GettextCatalog.GetString($"Godot executable \"{Options.GodotExecutable.Value}\" not found. Update Godot executable setting in perferences."));
81 | return;
82 | }
83 | }
84 | }
85 | await base.OnExecuteCommand(monitor, context, configuration, executionCommand);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Godot/GodotSoftDebuggerArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using Mono.Debugging.Soft;
4 |
5 | namespace Godot
6 | {
7 | public class GodotSoftDebuggerArgs : SoftDebuggerRemoteArgs
8 | {
9 | public GodotSoftDebuggerArgs(string appName, IPAddress address, int debugPort, int outputPort) : base(appName, address, debugPort, outputPort)
10 | {
11 | }
12 |
13 | public override ISoftDebuggerConnectionProvider ConnectionProvider => null;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Godot/Options.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MonoDevelop.Core;
3 |
4 | namespace Godot
5 | {
6 | static class Options
7 | {
8 | public static readonly ConfigurationProperty GodotExecutable = ConfigurationProperty.Create("Godot.GodotExecutable", "/Applications/Godot_mono.app/Contents/MacOS/Godot");
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Godot/Options/GlobalOptionsPanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MonoDevelop.Ide.Gui.Dialogs;
3 | using MonoDevelop.Components;
4 | using MonoDevelop.Core;
5 |
6 | namespace Godot
7 | {
8 | public class GlobalOptionsPanel : OptionsPanel
9 | {
10 | FileEntry fileEntry = new FileEntry();
11 |
12 | public override Control CreatePanelWidget()
13 | {
14 | var vbox = new Gtk.VBox();
15 | vbox.Spacing = 6;
16 |
17 | var generalSectionLabel = new Gtk.Label("" + GettextCatalog.GetString("General") + "");
18 | generalSectionLabel.UseMarkup = true;
19 | generalSectionLabel.Xalign = 0;
20 | vbox.PackStart(generalSectionLabel, false, false, 0);
21 |
22 | var godotExecutableHBox = new Gtk.HBox();
23 | godotExecutableHBox.BorderWidth = 10;
24 | godotExecutableHBox.Spacing = 6;
25 | var outputDirectoryLabel = new Gtk.Label(GettextCatalog.GetString("Godot executable:"));
26 | outputDirectoryLabel.Xalign = 0;
27 | godotExecutableHBox.PackStart(outputDirectoryLabel, false, false, 0);
28 | fileEntry.Path = Options.GodotExecutable.Value;
29 | godotExecutableHBox.PackStart(fileEntry, true, true, 0);
30 |
31 | vbox.PackStart(godotExecutableHBox, false, false, 0);
32 |
33 | vbox.ShowAll();
34 | return vbox;
35 | }
36 |
37 | public override void ApplyChanges()
38 | {
39 | Options.GodotExecutable.Value = fileEntry.Path;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Godot/Properties/AddinInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Mono.Addins;
3 | using Mono.Addins.Description;
4 |
5 | [assembly: Addin(
6 | "Godot",
7 | Namespace = "Godot",
8 | Version = "1.0"
9 | )]
10 |
11 | [assembly: AddinName("Godot")]
12 | [assembly: AddinCategory("IDE extensions")]
13 | [assembly: AddinDescription("Godot")]
14 | [assembly: AddinAuthor("David Karlaš")]
15 |
--------------------------------------------------------------------------------
/Godot/Properties/Godot.addin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Godot Extension
2 | MonoDevelop/Visual Studio for Mac Godot integration
3 |
4 | At this moment extension only has 3 basic functionalities:
5 | * Launching game: https://youtu.be/vj-75tZjwz4
6 | The way this works it start `/Applications/Godot_mono.app/Contents/MacOS/Godot`(can be modified in preferences) inside same working directory as .csproj file. It also adds `--remote-debug` parameter which allows sending "reload_scripts".
7 | * Attaching to existing game, launched from Godot Editor: https://youtu.be/3IsDl__Cpnk
8 | If game was started inside GodotEditor, it's listening on port `23685` or whatever is written in `project.godot` `[mono] "mono/debugger_agent/port"` so we just connect to that port with debugger. `--remote-debug` is connected to Godot Editor, hence "reload_scripts" is not woring.
9 | * When game started by Launching from IDE and source code is re-built inside IDE it sends "reload_scritpts", aka. hot reloading: https://youtu.be/Krx1FhB68zs
10 | Godot Mono integration does rest of the magic of reloading new .dll from hard drive and keeping existing values.
11 |
--------------------------------------------------------------------------------