diff options
Diffstat (limited to 'modules/mono')
18 files changed, 179 insertions, 123 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 15415d7655..5c1c098e3e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -411,7 +411,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) return "Godot.Object"; - if (p_var_type_name == Variant::get_type_name(Variant::REAL)) { + if (p_var_type_name == Variant::get_type_name(Variant::FLOAT)) { #ifdef REAL_T_IS_DOUBLE return "double"; #else @@ -430,9 +430,9 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::PACKED_BYTE_ARRAY)) return "byte[]"; - if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT32_ARRAY)) return "int[]"; - if (p_var_type_name == Variant::get_type_name(Variant::PACKED_REAL_ARRAY)) { + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_FLOAT32_ARRAY)) { #ifdef REAL_T_IS_DOUBLE return "double[]"; #else @@ -1720,7 +1720,7 @@ bool CSharpInstance::has_method(const StringName &p_method) const { return false; } -Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { ERR_FAIL_COND_V(!script.is_valid(), Variant()); @@ -1729,7 +1729,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, MonoObject *mono_object = get_mono_object(); if (!mono_object) { - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; ERR_FAIL_V(Variant()); } @@ -1741,7 +1741,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, if (method) { MonoObject *return_value = method->invoke(mono_object, p_args); - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; if (return_value) { return GDMonoMarshal::mono_object_to_variant(return_value); @@ -1753,7 +1753,7 @@ Variant CSharpInstance::call(const StringName &p_method, const Variant **p_args, top = top->get_parent_class(); } - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } @@ -2704,11 +2704,11 @@ void CSharpScript::_clear() { script_class = NULL; } -Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpScript::call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (unlikely(GDMono::get_singleton() == NULL)) { // Probably not the best error but eh. - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } @@ -2904,7 +2904,7 @@ StringName CSharpScript::get_instance_base_type() const { return StringName(); } -CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error) { +CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error) { GD_MONO_ASSERT_THREAD_ATTACHED; @@ -2968,7 +2968,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg CRASH_COND(die == true); p_owner->set_script_instance(NULL); - r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL; + r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; ERR_FAIL_V_MSG(NULL, "Failed to allocate memory for the object."); } @@ -2994,14 +2994,14 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg return instance; } -Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant CSharpScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { if (!valid) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; return Variant(); } - r_error.error = Variant::CallError::CALL_OK; + r_error.error = Callable::CallError::CALL_OK; ERR_FAIL_NULL_V(native, Variant()); @@ -3049,7 +3049,7 @@ ScriptInstance *CSharpScript::instance_create(Object *p_this) { GD_MONO_SCOPE_THREAD_ATTACH; - Variant::CallError unchecked_error; + Callable::CallError unchecked_error; return _create_instance(NULL, 0, p_this, Object::cast_to<Reference>(p_this) != NULL, unchecked_error); } diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h index 8ee741b4d2..627218eaf5 100644 --- a/modules/mono/csharp_script.h +++ b/modules/mono/csharp_script.h @@ -141,8 +141,8 @@ class CSharpScript : public Script { static int _try_get_member_export_hint(IMonoClassMember *p_member, ManagedType p_type, Variant::Type p_variant_type, bool p_allow_generics, PropertyHint &r_hint, String &r_hint_string); #endif - CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Variant::CallError &r_error); - Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + CSharpInstance *_create_instance(const Variant **p_args, int p_argcount, Object *p_owner, bool p_isref, Callable::CallError &r_error); + Variant _new(const Variant **p_args, int p_argcount, Callable::CallError &r_error); // Do not use unless you know what you are doing friend void GDMonoInternals::tie_managed_to_unmanaged(MonoObject *, Object *); @@ -154,7 +154,7 @@ class CSharpScript : public Script { protected: static void _bind_methods(); - Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual void _resource_path_changed(); bool _get(const StringName &p_name, Variant &r_ret) const; bool _set(const StringName &p_name, const Variant &p_value); @@ -265,7 +265,7 @@ public: /* TODO */ virtual void get_method_list(List<MethodInfo> *p_list) const {} virtual bool has_method(const StringName &p_method) const; - virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error); + virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); diff --git a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs b/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs index 4c76d2abf1..bd7eb59913 100644 --- a/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs +++ b/modules/mono/editor/GodotTools/GodotTools/BottomPanel.cs @@ -172,7 +172,7 @@ namespace GodotTools return; // Notify running game for hot-reload - Internal.ScriptEditorDebuggerReloadScripts(); + Internal.EditorDebuggerNodeReloadScripts(); // Hot-reload in the editor GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer(); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs index c3db52aa9e..af8d070cbd 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/MsBuildFinder.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; using Godot; +using GodotTools.Ides.Rider; using GodotTools.Internals; using Directory = System.IO.Directory; using Environment = System.Environment; @@ -54,6 +55,12 @@ namespace GodotTools.Build return msbuildPath; } + case BuildManager.BuildTool.JetBrainsMsBuild: + var editorPath = (string)editorSettings.GetSetting(RiderPathManager.EditorPathSettingName); + if (!File.Exists(editorPath)) + throw new FileNotFoundException($"Cannot find Rider executable. Tried with path: {editorPath}"); + var riderDir = new FileInfo(editorPath).Directory.Parent; + return Path.Combine(riderDir.FullName, @"tools\MSBuild\Current\Bin\MSBuild.exe"); default: throw new IndexOutOfRangeException("Invalid build tool in editor settings"); } diff --git a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs index fa6bf4dafd..69a8c9cf4a 100644 --- a/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/BuildManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using GodotTools.Build; +using GodotTools.Ides.Rider; using GodotTools.Internals; using GodotTools.Utils; using static GodotTools.Internals.Globals; @@ -16,6 +17,7 @@ namespace GodotTools public const string PropNameMsbuildMono = "MSBuild (Mono)"; public const string PropNameMsbuildVs = "MSBuild (VS Build Tools)"; + public const string PropNameMsbuildJetBrains = "MSBuild (JetBrains Rider)"; public const string MsBuildIssuesFileName = "msbuild_issues.csv"; public const string MsBuildLogFileName = "msbuild_log.txt"; @@ -23,7 +25,8 @@ namespace GodotTools public enum BuildTool { MsBuildMono, - MsBuildVs + MsBuildVs, + JetBrainsMsBuild } private static void RemoveOldIssuesFile(BuildInfo buildInfo) @@ -181,7 +184,7 @@ namespace GodotTools var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, config); // Add Godot defines - string constants = buildTool == BuildTool.MsBuildVs ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\""; + string constants = buildTool != BuildTool.MsBuildMono ? "GodotDefineConstants=\"" : "GodotDefineConstants=\\\""; foreach (var godotDefine in godotDefines) constants += $"GODOT_{godotDefine.ToUpper().Replace("-", "_").Replace(" ", "_").Replace(";", "_")};"; @@ -189,7 +192,7 @@ namespace GodotTools if (Internal.GodotIsRealTDouble()) constants += "GODOT_REAL_T_IS_DOUBLE;"; - constants += buildTool == BuildTool.MsBuildVs ? "\"" : "\\\""; + constants += buildTool != BuildTool.MsBuildMono ? "\"" : "\\\""; buildInfo.CustomProperties.Add(constants); @@ -245,18 +248,22 @@ namespace GodotTools public static void Initialize() { // Build tool settings - - EditorDef("mono/builds/build_tool", OS.IsWindows ? BuildTool.MsBuildVs : BuildTool.MsBuildMono); - var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); - + var msbuild = BuildTool.MsBuildMono; + if (OS.IsWindows) + msbuild = RiderPathManager.IsRider((string) editorSettings.GetSetting(RiderPathManager.EditorPathSettingName)) + ? BuildTool.JetBrainsMsBuild + : BuildTool.MsBuildVs; + + EditorDef("mono/builds/build_tool", msbuild); + editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary { ["type"] = Godot.Variant.Type.Int, ["name"] = "mono/builds/build_tool", ["hint"] = Godot.PropertyHint.Enum, ["hint_string"] = OS.IsWindows ? - $"{PropNameMsbuildMono},{PropNameMsbuildVs}" : + $"{PropNameMsbuildMono},{PropNameMsbuildVs},{PropNameMsbuildJetBrains}" : $"{PropNameMsbuildMono}" }); diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs index 9038333d38..5965e0fbcf 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs @@ -11,6 +11,10 @@ using Environment = System.Environment; using File = System.IO.File; using Path = System.IO.Path; using OS = GodotTools.Utils.OS; +// ReSharper disable UnassignedField.Local +// ReSharper disable InconsistentNaming +// ReSharper disable UnassignedField.Global +// ReSharper disable MemberHidesStaticFromOuterClass namespace GodotTools.Ides.Rider { @@ -131,28 +135,45 @@ namespace GodotTools.Ides.Rider if (OS.IsWindows) { var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - return Path.Combine(localAppData, @"JetBrains\Toolbox\apps\Rider"); + return GetToolboxRiderRootPath(localAppData); } if (OS.IsOSX) { var home = Environment.GetEnvironmentVariable("HOME"); - if (!string.IsNullOrEmpty(home)) - { - return Path.Combine(home, @"Library/Application Support/JetBrains/Toolbox/apps/Rider"); - } + if (string.IsNullOrEmpty(home)) + return string.Empty; + var localAppData = Path.Combine(home, @"Library/Application Support"); + return GetToolboxRiderRootPath(localAppData); } if (OS.IsUnixLike()) { var home = Environment.GetEnvironmentVariable("HOME"); - if (!string.IsNullOrEmpty(home)) - { - return Path.Combine(home, @".local/share/JetBrains/Toolbox/apps/Rider"); - } + if (string.IsNullOrEmpty(home)) + return string.Empty; + var localAppData = Path.Combine(home, @".local/share"); + return GetToolboxRiderRootPath(localAppData); + } + + return string.Empty; + } + + + private static string GetToolboxRiderRootPath(string localAppData) + { + var toolboxPath = Path.Combine(localAppData, @"JetBrains\Toolbox"); + var settingsJson = Path.Combine(toolboxPath, ".settings.json"); + + if (File.Exists(settingsJson)) + { + var path = SettingsJson.GetInstallLocationFromJson(File.ReadAllText(settingsJson)); + if (!string.IsNullOrEmpty(path)) + toolboxPath = path; } - throw new Exception("Unexpected OS."); + var toolboxRiderRootPath = Path.Combine(toolboxPath, @"apps\Rider"); + return toolboxRiderRootPath; } internal static ProductInfo GetBuildVersion(string path) @@ -226,8 +247,8 @@ namespace GodotTools.Ides.Rider { try { - // use history.json - last entry stands for the active build https://jetbrains.slack.com/archives/C07KNP99D/p1547807024066500?thread_ts=1547731708.057700&cid=C07KNP99D - var historyFile = Path.Combine(channelDir, ".history.json"); + // use history.json - last entry stands for the active build https://jetbrains.slack.com/archives/C07KNP99D/p1547807024066500?thread_ts=1547731708.057700&cid=C07KNP99D + var historyFile = Path.Combine(channelDir, ".history.json"); if (File.Exists(historyFile)) { var json = File.ReadAllText(historyFile); @@ -255,14 +276,14 @@ namespace GodotTools.Ides.Rider } } - // changes in toolbox json files format may brake the logic above, so return all found Rider installations - return Directory.GetDirectories(channelDir) - .SelectMany(buildDir => GetExecutablePaths(dirName, searchPattern, isMac, buildDir)); + // changes in toolbox json files format may brake the logic above, so return all found Rider installations + return Directory.GetDirectories(channelDir) + .SelectMany(buildDir => GetExecutablePaths(dirName, searchPattern, isMac, buildDir)); } catch (Exception e) { - // do not write to Debug.Log, just log it. - Logger.Warn($"Failed to get RiderPath from {channelDir}", e); + // do not write to Debug.Log, just log it. + Logger.Warn($"Failed to get RiderPath from {channelDir}", e); } return new string[0]; @@ -289,6 +310,27 @@ namespace GodotTools.Ides.Rider #pragma warning disable 0649 [Serializable] + class SettingsJson + { + public string install_location; + + [CanBeNull] + public static string GetInstallLocationFromJson(string json) + { + try + { + return JsonConvert.DeserializeObject<SettingsJson>(json).install_location; + } + catch (Exception) + { + Logger.Warn($"Failed to get install_location from json {json}"); + } + + return null; + } + } + + [Serializable] class ToolboxHistory { public List<ItemNode> history; @@ -372,7 +414,6 @@ namespace GodotTools.Ides.Rider [Serializable] class ActiveApplication { - // ReSharper disable once InconsistentNaming public List<string> builds; } @@ -380,6 +421,7 @@ namespace GodotTools.Ides.Rider public struct RiderInfo { + // ReSharper disable once NotAccessedField.Global public bool IsToolbox; public string Presentation; public Version BuildNumber; diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs index 558a242bf9..ee5677a6a8 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathManager.cs @@ -9,13 +9,13 @@ namespace GodotTools.Ides.Rider { public static class RiderPathManager { - private static readonly string editorPathSettingName = "mono/editor/editor_path_optional"; + public static readonly string EditorPathSettingName = "mono/editor/editor_path_optional"; private static string GetRiderPathFromSettings() { var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings(); - if (editorSettings.HasSetting(editorPathSettingName)) - return (string)editorSettings.GetSetting(editorPathSettingName); + if (editorSettings.HasSetting(EditorPathSettingName)) + return (string)editorSettings.GetSetting(EditorPathSettingName); return null; } @@ -25,22 +25,22 @@ namespace GodotTools.Ides.Rider var editor = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor"); if (editor == ExternalEditorId.Rider) { - if (!editorSettings.HasSetting(editorPathSettingName)) + if (!editorSettings.HasSetting(EditorPathSettingName)) { - Globals.EditorDef(editorPathSettingName, "Optional"); + Globals.EditorDef(EditorPathSettingName, "Optional"); editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary { ["type"] = Variant.Type.String, - ["name"] = editorPathSettingName, + ["name"] = EditorPathSettingName, ["hint"] = PropertyHint.File, ["hint_string"] = "" }); } - var riderPath = (string)editorSettings.GetSetting(editorPathSettingName); + var riderPath = (string)editorSettings.GetSetting(EditorPathSettingName); if (IsRiderAndExists(riderPath)) { - Globals.EditorDef(editorPathSettingName, riderPath); + Globals.EditorDef(EditorPathSettingName, riderPath); return; } @@ -50,17 +50,15 @@ namespace GodotTools.Ides.Rider return; var newPath = paths.Last().Path; - Globals.EditorDef(editorPathSettingName, newPath); - editorSettings.SetSetting(editorPathSettingName, newPath); + Globals.EditorDef(EditorPathSettingName, newPath); + editorSettings.SetSetting(EditorPathSettingName, newPath); } } - private static bool IsRider(string path) + public static bool IsRider(string path) { if (string.IsNullOrEmpty(path)) - { return false; - } var fileInfo = new FileInfo(path); var filename = fileInfo.Name.ToLowerInvariant(); @@ -81,8 +79,8 @@ namespace GodotTools.Ides.Rider return null; var newPath = paths.Last().Path; - editorSettings.SetSetting(editorPathSettingName, newPath); - Globals.EditorDef(editorPathSettingName, newPath); + editorSettings.SetSetting(EditorPathSettingName, newPath); + Globals.EditorDef(EditorPathSettingName, newPath); return newPath; } diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs index de361ba844..2e121ba879 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs @@ -34,7 +34,7 @@ namespace GodotTools.Internals public static void ReloadAssemblies(bool softReload) => internal_ReloadAssemblies(softReload); - public static void ScriptEditorDebuggerReloadScripts() => internal_ScriptEditorDebuggerReloadScripts(); + public static void EditorDebuggerNodeReloadScripts() => internal_EditorDebuggerNodeReloadScripts(); public static bool ScriptEditorEdit(Resource resource, int line, int col, bool grabFocus = true) => internal_ScriptEditorEdit(resource, line, col, grabFocus); @@ -88,7 +88,7 @@ namespace GodotTools.Internals private static extern void internal_ReloadAssemblies(bool softReload); [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ScriptEditorDebuggerReloadScripts(); + private static extern void internal_EditorDebuggerNodeReloadScripts(); [MethodImpl(MethodImplOptions.InternalCall)] private static extern bool internal_ScriptEditorEdit(Resource resource, int line, int col, bool grabFocus); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 0724d72ce6..908c72c591 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -505,9 +505,9 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("</c>"); } else if (tag == "PackedByteArray") { xml_output.append("<see cref=\"byte\"/>"); - } else if (tag == "PackedIntArray") { + } else if (tag == "PackedInt32Array") { xml_output.append("<see cref=\"int\"/>"); - } else if (tag == "PackedRealArray") { + } else if (tag == "PackedFloat32Array") { #ifdef REAL_T_IS_DOUBLE xml_output.append("<see cref=\"double\"/>"); #else @@ -2054,7 +2054,7 @@ Error BindingsGenerator::_generate_glue_method(const BindingsGenerator::TypeInte } if (p_imethod.is_vararg) { - p_output.append("\tVariant::CallError vcall_error;\n\t"); + p_output.append("\tCallable::CallError vcall_error;\n\t"); if (!ret_void) { // See the comment on the C_LOCAL_VARARG_RET declaration @@ -2383,7 +2383,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { } else { if (return_info.type == Variant::INT) { imethod.return_type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE); - } else if (return_info.type == Variant::REAL) { + } else if (return_info.type == Variant::FLOAT) { imethod.return_type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE); } else { imethod.return_type.cname = Variant::get_type_name(return_info.type); @@ -2410,7 +2410,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { } else { if (arginfo.type == Variant::INT) { iarg.type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE); - } else if (arginfo.type == Variant::REAL) { + } else if (arginfo.type == Variant::FLOAT) { iarg.type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE); } else { iarg.type.cname = Variant::get_type_name(arginfo.type); @@ -2581,7 +2581,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.default_argument = "(%s)" + r_iarg.default_argument; } break; - case Variant::REAL: + case Variant::FLOAT: #ifndef REAL_T_IS_DOUBLE r_iarg.default_argument += "f"; #endif @@ -2629,8 +2629,10 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar break; case Variant::ARRAY: case Variant::PACKED_BYTE_ARRAY: - case Variant::PACKED_INT_ARRAY: - case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: case Variant::PACKED_STRING_ARRAY: case Variant::PACKED_VECTOR2_ARRAY: case Variant::PACKED_VECTOR3_ARRAY: @@ -2914,13 +2916,13 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { #define INSERT_ARRAY(m_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_proxy_t) - INSERT_ARRAY(PackedIntArray, int); + INSERT_ARRAY(PackedInt32Array, int); INSERT_ARRAY_FULL(PackedByteArray, PackedByteArray, byte); #ifdef REAL_T_IS_DOUBLE - INSERT_ARRAY(PackedRealArray, double); + INSERT_ARRAY(PackedFloat32Array, double); #else - INSERT_ARRAY(PackedRealArray, float); + INSERT_ARRAY(PackedFloat32Array, float); #endif INSERT_ARRAY(PackedStringArray, string); diff --git a/modules/mono/editor/editor_internal_calls.cpp b/modules/mono/editor/editor_internal_calls.cpp index c8d20e80be..31996a03d0 100644 --- a/modules/mono/editor/editor_internal_calls.cpp +++ b/modules/mono/editor/editor_internal_calls.cpp @@ -36,10 +36,10 @@ #include "core/os/os.h" #include "core/version.h" +#include "editor/debugger/editor_debugger_node.h" #include "editor/editor_node.h" #include "editor/editor_scale.h" #include "editor/plugins/script_editor_plugin.h" -#include "editor/script_editor_debugger.h" #include "main/main.h" #include "../csharp_script.h" @@ -305,8 +305,8 @@ void godot_icall_Internal_ReloadAssemblies(MonoBoolean p_soft_reload) { #endif } -void godot_icall_Internal_ScriptEditorDebuggerReloadScripts() { - ScriptEditor::get_singleton()->get_debugger()->reload_scripts(); +void godot_icall_Internal_EditorDebuggerNodeReloadScripts() { + EditorDebuggerNode::get_singleton()->reload_scripts(); } MonoBoolean godot_icall_Internal_ScriptEditorEdit(MonoObject *p_resource, int32_t p_line, int32_t p_col, MonoBoolean p_grab_focus) { @@ -348,9 +348,9 @@ void godot_icall_Internal_EditorRunStop() { } void godot_icall_Internal_ScriptEditorDebugger_ReloadScripts() { - ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger(); - if (sed) { - sed->reload_scripts(); + EditorDebuggerNode *ed = EditorDebuggerNode::get_singleton(); + if (ed) { + ed->reload_scripts(); } } @@ -446,7 +446,7 @@ void register_editor_internal_calls() { mono_add_internal_call("GodotTools.Internals.Internal::internal_GetEditorApiHash", (void *)godot_icall_Internal_GetEditorApiHash); mono_add_internal_call("GodotTools.Internals.Internal::internal_IsAssembliesReloadingNeeded", (void *)godot_icall_Internal_IsAssembliesReloadingNeeded); mono_add_internal_call("GodotTools.Internals.Internal::internal_ReloadAssemblies", (void *)godot_icall_Internal_ReloadAssemblies); - mono_add_internal_call("GodotTools.Internals.Internal::internal_ScriptEditorDebuggerReloadScripts", (void *)godot_icall_Internal_ScriptEditorDebuggerReloadScripts); + mono_add_internal_call("GodotTools.Internals.Internal::internal_EditorDebuggerNodeReloadScripts", (void *)godot_icall_Internal_EditorDebuggerNodeReloadScripts); mono_add_internal_call("GodotTools.Internals.Internal::internal_ScriptEditorEdit", (void *)godot_icall_Internal_ScriptEditorEdit); mono_add_internal_call("GodotTools.Internals.Internal::internal_EditorNodeShowScriptScreen", (void *)godot_icall_Internal_EditorNodeShowScriptScreen); mono_add_internal_call("GodotTools.Internals.Internal::internal_GetScriptsMetadataOrNothing", (void *)godot_icall_Internal_GetScriptsMetadataOrNothing); diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp index 8dfb5b7147..8c77220b85 100644 --- a/modules/mono/glue/base_object_glue.cpp +++ b/modules/mono/glue/base_object_glue.cpp @@ -189,12 +189,12 @@ MonoBoolean godot_icall_DynamicGodotObject_InvokeMember(Object *p_ptr, MonoStrin args.set(i, &arg_store.get(i)); } - Variant::CallError error; + Callable::CallError error; Variant result = p_ptr->call(StringName(name), args.ptr(), argc, error); *r_result = GDMonoMarshal::variant_to_mono_object(result); - return error.error == Variant::CallError::CALL_OK; + return error.error == Callable::CallError::CALL_OK; } MonoBoolean godot_icall_DynamicGodotObject_GetMember(Object *p_ptr, MonoString *p_name, MonoObject **r_result) { diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index a6273a60ac..cdacd90538 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -55,9 +55,9 @@ MonoObject *godot_icall_GD_bytes2var(MonoArray *p_bytes, MonoBoolean p_allow_obj MonoObject *godot_icall_GD_convert(MonoObject *p_what, int32_t p_type) { Variant what = GDMonoMarshal::mono_object_to_variant(p_what); const Variant *args[1] = { &what }; - Variant::CallError ce; + Callable::CallError ce; Variant ret = Variant::construct(Variant::Type(p_type), args, 1, ce); - ERR_FAIL_COND_V(ce.error != Variant::CallError::CALL_OK, NULL); + ERR_FAIL_COND_V(ce.error != Callable::CallError::CALL_OK, NULL); return GDMonoMarshal::variant_to_mono_object(ret); } diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 21d78483ee..03b56c9949 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -252,12 +252,12 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) { - SET_FROM_ARRAY(PackedIntArray); + SET_FROM_ARRAY(PackedInt32Array); break; } if (array_type->eklass == REAL_T_MONOCLASS) { - SET_FROM_ARRAY(PackedRealArray); + SET_FROM_ARRAY(PackedFloat32Array); break; } @@ -370,7 +370,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ int32_t val = p_value.operator signed int(); mono_field_set_value(p_object, mono_field, &val); } break; - case Variant::REAL: { + case Variant::FLOAT: { #ifdef REAL_T_IS_DOUBLE double val = p_value.operator double(); mono_field_set_value(p_object, mono_field, &val); @@ -437,11 +437,11 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ case Variant::PACKED_BYTE_ARRAY: { SET_FROM_ARRAY(PackedByteArray); } break; - case Variant::PACKED_INT_ARRAY: { - SET_FROM_ARRAY(PackedIntArray); + case Variant::PACKED_INT32_ARRAY: { + SET_FROM_ARRAY(PackedInt32Array); } break; - case Variant::PACKED_REAL_ARRAY: { - SET_FROM_ARRAY(PackedRealArray); + case Variant::PACKED_FLOAT32_ARRAY: { + SET_FROM_ARRAY(PackedFloat32Array); } break; case Variant::PACKED_STRING_ARRAY: { SET_FROM_ARRAY(PackedStringArray); diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 63890f6066..695be64d6e 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -60,9 +60,9 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::INT; case MONO_TYPE_R4: - return Variant::REAL; + return Variant::FLOAT; case MONO_TYPE_R8: - return Variant::REAL; + return Variant::FLOAT; case MONO_TYPE_STRING: { return Variant::STRING; @@ -116,10 +116,10 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::PACKED_BYTE_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return Variant::PACKED_INT_ARRAY; + return Variant::PACKED_INT32_ARRAY; if (array_type->eklass == REAL_T_MONOCLASS) - return Variant::PACKED_REAL_ARRAY; + return Variant::PACKED_FLOAT32_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(String)) return Variant::PACKED_STRING_ARRAY; @@ -494,10 +494,10 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); + return (MonoObject *)PackedInt32Array_to_mono_array(p_var->operator PackedInt32Array()); if (array_type->eklass == REAL_T_MONOCLASS) - return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + return (MonoObject *)PackedFloat32Array_to_mono_array(p_var->operator PackedFloat32Array()); if (array_type->eklass == CACHED_CLASS_RAW(String)) return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); @@ -577,7 +577,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty int32_t val = p_var->operator signed int(); return BOX_INT32(val); } - case Variant::REAL: { + case Variant::FLOAT: { #ifdef REAL_T_IS_DOUBLE double val = p_var->operator double(); return BOX_DOUBLE(val); @@ -640,10 +640,10 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array)); case Variant::PACKED_BYTE_ARRAY: return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); - case Variant::PACKED_INT_ARRAY: - return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); - case Variant::PACKED_REAL_ARRAY: - return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + case Variant::PACKED_INT32_ARRAY: + return (MonoObject *)PackedInt32Array_to_mono_array(p_var->operator PackedInt32Array()); + case Variant::PACKED_FLOAT32_ARRAY: + return (MonoObject *)PackedFloat32Array_to_mono_array(p_var->operator PackedFloat32Array()); case Variant::PACKED_STRING_ARRAY: return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); case Variant::PACKED_VECTOR2_ARRAY: @@ -788,10 +788,10 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type return mono_array_to_PackedByteArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return mono_array_to_PackedIntArray((MonoArray *)p_obj); + return mono_array_to_PackedInt32Array((MonoArray *)p_obj); if (array_type->eklass == REAL_T_MONOCLASS) - return mono_array_to_PackedRealArray((MonoArray *)p_obj); + return mono_array_to_PackedFloat32Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(String)) return mono_array_to_PackedStringArray((MonoArray *)p_obj); @@ -987,7 +987,7 @@ Array mono_array_to_Array(MonoArray *p_array) { // TODO: Use memcpy where possible -MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { +MonoArray *PackedInt32Array_to_mono_array(const PackedInt32Array &p_array) { const int *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(int32_t), p_array.size()); @@ -999,8 +999,8 @@ MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { return ret; } -PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array) { - PackedIntArray ret; +PackedInt32Array mono_array_to_PackedInt32Array(MonoArray *p_array) { + PackedInt32Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); @@ -1041,7 +1041,7 @@ PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array) { return ret; } -MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { +MonoArray *PackedFloat32Array_to_mono_array(const PackedFloat32Array &p_array) { const real_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), REAL_T_MONOCLASS, p_array.size()); @@ -1053,8 +1053,8 @@ MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { return ret; } -PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array) { - PackedRealArray ret; +PackedFloat32Array mono_array_to_PackedFloat32Array(MonoArray *p_array) { + PackedFloat32Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index d3527109ff..5db59522ce 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -127,20 +127,20 @@ String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc); MonoArray *Array_to_mono_array(const Array &p_array); Array mono_array_to_Array(MonoArray *p_array); -// PackedIntArray +// PackedInt32Array -MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array); -PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array); +MonoArray *PackedInt32Array_to_mono_array(const PackedInt32Array &p_array); +PackedInt32Array mono_array_to_PackedInt32Array(MonoArray *p_array); // PackedByteArray MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array); PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array); -// PackedRealArray +// PackedFloat32Array -MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array); -PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array); +MonoArray *PackedFloat32Array_to_mono_array(const PackedFloat32Array &p_array); +PackedFloat32Array mono_array_to_PackedFloat32Array(MonoArray *p_array); // PackedStringArray diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp index 05077a00c4..ae6625a6c6 100644 --- a/modules/mono/mono_gd/gd_mono_utils.cpp +++ b/modules/mono/mono_gd/gd_mono_utils.cpp @@ -38,7 +38,7 @@ #include "core/reference.h" #ifdef TOOLS_ENABLED -#include "editor/script_editor_debugger.h" +#include "editor/debugger/script_editor_debugger.h" #endif #include "../csharp_script.h" diff --git a/modules/mono/signal_awaiter_utils.cpp b/modules/mono/signal_awaiter_utils.cpp index b85d5f2fd9..718bc2bb93 100644 --- a/modules/mono/signal_awaiter_utils.cpp +++ b/modules/mono/signal_awaiter_utils.cpp @@ -51,7 +51,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p Vector<Variant> binds; binds.push_back(sa_con); - Error err = p_source->connect(p_signal, sa_con.ptr(), + Error err = p_source->connect_compat(p_signal, sa_con.ptr(), CSharpLanguage::get_singleton()->get_string_names()._signal_callback, binds, Object::CONNECT_ONESHOT); @@ -65,7 +65,7 @@ Error connect_signal_awaiter(Object *p_source, const String &p_signal, Object *p } } // namespace SignalAwaiterUtils -Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { #ifdef DEBUG_ENABLED ERR_FAIL_COND_V_MSG(conn_target_id.is_valid() && !ObjectDB::get_instance(conn_target_id), Variant(), @@ -73,7 +73,7 @@ Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argc #endif if (p_argcount < 1) { - r_error.error = Variant::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; + r_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS; r_error.argument = 1; return Variant(); } @@ -81,7 +81,7 @@ Variant SignalAwaiterHandle::_signal_callback(const Variant **p_args, int p_argc Ref<SignalAwaiterHandle> self = *p_args[p_argcount - 1]; if (self.is_null()) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = p_argcount - 1; r_error.expected = Variant::OBJECT; return Variant(); diff --git a/modules/mono/signal_awaiter_utils.h b/modules/mono/signal_awaiter_utils.h index a9956ad5ba..012f6e5bb3 100644 --- a/modules/mono/signal_awaiter_utils.h +++ b/modules/mono/signal_awaiter_utils.h @@ -49,7 +49,7 @@ class SignalAwaiterHandle : public MonoGCHandle { ObjectID conn_target_id; #endif - Variant _signal_callback(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + Variant _signal_callback(const Variant **p_args, int p_argcount, Callable::CallError &r_error); protected: static void _bind_methods(); |