feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -7,7 +7,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>Godot.NET.Sdk</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_Godot_NET_Sdk)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/editor/Godot.NET.Sdk</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -103,15 +103,6 @@
|
|||
<GodotDefineConstants>$(GodotDefineConstants);$(GodotPlatformConstants);$(GodotVersionConstants)</GodotDefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- ExportDebug also defines DEBUG like Debug does. -->
|
||||
<DefineConstants Condition=" '$(Configuration)' == 'ExportDebug' ">$(DefineConstants);DEBUG</DefineConstants>
|
||||
<!-- Debug defines TOOLS to differentiate between Debug and ExportDebug configurations. -->
|
||||
<DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);TOOLS</DefineConstants>
|
||||
|
||||
<DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(MSBuildThisFileDirectory)\Android.props" Condition=" '$(GodotTargetPlatform)' == 'android' " />
|
||||
<Import Project="$(MSBuildThisFileDirectory)\iOSNativeAOT.props" Condition=" '$(GodotTargetPlatform)' == 'ios' " />
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,19 @@
|
|||
<DefineConstants Condition=" '$(GodotFloat64)' == 'true' ">GODOT_REAL_T_IS_DOUBLE;$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
We are defining ExportDebug and Debug in Sdk.targets to ensure that the user cannot
|
||||
override the DefineConstants property in their csproj file and break the editor functionality.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<!-- ExportDebug also defines DEBUG like Debug does. -->
|
||||
<DefineConstants Condition=" '$(Configuration)' == 'ExportDebug' ">$(DefineConstants);DEBUG</DefineConstants>
|
||||
<!-- Debug defines TOOLS to differentiate between Debug and ExportDebug configurations. -->
|
||||
<DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);TOOLS</DefineConstants>
|
||||
|
||||
<DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- C# source generators -->
|
||||
<ItemGroup Condition=" '$(DisableImplicitGodotGeneratorReferences)' != 'true' ">
|
||||
<PackageReference Include="Godot.SourceGenerators" Version="$(PackageVersion_Godot_SourceGenerators)" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Godot.SourceGenerators.Tests;
|
||||
|
||||
public class NestedInGenericTest
|
||||
{
|
||||
[Fact]
|
||||
public async void GenerateScriptMethodsTest()
|
||||
{
|
||||
await CSharpSourceGeneratorVerifier<ScriptMethodsGenerator>.Verify(
|
||||
"NestedInGeneric.cs",
|
||||
"GenericClass(Of T).NestedClass_ScriptMethods.generated.cs"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,13 @@ public class ScriptPropertyDefValGeneratorTests
|
|||
);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void ExportedProperties2()
|
||||
{
|
||||
await CSharpSourceGeneratorVerifier<ScriptPropertyDefValGenerator>.Verify(
|
||||
"ExportedProperties2.cs", "ExportedProperties2_ScriptPropertyDefVal.generated.cs");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void ExportedComplexStrings()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
partial class ExportedProperties2
|
||||
{
|
||||
#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword
|
||||
#if TOOLS
|
||||
/// <summary>
|
||||
/// Get the default values for all properties declared in this class.
|
||||
/// This method is used by Godot to determine the value that will be
|
||||
/// used by the inspector when resetting properties.
|
||||
/// Do not call this method.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
|
||||
internal new static global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant> GetGodotPropertyDefaultValues()
|
||||
{
|
||||
var values = new global::System.Collections.Generic.Dictionary<global::Godot.StringName, global::Godot.Variant>(3);
|
||||
int __Health_default_value = default;
|
||||
values.Add(PropertyName.@Health, global::Godot.Variant.From<int>(__Health_default_value));
|
||||
global::Godot.Resource __SubResource_default_value = default;
|
||||
values.Add(PropertyName.@SubResource, global::Godot.Variant.From<global::Godot.Resource>(__SubResource_default_value));
|
||||
string[] __Strings_default_value = default;
|
||||
values.Add(PropertyName.@Strings, global::Godot.Variant.From<string[]>(__Strings_default_value));
|
||||
return values;
|
||||
}
|
||||
#endif // TOOLS
|
||||
#pragma warning restore CS0109
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
using Godot.NativeInterop;
|
||||
|
||||
partial class GenericClass<T>
|
||||
{
|
||||
partial class NestedClass
|
||||
{
|
||||
#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword
|
||||
/// <summary>
|
||||
/// Cached StringNames for the methods contained in this class, for fast lookup.
|
||||
/// </summary>
|
||||
public new class MethodName : global::Godot.GodotObject.MethodName {
|
||||
}
|
||||
#pragma warning restore CS0109
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ExportedProperties2(int health, Resource subResource, string[] strings) : Resource
|
||||
{
|
||||
[Export]
|
||||
public int Health { get; set; } = health;
|
||||
[Export]
|
||||
public Resource SubResource { get; set; } = subResource;
|
||||
[Export]
|
||||
public string[] Strings { get; set; } = strings ?? System.Array.Empty<string>();
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using Godot;
|
||||
|
||||
public partial class GenericClass<T>
|
||||
{
|
||||
public partial class NestedClass : GodotObject
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -28,3 +28,22 @@ Rule ID | Category | Severity | Notes
|
|||
GD0107 | Usage | Error | ScriptPropertyDefValGenerator, [Documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/diagnostics/GD0107.html)
|
||||
GD0401 | Usage | Error | GlobalClassAnalyzer, [Documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/diagnostics/GD0401.html)
|
||||
GD0402 | Usage | Error | GlobalClassAnalyzer, [Documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/diagnostics/GD0402.html)
|
||||
|
||||
## Release 4.3
|
||||
|
||||
### New Rules
|
||||
|
||||
Rule ID | Category | Severity | Notes
|
||||
--------|----------|----------|--------------------
|
||||
GD0003 | Usage | Error | ScriptPathAttributeGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0003.html)
|
||||
|
||||
## Release 4.4
|
||||
|
||||
### New Rules
|
||||
|
||||
Rule ID | Category | Severity | Notes
|
||||
--------|----------|----------|--------------------
|
||||
GD0108 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0108.html)
|
||||
GD0109 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0109.html)
|
||||
GD0110 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0110.html)
|
||||
GD0111 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0111.html)
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
### New Rules
|
||||
|
||||
Rule ID | Category | Severity | Notes
|
||||
--------|----------|----------|--------------------
|
||||
GD0003 | Usage | Error | ScriptPathAttributeGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0003.html)
|
||||
GD0108 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0108.html)
|
||||
GD0109 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0109.html)
|
||||
GD0110 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0110.html)
|
||||
GD0111 | Usage | Error | ScriptPropertiesGenerator, [Documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/c_sharp/diagnostics/GD0111.html)
|
||||
|
|
@ -183,7 +183,7 @@ namespace Godot.SourceGenerators
|
|||
|
||||
public static string NameWithTypeParameters(this INamedTypeSymbol symbol)
|
||||
{
|
||||
return symbol.IsGenericType ?
|
||||
return symbol.IsGenericType && symbol.TypeParameters.Length > 0 ?
|
||||
string.Concat(symbol.Name, "<", string.Join(", ", symbol.TypeParameters), ">") :
|
||||
symbol.Name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>Godot.SourceGenerators</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_Godot_SourceGenerators)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -215,7 +215,11 @@ namespace Godot.SourceGenerators
|
|||
if (propertyDeclarationSyntax.Initializer != null)
|
||||
{
|
||||
var sm = context.Compilation.GetSemanticModel(propertyDeclarationSyntax.Initializer.SyntaxTree);
|
||||
value = propertyDeclarationSyntax.Initializer.Value.FullQualifiedSyntax(sm);
|
||||
var initializerValue = propertyDeclarationSyntax.Initializer.Value;
|
||||
if (!IsStaticallyResolvable(initializerValue, sm))
|
||||
value = "default";
|
||||
else
|
||||
value = propertyDeclarationSyntax.Initializer.Value.FullQualifiedSyntax(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -418,6 +422,106 @@ namespace Godot.SourceGenerators
|
|||
context.AddSource(uniqueHint, SourceText.From(source.ToString(), Encoding.UTF8));
|
||||
}
|
||||
|
||||
private static bool IsStaticallyResolvable(ExpressionSyntax expression, SemanticModel semanticModel)
|
||||
{
|
||||
// Handle literals (e.g., `10`, `"string"`, `true`, etc.)
|
||||
if (expression is LiteralExpressionSyntax)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle identifiers (e.g., variable names)
|
||||
if (expression is IdentifierNameSyntax identifier)
|
||||
{
|
||||
var symbolInfo = semanticModel.GetSymbolInfo(identifier).Symbol;
|
||||
|
||||
// Ensure it's a static member
|
||||
return symbolInfo is { IsStatic: true };
|
||||
}
|
||||
|
||||
// Handle member access (e.g., `MyClass.StaticValue`)
|
||||
if (expression is MemberAccessExpressionSyntax memberAccess)
|
||||
{
|
||||
var symbolInfo = semanticModel.GetSymbolInfo(memberAccess).Symbol;
|
||||
|
||||
// Ensure it's referring to a static member
|
||||
return symbolInfo is { IsStatic: true };
|
||||
}
|
||||
|
||||
// Handle object creation expressions (e.g., `new Vector2(1.0f, 2.0f)`)
|
||||
if (expression is ObjectCreationExpressionSyntax objectCreation)
|
||||
{
|
||||
// Recursively ensure all its arguments are self-contained
|
||||
if (objectCreation.ArgumentList == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
foreach (var argument in objectCreation.ArgumentList.Arguments)
|
||||
{
|
||||
if (!IsStaticallyResolvable(argument.Expression, semanticModel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (expression is ImplicitObjectCreationExpressionSyntax)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (expression is InvocationExpressionSyntax invocationExpression)
|
||||
{
|
||||
// Resolve the method being invoked
|
||||
var symbolInfo = semanticModel.GetSymbolInfo(invocationExpression).Symbol;
|
||||
|
||||
if (symbolInfo is IMethodSymbol methodSymbol)
|
||||
{
|
||||
// Ensure the method is static
|
||||
if (methodSymbol.IsStatic)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (expression is InterpolatedStringExpressionSyntax interpolatedString)
|
||||
{
|
||||
foreach (var content in interpolatedString.Contents)
|
||||
{
|
||||
if (content is not InterpolationSyntax interpolation)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Analyze the expression inside `${...}`
|
||||
var interpolatedExpression = interpolation.Expression;
|
||||
|
||||
if (!IsStaticallyResolvable(interpolatedExpression, semanticModel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (expression is InitializerExpressionSyntax initializerExpressionSyntax)
|
||||
{
|
||||
foreach (var content in initializerExpressionSyntax.Expressions)
|
||||
{
|
||||
if (!IsStaticallyResolvable(content, semanticModel))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Handle other expressions conservatively (e.g., method calls, instance references, etc.)
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool MemberHasNodeType(ITypeSymbol memberType, MarshalType marshalType)
|
||||
{
|
||||
if (marshalType == MarshalType.GodotObjectOrDerived)
|
||||
|
|
|
|||
|
|
@ -191,6 +191,13 @@ namespace GodotTools.ProjectEditor
|
|||
// Otherwise, it can be removed.
|
||||
if (mainTfmVersion > minTfmVersion)
|
||||
{
|
||||
var propertyTfmVersion = NuGetFramework.Parse(property.Value).Version;
|
||||
if (propertyTfmVersion == minTfmVersion)
|
||||
{
|
||||
// The 'TargetFramework' property already matches the minimum version.
|
||||
continue;
|
||||
}
|
||||
|
||||
property.Value = minTfmValue;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -37,8 +37,28 @@ namespace GodotTools.Export
|
|||
|
||||
public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetExportOptions(EditorExportPlatform platform)
|
||||
{
|
||||
return new Godot.Collections.Array<Godot.Collections.Dictionary>()
|
||||
var exportOptionList = new Godot.Collections.Array<Godot.Collections.Dictionary>();
|
||||
|
||||
if (platform.GetOsName().Equals(OS.Platforms.Android, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
exportOptionList.Add
|
||||
(
|
||||
new Godot.Collections.Dictionary()
|
||||
{
|
||||
{
|
||||
"option", new Godot.Collections.Dictionary()
|
||||
{
|
||||
{ "name", "dotnet/android_use_linux_bionic" },
|
||||
{ "type", (int)Variant.Type.Bool }
|
||||
}
|
||||
},
|
||||
{ "default_value", false }
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
exportOptionList.Add
|
||||
(
|
||||
new Godot.Collections.Dictionary()
|
||||
{
|
||||
{
|
||||
|
|
@ -49,7 +69,10 @@ namespace GodotTools.Export
|
|||
}
|
||||
},
|
||||
{ "default_value", false }
|
||||
},
|
||||
}
|
||||
);
|
||||
exportOptionList.Add
|
||||
(
|
||||
new Godot.Collections.Dictionary()
|
||||
{
|
||||
{
|
||||
|
|
@ -60,7 +83,10 @@ namespace GodotTools.Export
|
|||
}
|
||||
},
|
||||
{ "default_value", true }
|
||||
},
|
||||
}
|
||||
);
|
||||
exportOptionList.Add
|
||||
(
|
||||
new Godot.Collections.Dictionary()
|
||||
{
|
||||
{
|
||||
|
|
@ -72,7 +98,8 @@ namespace GodotTools.Export
|
|||
},
|
||||
{ "default_value", false }
|
||||
}
|
||||
};
|
||||
);
|
||||
return exportOptionList;
|
||||
}
|
||||
|
||||
private void AddExceptionMessage(EditorExportPlatform platform, Exception exception)
|
||||
|
|
@ -158,11 +185,12 @@ namespace GodotTools.Export
|
|||
throw new NotImplementedException("Target platform not yet implemented.");
|
||||
}
|
||||
|
||||
bool useAndroidLinuxBionic = (bool)GetOption("dotnet/android_use_linux_bionic");
|
||||
PublishConfig publishConfig = new()
|
||||
{
|
||||
BuildConfig = isDebug ? "ExportDebug" : "ExportRelease",
|
||||
IncludeDebugSymbols = (bool)GetOption("dotnet/include_debug_symbols"),
|
||||
RidOS = DetermineRuntimeIdentifierOS(platform),
|
||||
RidOS = DetermineRuntimeIdentifierOS(platform, useAndroidLinuxBionic),
|
||||
Archs = new List<string>(),
|
||||
UseTempDir = platform != OS.Platforms.iOS, // xcode project links directly to files in the publish dir, so use one that sticks around.
|
||||
BundleOutputs = true,
|
||||
|
|
@ -329,6 +357,14 @@ namespace GodotTools.Export
|
|||
|
||||
if (IsSharedObject(fileName))
|
||||
{
|
||||
if (fileName.EndsWith(".so") && !fileName.StartsWith("lib"))
|
||||
{
|
||||
// Add 'lib' prefix required for all native libraries in Android.
|
||||
string newPath = string.Concat(path.AsSpan(0, path.Length - fileName.Length), "lib", fileName);
|
||||
Godot.DirAccess.RenameAbsolute(path, newPath);
|
||||
path = newPath;
|
||||
}
|
||||
|
||||
AddSharedObject(path, tags: new string[] { arch },
|
||||
Path.Join(projectDataDirName,
|
||||
Path.GetRelativePath(publishOutputDir,
|
||||
|
|
@ -453,8 +489,14 @@ namespace GodotTools.Export
|
|||
return path;
|
||||
}
|
||||
|
||||
private string DetermineRuntimeIdentifierOS(string platform)
|
||||
=> OS.DotNetOSPlatformMap[platform];
|
||||
private string DetermineRuntimeIdentifierOS(string platform, bool useAndroidLinuxBionic)
|
||||
{
|
||||
if (platform == OS.Platforms.Android && useAndroidLinuxBionic)
|
||||
{
|
||||
return OS.DotNetOS.LinuxBionic;
|
||||
}
|
||||
return OS.DotNetOSPlatformMap[platform];
|
||||
}
|
||||
|
||||
private string DetermineRuntimeIdentifierArch(string arch)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ namespace GodotTools
|
|||
MonoDevelop,
|
||||
VsCode,
|
||||
Rider,
|
||||
CustomEditor
|
||||
CustomEditor,
|
||||
Fleet,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -286,9 +286,10 @@ namespace GodotTools
|
|||
case ExternalEditorId.VisualStudioForMac:
|
||||
goto case ExternalEditorId.MonoDevelop;
|
||||
case ExternalEditorId.Rider:
|
||||
case ExternalEditorId.Fleet:
|
||||
{
|
||||
string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
|
||||
RiderPathManager.OpenFile(GodotSharpDirs.ProjectSlnPath, scriptPath, line + 1, col);
|
||||
RiderPathManager.OpenFile(editorId, GodotSharpDirs.ProjectSlnPath, scriptPath, line + 1, col);
|
||||
return Error.Ok;
|
||||
}
|
||||
case ExternalEditorId.MonoDevelop:
|
||||
|
|
@ -568,7 +569,8 @@ namespace GodotTools
|
|||
settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudio}" +
|
||||
$",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
|
||||
$",Custom:{(int)ExternalEditorId.CustomEditor}";
|
||||
}
|
||||
else if (OS.IsMacOS)
|
||||
|
|
@ -576,14 +578,16 @@ namespace GodotTools
|
|||
settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
|
||||
$",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
|
||||
$",Custom:{(int)ExternalEditorId.CustomEditor}";
|
||||
}
|
||||
else if (OS.IsUnixLike)
|
||||
{
|
||||
settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
|
||||
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
|
||||
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
|
||||
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
|
||||
$",Custom:{(int)ExternalEditorId.CustomEditor}";
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +644,6 @@ namespace GodotTools
|
|||
_inspectorPluginWeak = WeakRef(inspectorPlugin);
|
||||
|
||||
BuildManager.Initialize();
|
||||
RiderPathManager.Initialize();
|
||||
|
||||
GodotIdeManager = new GodotIdeManager();
|
||||
AddChild(GodotIdeManager);
|
||||
|
|
@ -664,13 +667,28 @@ namespace GodotTools
|
|||
|
||||
private void OnSettingsChanged()
|
||||
{
|
||||
// We want to force NoConsoleLogging to true when the VerbosityLevel is at Detailed or above.
|
||||
// At that point, there's so much info logged that it doesn't make sense to display it in
|
||||
// the tiny editor window, and it'd make the editor hang or crash anyway.
|
||||
var verbosityLevel = _editorSettings.GetSetting(Settings.VerbosityLevel).As<VerbosityLevelId>();
|
||||
var hideConsoleLog = (bool)_editorSettings.GetSetting(Settings.NoConsoleLogging);
|
||||
if (verbosityLevel >= VerbosityLevelId.Detailed && !hideConsoleLog)
|
||||
_editorSettings.SetSetting(Settings.NoConsoleLogging, Variant.From(true));
|
||||
var changedSettings = _editorSettings.GetChangedSettings();
|
||||
if (changedSettings.Contains(Settings.VerbosityLevel))
|
||||
{
|
||||
// We want to force NoConsoleLogging to true when the VerbosityLevel is at Detailed or above.
|
||||
// At that point, there's so much info logged that it doesn't make sense to display it in
|
||||
// the tiny editor window, and it'd make the editor hang or crash anyway.
|
||||
var verbosityLevel = _editorSettings.GetSetting(Settings.VerbosityLevel).As<VerbosityLevelId>();
|
||||
var hideConsoleLog = (bool)_editorSettings.GetSetting(Settings.NoConsoleLogging);
|
||||
if (verbosityLevel >= VerbosityLevelId.Detailed && !hideConsoleLog)
|
||||
_editorSettings.SetSetting(Settings.NoConsoleLogging, Variant.From(true));
|
||||
}
|
||||
|
||||
if (changedSettings.Contains(Settings.ExternalEditor) && !changedSettings.Contains(RiderPathManager.EditorPathSettingName))
|
||||
{
|
||||
var editor = _editorSettings.GetSetting(Settings.ExternalEditor).As<ExternalEditorId>();
|
||||
if (editor != ExternalEditorId.Fleet && editor != ExternalEditorId.Rider)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RiderPathManager.InitializeIfNeeded(editor);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3.0" ExcludeAssets="runtime" PrivateAssets="all" />
|
||||
<PackageReference Include="JetBrains.Rider.PathLocator" Version="1.0.9" />
|
||||
<PackageReference Include="JetBrains.Rider.PathLocator" Version="1.0.12" />
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<Reference Include="GodotSharp">
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ namespace GodotTools.Ides
|
|||
return "VisualStudioCode";
|
||||
case ExternalEditorId.Rider:
|
||||
return "Rider";
|
||||
case ExternalEditorId.Fleet:
|
||||
return "Fleet";
|
||||
case ExternalEditorId.VisualStudioForMac:
|
||||
return "VisualStudioForMac";
|
||||
case ExternalEditorId.MonoDevelop:
|
||||
|
|
@ -107,6 +109,7 @@ namespace GodotTools.Ides
|
|||
case ExternalEditorId.VisualStudio:
|
||||
case ExternalEditorId.VsCode:
|
||||
case ExternalEditorId.Rider:
|
||||
case ExternalEditorId.Fleet:
|
||||
case ExternalEditorId.CustomEditor:
|
||||
throw new NotSupportedException();
|
||||
case ExternalEditorId.VisualStudioForMac:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace GodotTools.Ides.Rider
|
|||
{
|
||||
public static class RiderPathManager
|
||||
{
|
||||
private const string EditorPathSettingName = "dotnet/editor/editor_path_optional";
|
||||
internal const string EditorPathSettingName = "dotnet/editor/editor_path_optional";
|
||||
|
||||
private static readonly RiderPathLocator RiderPathLocator;
|
||||
private static readonly RiderFileOpener RiderFileOpener;
|
||||
|
|
@ -32,44 +32,40 @@ namespace GodotTools.Ides.Rider
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
public static void InitializeIfNeeded(ExternalEditorId editor)
|
||||
{
|
||||
var editorSettings = EditorInterface.Singleton.GetEditorSettings();
|
||||
var editor = editorSettings.GetSetting(GodotSharpEditor.Settings.ExternalEditor).As<ExternalEditorId>();
|
||||
if (editor == ExternalEditorId.Rider)
|
||||
if (!editorSettings.HasSetting(EditorPathSettingName))
|
||||
{
|
||||
if (!editorSettings.HasSetting(EditorPathSettingName))
|
||||
Globals.EditorDef(EditorPathSettingName, "");
|
||||
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
|
||||
{
|
||||
Globals.EditorDef(EditorPathSettingName, "");
|
||||
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
|
||||
{
|
||||
["type"] = (int)Variant.Type.String,
|
||||
["name"] = EditorPathSettingName,
|
||||
["hint"] = (int)PropertyHint.File,
|
||||
["hint_string"] = ""
|
||||
});
|
||||
}
|
||||
|
||||
var riderPath = (string)editorSettings.GetSetting(EditorPathSettingName);
|
||||
if (File.Exists(riderPath))
|
||||
{
|
||||
Globals.EditorDef(EditorPathSettingName, riderPath);
|
||||
return;
|
||||
}
|
||||
|
||||
var paths = RiderPathLocator.GetAllRiderPaths();
|
||||
if (paths.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string newPath = paths.Last().Path;
|
||||
Globals.EditorDef(EditorPathSettingName, newPath);
|
||||
editorSettings.SetSetting(EditorPathSettingName, newPath);
|
||||
["type"] = (int)Variant.Type.String,
|
||||
["name"] = EditorPathSettingName,
|
||||
["hint"] = (int)PropertyHint.File,
|
||||
["hint_string"] = ""
|
||||
});
|
||||
}
|
||||
|
||||
var editorPath = (string)editorSettings.GetSetting(EditorPathSettingName);
|
||||
if (File.Exists(editorPath) && IsMatch(editor, editorPath))
|
||||
{
|
||||
Globals.EditorDef(EditorPathSettingName, editorPath);
|
||||
return;
|
||||
}
|
||||
|
||||
var paths = RiderPathLocator.GetAllRiderPaths().Where(info => IsMatch(editor, info.Path)).ToArray();
|
||||
if (paths.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string newPath = paths.Last().Path;
|
||||
Globals.EditorDef(EditorPathSettingName, newPath);
|
||||
editorSettings.SetSetting(EditorPathSettingName, newPath);
|
||||
}
|
||||
|
||||
public static bool IsRider(string path)
|
||||
private static bool IsMatch(ExternalEditorId editorId, string path)
|
||||
{
|
||||
if (path.IndexOfAny(Path.GetInvalidPathChars()) != -1)
|
||||
{
|
||||
|
|
@ -77,14 +73,15 @@ namespace GodotTools.Ides.Rider
|
|||
}
|
||||
|
||||
var fileInfo = new FileInfo(path);
|
||||
return fileInfo.Name.StartsWith("rider", StringComparison.OrdinalIgnoreCase);
|
||||
var name = editorId == ExternalEditorId.Fleet ? "fleet" : "rider";
|
||||
return fileInfo.Name.StartsWith(name, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private static string? CheckAndUpdatePath(string? riderPath)
|
||||
private static string? CheckAndUpdatePath(ExternalEditorId editorId, string? idePath)
|
||||
{
|
||||
if (File.Exists(riderPath))
|
||||
if (File.Exists(idePath))
|
||||
{
|
||||
return riderPath;
|
||||
return idePath;
|
||||
}
|
||||
|
||||
var allInfos = RiderPathLocator.GetAllRiderPaths();
|
||||
|
|
@ -93,9 +90,13 @@ namespace GodotTools.Ides.Rider
|
|||
return null;
|
||||
}
|
||||
|
||||
// RiderPathLocator includes Rider and Fleet locations, prefer Rider when available.
|
||||
var preferredInfo = allInfos.LastOrDefault(info => IsRider(info.Path), allInfos[allInfos.Length - 1]);
|
||||
string newPath = preferredInfo.Path;
|
||||
// RiderPathLocator includes Rider and Fleet locations.
|
||||
var matchingIde = allInfos.LastOrDefault(info => IsMatch(editorId, info.Path));
|
||||
var newPath = matchingIde.Path;
|
||||
if (string.IsNullOrEmpty(newPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var editorSettings = EditorInterface.Singleton.GetEditorSettings();
|
||||
editorSettings.SetSetting(EditorPathSettingName, newPath);
|
||||
|
|
@ -103,10 +104,10 @@ namespace GodotTools.Ides.Rider
|
|||
return newPath;
|
||||
}
|
||||
|
||||
public static void OpenFile(string slnPath, string scriptPath, int line, int column)
|
||||
public static void OpenFile(ExternalEditorId editorId, string slnPath, string scriptPath, int line, int column)
|
||||
{
|
||||
string? pathFromSettings = GetRiderPathFromSettings();
|
||||
string? path = CheckAndUpdatePath(pathFromSettings);
|
||||
var pathFromSettings = GetRiderPathFromSettings();
|
||||
var path = CheckAndUpdatePath(editorId, pathFromSettings);
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
GD.PushError($"Error when trying to run code editor: JetBrains Rider or Fleet. Could not find path to the editor.");
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ namespace GodotTools.Utils
|
|||
public const string Linux = "linux";
|
||||
public const string Win10 = "win10";
|
||||
public const string Android = "android";
|
||||
public const string LinuxBionic = "linux-bionic";
|
||||
public const string iOS = "ios";
|
||||
public const string iOSSimulator = "iossimulator";
|
||||
public const string Browser = "browser";
|
||||
|
|
@ -99,7 +100,6 @@ namespace GodotTools.Utils
|
|||
[Platforms.iOS] = DotNetOS.iOS,
|
||||
[Platforms.Web] = DotNetOS.Browser
|
||||
};
|
||||
|
||||
private static bool IsOS(string name)
|
||||
{
|
||||
Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "bindings_generator.h"
|
||||
|
||||
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
|
||||
#include "../godotsharp_defs.h"
|
||||
#include "../utils/naming_utils.h"
|
||||
|
|
@ -141,6 +141,7 @@ const Vector<String> prop_allowed_inherited_member_hiding = {
|
|||
"MenuBar.TextDirection",
|
||||
"RichTextLabel.TextDirection",
|
||||
"TextEdit.TextDirection",
|
||||
"FoldableContainer.TextDirection",
|
||||
"VisualShaderNodeReroute.PortType",
|
||||
// The following instances are uniquely egregious violations, hiding `GetType()` from `object`.
|
||||
// Included for the sake of CI, with the understanding that they *deserve* warnings.
|
||||
|
|
@ -172,8 +173,7 @@ static String fix_doc_description(const String &p_bbcode) {
|
|||
// This seems to be the correct way to do this. It's the same EditorHelp does.
|
||||
|
||||
return p_bbcode.dedent()
|
||||
.replace("\t", "")
|
||||
.replace("\r", "")
|
||||
.remove_chars("\t\r")
|
||||
.strip_edges();
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
int brk_end = bbcode.find_char(']', brk_pos + 1);
|
||||
|
||||
if (brk_end == -1) {
|
||||
String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
|
||||
String text = bbcode.substr(brk_pos);
|
||||
if (code_tag || tag_stack.size() > 0) {
|
||||
output.append("'" + text + "'");
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
String tag = bbcode.substr(brk_pos + 1, brk_end - brk_pos - 1);
|
||||
|
||||
if (tag.begins_with("/")) {
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1);
|
||||
|
||||
if (!tag_ok) {
|
||||
output.append("]");
|
||||
|
|
@ -246,11 +246,11 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
const String link_target = tag.substr(tag_end + 1).lstrip(" ");
|
||||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
output.append(tag);
|
||||
|
|
@ -401,7 +401,7 @@ String BindingsGenerator::bbcode_to_text(const String &p_bbcode, const TypeInter
|
|||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag.begins_with("url=")) {
|
||||
String url = tag.substr(4, tag.length());
|
||||
String url = tag.substr(4);
|
||||
// Not supported. Just append the url.
|
||||
output.append(url);
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
|
||||
if (brk_end == -1) {
|
||||
if (!line_del) {
|
||||
String text = bbcode.substr(brk_pos, bbcode.length() - brk_pos);
|
||||
String text = bbcode.substr(brk_pos);
|
||||
if (code_tag || tag_stack.size() > 0) {
|
||||
xml_output.append(text.xml_escape());
|
||||
} else {
|
||||
|
|
@ -522,7 +522,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
String tag = bbcode.substr(brk_pos + 1, brk_end - brk_pos - 1);
|
||||
|
||||
if (tag.begins_with("/")) {
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1, tag.length());
|
||||
bool tag_ok = tag_stack.size() && tag_stack.front()->get() == tag.substr(1);
|
||||
|
||||
if (!tag_ok) {
|
||||
if (!line_del) {
|
||||
|
|
@ -558,11 +558,11 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
} else if (tag.begins_with("method ") || tag.begins_with("constructor ") || tag.begins_with("operator ") || tag.begins_with("member ") || tag.begins_with("signal ") || tag.begins_with("enum ") || tag.begins_with("constant ") || tag.begins_with("theme_item ") || tag.begins_with("param ")) {
|
||||
const int tag_end = tag.find_char(' ');
|
||||
const String link_tag = tag.substr(0, tag_end);
|
||||
const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" ");
|
||||
const String link_target = tag.substr(tag_end + 1).lstrip(" ");
|
||||
|
||||
const Vector<String> link_target_parts = link_target.split(".");
|
||||
|
||||
if (link_target_parts.size() <= 0 || link_target_parts.size() > 2) {
|
||||
if (link_target_parts.is_empty() || link_target_parts.size() > 2) {
|
||||
ERR_PRINT("Invalid reference format: '" + tag + "'.");
|
||||
|
||||
xml_output.append("<c>");
|
||||
|
|
@ -763,7 +763,7 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf
|
|||
pos = brk_end + 1;
|
||||
tag_stack.push_front(tag);
|
||||
} else if (tag.begins_with("url=")) {
|
||||
String url = tag.substr(4, tag.length());
|
||||
String url = tag.substr(4);
|
||||
xml_output.append("<a href=\"");
|
||||
xml_output.append(url);
|
||||
xml_output.append("\">");
|
||||
|
|
@ -1741,8 +1741,8 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
da->make_dir("Generated");
|
||||
da->make_dir("Generated/GodotObjects");
|
||||
|
||||
String base_gen_dir = path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
|
||||
String base_gen_dir = Path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = Path::join(base_gen_dir, "GodotObjects");
|
||||
|
||||
Vector<String> compile_items;
|
||||
|
||||
|
|
@ -1750,7 +1750,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
{
|
||||
StringBuilder constants_source;
|
||||
_generate_global_constants(constants_source);
|
||||
String output_file = path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
|
||||
String output_file = Path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_constants.cs");
|
||||
Error save_err = _save_file(output_file, constants_source);
|
||||
if (save_err != OK) {
|
||||
return save_err;
|
||||
|
|
@ -1763,7 +1763,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
{
|
||||
StringBuilder extensions_source;
|
||||
_generate_array_extensions(extensions_source);
|
||||
String output_file = path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_extensions.cs");
|
||||
String output_file = Path::join(base_gen_dir, BINDINGS_GLOBAL_SCOPE_CLASS "_extensions.cs");
|
||||
Error save_err = _save_file(output_file, extensions_source);
|
||||
if (save_err != OK) {
|
||||
return save_err;
|
||||
|
|
@ -1779,7 +1779,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
continue;
|
||||
}
|
||||
|
||||
String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
String output_file = Path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
Error err = _generate_cs_type(itype, output_file);
|
||||
|
||||
if (err == ERR_SKIP) {
|
||||
|
|
@ -1846,7 +1846,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
|
||||
cs_built_in_ctors_content.append(CLOSE_BLOCK);
|
||||
|
||||
String constructors_file = path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR ".cs");
|
||||
String constructors_file = Path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR ".cs");
|
||||
Error err = _save_file(constructors_file, cs_built_in_ctors_content);
|
||||
|
||||
if (err != OK) {
|
||||
|
|
@ -1889,7 +1889,7 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
|
||||
cs_icalls_content.append(CLOSE_BLOCK);
|
||||
|
||||
String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
|
||||
String internal_methods_file = Path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS ".cs");
|
||||
|
||||
Error err = _save_file(internal_methods_file, cs_icalls_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -1905,14 +1905,14 @@ Error BindingsGenerator::generate_cs_core_project(const String &p_proj_dir) {
|
|||
" <ItemGroup>\n");
|
||||
|
||||
for (int i = 0; i < compile_items.size(); i++) {
|
||||
String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
|
||||
String include = Path::relative_to(compile_items[i], p_proj_dir).replace_char('/', '\\');
|
||||
includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
|
||||
}
|
||||
|
||||
includes_props_content.append(" </ItemGroup>\n"
|
||||
"</Project>\n");
|
||||
|
||||
String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
String includes_props_file = Path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
|
||||
err = _save_file(includes_props_file, includes_props_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -1937,8 +1937,8 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
da->make_dir("Generated");
|
||||
da->make_dir("Generated/GodotObjects");
|
||||
|
||||
String base_gen_dir = path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = path::join(base_gen_dir, "GodotObjects");
|
||||
String base_gen_dir = Path::join(p_proj_dir, "Generated");
|
||||
String godot_objects_gen_dir = Path::join(base_gen_dir, "GodotObjects");
|
||||
|
||||
Vector<String> compile_items;
|
||||
|
||||
|
|
@ -1949,7 +1949,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
continue;
|
||||
}
|
||||
|
||||
String output_file = path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
String output_file = Path::join(godot_objects_gen_dir, itype.proxy_name + ".cs");
|
||||
Error err = _generate_cs_type(itype, output_file);
|
||||
|
||||
if (err == ERR_SKIP) {
|
||||
|
|
@ -2004,7 +2004,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
|
||||
cs_built_in_ctors_content.append(CLOSE_BLOCK);
|
||||
|
||||
String constructors_file = path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR_EDITOR ".cs");
|
||||
String constructors_file = Path::join(base_gen_dir, BINDINGS_CLASS_CONSTRUCTOR_EDITOR ".cs");
|
||||
Error err = _save_file(constructors_file, cs_built_in_ctors_content);
|
||||
|
||||
if (err != OK) {
|
||||
|
|
@ -2049,7 +2049,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
|
||||
cs_icalls_content.append(CLOSE_BLOCK);
|
||||
|
||||
String internal_methods_file = path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
|
||||
String internal_methods_file = Path::join(base_gen_dir, BINDINGS_CLASS_NATIVECALLS_EDITOR ".cs");
|
||||
|
||||
Error err = _save_file(internal_methods_file, cs_icalls_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -2065,14 +2065,14 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
" <ItemGroup>\n");
|
||||
|
||||
for (int i = 0; i < compile_items.size(); i++) {
|
||||
String include = path::relative_to(compile_items[i], p_proj_dir).replace("/", "\\");
|
||||
String include = Path::relative_to(compile_items[i], p_proj_dir).replace_char('/', '\\');
|
||||
includes_props_content.append(" <Compile Include=\"" + include + "\" />\n");
|
||||
}
|
||||
|
||||
includes_props_content.append(" </ItemGroup>\n"
|
||||
"</Project>\n");
|
||||
|
||||
String includes_props_file = path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
String includes_props_file = Path::join(base_gen_dir, "GeneratedIncludes.props");
|
||||
|
||||
err = _save_file(includes_props_file, includes_props_content);
|
||||
if (err != OK) {
|
||||
|
|
@ -2085,7 +2085,7 @@ Error BindingsGenerator::generate_cs_editor_project(const String &p_proj_dir) {
|
|||
Error BindingsGenerator::generate_cs_api(const String &p_output_dir) {
|
||||
ERR_FAIL_COND_V(!initialized, ERR_UNCONFIGURED);
|
||||
|
||||
String output_dir = path::abspath(path::realpath(p_output_dir));
|
||||
String output_dir = Path::abspath(Path::realpath(p_output_dir));
|
||||
|
||||
Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
||||
ERR_FAIL_COND_V(da.is_null(), ERR_CANT_CREATE);
|
||||
|
|
@ -3011,7 +3011,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
|
|||
}
|
||||
|
||||
// Apparently the name attribute must not include the @
|
||||
String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1, iarg.name.length()) : iarg.name;
|
||||
String param_tag_name = iarg.name.begins_with("@") ? iarg.name.substr(1) : iarg.name;
|
||||
// Escape < and > in the attribute default value
|
||||
String param_def_arg = def_arg.replacen("<", "<").replacen(">", ">");
|
||||
|
||||
|
|
@ -3201,7 +3201,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
|
|||
|
||||
// Generate signal
|
||||
{
|
||||
bool is_parameterless = p_isignal.arguments.size() == 0;
|
||||
bool is_parameterless = p_isignal.arguments.is_empty();
|
||||
|
||||
// Delegate name is [SignalName]EventHandler
|
||||
String delegate_name = is_parameterless ? "Action" : p_isignal.proxy_name + "EventHandler";
|
||||
|
|
@ -3800,6 +3800,8 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
|
|||
case Variant::VECTOR2:
|
||||
case Variant::RECT2:
|
||||
case Variant::VECTOR3:
|
||||
case Variant::VECTOR4:
|
||||
case Variant::PROJECTION:
|
||||
case Variant::RID:
|
||||
case Variant::PACKED_BYTE_ARRAY:
|
||||
case Variant::PACKED_INT32_ARRAY:
|
||||
|
|
@ -3829,7 +3831,10 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
|
|||
case Variant::VECTOR3I:
|
||||
return p_arg_type.name == name_cache.type_Vector3 ||
|
||||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
|
||||
default:
|
||||
case Variant::VECTOR4I:
|
||||
return p_arg_type.name == name_cache.type_Vector4 ||
|
||||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
|
||||
case Variant::VARIANT_MAX:
|
||||
CRASH_NOW_MSG("Unexpected Variant type: " + itos(p_val.get_type()));
|
||||
break;
|
||||
}
|
||||
|
|
@ -4112,9 +4117,8 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
imethod.return_type.cname = _get_type_name_from_meta(return_info.type, m ? m->get_argument_meta(-1) : (GodotTypeInfo::Metadata)method_info.return_val_metadata);
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++idx) {
|
||||
const PropertyInfo &arginfo = *itr;
|
||||
for (int64_t idx = 0; idx < method_info.arguments.size(); ++idx) {
|
||||
const PropertyInfo &arginfo = method_info.arguments[idx];
|
||||
|
||||
String orig_arg_name = arginfo.name;
|
||||
|
||||
|
|
@ -4204,6 +4208,18 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
// after all the non-compat methods have been added. The compat methods are added in
|
||||
// reverse so the most recently added ones take precedence over older compat methods.
|
||||
if (imethod.is_compat) {
|
||||
// If the method references deprecated types, mark the method as deprecated as well.
|
||||
for (const ArgumentInterface &iarg : imethod.arguments) {
|
||||
String arg_type_name = iarg.type.cname;
|
||||
String doc_name = arg_type_name.begins_with("_") ? arg_type_name.substr(1) : arg_type_name;
|
||||
const DocData::ClassDoc &class_doc = EditorHelp::get_doc_data()->class_list[doc_name];
|
||||
if (class_doc.is_deprecated) {
|
||||
imethod.is_deprecated = true;
|
||||
imethod.deprecation_message = "This method overload is deprecated.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
imethod.is_hidden = true;
|
||||
compat_methods.push_front(imethod);
|
||||
continue;
|
||||
|
|
@ -4244,9 +4260,8 @@ bool BindingsGenerator::_populate_object_type_interfaces() {
|
|||
isignal.name = method_info.name;
|
||||
isignal.cname = method_info.name;
|
||||
|
||||
int idx = 0;
|
||||
for (List<PropertyInfo>::ConstIterator itr = method_info.arguments.begin(); itr != method_info.arguments.end(); ++itr, ++idx) {
|
||||
const PropertyInfo &arginfo = *itr;
|
||||
for (int64_t idx = 0; idx < method_info.arguments.size(); ++idx) {
|
||||
const PropertyInfo &arginfo = method_info.arguments[idx];
|
||||
|
||||
String orig_arg_name = arginfo.name;
|
||||
|
||||
|
|
@ -4698,7 +4713,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
|
|||
"Parameter of type '" + String(r_iarg.type.cname) + "' can only have null/zero as the default value.");
|
||||
r_iarg.default_argument = "default";
|
||||
break;
|
||||
default:
|
||||
case Variant::VARIANT_MAX:
|
||||
ERR_FAIL_V_MSG(false, "Unexpected Variant type: " + itos(p_val.get_type()));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef BINDINGS_GENERATOR_H
|
||||
#define BINDINGS_GENERATOR_H
|
||||
#pragma once
|
||||
|
||||
#include "core/typedefs.h" // DEBUG_METHODS_ENABLED
|
||||
|
||||
#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED)
|
||||
#ifdef DEBUG_METHODS_ENABLED
|
||||
|
||||
#include "core/doc_data.h"
|
||||
#include "core/object/class_db.h"
|
||||
|
|
@ -875,5 +874,3 @@ public:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BINDINGS_GENERATOR_H
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_scr
|
|||
continue;
|
||||
}
|
||||
|
||||
String name = prop.name.substr(prop.name.find_char('/') + 1, prop.name.length());
|
||||
String name = prop.name.substr(prop.name.find_char('/') + 1);
|
||||
suggestions.push_back(quoted(name));
|
||||
}
|
||||
} break;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef CODE_COMPLETION_H
|
||||
#define CODE_COMPLETION_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
|
@ -52,5 +51,3 @@ enum class CompletionKind {
|
|||
|
||||
PackedStringArray get_code_completion(CompletionKind p_kind, const String &p_script_file);
|
||||
} // namespace gdmono
|
||||
|
||||
#endif // CODE_COMPLETION_H
|
||||
|
|
|
|||
|
|
@ -68,23 +68,15 @@ void godot_icall_GodotSharpDirs_MonoUserDir(godot_string *r_dest) {
|
|||
}
|
||||
|
||||
void godot_icall_GodotSharpDirs_BuildLogsDirs(godot_string *r_dest) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
memnew_placement(r_dest, String(GodotSharpDirs::get_build_logs_dir()));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void godot_icall_GodotSharpDirs_DataEditorToolsDir(godot_string *r_dest) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
memnew_placement(r_dest, String(GodotSharpDirs::get_data_editor_tools_dir()));
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void godot_icall_GodotSharpDirs_CSharpProjectName(godot_string *r_dest) {
|
||||
memnew_placement(r_dest, String(path::get_csharp_project_name()));
|
||||
memnew_placement(r_dest, String(Path::get_csharp_project_name()));
|
||||
}
|
||||
|
||||
void godot_icall_EditorProgress_Create(const godot_string *p_task, const godot_string *p_label, int32_t p_amount, bool p_can_cancel) {
|
||||
|
|
@ -105,7 +97,7 @@ bool godot_icall_EditorProgress_Step(const godot_string *p_task, const godot_str
|
|||
}
|
||||
|
||||
void godot_icall_Internal_FullExportTemplatesDir(godot_string *r_dest) {
|
||||
String full_templates_dir = EditorPaths::get_singleton()->get_export_templates_dir().path_join(VERSION_FULL_CONFIG);
|
||||
String full_templates_dir = EditorPaths::get_singleton()->get_export_templates_dir().path_join(GODOT_VERSION_FULL_CONFIG);
|
||||
memnew_placement(r_dest, String(full_templates_dir));
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +144,7 @@ bool godot_icall_Internal_IsAssembliesReloadingNeeded() {
|
|||
|
||||
void godot_icall_Internal_ReloadAssemblies(bool p_soft_reload) {
|
||||
#ifdef GD_MONO_HOT_RELOAD
|
||||
callable_mp(mono_bind::GodotSharp::get_singleton(), &mono_bind::GodotSharp::reload_assemblies).call_deferred(p_soft_reload);
|
||||
callable_mp(MonoBind::GodotSharp::get_singleton(), &MonoBind::GodotSharp::reload_assemblies).call_deferred(p_soft_reload);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef EDITOR_INTERNAL_CALLS_H
|
||||
#define EDITOR_INTERNAL_CALLS_H
|
||||
#pragma once
|
||||
|
||||
#include "core/typedefs.h"
|
||||
|
||||
namespace godotsharp {
|
||||
const void **get_editor_interop_funcs(int32_t &r_size);
|
||||
}
|
||||
|
||||
#endif // EDITOR_INTERNAL_CALLS_H
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ bool get_latest_fxr(const String &fxr_root, String &r_fxr_path) {
|
|||
return false;
|
||||
}
|
||||
|
||||
String fxr_with_ver = path::join(fxr_root, latest_ver_str);
|
||||
String hostfxr_file_path = path::join(fxr_with_ver, get_hostfxr_file_name());
|
||||
String fxr_with_ver = Path::join(fxr_root, latest_ver_str);
|
||||
String hostfxr_file_path = Path::join(fxr_with_ver, get_hostfxr_file_name());
|
||||
|
||||
ERR_FAIL_COND_V_MSG(!FileAccess::exists(hostfxr_file_path), false, "Missing hostfxr library in directory: " + fxr_with_ver);
|
||||
|
||||
|
|
@ -188,22 +188,22 @@ bool get_default_installation_dir(String &r_dotnet_root) {
|
|||
|
||||
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) || defined(_M_X64)
|
||||
// When emulating x64 on arm
|
||||
String dotnet_root_emulated = path::join(program_files_dir, "dotnet", "x64");
|
||||
if (FileAccess::exists(path::join(dotnet_root_emulated, "dotnet.exe"))) {
|
||||
String dotnet_root_emulated = Path::join(program_files_dir, "dotnet", "x64");
|
||||
if (FileAccess::exists(Path::join(dotnet_root_emulated, "dotnet.exe"))) {
|
||||
r_dotnet_root = dotnet_root_emulated;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
r_dotnet_root = path::join(program_files_dir, "dotnet");
|
||||
r_dotnet_root = Path::join(program_files_dir, "dotnet");
|
||||
return true;
|
||||
#elif defined(MACOS_ENABLED)
|
||||
r_dotnet_root = "/usr/local/share/dotnet";
|
||||
|
||||
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) || defined(_M_X64)
|
||||
// When emulating x64 on arm
|
||||
String dotnet_root_emulated = path::join(r_dotnet_root, "x64");
|
||||
if (FileAccess::exists(path::join(dotnet_root_emulated, "dotnet"))) {
|
||||
String dotnet_root_emulated = Path::join(r_dotnet_root, "x64");
|
||||
if (FileAccess::exists(Path::join(dotnet_root_emulated, "dotnet"))) {
|
||||
r_dotnet_root = dotnet_root_emulated;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -262,11 +262,11 @@ bool get_dotnet_self_registered_dir(String &r_dotnet_root) {
|
|||
return false;
|
||||
}
|
||||
|
||||
r_dotnet_root = String::utf16((const char16_t *)buffer.ptr()).replace("\\", "/");
|
||||
r_dotnet_root = String::utf16((const char16_t *)buffer.ptr()).replace_char('\\', '/');
|
||||
RegCloseKey(hkey);
|
||||
return true;
|
||||
#else
|
||||
String install_location_file = path::join("/etc/dotnet", "install_location_" + get_dotnet_arch().to_lower());
|
||||
String install_location_file = Path::join("/etc/dotnet", "install_location_" + get_dotnet_arch().to_lower());
|
||||
if (get_install_location_from_file(install_location_file, r_dotnet_root)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ bool get_dotnet_self_registered_dir(String &r_dotnet_root) {
|
|||
return false;
|
||||
}
|
||||
|
||||
String legacy_install_location_file = path::join("/etc/dotnet", "install_location");
|
||||
String legacy_install_location_file = Path::join("/etc/dotnet", "install_location");
|
||||
return get_install_location_from_file(legacy_install_location_file, r_dotnet_root);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ bool get_file_path_from_env(const String &p_env_key, String &r_dotnet_root) {
|
|||
String env_value = OS::get_singleton()->get_environment(p_env_key);
|
||||
|
||||
if (!env_value.is_empty()) {
|
||||
env_value = path::realpath(env_value);
|
||||
env_value = Path::realpath(env_value);
|
||||
|
||||
if (DirAccess::exists(env_value)) {
|
||||
r_dotnet_root = env_value;
|
||||
|
|
@ -321,7 +321,7 @@ bool get_dotnet_root_from_env(String &r_dotnet_root) {
|
|||
} //namespace
|
||||
|
||||
bool godotsharp::hostfxr_resolver::try_get_path_from_dotnet_root(const String &p_dotnet_root, String &r_fxr_path) {
|
||||
String fxr_dir = path::join(p_dotnet_root, "host", "fxr");
|
||||
String fxr_dir = Path::join(p_dotnet_root, "host", "fxr");
|
||||
if (!DirAccess::exists(fxr_dir)) {
|
||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
ERR_PRINT("The host fxr folder does not exist: " + fxr_dir + ".");
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef HOSTFXR_RESOLVER_H
|
||||
#define HOSTFXR_RESOLVER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
|
|
@ -41,5 +40,3 @@ bool try_get_path(String &r_out_dotnet_root, String &r_out_fxr_path);
|
|||
|
||||
} //namespace hostfxr_resolver
|
||||
} //namespace godotsharp
|
||||
|
||||
#endif // HOSTFXR_RESOLVER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SEMVER_H
|
||||
#define SEMVER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
|
|
@ -103,5 +102,3 @@ public:
|
|||
};
|
||||
|
||||
} //namespace godotsharp
|
||||
|
||||
#endif // SEMVER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue