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
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef CLASS_DB_API_JSON_H
|
||||
#define CLASS_DB_API_JSON_H
|
||||
#pragma once
|
||||
|
||||
// 'core/object/method_bind.h' defines DEBUG_METHODS_ENABLED, but it looks like we
|
||||
// cannot include it here. That's why we include it through 'core/object/class_db.h'.
|
||||
|
|
@ -42,5 +41,3 @@
|
|||
void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api);
|
||||
|
||||
#endif // DEBUG_METHODS_ENABLED
|
||||
|
||||
#endif // CLASS_DB_API_JSON_H
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@
|
|||
#include "editor/node_dock.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Types that will be skipped over (in favor of their base types) when setting up instance bindings.
|
||||
// This must be a superset of `ignored_types` in bindings_generator.cpp.
|
||||
const Vector<String> ignored_types = {};
|
||||
|
|
@ -364,7 +362,7 @@ Ref<Script> CSharpLanguage::make_template(const String &p_template, const String
|
|||
Ref<CSharpScript> scr;
|
||||
scr.instantiate();
|
||||
|
||||
String class_name_no_spaces = p_class_name.replace(" ", "_");
|
||||
String class_name_no_spaces = p_class_name.replace_char(' ', '_');
|
||||
String base_class_name = get_base_class_name(p_base_class_name, class_name_no_spaces);
|
||||
String processed_template = p_template;
|
||||
processed_template = processed_template.replace("_BINDINGS_NAMESPACE_", BINDINGS_NAMESPACE)
|
||||
|
|
@ -615,7 +613,7 @@ bool CSharpLanguage::is_assembly_reloading_needed() {
|
|||
return false; // Already up to date
|
||||
}
|
||||
} else {
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
|
||||
assembly_path = GodotSharpDirs::get_res_temp_assemblies_dir()
|
||||
.path_join(assembly_name + ".dll");
|
||||
|
|
@ -652,7 +650,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
|
|||
|
||||
for (SelfList<CSharpScript> *elem = script_list.first(); elem; elem = elem->next()) {
|
||||
// Do not reload scripts with only non-collectible instances to avoid disrupting event subscriptions and such.
|
||||
bool is_reloadable = elem->self()->instances.size() == 0;
|
||||
bool is_reloadable = elem->self()->instances.is_empty();
|
||||
for (Object *obj : elem->self()->instances) {
|
||||
ERR_CONTINUE(!obj->get_script_instance());
|
||||
CSharpInstance *csi = static_cast<CSharpInstance *>(obj->get_script_instance());
|
||||
|
|
@ -1059,7 +1057,7 @@ void CSharpLanguage::_editor_init_callback() {
|
|||
const void **interop_funcs = godotsharp::get_editor_interop_funcs(interop_funcs_size);
|
||||
|
||||
Object *editor_plugin_obj = GDMono::get_singleton()->get_plugin_callbacks().LoadToolsAssemblyCallback(
|
||||
GodotSharpDirs::get_data_editor_tools_dir().path_join("GodotTools.dll").utf16(),
|
||||
GodotSharpDirs::get_data_editor_tools_dir().path_join("GodotTools.dll").utf16().get_data(),
|
||||
interop_funcs, interop_funcs_size);
|
||||
CRASH_COND(editor_plugin_obj == nullptr);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef CSHARP_SCRIPT_H
|
||||
#define CSHARP_SCRIPT_H
|
||||
#pragma once
|
||||
|
||||
#include "mono_gc_handle.h"
|
||||
#include "mono_gd/gd_mono.h"
|
||||
|
|
@ -603,5 +602,3 @@ public:
|
|||
void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const override;
|
||||
bool recognize(const Ref<Resource> &p_resource) const override;
|
||||
};
|
||||
|
||||
#endif // CSHARP_SCRIPT_H
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ internal static class ExtensionMethods
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1035,12 +1035,17 @@ namespace Godot.Collections
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Typed wrapper around Godot's Array class, an array of Variant
|
||||
/// typed elements allocated in the engine in C++. Useful when
|
||||
/// interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// Typed wrapper around Godot's Array class, an array of <typeparamref name="T"/>
|
||||
/// annotated, Variant typed elements allocated in the engine in C++.
|
||||
/// Useful when interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// such as arrays or <see cref="List{T}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the array.</typeparam>
|
||||
/// <remarks>
|
||||
/// While the elements are statically annotated to <typeparamref name="T"/>,
|
||||
/// the underlying array still stores <see cref="Variant"/>, which has the same
|
||||
/// memory footprint per element as an untyped <see cref="Array"/>.
|
||||
/// </remarks>
|
||||
[DebuggerTypeProxy(typeof(ArrayDebugView<>))]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
[SuppressMessage("ReSharper", "RedundantExtendsListEntry")]
|
||||
|
|
|
|||
|
|
@ -476,13 +476,18 @@ namespace Godot.Collections
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Typed wrapper around Godot's Dictionary class, a dictionary of Variant
|
||||
/// typed elements allocated in the engine in C++. Useful when
|
||||
/// interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// Typed wrapper around Godot's Dictionary class, a dictionary of <typeparamref name="TKey"/>
|
||||
/// and <typeparamref name="TValue"/> annotated, Variant typed elements allocated in the engine in C++.
|
||||
/// Useful when interfacing with the engine. Otherwise prefer .NET collections
|
||||
/// such as <see cref="System.Collections.Generic.Dictionary{TKey, TValue}"/>.
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey">The type of the dictionary's keys.</typeparam>
|
||||
/// <typeparam name="TValue">The type of the dictionary's values.</typeparam>
|
||||
/// <remarks>
|
||||
/// While the elements are statically annotated to <typeparamref name="TKey"/> and <typeparamref name="TValue"/>,
|
||||
/// the underlying dictionary still stores <see cref="Variant"/>, which has the same memory footprint per element
|
||||
/// as an untyped <see cref="Dictionary"/>.
|
||||
/// </remarks>
|
||||
[DebuggerTypeProxy(typeof(DictionaryDebugView<,>))]
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
[SuppressMessage("Design", "CA1001", MessageId = "Types that own disposable fields should be disposable",
|
||||
|
|
|
|||
|
|
@ -455,6 +455,12 @@ namespace Godot.NativeInterop
|
|||
get => _data._m_obj_data.obj;
|
||||
}
|
||||
|
||||
public readonly ulong ObjectId
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => _data._m_obj_data.id;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
switch (Type)
|
||||
|
|
|
|||
|
|
@ -503,6 +503,9 @@ namespace Godot.NativeInterop
|
|||
public static partial void godotsharp_string_simplify_path(scoped in godot_string p_self,
|
||||
out godot_string r_simplified_path);
|
||||
|
||||
public static partial void godotsharp_string_capitalize(scoped in godot_string p_self,
|
||||
out godot_string r_capitalized);
|
||||
|
||||
public static partial void godotsharp_string_to_camel_case(scoped in godot_string p_self,
|
||||
out godot_string r_camel_case);
|
||||
|
||||
|
|
@ -512,6 +515,9 @@ namespace Godot.NativeInterop
|
|||
public static partial void godotsharp_string_to_snake_case(scoped in godot_string p_self,
|
||||
out godot_string r_snake_case);
|
||||
|
||||
public static partial void godotsharp_string_to_kebab_case(scoped in godot_string p_self,
|
||||
out godot_string r_kebab_case);
|
||||
|
||||
// NodePath
|
||||
|
||||
public static partial void godotsharp_node_path_get_as_property_path(in godot_node_path p_self,
|
||||
|
|
|
|||
|
|
@ -485,7 +485,14 @@ namespace Godot.NativeInterop
|
|||
NativeFuncs.godotsharp_variant_as_rid(p_var);
|
||||
|
||||
public static IntPtr ConvertToGodotObjectPtr(in godot_variant p_var)
|
||||
=> p_var.Type == Variant.Type.Object ? p_var.Object : IntPtr.Zero;
|
||||
{
|
||||
if (p_var.Type != Variant.Type.Object || p_var.ObjectId == 0)
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
return NativeFuncs.godotsharp_instance_from_id(p_var.ObjectId);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static GodotObject ConvertToGodotObject(in godot_variant p_var)
|
||||
|
|
|
|||
|
|
@ -845,6 +845,33 @@ namespace Godot
|
|||
W = w;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a projection from 16 scalars.
|
||||
/// </summary>
|
||||
/// <param name="xx">The X column vector's X component, accessed via <c>p.X.X</c> or <c>[0][0]</c>.</param>
|
||||
/// <param name="xy">The X column vector's Y component, accessed via <c>p.X.Y</c> or <c>[0][1]</c>.</param>
|
||||
/// <param name="xz">The X column vector's Z component, accessed via <c>p.X.Z</c> or <c>[0][2]</c>.</param>
|
||||
/// <param name="xw">The X column vector's W component, accessed via <c>p.X.W</c> or <c>[0][3]</c>.</param>
|
||||
/// <param name="yx">The Y column vector's X component, accessed via <c>p.Y.X</c> or <c>[1][0]</c>.</param>
|
||||
/// <param name="yy">The Y column vector's Y component, accessed via <c>p.Y.Y</c> or <c>[1][1]</c>.</param>
|
||||
/// <param name="yz">The Y column vector's Z component, accessed via <c>p.Y.Z</c> or <c>[1][2]</c>.</param>
|
||||
/// <param name="yw">The Y column vector's W component, accessed via <c>p.Y.W</c> or <c>[1][3]</c>.</param>
|
||||
/// <param name="zx">The Z column vector's X component, accessed via <c>p.Z.X</c> or <c>[2][0]</c>.</param>
|
||||
/// <param name="zy">The Z column vector's Y component, accessed via <c>p.Z.Y</c> or <c>[2][1]</c>.</param>
|
||||
/// <param name="zz">The Z column vector's Z component, accessed via <c>p.Z.Z</c> or <c>[2][2]</c>.</param>
|
||||
/// <param name="zw">The Z column vector's W component, accessed via <c>p.Z.W</c> or <c>[2][3]</c>.</param>
|
||||
/// <param name="wx">The W column vector's X component, accessed via <c>p.W.X</c> or <c>[3][0]</c>.</param>
|
||||
/// <param name="wy">The W column vector's Y component, accessed via <c>p.W.Y</c> or <c>[3][1]</c>.</param>
|
||||
/// <param name="wz">The W column vector's Z component, accessed via <c>p.W.Z</c> or <c>[3][2]</c>.</param>
|
||||
/// <param name="ww">The W column vector's W component, accessed via <c>p.W.W</c> or <c>[3][3]</c>.</param>
|
||||
public Projection(real_t xx, real_t xy, real_t xz, real_t xw, real_t yx, real_t yy, real_t yz, real_t yw, real_t zx, real_t zy, real_t zz, real_t zw, real_t wx, real_t wy, real_t wz, real_t ww)
|
||||
{
|
||||
X = new Vector4(xx, xy, xz, xw);
|
||||
Y = new Vector4(yx, yy, yz, yw);
|
||||
Z = new Vector4(zx, zy, zz, zw);
|
||||
W = new Vector4(wx, wy, wz, ww);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Projection"/> from a <see cref="Transform3D"/>.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -48,12 +48,19 @@ namespace Godot
|
|||
|
||||
awaiter._completed = true;
|
||||
|
||||
Variant[] signalArgs = new Variant[argCount];
|
||||
if (argCount > 0)
|
||||
{
|
||||
Variant[] signalArgs = new Variant[argCount];
|
||||
|
||||
for (int i = 0; i < argCount; i++)
|
||||
signalArgs[i] = Variant.CreateCopyingBorrowed(*args[i]);
|
||||
for (int i = 0; i < argCount; i++)
|
||||
signalArgs[i] = Variant.CreateCopyingBorrowed(*args[i]);
|
||||
|
||||
awaiter._result = signalArgs;
|
||||
awaiter._result = signalArgs;
|
||||
}
|
||||
else
|
||||
{
|
||||
awaiter._result = [];
|
||||
}
|
||||
|
||||
awaiter._continuation?.Invoke();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,22 +314,10 @@ namespace Godot
|
|||
/// <returns>The capitalized string.</returns>
|
||||
public static string Capitalize(this string instance)
|
||||
{
|
||||
string aux = instance.CamelcaseToUnderscore(true).Replace("_", " ", StringComparison.Ordinal).Trim();
|
||||
string cap = string.Empty;
|
||||
|
||||
for (int i = 0; i < aux.GetSliceCount(" "); i++)
|
||||
{
|
||||
string slice = aux.GetSliceCharacter(' ', i);
|
||||
if (slice.Length > 0)
|
||||
{
|
||||
slice = char.ToUpperInvariant(slice[0]) + slice.Substring(1);
|
||||
if (i > 0)
|
||||
cap += " ";
|
||||
cap += slice;
|
||||
}
|
||||
}
|
||||
|
||||
return cap;
|
||||
using godot_string instanceStr = Marshaling.ConvertStringToNative(instance);
|
||||
NativeFuncs.godotsharp_string_capitalize(instanceStr, out godot_string capitalized);
|
||||
using (capitalized)
|
||||
return Marshaling.ConvertStringToManaged(capitalized);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -371,49 +359,17 @@ namespace Godot
|
|||
return Marshaling.ConvertStringToManaged(snakeCase);
|
||||
}
|
||||
|
||||
private static string CamelcaseToUnderscore(this string instance, bool lowerCase)
|
||||
/// <summary>
|
||||
/// Returns the string converted to <c>kebab-case</c>.
|
||||
/// </summary>
|
||||
/// <param name="instance">The string to convert.</param>
|
||||
/// <returns>The converted string.</returns>
|
||||
public static string ToKebabCase(this string instance)
|
||||
{
|
||||
string newString = string.Empty;
|
||||
int startIndex = 0;
|
||||
|
||||
for (int i = 1; i < instance.Length; i++)
|
||||
{
|
||||
bool isUpper = char.IsUpper(instance[i]);
|
||||
bool isNumber = char.IsDigit(instance[i]);
|
||||
|
||||
bool areNext2Lower = false;
|
||||
bool isNextLower = false;
|
||||
bool isNextNumber = false;
|
||||
bool wasPrecedentUpper = char.IsUpper(instance[i - 1]);
|
||||
bool wasPrecedentNumber = char.IsDigit(instance[i - 1]);
|
||||
|
||||
if (i + 2 < instance.Length)
|
||||
{
|
||||
areNext2Lower = char.IsLower(instance[i + 1]) && char.IsLower(instance[i + 2]);
|
||||
}
|
||||
|
||||
if (i + 1 < instance.Length)
|
||||
{
|
||||
isNextLower = char.IsLower(instance[i + 1]);
|
||||
isNextNumber = char.IsDigit(instance[i + 1]);
|
||||
}
|
||||
|
||||
bool condA = isUpper && !wasPrecedentUpper && !wasPrecedentNumber;
|
||||
bool condB = wasPrecedentUpper && isUpper && areNext2Lower;
|
||||
bool condC = isNumber && !wasPrecedentNumber;
|
||||
bool canBreakNumberLetter = isNumber && !wasPrecedentNumber && isNextLower;
|
||||
bool canBreakLetterNumber = !isNumber && wasPrecedentNumber && (isNextLower || isNextNumber);
|
||||
|
||||
bool shouldSplit = condA || condB || condC || canBreakNumberLetter || canBreakLetterNumber;
|
||||
if (shouldSplit)
|
||||
{
|
||||
newString += string.Concat(instance.AsSpan(startIndex, i - startIndex), "_");
|
||||
startIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
newString += instance.Substring(startIndex, instance.Length - startIndex);
|
||||
return lowerCase ? newString.ToLowerInvariant() : newString;
|
||||
using godot_string instanceStr = Marshaling.ConvertStringToNative(instance);
|
||||
NativeFuncs.godotsharp_string_to_kebab_case(instanceStr, out godot_string kebabCase);
|
||||
using (kebabCase)
|
||||
return Marshaling.ConvertStringToManaged(kebabCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -1359,7 +1315,9 @@ namespace Godot
|
|||
/// <returns>The concatenated path with the given file name.</returns>
|
||||
public static string PathJoin(this string instance, string file)
|
||||
{
|
||||
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
|
||||
if (instance.Length == 0)
|
||||
return file;
|
||||
if (instance[^1] == '/' || (file.Length > 0 && file[0] == '/'))
|
||||
return instance + file;
|
||||
return instance + "/" + file;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,23 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the result of the component-wise minimum between
|
||||
/// this vector and <paramref name="with"/>.
|
||||
/// Equivalent to <c>new Vector3(Mathf.Min(X, with), Mathf.Min(Y, with), Mathf.Min(Z, with))</c>.
|
||||
/// </summary>
|
||||
/// <param name="with">The other value to use.</param>
|
||||
/// <returns>The resulting minimum vector.</returns>
|
||||
public readonly Vector3 Min(real_t with)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
Mathf.Min(X, with),
|
||||
Mathf.Min(Y, with),
|
||||
Mathf.Min(Z, with)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.X"/>.
|
||||
|
|
@ -751,6 +768,50 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the octahedral-encoded (oct32) form of this Vector3 as a Vector2. Since a Vector2 occupies 1/3 less memory compared to Vector3,
|
||||
/// this form of compression can be used to pass greater amounts of normalized Vector3s without increasing storage or memory requirements.
|
||||
/// See also <see cref="Normalized()"/>, <see cref="OctahedronDecode(Vector2)"/>.
|
||||
/// Note: OctahedronEncode can only be used for normalized vectors. OctahedronEncode does not check whether this Vector3 is normalized,
|
||||
/// and will return a value that does not decompress to the original value if the Vector3 is not normalized.
|
||||
/// Note: Octahedral compression is lossy, although visual differences are rarely perceptible in real world scenarios.
|
||||
/// </summary>
|
||||
/// <returns>The encoded Vector2.</returns>
|
||||
public readonly Vector2 OctahedronEncode()
|
||||
{
|
||||
Vector3 n = this;
|
||||
n /= Mathf.Abs(n.X) + Mathf.Abs(n.Y) + Mathf.Abs(n.Z);
|
||||
Vector2 o;
|
||||
if (n.Z >= 0.0f)
|
||||
{
|
||||
o.X = n.X;
|
||||
o.Y = n.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
o.X = (1.0f - Mathf.Abs(n.Y)) * (n.X >= 0.0f ? 1.0f : -1.0f);
|
||||
o.Y = (1.0f - Mathf.Abs(n.X)) * (n.Y >= 0.0f ? 1.0f : -1.0f);
|
||||
}
|
||||
o.X = o.X * 0.5f + 0.5f;
|
||||
o.Y = o.Y * 0.5f + 0.5f;
|
||||
return o;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the Vector3 from an octahedral-compressed form created using <see cref="OctahedronEncode()"/> (stored as a Vector2).
|
||||
/// </summary>
|
||||
/// <param name="oct">Encoded Vector2</param>
|
||||
/// <returns>The decoded normalized Vector3.</returns>
|
||||
public static Vector3 OctahedronDecode(Vector2 oct)
|
||||
{
|
||||
var f = new Vector2(oct.X * 2.0f - 1.0f, oct.Y * 2.0f - 1.0f);
|
||||
var n = new Vector3(f.X, f.Y, 1.0f - Mathf.Abs(f.X) - Mathf.Abs(f.Y));
|
||||
real_t t = Mathf.Clamp(-n.Z, 0.0f, 1.0f);
|
||||
n.X += n.X >= 0 ? -t : t;
|
||||
n.Y += n.Y >= 0 ? -t : t;
|
||||
return n.Normalized();
|
||||
}
|
||||
|
||||
// Constants
|
||||
private static readonly Vector3 _zero = new Vector3(0, 0, 0);
|
||||
private static readonly Vector3 _one = new Vector3(1, 1, 1);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>GodotSharp</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharp</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<Authors>Godot Engine contributors</Authors>
|
||||
|
||||
<PackageId>GodotSharpEditor</PackageId>
|
||||
<Version>4.4.0</Version>
|
||||
<Version>4.5.0</Version>
|
||||
<PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion>
|
||||
<RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharpEditor</RepositoryUrl>
|
||||
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
|
||||
|
|
|
|||
|
|
@ -934,7 +934,7 @@ bool godotsharp_variant_equals(const godot_variant *p_a, const godot_variant *p_
|
|||
|
||||
void godotsharp_string_new_with_utf16_chars(String *r_dest, const char16_t *p_contents) {
|
||||
memnew_placement(r_dest, String());
|
||||
r_dest->parse_utf16(p_contents);
|
||||
r_dest->append_utf16(p_contents);
|
||||
}
|
||||
|
||||
// string_name.h
|
||||
|
|
@ -1289,6 +1289,10 @@ void godotsharp_string_simplify_path(const String *p_self, String *r_simplified_
|
|||
memnew_placement(r_simplified_path, String(p_self->simplify_path()));
|
||||
}
|
||||
|
||||
void godotsharp_string_capitalize(const String *p_self, String *r_capitalized) {
|
||||
memnew_placement(r_capitalized, String(p_self->capitalize()));
|
||||
}
|
||||
|
||||
void godotsharp_string_to_camel_case(const String *p_self, String *r_camel_case) {
|
||||
memnew_placement(r_camel_case, String(p_self->to_camel_case()));
|
||||
}
|
||||
|
|
@ -1301,6 +1305,10 @@ void godotsharp_string_to_snake_case(const String *p_self, String *r_snake_case)
|
|||
memnew_placement(r_snake_case, String(p_self->to_snake_case()));
|
||||
}
|
||||
|
||||
void godotsharp_string_to_kebab_case(const String *p_self, String *r_kebab_case) {
|
||||
memnew_placement(r_kebab_case, String(p_self->to_kebab_case()));
|
||||
}
|
||||
|
||||
void godotsharp_node_path_get_as_property_path(const NodePath *p_ptr, NodePath *r_dest) {
|
||||
memnew_placement(r_dest, NodePath(p_ptr->get_as_property_path()));
|
||||
}
|
||||
|
|
@ -1700,9 +1708,11 @@ static const void *unmanaged_callbacks[]{
|
|||
(void *)godotsharp_dictionary_get_typed_value_script,
|
||||
(void *)godotsharp_dictionary_to_string,
|
||||
(void *)godotsharp_string_simplify_path,
|
||||
(void *)godotsharp_string_capitalize,
|
||||
(void *)godotsharp_string_to_camel_case,
|
||||
(void *)godotsharp_string_to_pascal_case,
|
||||
(void *)godotsharp_string_to_snake_case,
|
||||
(void *)godotsharp_string_to_kebab_case,
|
||||
(void *)godotsharp_node_path_get_as_property_path,
|
||||
(void *)godotsharp_node_path_get_concatenated_names,
|
||||
(void *)godotsharp_node_path_get_concatenated_subnames,
|
||||
|
|
|
|||
|
|
@ -28,13 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef RUNTIME_INTEROP_H
|
||||
#define RUNTIME_INTEROP_H
|
||||
#pragma once
|
||||
|
||||
#include "core/typedefs.h"
|
||||
|
||||
namespace godotsharp {
|
||||
const void **get_runtime_interop_funcs(int32_t &r_size);
|
||||
}
|
||||
|
||||
#endif // RUNTIME_INTEROP_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOTSHARP_DEFS_H
|
||||
#define GODOTSHARP_DEFS_H
|
||||
#pragma once
|
||||
|
||||
#define BINDINGS_NAMESPACE "Godot"
|
||||
#define BINDINGS_NAMESPACE_COLLECTIONS BINDINGS_NAMESPACE ".Collections"
|
||||
|
|
@ -40,5 +39,3 @@
|
|||
|
||||
#define BINDINGS_CLASS_NATIVECALLS "NativeCalls"
|
||||
#define BINDINGS_CLASS_NATIVECALLS_EDITOR "EditorNativeCalls"
|
||||
|
||||
#endif // GODOTSHARP_DEFS_H
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ private:
|
|||
#else // TOOLS_ENABLED
|
||||
String platform = _get_platform_name();
|
||||
String arch = Engine::get_singleton()->get_architecture_name();
|
||||
String appname_safe = path::get_csharp_project_name();
|
||||
String appname_safe = Path::get_csharp_project_name();
|
||||
String packed_path = "res://.godot/mono/publish/" + arch;
|
||||
if (DirAccess::exists(packed_path)) {
|
||||
// The dotnet publish data is packed in the pck/zip.
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GODOTSHARP_DIRS_H
|
||||
#define GODOTSHARP_DIRS_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
|
|
@ -48,5 +47,3 @@ String get_data_editor_tools_dir();
|
|||
#endif
|
||||
|
||||
} // namespace GodotSharpDirs
|
||||
|
||||
#endif // GODOTSHARP_DIRS_H
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m2.256 4.85 1.7 2.945 2.598-1.5 4.5 7.794a1 1-30 0 0 2.598-1.5l-4.65-8.054 3.464-2-.25-.433s-1.25-2.165-3.848-.665l-3.464 2-.31.063z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="m2.256 4.85 1.7 2.945 2.598-1.5 4.5 7.794a1 1-30 0 0 2.598-1.5l-4.65-8.054 3.464-2-.25-.433s-1.25-2.165-3.848-.665l-3.464 2-.31.063z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 229 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M6 10a3 3 0 1 0 0 6h1v-2H6a1 1 0 0 1 0-2h1v-2zm1-9-.564 2.258a4.91 4.91 0 0 0-.69.28L3.758 2.343 2.344 3.758l1.195 1.994-.285.685L1 7v2h5.27a2 2 0 1 1 3.46 0H15V7l-2.258-.565a5.007 5.007 0 0 0-.28-.687l1.194-1.99-1.414-1.414-1.994 1.195a4.998 4.998 0 0 0-.686-.285L9 1zm4 9a2 2 0 1 0 0 4H9v2h2a2 2 0 1 0 0-4h2v-2z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#e0e0e0" d="M6 10a3 3 0 1 0 0 6h1v-2H6a1 1 0 0 1 0-2h1v-2zm1-9-.564 2.258a4.91 4.91 0 0 0-.69.28L3.758 2.343 2.344 3.758l1.195 1.994-.285.685L1 7v2h5.27a2 2 0 1 1 3.46 0H15V7l-2.258-.565a5.007 5.007 0 0 0-.28-.687l1.194-1.99-1.414-1.414-1.994 1.195a4.998 4.998 0 0 0-.686-.285L9 1zm4 9a2 2 0 1 0 0 4H9v2h2a2 2 0 1 0 0-4h2v-2z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 410 B |
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef INTEROP_TYPES_H
|
||||
#define INTEROP_TYPES_H
|
||||
#pragma once
|
||||
|
||||
#include "core/math/math_defs.h"
|
||||
|
||||
|
|
@ -204,5 +203,3 @@ typedef struct {
|
|||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INTEROP_TYPES_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MANAGED_CALLABLE_H
|
||||
#define MANAGED_CALLABLE_H
|
||||
#pragma once
|
||||
|
||||
#include "mono_gc_handle.h"
|
||||
|
||||
|
|
@ -73,5 +72,3 @@ public:
|
|||
ManagedCallable(GCHandleIntPtr p_delegate_handle, void *p_trampoline, ObjectID p_object_id);
|
||||
~ManagedCallable();
|
||||
};
|
||||
|
||||
#endif // MANAGED_CALLABLE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_GC_HANDLE_H
|
||||
#define MONO_GC_HANDLE_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
|
||||
|
|
@ -85,5 +84,3 @@ struct MonoGCHandleData {
|
|||
type(p_type) {
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MONO_GC_HANDLE_H
|
||||
|
|
|
|||
|
|
@ -101,11 +101,11 @@ String find_hostfxr() {
|
|||
|
||||
// hostfxr_resolver doesn't look for dotnet in `PATH`. If it fails, we try to find the dotnet
|
||||
// executable in `PATH` here and pass its location as `dotnet_root` to `get_hostfxr_path`.
|
||||
String dotnet_exe = path::find_executable("dotnet");
|
||||
String dotnet_exe = Path::find_executable("dotnet");
|
||||
|
||||
if (!dotnet_exe.is_empty()) {
|
||||
// The file found in PATH may be a symlink
|
||||
dotnet_exe = path::abspath(path::realpath(dotnet_exe));
|
||||
dotnet_exe = Path::abspath(Path::realpath(dotnet_exe));
|
||||
|
||||
// TODO:
|
||||
// Sometimes, the symlink may not point to the dotnet executable in the dotnet root.
|
||||
|
|
@ -385,7 +385,7 @@ godot_plugins_initialize_fn initialize_hostfxr_and_godot_plugins(bool &r_runtime
|
|||
godot_plugins_initialize_fn initialize_hostfxr_and_godot_plugins(bool &r_runtime_initialized) {
|
||||
godot_plugins_initialize_fn godot_plugins_initialize = nullptr;
|
||||
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
|
||||
HostFxrCharString assembly_path = str_to_hostfxr(GodotSharpDirs::get_api_assemblies_dir()
|
||||
.path_join(assembly_name + ".dll"));
|
||||
|
|
@ -410,12 +410,14 @@ godot_plugins_initialize_fn initialize_hostfxr_and_godot_plugins(bool &r_runtime
|
|||
}
|
||||
|
||||
godot_plugins_initialize_fn try_load_native_aot_library(void *&r_aot_dll_handle) {
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
|
||||
#if defined(WINDOWS_ENABLED)
|
||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dll");
|
||||
#elif defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".dylib");
|
||||
#elif defined(ANDROID_ENABLED)
|
||||
String native_aot_so_path = "lib" + assembly_name + ".so";
|
||||
#elif defined(UNIX_ENABLED)
|
||||
String native_aot_so_path = GodotSharpDirs::get_api_assemblies_dir().path_join(assembly_name + ".so");
|
||||
#else
|
||||
|
|
@ -461,12 +463,12 @@ String make_tpa_list() {
|
|||
godot_plugins_initialize_fn initialize_coreclr_and_godot_plugins(bool &r_runtime_initialized) {
|
||||
godot_plugins_initialize_fn godot_plugins_initialize = nullptr;
|
||||
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
|
||||
String tpa_list = make_tpa_list();
|
||||
const char *prop_keys[] = { "TRUSTED_PLATFORM_ASSEMBLIES" };
|
||||
const char *prop_values[] = { tpa_list.utf8().get_data() };
|
||||
int nprops = sizeof(prop_keys) / sizeof(prop_keys[0]);
|
||||
constexpr int nprops = std::size(prop_keys);
|
||||
|
||||
void *coreclr_handle = nullptr;
|
||||
unsigned int domain_id = 0;
|
||||
|
|
@ -625,7 +627,7 @@ void GDMono::_init_godot_api_hashes() {
|
|||
|
||||
#ifdef TOOLS_ENABLED
|
||||
bool GDMono::_load_project_assembly() {
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
|
||||
String assembly_path = GodotSharpDirs::get_res_temp_assemblies_dir()
|
||||
.path_join(assembly_name + ".dll");
|
||||
|
|
@ -636,7 +638,7 @@ bool GDMono::_load_project_assembly() {
|
|||
}
|
||||
|
||||
String loaded_assembly_path;
|
||||
bool success = plugin_callbacks.LoadProjectAssemblyCallback(assembly_path.utf16(), &loaded_assembly_path);
|
||||
bool success = plugin_callbacks.LoadProjectAssemblyCallback(assembly_path.utf16().get_data(), &loaded_assembly_path);
|
||||
|
||||
if (success) {
|
||||
project_assembly_path = loaded_assembly_path.simplify_path();
|
||||
|
|
@ -656,7 +658,7 @@ void GDMono::reload_failure() {
|
|||
|
||||
ERR_PRINT_ED(".NET: Giving up on assembly reloading. Please restart the editor if unloading was failing.");
|
||||
|
||||
String assembly_name = path::get_csharp_project_name();
|
||||
String assembly_name = Path::get_csharp_project_name();
|
||||
String assembly_path = GodotSharpDirs::get_res_temp_assemblies_dir().path_join(assembly_name + ".dll");
|
||||
assembly_path = ProjectSettings::get_singleton()->globalize_path(assembly_path);
|
||||
project_assembly_path = assembly_path.simplify_path();
|
||||
|
|
@ -714,7 +716,7 @@ GDMono::~GDMono() {
|
|||
singleton = nullptr;
|
||||
}
|
||||
|
||||
namespace mono_bind {
|
||||
namespace MonoBind {
|
||||
|
||||
GodotSharp *GodotSharp::singleton = nullptr;
|
||||
|
||||
|
|
@ -737,4 +739,4 @@ GodotSharp::~GodotSharp() {
|
|||
singleton = nullptr;
|
||||
}
|
||||
|
||||
} // namespace mono_bind
|
||||
} // namespace MonoBind
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GD_MONO_H
|
||||
#define GD_MONO_H
|
||||
#pragma once
|
||||
|
||||
#include "../godotsharp_defs.h"
|
||||
|
||||
|
|
@ -162,7 +161,7 @@ public:
|
|||
~GDMono();
|
||||
};
|
||||
|
||||
namespace mono_bind {
|
||||
namespace MonoBind {
|
||||
|
||||
class GodotSharp : public Object {
|
||||
GDCLASS(GodotSharp, Object);
|
||||
|
|
@ -179,6 +178,4 @@ public:
|
|||
~GodotSharp();
|
||||
};
|
||||
|
||||
} // namespace mono_bind
|
||||
|
||||
#endif // GD_MONO_H
|
||||
} // namespace MonoBind
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GD_MONO_CACHE_H
|
||||
#define GD_MONO_CACHE_H
|
||||
#pragma once
|
||||
|
||||
#include "../csharp_script.h"
|
||||
#include "../interop_types.h"
|
||||
|
|
@ -42,8 +41,6 @@
|
|||
#include "core/variant/dictionary.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class CSharpScript;
|
||||
|
||||
namespace GDMonoCache {
|
||||
|
|
@ -157,5 +154,3 @@ extern bool godot_api_cache_updated;
|
|||
void update_godot_api_cache(const ManagedCallbacks &p_managed_callbacks);
|
||||
|
||||
} // namespace GDMonoCache
|
||||
|
||||
#endif // GD_MONO_CACHE_H
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ CSharpLanguage *script_language_cs = nullptr;
|
|||
Ref<ResourceFormatLoaderCSharpScript> resource_loader_cs;
|
||||
Ref<ResourceFormatSaverCSharpScript> resource_saver_cs;
|
||||
|
||||
mono_bind::GodotSharp *_godotsharp = nullptr;
|
||||
MonoBind::GodotSharp *_godotsharp = nullptr;
|
||||
|
||||
void initialize_mono_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
|
||||
|
|
@ -47,17 +47,18 @@ void initialize_mono_module(ModuleInitializationLevel p_level) {
|
|||
|
||||
GDREGISTER_CLASS(CSharpScript);
|
||||
|
||||
_godotsharp = memnew(mono_bind::GodotSharp);
|
||||
_godotsharp = memnew(MonoBind::GodotSharp);
|
||||
|
||||
script_language_cs = memnew(CSharpLanguage);
|
||||
script_language_cs->set_language_index(ScriptServer::get_language_count());
|
||||
ScriptServer::register_language(script_language_cs);
|
||||
|
||||
resource_loader_cs.instantiate();
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_cs);
|
||||
|
||||
resource_saver_cs.instantiate();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_cs);
|
||||
if (GD_IS_CLASS_ENABLED(CSharpScript)) {
|
||||
resource_loader_cs.instantiate();
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_cs);
|
||||
resource_saver_cs.instantiate();
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_cs);
|
||||
}
|
||||
}
|
||||
|
||||
void uninitialize_mono_module(ModuleInitializationLevel p_level) {
|
||||
|
|
@ -71,11 +72,12 @@ void uninitialize_mono_module(ModuleInitializationLevel p_level) {
|
|||
memdelete(script_language_cs);
|
||||
}
|
||||
|
||||
ResourceLoader::remove_resource_format_loader(resource_loader_cs);
|
||||
resource_loader_cs.unref();
|
||||
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_cs);
|
||||
resource_saver_cs.unref();
|
||||
if (GD_IS_CLASS_ENABLED(CSharpScript)) {
|
||||
ResourceLoader::remove_resource_format_loader(resource_loader_cs);
|
||||
resource_loader_cs.unref();
|
||||
ResourceSaver::remove_resource_format_saver(resource_saver_cs);
|
||||
resource_saver_cs.unref();
|
||||
}
|
||||
|
||||
if (_godotsharp) {
|
||||
memdelete(_godotsharp);
|
||||
|
|
|
|||
|
|
@ -28,12 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_REGISTER_TYPES_H
|
||||
#define MONO_REGISTER_TYPES_H
|
||||
#pragma once
|
||||
|
||||
#include "modules/register_module_types.h"
|
||||
|
||||
void initialize_mono_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_mono_module(ModuleInitializationLevel p_level);
|
||||
|
||||
#endif // MONO_REGISTER_TYPES_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SIGNAL_AWAITER_UTILS_H
|
||||
#define SIGNAL_AWAITER_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include "csharp_script.h"
|
||||
#include "mono_gc_handle.h"
|
||||
|
|
@ -98,5 +97,3 @@ public:
|
|||
|
||||
EventSignalCallable(Object *p_owner, const StringName &p_event_signal_name);
|
||||
};
|
||||
|
||||
#endif // SIGNAL_AWAITER_UTILS_H
|
||||
|
|
|
|||
|
|
@ -28,17 +28,17 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "macos_utils.h"
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
|
||||
#import "macos_utils.h"
|
||||
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
#import <CoreServices/CoreServices.h>
|
||||
|
||||
bool macos_is_app_bundle_installed(const String &p_bundle_id) {
|
||||
CFStringRef bundle_id = CFStringCreateWithCString(nullptr, p_bundle_id.utf8(), kCFStringEncodingUTF8);
|
||||
CFStringRef bundle_id = CFStringCreateWithCString(nullptr, p_bundle_id.utf8().get_data(), kCFStringEncodingUTF8);
|
||||
CFArrayRef result = LSCopyApplicationURLsForBundleIdentifier(bundle_id, nullptr);
|
||||
CFRelease(bundle_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_MACOS_UTILS_H
|
||||
#define MONO_MACOS_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#ifdef MACOS_ENABLED
|
||||
|
||||
|
|
@ -38,5 +37,3 @@
|
|||
bool macos_is_app_bundle_installed(const String &p_bundle_id);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // MONO_MACOS_UTILS_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_MACROS_H
|
||||
#define MONO_MACROS_H
|
||||
#pragma once
|
||||
|
||||
#define _GD_VARNAME_CONCAT_B_(m_ignore, m_name) m_name
|
||||
#define _GD_VARNAME_CONCAT_A_(m_a, m_b, m_c) _GD_VARNAME_CONCAT_B_(hello there, m_a##m_b##m_c)
|
||||
|
|
@ -68,5 +67,3 @@ public:
|
|||
|
||||
#define SCOPE_EXIT \
|
||||
auto GD_UNIQUE_NAME(gd_scope_exit) = gdmono::ScopeExitAux() + [=]() -> void
|
||||
|
||||
#endif // MONO_MACROS_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_NAMING_UTILS_H
|
||||
#define MONO_NAMING_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
|
|
@ -38,5 +37,3 @@ String pascal_to_pascal_case(const String &p_identifier);
|
|||
String snake_to_pascal_case(const String &p_identifier, bool p_input_is_upper = false);
|
||||
|
||||
String snake_to_camel_case(const String &p_identifier, bool p_input_is_upper = false);
|
||||
|
||||
#endif // MONO_NAMING_UTILS_H
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#define ENV_PATH_SEP ":"
|
||||
#endif
|
||||
|
||||
namespace path {
|
||||
namespace Path {
|
||||
|
||||
String find_executable(const String &p_name) {
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
|
@ -62,7 +62,7 @@ String find_executable(const String &p_name) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < env_path.size(); i++) {
|
||||
String p = path::join(env_path[i], p_name);
|
||||
String p = Path::join(env_path[i], p_name);
|
||||
|
||||
#ifdef WINDOWS_ENABLED
|
||||
for (int j = 0; j < exts.size(); j++) {
|
||||
|
|
@ -92,8 +92,7 @@ String cwd() {
|
|||
return ".";
|
||||
}
|
||||
|
||||
String result;
|
||||
result.parse_utf16(buffer.ptr());
|
||||
String result = String::utf16(buffer.ptr());
|
||||
if (result.is_empty()) {
|
||||
return ".";
|
||||
}
|
||||
|
|
@ -105,7 +104,7 @@ String cwd() {
|
|||
}
|
||||
|
||||
String result;
|
||||
if (result.parse_utf8(buffer) != OK) {
|
||||
if (result.append_utf8(buffer) != OK) {
|
||||
return ".";
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +116,7 @@ String abspath(const String &p_path) {
|
|||
if (p_path.is_absolute_path()) {
|
||||
return p_path.simplify_path();
|
||||
} else {
|
||||
return path::join(path::cwd(), p_path).simplify_path();
|
||||
return Path::join(Path::cwd(), p_path).simplify_path();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +144,7 @@ String realpath(const String &p_path) {
|
|||
|
||||
::CloseHandle(hFile);
|
||||
|
||||
String result;
|
||||
result.parse_utf16(buffer.ptr());
|
||||
String result = String::utf16(buffer.ptr());
|
||||
if (result.is_empty()) {
|
||||
return p_path;
|
||||
}
|
||||
|
|
@ -160,7 +158,7 @@ String realpath(const String &p_path) {
|
|||
}
|
||||
|
||||
String result;
|
||||
Error parse_ok = result.parse_utf8(resolved_path);
|
||||
Error parse_ok = result.append_utf8(resolved_path);
|
||||
::free(resolved_path);
|
||||
|
||||
if (parse_ok != OK) {
|
||||
|
|
@ -186,11 +184,11 @@ String join(const String &p_a, const String &p_b) {
|
|||
}
|
||||
|
||||
String join(const String &p_a, const String &p_b, const String &p_c) {
|
||||
return path::join(path::join(p_a, p_b), p_c);
|
||||
return Path::join(Path::join(p_a, p_b), p_c);
|
||||
}
|
||||
|
||||
String join(const String &p_a, const String &p_b, const String &p_c, const String &p_d) {
|
||||
return path::join(path::join(path::join(p_a, p_b), p_c), p_d);
|
||||
return Path::join(Path::join(Path::join(p_a, p_b), p_c), p_d);
|
||||
}
|
||||
|
||||
String relative_to_impl(const String &p_path, const String &p_relative_to) {
|
||||
|
|
@ -263,4 +261,4 @@ String get_csharp_project_name() {
|
|||
return name;
|
||||
}
|
||||
|
||||
} // namespace path
|
||||
} // namespace Path
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_PATH_UTILS_H
|
||||
#define MONO_PATH_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
namespace path {
|
||||
namespace Path {
|
||||
|
||||
String find_executable(const String &p_name);
|
||||
|
||||
|
|
@ -59,6 +58,4 @@ String realpath(const String &p_path);
|
|||
String relative_to(const String &p_path, const String &p_relative_to);
|
||||
|
||||
String get_csharp_project_name();
|
||||
} // namespace path
|
||||
|
||||
#endif // MONO_PATH_UTILS_H
|
||||
} // namespace Path
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ String sformat(const String &p_text, const String &p1, const String &p2,
|
|||
search_from = result + 2;
|
||||
}
|
||||
|
||||
new_string += p_text.substr(search_from, p_text.length() - search_from);
|
||||
new_string += p_text.substr(search_from);
|
||||
|
||||
return new_string;
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ Error read_all_file_utf8(const String &p_path, String &r_content) {
|
|||
w[len] = 0;
|
||||
|
||||
String source;
|
||||
if (source.parse_utf8((const char *)w, len) != OK) {
|
||||
if (source.append_utf8((const char *)w, len) != OK) {
|
||||
ERR_FAIL_V(ERR_INVALID_DATA);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef MONO_STRING_UTILS_H
|
||||
#define MONO_STRING_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
|
@ -59,5 +58,3 @@ String str_format(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_1_2;
|
|||
String str_format(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE_1_0;
|
||||
char *str_format_new(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_1_2;
|
||||
char *str_format_new(const char *p_format, va_list p_list) _PRINTF_FORMAT_ATTRIBUTE_1_0;
|
||||
|
||||
#endif // MONO_STRING_UTILS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue