Update bindings
This commit is contained in:
parent
25c108f3b2
commit
1e26139558
|
|
@ -0,0 +1,6 @@
|
|||
<Project Sdk="Godot.NET.Sdk/4.4.1">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Terrain3D", "Terrain3D.csproj", "{E3C3EDF1-6587-443E-B932-EBA7704DB53E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
ExportDebug|Any CPU = ExportDebug|Any CPU
|
||||
ExportRelease|Any CPU = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU
|
||||
{E3C3EDF1-6587-443E-B932-EBA7704DB53E}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +1 @@
|
|||
uid://8lc3g6saqrfo
|
||||
uid://des50dgjni8ga
|
||||
|
|
|
|||
|
|
@ -1,205 +1,225 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DAssets : Resource
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DAssets";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying Resource), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DAssets() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DAssets");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DAssets"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DAssets Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DAssets>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DAssets object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DAssets() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DAssets"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DAssets"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DAssets"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DAssets"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DAssets Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DAssets>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public enum AssetType : long
|
||||
{
|
||||
TypeTexture = 0,
|
||||
TypeMesh = 1,
|
||||
}
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DAssets"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DAssets"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DAssets"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DAssets"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DAssets Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DAssets wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#endregion
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DAssets);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
#region Properties
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DAssets).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public Godot.Collections.Array<Terrain3DMeshAsset> MeshList
|
||||
{
|
||||
get => GDExtensionHelper.Cast<Terrain3DMeshAsset>((Godot.Collections.Array<Godot.GodotObject>)Get(_cached_mesh_list));
|
||||
set => Set(_cached_mesh_list, Variant.From(value));
|
||||
}
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DAssets)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public Godot.Collections.Array<Terrain3DTextureAsset> TextureList
|
||||
{
|
||||
get => GDExtensionHelper.Cast<Terrain3DTextureAsset>((Godot.Collections.Array<Godot.GodotObject>)Get(_cached_texture_list));
|
||||
set => Set(_cached_texture_list, Variant.From(value));
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DAssets"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DAssets" type.</returns>
|
||||
public new static Terrain3DAssets Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
#endregion
|
||||
public enum AssetType
|
||||
{
|
||||
Texture = 0,
|
||||
Mesh = 1,
|
||||
}
|
||||
|
||||
#region Signals
|
||||
public new static class GDExtensionSignalName
|
||||
{
|
||||
public new static readonly StringName MeshesChanged = "meshes_changed";
|
||||
public new static readonly StringName TexturesChanged = "textures_changed";
|
||||
}
|
||||
|
||||
public delegate void MeshesChangedHandler();
|
||||
public new delegate void MeshesChangedSignalHandler();
|
||||
private MeshesChangedSignalHandler _meshesChangedSignal;
|
||||
private Callable _meshesChangedSignalCallable;
|
||||
public event MeshesChangedSignalHandler MeshesChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_meshesChangedSignal is null)
|
||||
{
|
||||
_meshesChangedSignalCallable = Callable.From(() =>
|
||||
_meshesChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.MeshesChanged, _meshesChangedSignalCallable);
|
||||
}
|
||||
_meshesChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_meshesChangedSignal -= value;
|
||||
if (_meshesChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.MeshesChanged, _meshesChangedSignalCallable);
|
||||
_meshesChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
private MeshesChangedHandler _meshesChanged_backing;
|
||||
private Callable _meshesChanged_backing_callable;
|
||||
public event MeshesChangedHandler MeshesChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_meshesChanged_backing == null)
|
||||
{
|
||||
_meshesChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_meshesChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_meshes_changed, _meshesChanged_backing_callable);
|
||||
}
|
||||
_meshesChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_meshesChanged_backing -= value;
|
||||
|
||||
if(_meshesChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_meshes_changed, _meshesChanged_backing_callable);
|
||||
_meshesChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
public new delegate void TexturesChangedSignalHandler();
|
||||
private TexturesChangedSignalHandler _texturesChangedSignal;
|
||||
private Callable _texturesChangedSignalCallable;
|
||||
public event TexturesChangedSignalHandler TexturesChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_texturesChangedSignal is null)
|
||||
{
|
||||
_texturesChangedSignalCallable = Callable.From(() =>
|
||||
_texturesChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.TexturesChanged, _texturesChangedSignalCallable);
|
||||
}
|
||||
_texturesChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_texturesChangedSignal -= value;
|
||||
if (_texturesChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.TexturesChanged, _texturesChangedSignalCallable);
|
||||
_texturesChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void TexturesChangedHandler();
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName MeshList = "mesh_list";
|
||||
public new static readonly StringName TextureList = "texture_list";
|
||||
}
|
||||
|
||||
private TexturesChangedHandler _texturesChanged_backing;
|
||||
private Callable _texturesChanged_backing_callable;
|
||||
public event TexturesChangedHandler TexturesChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_texturesChanged_backing == null)
|
||||
{
|
||||
_texturesChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_texturesChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_textures_changed, _texturesChanged_backing_callable);
|
||||
}
|
||||
_texturesChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_texturesChanged_backing -= value;
|
||||
|
||||
if(_texturesChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_textures_changed, _texturesChanged_backing_callable);
|
||||
_texturesChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
public new Godot.Collections.Array MeshList
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.MeshList).As<Godot.Collections.Array>();
|
||||
set => Set(GDExtensionPropertyName.MeshList, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public new Godot.Collections.Array TextureList
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.TextureList).As<Godot.Collections.Array>();
|
||||
set => Set(GDExtensionPropertyName.TextureList, value);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName SetTexture = "set_texture";
|
||||
public new static readonly StringName GetTexture = "get_texture";
|
||||
public new static readonly StringName GetTextureCount = "get_texture_count";
|
||||
public new static readonly StringName GetAlbedoArrayRid = "get_albedo_array_rid";
|
||||
public new static readonly StringName GetNormalArrayRid = "get_normal_array_rid";
|
||||
public new static readonly StringName GetTextureColors = "get_texture_colors";
|
||||
public new static readonly StringName GetTextureNormalDepths = "get_texture_normal_depths";
|
||||
public new static readonly StringName GetTextureAoStrengths = "get_texture_ao_strengths";
|
||||
public new static readonly StringName GetTextureRoughnessMods = "get_texture_roughness_mods";
|
||||
public new static readonly StringName GetTextureUvScales = "get_texture_uv_scales";
|
||||
public new static readonly StringName GetTextureVerticalProjections = "get_texture_vertical_projections";
|
||||
public new static readonly StringName GetTextureDetiles = "get_texture_detiles";
|
||||
public new static readonly StringName ClearTextures = "clear_textures";
|
||||
public new static readonly StringName UpdateTextureList = "update_texture_list";
|
||||
public new static readonly StringName SetMeshAsset = "set_mesh_asset";
|
||||
public new static readonly StringName GetMeshAsset = "get_mesh_asset";
|
||||
public new static readonly StringName GetMeshCount = "get_mesh_count";
|
||||
public new static readonly StringName CreateMeshThumbnails = "create_mesh_thumbnails";
|
||||
public new static readonly StringName UpdateMeshList = "update_mesh_list";
|
||||
public new static readonly StringName Save = "save";
|
||||
}
|
||||
|
||||
public void SetTexture(int id, Terrain3DTextureAsset texture) => Call(_cached_set_texture, id, (Resource)texture);
|
||||
public new void SetTexture(long id, Terrain3DTextureAsset texture) =>
|
||||
Call(GDExtensionMethodName.SetTexture, [id, texture]);
|
||||
|
||||
public Terrain3DTextureAsset GetTexture(int id) => GDExtensionHelper.Bind<Terrain3DTextureAsset>(Call(_cached_get_texture, id).As<GodotObject>());
|
||||
public new Terrain3DTextureAsset GetTexture(long id) =>
|
||||
Terrain3DTextureAsset.Bind(Call(GDExtensionMethodName.GetTexture, [id]).As<Resource>());
|
||||
|
||||
public void SetTextureList(Godot.Collections.Array<Terrain3DTextureAsset> textureList) => Call(_cached_set_texture_list, textureList);
|
||||
public new long GetTextureCount() =>
|
||||
Call(GDExtensionMethodName.GetTextureCount, []).As<long>();
|
||||
|
||||
public Godot.Collections.Array<Terrain3DTextureAsset> GetTextureList() => GDExtensionHelper.Cast<Terrain3DTextureAsset>(Call(_cached_get_texture_list).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new Rid GetAlbedoArrayRid() =>
|
||||
Call(GDExtensionMethodName.GetAlbedoArrayRid, []).As<Rid>();
|
||||
|
||||
public int GetTextureCount() => Call(_cached_get_texture_count).As<int>();
|
||||
public new Rid GetNormalArrayRid() =>
|
||||
Call(GDExtensionMethodName.GetNormalArrayRid, []).As<Rid>();
|
||||
|
||||
public Rid GetAlbedoArrayRid() => Call(_cached_get_albedo_array_rid).As<Rid>();
|
||||
public new Color[] GetTextureColors() =>
|
||||
Call(GDExtensionMethodName.GetTextureColors, []).As<Color[]>();
|
||||
|
||||
public Rid GetNormalArrayRid() => Call(_cached_get_normal_array_rid).As<Rid>();
|
||||
public new float[] GetTextureNormalDepths() =>
|
||||
Call(GDExtensionMethodName.GetTextureNormalDepths, []).As<float[]>();
|
||||
|
||||
public Color[] GetTextureColors() => Call(_cached_get_texture_colors).As<Color[]>();
|
||||
public new float[] GetTextureAoStrengths() =>
|
||||
Call(GDExtensionMethodName.GetTextureAoStrengths, []).As<float[]>();
|
||||
|
||||
public float[] GetTextureNormalDepths() => Call(_cached_get_texture_normal_depths).As<float[]>();
|
||||
public new float[] GetTextureRoughnessMods() =>
|
||||
Call(GDExtensionMethodName.GetTextureRoughnessMods, []).As<float[]>();
|
||||
|
||||
public float[] GetTextureAoStrengths() => Call(_cached_get_texture_ao_strengths).As<float[]>();
|
||||
public new float[] GetTextureUvScales() =>
|
||||
Call(GDExtensionMethodName.GetTextureUvScales, []).As<float[]>();
|
||||
|
||||
public float[] GetTextureRoughnessMods() => Call(_cached_get_texture_roughness_mods).As<float[]>();
|
||||
public new long GetTextureVerticalProjections() =>
|
||||
Call(GDExtensionMethodName.GetTextureVerticalProjections, []).As<long>();
|
||||
|
||||
public float[] GetTextureUvScales() => Call(_cached_get_texture_uv_scales).As<float[]>();
|
||||
public new Vector2[] GetTextureDetiles() =>
|
||||
Call(GDExtensionMethodName.GetTextureDetiles, []).As<Vector2[]>();
|
||||
|
||||
public Vector2[] GetTextureDetiles() => Call(_cached_get_texture_detiles).As<Vector2[]>();
|
||||
public new void ClearTextures(bool update = false) =>
|
||||
Call(GDExtensionMethodName.ClearTextures, [update]);
|
||||
|
||||
public void ClearTextures(bool update) => Call(_cached_clear_textures, update);
|
||||
public new void UpdateTextureList() =>
|
||||
Call(GDExtensionMethodName.UpdateTextureList, []);
|
||||
|
||||
public void UpdateTextureList() => Call(_cached_update_texture_list);
|
||||
public new void SetMeshAsset(long id, Terrain3DMeshAsset mesh) =>
|
||||
Call(GDExtensionMethodName.SetMeshAsset, [id, mesh]);
|
||||
|
||||
public void SetMeshAsset(int id, Terrain3DMeshAsset mesh) => Call(_cached_set_mesh_asset, id, (Resource)mesh);
|
||||
public new Terrain3DMeshAsset GetMeshAsset(long id) =>
|
||||
Terrain3DMeshAsset.Bind(Call(GDExtensionMethodName.GetMeshAsset, [id]).As<Resource>());
|
||||
|
||||
public Terrain3DMeshAsset GetMeshAsset(int id) => GDExtensionHelper.Bind<Terrain3DMeshAsset>(Call(_cached_get_mesh_asset, id).As<GodotObject>());
|
||||
public new long GetMeshCount() =>
|
||||
Call(GDExtensionMethodName.GetMeshCount, []).As<long>();
|
||||
|
||||
public void SetMeshList(Godot.Collections.Array<Terrain3DMeshAsset> meshList) => Call(_cached_set_mesh_list, meshList);
|
||||
public new void CreateMeshThumbnails(long id = -1, Vector2I size = default, bool force = false) =>
|
||||
Call(GDExtensionMethodName.CreateMeshThumbnails, [id, size, force]);
|
||||
|
||||
public Godot.Collections.Array<Terrain3DMeshAsset> GetMeshList() => GDExtensionHelper.Cast<Terrain3DMeshAsset>(Call(_cached_get_mesh_list).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new void UpdateMeshList() =>
|
||||
Call(GDExtensionMethodName.UpdateMeshList, []);
|
||||
|
||||
public int GetMeshCount() => Call(_cached_get_mesh_count).As<int>();
|
||||
public new Error Save(string path = "") =>
|
||||
Call(GDExtensionMethodName.Save, [path]).As<Error>();
|
||||
|
||||
public void CreateMeshThumbnails(int id, Vector2I size) => Call(_cached_create_mesh_thumbnails, id, size);
|
||||
|
||||
public void UpdateMeshList() => Call(_cached_update_mesh_list);
|
||||
|
||||
public int Save(string path) => Call(_cached_save, path).As<int>();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_mesh_list = "mesh_list";
|
||||
private static readonly StringName _cached_texture_list = "texture_list";
|
||||
private static readonly StringName _cached_set_texture = "set_texture";
|
||||
private static readonly StringName _cached_get_texture = "get_texture";
|
||||
private static readonly StringName _cached_set_texture_list = "set_texture_list";
|
||||
private static readonly StringName _cached_get_texture_list = "get_texture_list";
|
||||
private static readonly StringName _cached_get_texture_count = "get_texture_count";
|
||||
private static readonly StringName _cached_get_albedo_array_rid = "get_albedo_array_rid";
|
||||
private static readonly StringName _cached_get_normal_array_rid = "get_normal_array_rid";
|
||||
private static readonly StringName _cached_get_texture_colors = "get_texture_colors";
|
||||
private static readonly StringName _cached_get_texture_normal_depths = "get_texture_normal_depths";
|
||||
private static readonly StringName _cached_get_texture_ao_strengths = "get_texture_ao_strengths";
|
||||
private static readonly StringName _cached_get_texture_roughness_mods = "get_texture_roughness_mods";
|
||||
private static readonly StringName _cached_get_texture_uv_scales = "get_texture_uv_scales";
|
||||
private static readonly StringName _cached_get_texture_detiles = "get_texture_detiles";
|
||||
private static readonly StringName _cached_clear_textures = "clear_textures";
|
||||
private static readonly StringName _cached_update_texture_list = "update_texture_list";
|
||||
private static readonly StringName _cached_set_mesh_asset = "set_mesh_asset";
|
||||
private static readonly StringName _cached_get_mesh_asset = "get_mesh_asset";
|
||||
private static readonly StringName _cached_set_mesh_list = "set_mesh_list";
|
||||
private static readonly StringName _cached_get_mesh_list = "get_mesh_list";
|
||||
private static readonly StringName _cached_get_mesh_count = "get_mesh_count";
|
||||
private static readonly StringName _cached_create_mesh_thumbnails = "create_mesh_thumbnails";
|
||||
private static readonly StringName _cached_update_mesh_list = "update_mesh_list";
|
||||
private static readonly StringName _cached_save = "save";
|
||||
private static readonly StringName _cached_meshes_changed = "meshes_changed";
|
||||
private static readonly StringName _cached_textures_changed = "textures_changed";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://crhxgnvlcwq5x
|
||||
uid://myg4xtgeyn1n
|
||||
|
|
|
|||
|
|
@ -1,167 +1,157 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DCollision : GodotObject
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DCollision";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying GodotObject), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DCollision() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DCollision");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DCollision"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DCollision Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DCollision>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DCollision object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DCollision() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DCollision"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DCollision"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DCollision"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DCollision"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DCollision Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DCollision>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public enum CollisionMode : long
|
||||
{
|
||||
Disabled = 0,
|
||||
DynamicGame = 1,
|
||||
DynamicEditor = 2,
|
||||
FullGame = 3,
|
||||
FullEditor = 4,
|
||||
}
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DCollision"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DCollision"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DCollision"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DCollision"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DCollision Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DCollision wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#endregion
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DCollision);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
#region Properties
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DCollision).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public long /*Disabled,Dynamic/Game,Dynamic/Editor,Full/Game,Full/Editor*/ Mode
|
||||
{
|
||||
get => (long /*Disabled,Dynamic/Game,Dynamic/Editor,Full/Game,Full/Editor*/)Get(_cached_mode).As<Int64>();
|
||||
set => Set(_cached_mode, Variant.From(value));
|
||||
}
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DCollision)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public int ShapeSize
|
||||
{
|
||||
get => (int)Get(_cached_shape_size);
|
||||
set => Set(_cached_shape_size, Variant.From(value));
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DCollision"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DCollision" type.</returns>
|
||||
public new static Terrain3DCollision Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public int Radius
|
||||
{
|
||||
get => (int)Get(_cached_radius);
|
||||
set => Set(_cached_radius, Variant.From(value));
|
||||
}
|
||||
public enum CollisionMode
|
||||
{
|
||||
Disabled = 0,
|
||||
DynamicGame = 1,
|
||||
DynamicEditor = 2,
|
||||
FullGame = 3,
|
||||
FullEditor = 4,
|
||||
}
|
||||
|
||||
public int Layer
|
||||
{
|
||||
get => (int)Get(_cached_layer);
|
||||
set => Set(_cached_layer, Variant.From(value));
|
||||
}
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName Mode = "mode";
|
||||
public new static readonly StringName ShapeSize = "shape_size";
|
||||
public new static readonly StringName Radius = "radius";
|
||||
public new static readonly StringName Layer = "layer";
|
||||
public new static readonly StringName Mask = "mask";
|
||||
public new static readonly StringName Priority = "priority";
|
||||
public new static readonly StringName PhysicsMaterial = "physics_material";
|
||||
}
|
||||
|
||||
public int Mask
|
||||
{
|
||||
get => (int)Get(_cached_mask);
|
||||
set => Set(_cached_mask, Variant.From(value));
|
||||
}
|
||||
public new Variant Mode
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Mode).As<Variant>();
|
||||
set => Set(GDExtensionPropertyName.Mode, value);
|
||||
}
|
||||
|
||||
public float Priority
|
||||
{
|
||||
get => (float)Get(_cached_priority);
|
||||
set => Set(_cached_priority, Variant.From(value));
|
||||
}
|
||||
public new long ShapeSize
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShapeSize).As<long>();
|
||||
set => Set(GDExtensionPropertyName.ShapeSize, value);
|
||||
}
|
||||
|
||||
public PhysicsMaterial PhysicsMaterial
|
||||
{
|
||||
get => (PhysicsMaterial)Get(_cached_physics_material);
|
||||
set => Set(_cached_physics_material, Variant.From(value));
|
||||
}
|
||||
public new long Radius
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Radius).As<long>();
|
||||
set => Set(GDExtensionPropertyName.Radius, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public new long Layer
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Layer).As<long>();
|
||||
set => Set(GDExtensionPropertyName.Layer, value);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
public new long Mask
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Mask).As<long>();
|
||||
set => Set(GDExtensionPropertyName.Mask, value);
|
||||
}
|
||||
|
||||
public void Build() => Call(_cached_build);
|
||||
public new double Priority
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Priority).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Priority, value);
|
||||
}
|
||||
|
||||
public void Update(bool rebuild) => Call(_cached_update, rebuild);
|
||||
public new PhysicsMaterial PhysicsMaterial
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.PhysicsMaterial).As<PhysicsMaterial>();
|
||||
set => Set(GDExtensionPropertyName.PhysicsMaterial, value);
|
||||
}
|
||||
|
||||
public void Destroy() => Call(_cached_destroy);
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName Build = "build";
|
||||
public new static readonly StringName Update = "update";
|
||||
public new static readonly StringName Destroy = "destroy";
|
||||
public new static readonly StringName IsEnabled = "is_enabled";
|
||||
public new static readonly StringName IsEditorMode = "is_editor_mode";
|
||||
public new static readonly StringName IsDynamicMode = "is_dynamic_mode";
|
||||
public new static readonly StringName GetRid = "get_rid";
|
||||
}
|
||||
|
||||
public void SetMode(int mode) => Call(_cached_set_mode, mode);
|
||||
public new void Build() =>
|
||||
Call(GDExtensionMethodName.Build, []);
|
||||
|
||||
public int GetMode() => Call(_cached_get_mode).As<int>();
|
||||
public new void Update(bool rebuild = false) =>
|
||||
Call(GDExtensionMethodName.Update, [rebuild]);
|
||||
|
||||
public bool IsEnabled() => Call(_cached_is_enabled).As<bool>();
|
||||
public new void Destroy() =>
|
||||
Call(GDExtensionMethodName.Destroy, []);
|
||||
|
||||
public bool IsEditorMode() => Call(_cached_is_editor_mode).As<bool>();
|
||||
public new bool IsEnabled() =>
|
||||
Call(GDExtensionMethodName.IsEnabled, []).As<bool>();
|
||||
|
||||
public bool IsDynamicMode() => Call(_cached_is_dynamic_mode).As<bool>();
|
||||
public new bool IsEditorMode() =>
|
||||
Call(GDExtensionMethodName.IsEditorMode, []).As<bool>();
|
||||
|
||||
public void SetShapeSize(int size) => Call(_cached_set_shape_size, size);
|
||||
public new bool IsDynamicMode() =>
|
||||
Call(GDExtensionMethodName.IsDynamicMode, []).As<bool>();
|
||||
|
||||
public int GetShapeSize() => Call(_cached_get_shape_size).As<int>();
|
||||
public new Rid GetRid() =>
|
||||
Call(GDExtensionMethodName.GetRid, []).As<Rid>();
|
||||
|
||||
public void SetRadius(int radius) => Call(_cached_set_radius, radius);
|
||||
|
||||
public int GetRadius() => Call(_cached_get_radius).As<int>();
|
||||
|
||||
public void SetLayer(int layers) => Call(_cached_set_layer, layers);
|
||||
|
||||
public int GetLayer() => Call(_cached_get_layer).As<int>();
|
||||
|
||||
public void SetMask(int mask) => Call(_cached_set_mask, mask);
|
||||
|
||||
public int GetMask() => Call(_cached_get_mask).As<int>();
|
||||
|
||||
public void SetPriority(float priority) => Call(_cached_set_priority, priority);
|
||||
|
||||
public float GetPriority() => Call(_cached_get_priority).As<float>();
|
||||
|
||||
public void SetPhysicsMaterial(PhysicsMaterial material) => Call(_cached_set_physics_material, (PhysicsMaterial)material);
|
||||
|
||||
public PhysicsMaterial GetPhysicsMaterial() => GDExtensionHelper.Bind<PhysicsMaterial>(Call(_cached_get_physics_material).As<GodotObject>());
|
||||
|
||||
public Rid GetRid() => Call(_cached_get_rid).As<Rid>();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_mode = "mode";
|
||||
private static readonly StringName _cached_shape_size = "shape_size";
|
||||
private static readonly StringName _cached_radius = "radius";
|
||||
private static readonly StringName _cached_layer = "layer";
|
||||
private static readonly StringName _cached_mask = "mask";
|
||||
private static readonly StringName _cached_priority = "priority";
|
||||
private static readonly StringName _cached_physics_material = "physics_material";
|
||||
private static readonly StringName _cached_build = "build";
|
||||
private static readonly StringName _cached_update = "update";
|
||||
private static readonly StringName _cached_destroy = "destroy";
|
||||
private static readonly StringName _cached_set_mode = "set_mode";
|
||||
private static readonly StringName _cached_get_mode = "get_mode";
|
||||
private static readonly StringName _cached_is_enabled = "is_enabled";
|
||||
private static readonly StringName _cached_is_editor_mode = "is_editor_mode";
|
||||
private static readonly StringName _cached_is_dynamic_mode = "is_dynamic_mode";
|
||||
private static readonly StringName _cached_set_shape_size = "set_shape_size";
|
||||
private static readonly StringName _cached_get_shape_size = "get_shape_size";
|
||||
private static readonly StringName _cached_set_radius = "set_radius";
|
||||
private static readonly StringName _cached_get_radius = "get_radius";
|
||||
private static readonly StringName _cached_set_layer = "set_layer";
|
||||
private static readonly StringName _cached_get_layer = "get_layer";
|
||||
private static readonly StringName _cached_set_mask = "set_mask";
|
||||
private static readonly StringName _cached_get_mask = "get_mask";
|
||||
private static readonly StringName _cached_set_priority = "set_priority";
|
||||
private static readonly StringName _cached_get_priority = "get_priority";
|
||||
private static readonly StringName _cached_set_physics_material = "set_physics_material";
|
||||
private static readonly StringName _cached_get_physics_material = "get_physics_material";
|
||||
private static readonly StringName _cached_get_rid = "get_rid";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://b77lrkh5kmrlg
|
||||
uid://yab31a0ysqa3
|
||||
|
|
|
|||
|
|
@ -1,502 +1,532 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DData : GodotObject
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DData";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying GodotObject), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DData() { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DData"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DData Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DData>(GDExtensionName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DData"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DData"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DData"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DData"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DData Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DData>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
|
||||
public enum HeightFilter : long
|
||||
{
|
||||
Nearest = 0,
|
||||
Minimum = 1,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Godot.Collections.Array<Vector2I> RegionLocations
|
||||
{
|
||||
get => (Godot.Collections.Array<Vector2I>)Get(_cached_region_locations);
|
||||
set => Set(_cached_region_locations, Variant.From(value));
|
||||
}
|
||||
|
||||
public Godot.Collections.Array<Image> HeightMaps
|
||||
{
|
||||
get => GDExtensionHelper.Cast<Image>((Godot.Collections.Array<Godot.GodotObject>)Get(_cached_height_maps));
|
||||
set => Set(_cached_height_maps, Variant.From(value));
|
||||
}
|
||||
|
||||
public Godot.Collections.Array<Image> ControlMaps
|
||||
{
|
||||
get => GDExtensionHelper.Cast<Image>((Godot.Collections.Array<Godot.GodotObject>)Get(_cached_control_maps));
|
||||
set => Set(_cached_control_maps, Variant.From(value));
|
||||
}
|
||||
|
||||
public Godot.Collections.Array<Image> ColorMaps
|
||||
{
|
||||
get => GDExtensionHelper.Cast<Image>((Godot.Collections.Array<Godot.GodotObject>)Get(_cached_color_maps));
|
||||
set => Set(_cached_color_maps, Variant.From(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Signals
|
||||
|
||||
public delegate void MapsChangedHandler();
|
||||
|
||||
private MapsChangedHandler _mapsChanged_backing;
|
||||
private Callable _mapsChanged_backing_callable;
|
||||
public event MapsChangedHandler MapsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_mapsChanged_backing == null)
|
||||
{
|
||||
_mapsChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_mapsChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_maps_changed, _mapsChanged_backing_callable);
|
||||
}
|
||||
_mapsChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_mapsChanged_backing -= value;
|
||||
|
||||
if(_mapsChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_maps_changed, _mapsChanged_backing_callable);
|
||||
_mapsChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void RegionMapChangedHandler();
|
||||
|
||||
private RegionMapChangedHandler _regionMapChanged_backing;
|
||||
private Callable _regionMapChanged_backing_callable;
|
||||
public event RegionMapChangedHandler RegionMapChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_regionMapChanged_backing == null)
|
||||
{
|
||||
_regionMapChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_regionMapChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_region_map_changed, _regionMapChanged_backing_callable);
|
||||
}
|
||||
_regionMapChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_regionMapChanged_backing -= value;
|
||||
|
||||
if(_regionMapChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_region_map_changed, _regionMapChanged_backing_callable);
|
||||
_regionMapChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void HeightMapsChangedHandler();
|
||||
|
||||
private HeightMapsChangedHandler _heightMapsChanged_backing;
|
||||
private Callable _heightMapsChanged_backing_callable;
|
||||
public event HeightMapsChangedHandler HeightMapsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_heightMapsChanged_backing == null)
|
||||
{
|
||||
_heightMapsChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_heightMapsChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_height_maps_changed, _heightMapsChanged_backing_callable);
|
||||
}
|
||||
_heightMapsChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_heightMapsChanged_backing -= value;
|
||||
|
||||
if(_heightMapsChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_height_maps_changed, _heightMapsChanged_backing_callable);
|
||||
_heightMapsChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ControlMapsChangedHandler();
|
||||
|
||||
private ControlMapsChangedHandler _controlMapsChanged_backing;
|
||||
private Callable _controlMapsChanged_backing_callable;
|
||||
public event ControlMapsChangedHandler ControlMapsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_controlMapsChanged_backing == null)
|
||||
{
|
||||
_controlMapsChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_controlMapsChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_control_maps_changed, _controlMapsChanged_backing_callable);
|
||||
}
|
||||
_controlMapsChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_controlMapsChanged_backing -= value;
|
||||
|
||||
if(_controlMapsChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_control_maps_changed, _controlMapsChanged_backing_callable);
|
||||
_controlMapsChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void ColorMapsChangedHandler();
|
||||
|
||||
private ColorMapsChangedHandler _colorMapsChanged_backing;
|
||||
private Callable _colorMapsChanged_backing_callable;
|
||||
public event ColorMapsChangedHandler ColorMapsChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_colorMapsChanged_backing == null)
|
||||
{
|
||||
_colorMapsChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_colorMapsChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_color_maps_changed, _colorMapsChanged_backing_callable);
|
||||
}
|
||||
_colorMapsChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_colorMapsChanged_backing -= value;
|
||||
|
||||
if(_colorMapsChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_color_maps_changed, _colorMapsChanged_backing_callable);
|
||||
_colorMapsChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void MapsEditedHandler(Aabb editedArea);
|
||||
|
||||
private MapsEditedHandler _mapsEdited_backing;
|
||||
private Callable _mapsEdited_backing_callable;
|
||||
public event MapsEditedHandler MapsEdited
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_mapsEdited_backing == null)
|
||||
{
|
||||
_mapsEdited_backing_callable = Callable.From<Variant>(
|
||||
(arg0_variant) =>
|
||||
{
|
||||
var arg0 = arg0_variant.As<Aabb>();
|
||||
_mapsEdited_backing?.Invoke(arg0);
|
||||
}
|
||||
);
|
||||
Connect(_cached_maps_edited, _mapsEdited_backing_callable);
|
||||
}
|
||||
_mapsEdited_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_mapsEdited_backing -= value;
|
||||
|
||||
if(_mapsEdited_backing == null)
|
||||
{
|
||||
Disconnect(_cached_maps_edited, _mapsEdited_backing_callable);
|
||||
_mapsEdited_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DData");
|
||||
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DData object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DData() { }
|
||||
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DData"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DData"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DData"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DData"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DData Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DData wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DData);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DData).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DData)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DData"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DData" type.</returns>
|
||||
public new static Terrain3DData Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public enum HeightFilter
|
||||
{
|
||||
Nearest = 0,
|
||||
Minimum = 1,
|
||||
}
|
||||
|
||||
public new static class GDExtensionSignalName
|
||||
{
|
||||
public new static readonly StringName MapsChanged = "maps_changed";
|
||||
public new static readonly StringName RegionMapChanged = "region_map_changed";
|
||||
public new static readonly StringName HeightMapsChanged = "height_maps_changed";
|
||||
public new static readonly StringName ControlMapsChanged = "control_maps_changed";
|
||||
public new static readonly StringName ColorMapsChanged = "color_maps_changed";
|
||||
public new static readonly StringName MapsEdited = "maps_edited";
|
||||
}
|
||||
|
||||
public new delegate void MapsChangedSignalHandler();
|
||||
private MapsChangedSignalHandler _mapsChangedSignal;
|
||||
private Callable _mapsChangedSignalCallable;
|
||||
public event MapsChangedSignalHandler MapsChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_mapsChangedSignal is null)
|
||||
{
|
||||
_mapsChangedSignalCallable = Callable.From(() =>
|
||||
_mapsChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.MapsChanged, _mapsChangedSignalCallable);
|
||||
}
|
||||
_mapsChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_mapsChangedSignal -= value;
|
||||
if (_mapsChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.MapsChanged, _mapsChangedSignalCallable);
|
||||
_mapsChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void RegionMapChangedSignalHandler();
|
||||
private RegionMapChangedSignalHandler _regionMapChangedSignal;
|
||||
private Callable _regionMapChangedSignalCallable;
|
||||
public event RegionMapChangedSignalHandler RegionMapChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_regionMapChangedSignal is null)
|
||||
{
|
||||
_regionMapChangedSignalCallable = Callable.From(() =>
|
||||
_regionMapChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.RegionMapChanged, _regionMapChangedSignalCallable);
|
||||
}
|
||||
_regionMapChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_regionMapChangedSignal -= value;
|
||||
if (_regionMapChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.RegionMapChanged, _regionMapChangedSignalCallable);
|
||||
_regionMapChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void HeightMapsChangedSignalHandler();
|
||||
private HeightMapsChangedSignalHandler _heightMapsChangedSignal;
|
||||
private Callable _heightMapsChangedSignalCallable;
|
||||
public event HeightMapsChangedSignalHandler HeightMapsChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_heightMapsChangedSignal is null)
|
||||
{
|
||||
_heightMapsChangedSignalCallable = Callable.From(() =>
|
||||
_heightMapsChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.HeightMapsChanged, _heightMapsChangedSignalCallable);
|
||||
}
|
||||
_heightMapsChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_heightMapsChangedSignal -= value;
|
||||
if (_heightMapsChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.HeightMapsChanged, _heightMapsChangedSignalCallable);
|
||||
_heightMapsChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void ControlMapsChangedSignalHandler();
|
||||
private ControlMapsChangedSignalHandler _controlMapsChangedSignal;
|
||||
private Callable _controlMapsChangedSignalCallable;
|
||||
public event ControlMapsChangedSignalHandler ControlMapsChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_controlMapsChangedSignal is null)
|
||||
{
|
||||
_controlMapsChangedSignalCallable = Callable.From(() =>
|
||||
_controlMapsChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.ControlMapsChanged, _controlMapsChangedSignalCallable);
|
||||
}
|
||||
_controlMapsChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_controlMapsChangedSignal -= value;
|
||||
if (_controlMapsChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.ControlMapsChanged, _controlMapsChangedSignalCallable);
|
||||
_controlMapsChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void ColorMapsChangedSignalHandler();
|
||||
private ColorMapsChangedSignalHandler _colorMapsChangedSignal;
|
||||
private Callable _colorMapsChangedSignalCallable;
|
||||
public event ColorMapsChangedSignalHandler ColorMapsChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_colorMapsChangedSignal is null)
|
||||
{
|
||||
_colorMapsChangedSignalCallable = Callable.From(() =>
|
||||
_colorMapsChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.ColorMapsChanged, _colorMapsChangedSignalCallable);
|
||||
}
|
||||
_colorMapsChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_colorMapsChangedSignal -= value;
|
||||
if (_colorMapsChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.ColorMapsChanged, _colorMapsChangedSignalCallable);
|
||||
_colorMapsChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void MapsEditedSignalHandler(Aabb editedArea);
|
||||
private MapsEditedSignalHandler _mapsEditedSignal;
|
||||
private Callable _mapsEditedSignalCallable;
|
||||
public event MapsEditedSignalHandler MapsEditedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_mapsEditedSignal is null)
|
||||
{
|
||||
_mapsEditedSignalCallable = Callable.From((Variant editedArea) =>
|
||||
_mapsEditedSignal?.Invoke(editedArea.As<Aabb>()));
|
||||
Connect(GDExtensionSignalName.MapsEdited, _mapsEditedSignalCallable);
|
||||
}
|
||||
_mapsEditedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_mapsEditedSignal -= value;
|
||||
if (_mapsEditedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.MapsEdited, _mapsEditedSignalCallable);
|
||||
_mapsEditedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName RegionLocations = "region_locations";
|
||||
public new static readonly StringName HeightMaps = "height_maps";
|
||||
public new static readonly StringName ControlMaps = "control_maps";
|
||||
public new static readonly StringName ColorMaps = "color_maps";
|
||||
}
|
||||
|
||||
public new Godot.Collections.Array RegionLocations
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.RegionLocations).As<Godot.Collections.Array>();
|
||||
set => Set(GDExtensionPropertyName.RegionLocations, value);
|
||||
}
|
||||
|
||||
public new Godot.Collections.Array HeightMaps
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.HeightMaps).As<Godot.Collections.Array>();
|
||||
}
|
||||
|
||||
public new Godot.Collections.Array ControlMaps
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ControlMaps).As<Godot.Collections.Array>();
|
||||
}
|
||||
|
||||
public new Godot.Collections.Array ColorMaps
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ColorMaps).As<Godot.Collections.Array>();
|
||||
}
|
||||
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName GetRegionCount = "get_region_count";
|
||||
public new static readonly StringName GetRegionsActive = "get_regions_active";
|
||||
public new static readonly StringName GetRegionsAll = "get_regions_all";
|
||||
public new static readonly StringName GetRegionMap = "get_region_map";
|
||||
public new static readonly StringName GetRegionMapIndex = "get_region_map_index";
|
||||
public new static readonly StringName DoForRegions = "do_for_regions";
|
||||
public new static readonly StringName ChangeRegionSize = "change_region_size";
|
||||
public new static readonly StringName GetRegionLocation = "get_region_location";
|
||||
public new static readonly StringName GetRegionId = "get_region_id";
|
||||
public new static readonly StringName GetRegionIdp = "get_region_idp";
|
||||
public new static readonly StringName HasRegion = "has_region";
|
||||
public new static readonly StringName HasRegionp = "has_regionp";
|
||||
public new static readonly StringName GetRegion = "get_region";
|
||||
public new static readonly StringName GetRegionp = "get_regionp";
|
||||
public new static readonly StringName SetRegionModified = "set_region_modified";
|
||||
public new static readonly StringName IsRegionModified = "is_region_modified";
|
||||
public new static readonly StringName SetRegionDeleted = "set_region_deleted";
|
||||
public new static readonly StringName IsRegionDeleted = "is_region_deleted";
|
||||
public new static readonly StringName AddRegionBlankp = "add_region_blankp";
|
||||
public new static readonly StringName AddRegionBlank = "add_region_blank";
|
||||
public new static readonly StringName AddRegion = "add_region";
|
||||
public new static readonly StringName RemoveRegionp = "remove_regionp";
|
||||
public new static readonly StringName RemoveRegionl = "remove_regionl";
|
||||
public new static readonly StringName RemoveRegion = "remove_region";
|
||||
public new static readonly StringName SaveDirectory = "save_directory";
|
||||
public new static readonly StringName SaveRegion = "save_region";
|
||||
public new static readonly StringName LoadDirectory = "load_directory";
|
||||
public new static readonly StringName LoadRegion = "load_region";
|
||||
public new static readonly StringName GetMaps = "get_maps";
|
||||
public new static readonly StringName UpdateMaps = "update_maps";
|
||||
public new static readonly StringName GetHeightMapsRid = "get_height_maps_rid";
|
||||
public new static readonly StringName GetControlMapsRid = "get_control_maps_rid";
|
||||
public new static readonly StringName GetColorMapsRid = "get_color_maps_rid";
|
||||
public new static readonly StringName SetPixel = "set_pixel";
|
||||
public new static readonly StringName GetPixel = "get_pixel";
|
||||
public new static readonly StringName SetHeight = "set_height";
|
||||
public new static readonly StringName GetHeight = "get_height";
|
||||
public new static readonly StringName SetColor = "set_color";
|
||||
public new static readonly StringName GetColor = "get_color";
|
||||
public new static readonly StringName SetControl = "set_control";
|
||||
public new static readonly StringName GetControl = "get_control";
|
||||
public new static readonly StringName SetRoughness = "set_roughness";
|
||||
public new static readonly StringName GetRoughness = "get_roughness";
|
||||
public new static readonly StringName SetControlBaseId = "set_control_base_id";
|
||||
public new static readonly StringName GetControlBaseId = "get_control_base_id";
|
||||
public new static readonly StringName SetControlOverlayId = "set_control_overlay_id";
|
||||
public new static readonly StringName GetControlOverlayId = "get_control_overlay_id";
|
||||
public new static readonly StringName SetControlBlend = "set_control_blend";
|
||||
public new static readonly StringName GetControlBlend = "get_control_blend";
|
||||
public new static readonly StringName SetControlAngle = "set_control_angle";
|
||||
public new static readonly StringName GetControlAngle = "get_control_angle";
|
||||
public new static readonly StringName SetControlScale = "set_control_scale";
|
||||
public new static readonly StringName GetControlScale = "get_control_scale";
|
||||
public new static readonly StringName SetControlHole = "set_control_hole";
|
||||
public new static readonly StringName GetControlHole = "get_control_hole";
|
||||
public new static readonly StringName SetControlNavigation = "set_control_navigation";
|
||||
public new static readonly StringName GetControlNavigation = "get_control_navigation";
|
||||
public new static readonly StringName SetControlAuto = "set_control_auto";
|
||||
public new static readonly StringName GetControlAuto = "get_control_auto";
|
||||
public new static readonly StringName GetNormal = "get_normal";
|
||||
public new static readonly StringName IsInSlope = "is_in_slope";
|
||||
public new static readonly StringName GetTextureId = "get_texture_id";
|
||||
public new static readonly StringName GetMeshVertex = "get_mesh_vertex";
|
||||
public new static readonly StringName GetHeightRange = "get_height_range";
|
||||
public new static readonly StringName CalcHeightRange = "calc_height_range";
|
||||
public new static readonly StringName ImportImages = "import_images";
|
||||
public new static readonly StringName ExportImage = "export_image";
|
||||
public new static readonly StringName LayeredToImage = "layered_to_image";
|
||||
public new static readonly StringName Dump = "dump";
|
||||
}
|
||||
|
||||
public new long GetRegionCount() =>
|
||||
Call(GDExtensionMethodName.GetRegionCount, []).As<long>();
|
||||
|
||||
public new Godot.Collections.Array GetRegionsActive(bool copy = false, bool deep = false) =>
|
||||
Call(GDExtensionMethodName.GetRegionsActive, [copy, deep]).As<Godot.Collections.Array>();
|
||||
|
||||
public new Godot.Collections.Dictionary GetRegionsAll() =>
|
||||
Call(GDExtensionMethodName.GetRegionsAll, []).As<Godot.Collections.Dictionary>();
|
||||
|
||||
public new int[] GetRegionMap() =>
|
||||
Call(GDExtensionMethodName.GetRegionMap, []).As<int[]>();
|
||||
|
||||
public new static long GetRegionMapIndex(Vector2I regionLocation) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetRegionMapIndex, [regionLocation]).As<long>();
|
||||
|
||||
public new void DoForRegions(Rect2I area, Callable callback) =>
|
||||
Call(GDExtensionMethodName.DoForRegions, [area, callback]);
|
||||
|
||||
public new void ChangeRegionSize(long regionSize) =>
|
||||
Call(GDExtensionMethodName.ChangeRegionSize, [regionSize]);
|
||||
|
||||
public new Vector2I GetRegionLocation(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetRegionLocation, [globalPosition]).As<Vector2I>();
|
||||
|
||||
public new long GetRegionId(Vector2I regionLocation) =>
|
||||
Call(GDExtensionMethodName.GetRegionId, [regionLocation]).As<long>();
|
||||
|
||||
public new long GetRegionIdp(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetRegionIdp, [globalPosition]).As<long>();
|
||||
|
||||
public new bool HasRegion(Vector2I regionLocation) =>
|
||||
Call(GDExtensionMethodName.HasRegion, [regionLocation]).As<bool>();
|
||||
|
||||
public new bool HasRegionp(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.HasRegionp, [globalPosition]).As<bool>();
|
||||
|
||||
public new Terrain3DRegion GetRegion(Vector2I regionLocation) =>
|
||||
Terrain3DRegion.Bind(Call(GDExtensionMethodName.GetRegion, [regionLocation]).As<Resource>());
|
||||
|
||||
public new Terrain3DRegion GetRegionp(Vector3 globalPosition) =>
|
||||
Terrain3DRegion.Bind(Call(GDExtensionMethodName.GetRegionp, [globalPosition]).As<Resource>());
|
||||
|
||||
public new void SetRegionModified(Vector2I regionLocation, bool modified) =>
|
||||
Call(GDExtensionMethodName.SetRegionModified, [regionLocation, modified]);
|
||||
|
||||
public new bool IsRegionModified(Vector2I regionLocation) =>
|
||||
Call(GDExtensionMethodName.IsRegionModified, [regionLocation]).As<bool>();
|
||||
|
||||
#region Methods
|
||||
public new void SetRegionDeleted(Vector2I regionLocation, bool deleted) =>
|
||||
Call(GDExtensionMethodName.SetRegionDeleted, [regionLocation, deleted]);
|
||||
|
||||
public int GetRegionCount() => Call(_cached_get_region_count).As<int>();
|
||||
public new bool IsRegionDeleted(Vector2I regionLocation) =>
|
||||
Call(GDExtensionMethodName.IsRegionDeleted, [regionLocation]).As<bool>();
|
||||
|
||||
public void SetRegionLocations(Godot.Collections.Array<Vector2I> regionLocations) => Call(_cached_set_region_locations, regionLocations);
|
||||
public new Terrain3DRegion AddRegionBlankp(Vector3 globalPosition, bool update = true) =>
|
||||
Terrain3DRegion.Bind(Call(GDExtensionMethodName.AddRegionBlankp, [globalPosition, update]).As<Resource>());
|
||||
|
||||
public Godot.Collections.Array<Vector2I> GetRegionLocations() => Call(_cached_get_region_locations).As<Godot.Collections.Array<Vector2I>>();
|
||||
public new Terrain3DRegion AddRegionBlank(Vector2I regionLocation, bool update = true) =>
|
||||
Terrain3DRegion.Bind(Call(GDExtensionMethodName.AddRegionBlank, [regionLocation, update]).As<Resource>());
|
||||
|
||||
public Godot.Collections.Array<Terrain3DRegion> GetRegionsActive(bool copy, bool deep) => GDExtensionHelper.Cast<Terrain3DRegion>(Call(_cached_get_regions_active, copy, deep).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new Error AddRegion(Terrain3DRegion region, bool update = true) =>
|
||||
Call(GDExtensionMethodName.AddRegion, [region, update]).As<Error>();
|
||||
|
||||
public Godot.Collections.Dictionary GetRegionsAll() => Call(_cached_get_regions_all).As<Godot.Collections.Dictionary>();
|
||||
public new void RemoveRegionp(Vector3 globalPosition, bool update = true) =>
|
||||
Call(GDExtensionMethodName.RemoveRegionp, [globalPosition, update]);
|
||||
|
||||
public int[] GetRegionMap() => Call(_cached_get_region_map).As<int[]>();
|
||||
public new void RemoveRegionl(Vector2I regionLocation, bool update = true) =>
|
||||
Call(GDExtensionMethodName.RemoveRegionl, [regionLocation, update]);
|
||||
|
||||
public static int GetRegionMapIndex(Vector2I regionLocation) => GDExtensionHelper.Call(GDExtensionName, _cached_get_region_map_index, regionLocation).As<int>();
|
||||
public new void RemoveRegion(Terrain3DRegion region, bool update = true) =>
|
||||
Call(GDExtensionMethodName.RemoveRegion, [region, update]);
|
||||
|
||||
public void DoForRegions(Rect2I area, Callable callback) => Call(_cached_do_for_regions, area, callback);
|
||||
public new void SaveDirectory(string directory) =>
|
||||
Call(GDExtensionMethodName.SaveDirectory, [directory]);
|
||||
|
||||
public void ChangeRegionSize(int regionSize) => Call(_cached_change_region_size, regionSize);
|
||||
public new void SaveRegion(Vector2I regionLocation, string directory, bool save16Bit = false) =>
|
||||
Call(GDExtensionMethodName.SaveRegion, [regionLocation, directory, save16Bit]);
|
||||
|
||||
public Vector2I GetRegionLocation(Vector3 globalPosition) => Call(_cached_get_region_location, globalPosition).As<Vector2I>();
|
||||
public new void LoadDirectory(string directory) =>
|
||||
Call(GDExtensionMethodName.LoadDirectory, [directory]);
|
||||
|
||||
public int GetRegionId(Vector2I regionLocation) => Call(_cached_get_region_id, regionLocation).As<int>();
|
||||
public new void LoadRegion(Vector2I regionLocation, string directory, bool update = true) =>
|
||||
Call(GDExtensionMethodName.LoadRegion, [regionLocation, directory, update]);
|
||||
|
||||
public int GetRegionIdp(Vector3 globalPosition) => Call(_cached_get_region_idp, globalPosition).As<int>();
|
||||
public new Godot.Collections.Array GetMaps(Terrain3DRegion.MapType mapType) =>
|
||||
Call(GDExtensionMethodName.GetMaps, [Variant.From(mapType)]).As<Godot.Collections.Array>();
|
||||
|
||||
public bool HasRegion(Vector2I regionLocation) => Call(_cached_has_region, regionLocation).As<bool>();
|
||||
public new void UpdateMaps(Terrain3DRegion.MapType mapType = Terrain3DRegion.MapType.Max, bool allRegions = true, bool generateMipmaps = false) =>
|
||||
Call(GDExtensionMethodName.UpdateMaps, [Variant.From(mapType), allRegions, generateMipmaps]);
|
||||
|
||||
public bool HasRegionp(Vector3 globalPosition) => Call(_cached_has_regionp, globalPosition).As<bool>();
|
||||
public new Rid GetHeightMapsRid() =>
|
||||
Call(GDExtensionMethodName.GetHeightMapsRid, []).As<Rid>();
|
||||
|
||||
public Terrain3DRegion GetRegion(Vector2I regionLocation) => GDExtensionHelper.Bind<Terrain3DRegion>(Call(_cached_get_region, regionLocation).As<GodotObject>());
|
||||
public new Rid GetControlMapsRid() =>
|
||||
Call(GDExtensionMethodName.GetControlMapsRid, []).As<Rid>();
|
||||
|
||||
public Terrain3DRegion GetRegionp(Vector3 globalPosition) => GDExtensionHelper.Bind<Terrain3DRegion>(Call(_cached_get_regionp, globalPosition).As<GodotObject>());
|
||||
public new Rid GetColorMapsRid() =>
|
||||
Call(GDExtensionMethodName.GetColorMapsRid, []).As<Rid>();
|
||||
|
||||
public void SetRegionModified(Vector2I regionLocation, bool modified) => Call(_cached_set_region_modified, regionLocation, modified);
|
||||
public new void SetPixel(Terrain3DRegion.MapType mapType, Vector3 globalPosition, Color pixel) =>
|
||||
Call(GDExtensionMethodName.SetPixel, [Variant.From(mapType), globalPosition, pixel]);
|
||||
|
||||
public bool IsRegionModified(Vector2I regionLocation) => Call(_cached_is_region_modified, regionLocation).As<bool>();
|
||||
public new Color GetPixel(Terrain3DRegion.MapType mapType, Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetPixel, [Variant.From(mapType), globalPosition]).As<Color>();
|
||||
|
||||
public void SetRegionDeleted(Vector2I regionLocation, bool deleted) => Call(_cached_set_region_deleted, regionLocation, deleted);
|
||||
public new void SetHeight(Vector3 globalPosition, double height) =>
|
||||
Call(GDExtensionMethodName.SetHeight, [globalPosition, height]);
|
||||
|
||||
public bool IsRegionDeleted(Vector2I regionLocation) => Call(_cached_is_region_deleted, regionLocation).As<bool>();
|
||||
public new double GetHeight(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetHeight, [globalPosition]).As<double>();
|
||||
|
||||
public Terrain3DRegion AddRegionBlankp(Vector3 globalPosition, bool update) => GDExtensionHelper.Bind<Terrain3DRegion>(Call(_cached_add_region_blankp, globalPosition, update).As<GodotObject>());
|
||||
public new void SetColor(Vector3 globalPosition, Color color) =>
|
||||
Call(GDExtensionMethodName.SetColor, [globalPosition, color]);
|
||||
|
||||
public Terrain3DRegion AddRegionBlank(Vector2I regionLocation, bool update) => GDExtensionHelper.Bind<Terrain3DRegion>(Call(_cached_add_region_blank, regionLocation, update).As<GodotObject>());
|
||||
public new Color GetColor(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetColor, [globalPosition]).As<Color>();
|
||||
|
||||
public int AddRegion(Terrain3DRegion region, bool update) => Call(_cached_add_region, (Resource)region, update).As<int>();
|
||||
public new void SetControl(Vector3 globalPosition, long control) =>
|
||||
Call(GDExtensionMethodName.SetControl, [globalPosition, control]);
|
||||
|
||||
public void RemoveRegionp(Vector3 globalPosition, bool update) => Call(_cached_remove_regionp, globalPosition, update);
|
||||
public new long GetControl(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControl, [globalPosition]).As<long>();
|
||||
|
||||
public void RemoveRegionl(Vector2I regionLocation, bool update) => Call(_cached_remove_regionl, regionLocation, update);
|
||||
public new void SetRoughness(Vector3 globalPosition, double roughness) =>
|
||||
Call(GDExtensionMethodName.SetRoughness, [globalPosition, roughness]);
|
||||
|
||||
public void RemoveRegion(Terrain3DRegion region, bool update) => Call(_cached_remove_region, (Resource)region, update);
|
||||
public new double GetRoughness(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetRoughness, [globalPosition]).As<double>();
|
||||
|
||||
public void SaveDirectory(string directory) => Call(_cached_save_directory, directory);
|
||||
public new void SetControlBaseId(Vector3 globalPosition, long textureId) =>
|
||||
Call(GDExtensionMethodName.SetControlBaseId, [globalPosition, textureId]);
|
||||
|
||||
public void SaveRegion(Vector2I regionLocation, string directory, bool _16Bit) => Call(_cached_save_region, regionLocation, directory, _16Bit);
|
||||
public new long GetControlBaseId(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlBaseId, [globalPosition]).As<long>();
|
||||
|
||||
public void LoadDirectory(string directory) => Call(_cached_load_directory, directory);
|
||||
public new void SetControlOverlayId(Vector3 globalPosition, long textureId) =>
|
||||
Call(GDExtensionMethodName.SetControlOverlayId, [globalPosition, textureId]);
|
||||
|
||||
public void LoadRegion(Vector2I regionLocation, string directory, bool update) => Call(_cached_load_region, regionLocation, directory, update);
|
||||
public new long GetControlOverlayId(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlOverlayId, [globalPosition]).As<long>();
|
||||
|
||||
public Godot.Collections.Array<Image> GetHeightMaps() => GDExtensionHelper.Cast<Image>(Call(_cached_get_height_maps).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new void SetControlBlend(Vector3 globalPosition, double blendValue) =>
|
||||
Call(GDExtensionMethodName.SetControlBlend, [globalPosition, blendValue]);
|
||||
|
||||
public Godot.Collections.Array<Image> GetControlMaps() => GDExtensionHelper.Cast<Image>(Call(_cached_get_control_maps).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new double GetControlBlend(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlBlend, [globalPosition]).As<double>();
|
||||
|
||||
public Godot.Collections.Array<Image> GetColorMaps() => GDExtensionHelper.Cast<Image>(Call(_cached_get_color_maps).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new void SetControlAngle(Vector3 globalPosition, double degrees) =>
|
||||
Call(GDExtensionMethodName.SetControlAngle, [globalPosition, degrees]);
|
||||
|
||||
public Godot.Collections.Array<Image> GetMaps(int mapType) => GDExtensionHelper.Cast<Image>(Call(_cached_get_maps, mapType).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new double GetControlAngle(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlAngle, [globalPosition]).As<double>();
|
||||
|
||||
public void UpdateMaps(int mapType, bool allMaps, bool generateMipmaps) => Call(_cached_update_maps, mapType, allMaps, generateMipmaps);
|
||||
public new void SetControlScale(Vector3 globalPosition, double percentageModifier) =>
|
||||
Call(GDExtensionMethodName.SetControlScale, [globalPosition, percentageModifier]);
|
||||
|
||||
public Rid GetHeightMapsRid() => Call(_cached_get_height_maps_rid).As<Rid>();
|
||||
public new double GetControlScale(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlScale, [globalPosition]).As<double>();
|
||||
|
||||
public Rid GetControlMapsRid() => Call(_cached_get_control_maps_rid).As<Rid>();
|
||||
public new void SetControlHole(Vector3 globalPosition, bool enable) =>
|
||||
Call(GDExtensionMethodName.SetControlHole, [globalPosition, enable]);
|
||||
|
||||
public Rid GetColorMapsRid() => Call(_cached_get_color_maps_rid).As<Rid>();
|
||||
public new bool GetControlHole(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlHole, [globalPosition]).As<bool>();
|
||||
|
||||
public void SetPixel(int mapType, Vector3 globalPosition, Color pixel) => Call(_cached_set_pixel, mapType, globalPosition, pixel);
|
||||
public new void SetControlNavigation(Vector3 globalPosition, bool enable) =>
|
||||
Call(GDExtensionMethodName.SetControlNavigation, [globalPosition, enable]);
|
||||
|
||||
public Color GetPixel(int mapType, Vector3 globalPosition) => Call(_cached_get_pixel, mapType, globalPosition).As<Color>();
|
||||
public new bool GetControlNavigation(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlNavigation, [globalPosition]).As<bool>();
|
||||
|
||||
public void SetHeight(Vector3 globalPosition, float height) => Call(_cached_set_height, globalPosition, height);
|
||||
public new void SetControlAuto(Vector3 globalPosition, bool enable) =>
|
||||
Call(GDExtensionMethodName.SetControlAuto, [globalPosition, enable]);
|
||||
|
||||
public float GetHeight(Vector3 globalPosition) => Call(_cached_get_height, globalPosition).As<float>();
|
||||
public new bool GetControlAuto(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetControlAuto, [globalPosition]).As<bool>();
|
||||
|
||||
public void SetColor(Vector3 globalPosition, Color color) => Call(_cached_set_color, globalPosition, color);
|
||||
public new Vector3 GetNormal(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetNormal, [globalPosition]).As<Vector3>();
|
||||
|
||||
public Color GetColor(Vector3 globalPosition) => Call(_cached_get_color, globalPosition).As<Color>();
|
||||
public new bool IsInSlope(Vector3 globalPosition, Vector2 slopeRange, Vector3 normal = default) =>
|
||||
Call(GDExtensionMethodName.IsInSlope, [globalPosition, slopeRange, normal]).As<bool>();
|
||||
|
||||
public void SetControl(Vector3 globalPosition, int control) => Call(_cached_set_control, globalPosition, control);
|
||||
public new Vector3 GetTextureId(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetTextureId, [globalPosition]).As<Vector3>();
|
||||
|
||||
public int GetControl(Vector3 globalPosition) => Call(_cached_get_control, globalPosition).As<int>();
|
||||
public new Vector3 GetMeshVertex(long lod, Terrain3DData.HeightFilter filter, Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetMeshVertex, [lod, Variant.From(filter), globalPosition]).As<Vector3>();
|
||||
|
||||
public void SetRoughness(Vector3 globalPosition, float roughness) => Call(_cached_set_roughness, globalPosition, roughness);
|
||||
public new Vector2 GetHeightRange() =>
|
||||
Call(GDExtensionMethodName.GetHeightRange, []).As<Vector2>();
|
||||
|
||||
public float GetRoughness(Vector3 globalPosition) => Call(_cached_get_roughness, globalPosition).As<float>();
|
||||
public new void CalcHeightRange(bool recursive = false) =>
|
||||
Call(GDExtensionMethodName.CalcHeightRange, [recursive]);
|
||||
|
||||
public void SetControlBaseId(Vector3 globalPosition, int textureId) => Call(_cached_set_control_base_id, globalPosition, textureId);
|
||||
public new void ImportImages(Godot.Collections.Array images, Vector3 globalPosition = default, double offset = 0, double scale = 1) =>
|
||||
Call(GDExtensionMethodName.ImportImages, [images, globalPosition, offset, scale]);
|
||||
|
||||
public int GetControlBaseId(Vector3 globalPosition) => Call(_cached_get_control_base_id, globalPosition).As<int>();
|
||||
public new Error ExportImage(string fileName, Terrain3DRegion.MapType mapType) =>
|
||||
Call(GDExtensionMethodName.ExportImage, [fileName, Variant.From(mapType)]).As<Error>();
|
||||
|
||||
public void SetControlOverlayId(Vector3 globalPosition, int textureId) => Call(_cached_set_control_overlay_id, globalPosition, textureId);
|
||||
public new Image LayeredToImage(Terrain3DRegion.MapType mapType) =>
|
||||
Call(GDExtensionMethodName.LayeredToImage, [Variant.From(mapType)]).As<Image>();
|
||||
|
||||
public int GetControlOverlayId(Vector3 globalPosition) => Call(_cached_get_control_overlay_id, globalPosition).As<int>();
|
||||
public new void Dump(bool verbose = false) =>
|
||||
Call(GDExtensionMethodName.Dump, [verbose]);
|
||||
|
||||
public void SetControlBlend(Vector3 globalPosition, float blendValue) => Call(_cached_set_control_blend, globalPosition, blendValue);
|
||||
|
||||
public float GetControlBlend(Vector3 globalPosition) => Call(_cached_get_control_blend, globalPosition).As<float>();
|
||||
|
||||
public void SetControlAngle(Vector3 globalPosition, float degrees) => Call(_cached_set_control_angle, globalPosition, degrees);
|
||||
|
||||
public float GetControlAngle(Vector3 globalPosition) => Call(_cached_get_control_angle, globalPosition).As<float>();
|
||||
|
||||
public void SetControlScale(Vector3 globalPosition, float percentageModifier) => Call(_cached_set_control_scale, globalPosition, percentageModifier);
|
||||
|
||||
public float GetControlScale(Vector3 globalPosition) => Call(_cached_get_control_scale, globalPosition).As<float>();
|
||||
|
||||
public void SetControlHole(Vector3 globalPosition, bool enable) => Call(_cached_set_control_hole, globalPosition, enable);
|
||||
|
||||
public bool GetControlHole(Vector3 globalPosition) => Call(_cached_get_control_hole, globalPosition).As<bool>();
|
||||
|
||||
public void SetControlNavigation(Vector3 globalPosition, bool enable) => Call(_cached_set_control_navigation, globalPosition, enable);
|
||||
|
||||
public bool GetControlNavigation(Vector3 globalPosition) => Call(_cached_get_control_navigation, globalPosition).As<bool>();
|
||||
|
||||
public void SetControlAuto(Vector3 globalPosition, bool enable) => Call(_cached_set_control_auto, globalPosition, enable);
|
||||
|
||||
public bool GetControlAuto(Vector3 globalPosition) => Call(_cached_get_control_auto, globalPosition).As<bool>();
|
||||
|
||||
public Vector3 GetNormal(Vector3 globalPosition) => Call(_cached_get_normal, globalPosition).As<Vector3>();
|
||||
|
||||
public bool IsInSlope(Vector3 globalPosition, Vector2 slopeRange, bool invert) => Call(_cached_is_in_slope, globalPosition, slopeRange, invert).As<bool>();
|
||||
|
||||
public Vector3 GetTextureId(Vector3 globalPosition) => Call(_cached_get_texture_id, globalPosition).As<Vector3>();
|
||||
|
||||
public Vector3 GetMeshVertex(int lod, int filter, Vector3 globalPosition) => Call(_cached_get_mesh_vertex, lod, filter, globalPosition).As<Vector3>();
|
||||
|
||||
public Vector2 GetHeightRange() => Call(_cached_get_height_range).As<Vector2>();
|
||||
|
||||
public void CalcHeightRange(bool recursive) => Call(_cached_calc_height_range, recursive);
|
||||
|
||||
public void ImportImages(Godot.Collections.Array<Image> images, Vector3 globalPosition, float offset, float scale) => Call(_cached_import_images, images, globalPosition, offset, scale);
|
||||
|
||||
public int ExportImage(string fileName, int mapType) => Call(_cached_export_image, fileName, mapType).As<int>();
|
||||
|
||||
public Image LayeredToImage(int mapType) => GDExtensionHelper.Bind<Image>(Call(_cached_layered_to_image, mapType).As<GodotObject>());
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_region_locations = "region_locations";
|
||||
private static readonly StringName _cached_height_maps = "height_maps";
|
||||
private static readonly StringName _cached_control_maps = "control_maps";
|
||||
private static readonly StringName _cached_color_maps = "color_maps";
|
||||
private static readonly StringName _cached_get_region_count = "get_region_count";
|
||||
private static readonly StringName _cached_set_region_locations = "set_region_locations";
|
||||
private static readonly StringName _cached_get_region_locations = "get_region_locations";
|
||||
private static readonly StringName _cached_get_regions_active = "get_regions_active";
|
||||
private static readonly StringName _cached_get_regions_all = "get_regions_all";
|
||||
private static readonly StringName _cached_get_region_map = "get_region_map";
|
||||
private static readonly StringName _cached_get_region_map_index = "get_region_map_index";
|
||||
private static readonly StringName _cached_do_for_regions = "do_for_regions";
|
||||
private static readonly StringName _cached_change_region_size = "change_region_size";
|
||||
private static readonly StringName _cached_get_region_location = "get_region_location";
|
||||
private static readonly StringName _cached_get_region_id = "get_region_id";
|
||||
private static readonly StringName _cached_get_region_idp = "get_region_idp";
|
||||
private static readonly StringName _cached_has_region = "has_region";
|
||||
private static readonly StringName _cached_has_regionp = "has_regionp";
|
||||
private static readonly StringName _cached_get_region = "get_region";
|
||||
private static readonly StringName _cached_get_regionp = "get_regionp";
|
||||
private static readonly StringName _cached_set_region_modified = "set_region_modified";
|
||||
private static readonly StringName _cached_is_region_modified = "is_region_modified";
|
||||
private static readonly StringName _cached_set_region_deleted = "set_region_deleted";
|
||||
private static readonly StringName _cached_is_region_deleted = "is_region_deleted";
|
||||
private static readonly StringName _cached_add_region_blankp = "add_region_blankp";
|
||||
private static readonly StringName _cached_add_region_blank = "add_region_blank";
|
||||
private static readonly StringName _cached_add_region = "add_region";
|
||||
private static readonly StringName _cached_remove_regionp = "remove_regionp";
|
||||
private static readonly StringName _cached_remove_regionl = "remove_regionl";
|
||||
private static readonly StringName _cached_remove_region = "remove_region";
|
||||
private static readonly StringName _cached_save_directory = "save_directory";
|
||||
private static readonly StringName _cached_save_region = "save_region";
|
||||
private static readonly StringName _cached_load_directory = "load_directory";
|
||||
private static readonly StringName _cached_load_region = "load_region";
|
||||
private static readonly StringName _cached_get_height_maps = "get_height_maps";
|
||||
private static readonly StringName _cached_get_control_maps = "get_control_maps";
|
||||
private static readonly StringName _cached_get_color_maps = "get_color_maps";
|
||||
private static readonly StringName _cached_get_maps = "get_maps";
|
||||
private static readonly StringName _cached_update_maps = "update_maps";
|
||||
private static readonly StringName _cached_get_height_maps_rid = "get_height_maps_rid";
|
||||
private static readonly StringName _cached_get_control_maps_rid = "get_control_maps_rid";
|
||||
private static readonly StringName _cached_get_color_maps_rid = "get_color_maps_rid";
|
||||
private static readonly StringName _cached_set_pixel = "set_pixel";
|
||||
private static readonly StringName _cached_get_pixel = "get_pixel";
|
||||
private static readonly StringName _cached_set_height = "set_height";
|
||||
private static readonly StringName _cached_get_height = "get_height";
|
||||
private static readonly StringName _cached_set_color = "set_color";
|
||||
private static readonly StringName _cached_get_color = "get_color";
|
||||
private static readonly StringName _cached_set_control = "set_control";
|
||||
private static readonly StringName _cached_get_control = "get_control";
|
||||
private static readonly StringName _cached_set_roughness = "set_roughness";
|
||||
private static readonly StringName _cached_get_roughness = "get_roughness";
|
||||
private static readonly StringName _cached_set_control_base_id = "set_control_base_id";
|
||||
private static readonly StringName _cached_get_control_base_id = "get_control_base_id";
|
||||
private static readonly StringName _cached_set_control_overlay_id = "set_control_overlay_id";
|
||||
private static readonly StringName _cached_get_control_overlay_id = "get_control_overlay_id";
|
||||
private static readonly StringName _cached_set_control_blend = "set_control_blend";
|
||||
private static readonly StringName _cached_get_control_blend = "get_control_blend";
|
||||
private static readonly StringName _cached_set_control_angle = "set_control_angle";
|
||||
private static readonly StringName _cached_get_control_angle = "get_control_angle";
|
||||
private static readonly StringName _cached_set_control_scale = "set_control_scale";
|
||||
private static readonly StringName _cached_get_control_scale = "get_control_scale";
|
||||
private static readonly StringName _cached_set_control_hole = "set_control_hole";
|
||||
private static readonly StringName _cached_get_control_hole = "get_control_hole";
|
||||
private static readonly StringName _cached_set_control_navigation = "set_control_navigation";
|
||||
private static readonly StringName _cached_get_control_navigation = "get_control_navigation";
|
||||
private static readonly StringName _cached_set_control_auto = "set_control_auto";
|
||||
private static readonly StringName _cached_get_control_auto = "get_control_auto";
|
||||
private static readonly StringName _cached_get_normal = "get_normal";
|
||||
private static readonly StringName _cached_is_in_slope = "is_in_slope";
|
||||
private static readonly StringName _cached_get_texture_id = "get_texture_id";
|
||||
private static readonly StringName _cached_get_mesh_vertex = "get_mesh_vertex";
|
||||
private static readonly StringName _cached_get_height_range = "get_height_range";
|
||||
private static readonly StringName _cached_calc_height_range = "calc_height_range";
|
||||
private static readonly StringName _cached_import_images = "import_images";
|
||||
private static readonly StringName _cached_export_image = "export_image";
|
||||
private static readonly StringName _cached_layered_to_image = "layered_to_image";
|
||||
private static readonly StringName _cached_maps_changed = "maps_changed";
|
||||
private static readonly StringName _cached_region_map_changed = "region_map_changed";
|
||||
private static readonly StringName _cached_height_maps_changed = "height_maps_changed";
|
||||
private static readonly StringName _cached_control_maps_changed = "control_maps_changed";
|
||||
private static readonly StringName _cached_color_maps_changed = "color_maps_changed";
|
||||
private static readonly StringName _cached_maps_edited = "maps_edited";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://bsaf8mw2e3h27
|
||||
uid://ct5j1v1bbb4x3
|
||||
|
|
|
|||
|
|
@ -1,108 +1,146 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DEditor : GodotObject
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DEditor";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying GodotObject), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DEditor() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DEditor");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DEditor"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DEditor Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DEditor>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DEditor object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DEditor() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DEditor"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DEditor"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DEditor"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DEditor"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DEditor Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DEditor>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public enum Operation : long
|
||||
{
|
||||
Add = 0,
|
||||
Subtract = 1,
|
||||
Replace = 2,
|
||||
Average = 3,
|
||||
Gradient = 4,
|
||||
OpMax = 5,
|
||||
}
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DEditor"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DEditor"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DEditor"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DEditor"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DEditor Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DEditor wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
public enum Tool : long
|
||||
{
|
||||
Sculpt = 1,
|
||||
Height = 2,
|
||||
Texture = 3,
|
||||
Color = 4,
|
||||
Roughness = 5,
|
||||
Angle = 10,
|
||||
Scale = 11,
|
||||
Autoshader = 6,
|
||||
Holes = 7,
|
||||
Navigation = 8,
|
||||
Instancer = 9,
|
||||
Region = 0,
|
||||
Max = 12,
|
||||
}
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DEditor);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DEditor).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DEditor)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public void SetTerrain(Terrain3D terrain) => Call(_cached_set_terrain, (Node3D)terrain);
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DEditor"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DEditor" type.</returns>
|
||||
public new static Terrain3DEditor Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public Terrain3D GetTerrain() => GDExtensionHelper.Bind<Terrain3D>(Call(_cached_get_terrain).As<GodotObject>());
|
||||
public enum Operation
|
||||
{
|
||||
Add = 0,
|
||||
Subtract = 1,
|
||||
Replace = 2,
|
||||
Average = 3,
|
||||
Gradient = 4,
|
||||
OpMax = 5,
|
||||
}
|
||||
|
||||
public void SetBrushData(Godot.Collections.Dictionary data) => Call(_cached_set_brush_data, data);
|
||||
public enum Tool
|
||||
{
|
||||
Sculpt = 1,
|
||||
Height = 2,
|
||||
Texture = 3,
|
||||
Color = 4,
|
||||
Roughness = 5,
|
||||
Angle = 10,
|
||||
Scale = 11,
|
||||
Autoshader = 6,
|
||||
Holes = 7,
|
||||
Navigation = 8,
|
||||
Instancer = 9,
|
||||
Region = 0,
|
||||
Max = 12,
|
||||
}
|
||||
|
||||
public void SetTool(int tool) => Call(_cached_set_tool, tool);
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName SetTerrain = "set_terrain";
|
||||
public new static readonly StringName GetTerrain = "get_terrain";
|
||||
public new static readonly StringName SetBrushData = "set_brush_data";
|
||||
public new static readonly StringName SetTool = "set_tool";
|
||||
public new static readonly StringName GetTool = "get_tool";
|
||||
public new static readonly StringName SetOperation = "set_operation";
|
||||
public new static readonly StringName GetOperation = "get_operation";
|
||||
public new static readonly StringName StartOperation = "start_operation";
|
||||
public new static readonly StringName IsOperating = "is_operating";
|
||||
public new static readonly StringName Operate = "operate";
|
||||
public new static readonly StringName BackupRegion = "backup_region";
|
||||
public new static readonly StringName StopOperation = "stop_operation";
|
||||
public new static readonly StringName ApplyUndo = "apply_undo";
|
||||
}
|
||||
|
||||
public int GetTool() => Call(_cached_get_tool).As<int>();
|
||||
public new void SetTerrain(Terrain3D terrain) =>
|
||||
Call(GDExtensionMethodName.SetTerrain, [terrain]);
|
||||
|
||||
public void SetOperation(int operation) => Call(_cached_set_operation, operation);
|
||||
public new Terrain3D GetTerrain() =>
|
||||
Terrain3D.Bind(Call(GDExtensionMethodName.GetTerrain, []).As<Node3D>());
|
||||
|
||||
public int GetOperation() => Call(_cached_get_operation).As<int>();
|
||||
public new void SetBrushData(Godot.Collections.Dictionary data) =>
|
||||
Call(GDExtensionMethodName.SetBrushData, [data]);
|
||||
|
||||
public void StartOperation(Vector3 position) => Call(_cached_start_operation, position);
|
||||
public new void SetTool(Terrain3DEditor.Tool tool) =>
|
||||
Call(GDExtensionMethodName.SetTool, [Variant.From(tool)]);
|
||||
|
||||
public bool IsOperating() => Call(_cached_is_operating).As<bool>();
|
||||
public new Terrain3DEditor.Tool GetTool() =>
|
||||
Call(GDExtensionMethodName.GetTool, []).As<Terrain3DEditor.Tool>();
|
||||
|
||||
public void Operate(Vector3 position, float cameraDirection) => Call(_cached_operate, position, cameraDirection);
|
||||
public new void SetOperation(Terrain3DEditor.Operation operation) =>
|
||||
Call(GDExtensionMethodName.SetOperation, [Variant.From(operation)]);
|
||||
|
||||
public void BackupRegion(Terrain3DRegion region) => Call(_cached_backup_region, (Resource)region);
|
||||
public new Terrain3DEditor.Operation GetOperation() =>
|
||||
Call(GDExtensionMethodName.GetOperation, []).As<Terrain3DEditor.Operation>();
|
||||
|
||||
public void StopOperation() => Call(_cached_stop_operation);
|
||||
public new void StartOperation(Vector3 position) =>
|
||||
Call(GDExtensionMethodName.StartOperation, [position]);
|
||||
|
||||
public void ApplyUndo(Godot.Collections.Dictionary data) => Call(_cached_apply_undo, data);
|
||||
public new bool IsOperating() =>
|
||||
Call(GDExtensionMethodName.IsOperating, []).As<bool>();
|
||||
|
||||
#endregion
|
||||
public new void Operate(Vector3 position, double cameraDirection) =>
|
||||
Call(GDExtensionMethodName.Operate, [position, cameraDirection]);
|
||||
|
||||
private static readonly StringName _cached_set_terrain = "set_terrain";
|
||||
private static readonly StringName _cached_get_terrain = "get_terrain";
|
||||
private static readonly StringName _cached_set_brush_data = "set_brush_data";
|
||||
private static readonly StringName _cached_set_tool = "set_tool";
|
||||
private static readonly StringName _cached_get_tool = "get_tool";
|
||||
private static readonly StringName _cached_set_operation = "set_operation";
|
||||
private static readonly StringName _cached_get_operation = "get_operation";
|
||||
private static readonly StringName _cached_start_operation = "start_operation";
|
||||
private static readonly StringName _cached_is_operating = "is_operating";
|
||||
private static readonly StringName _cached_operate = "operate";
|
||||
private static readonly StringName _cached_backup_region = "backup_region";
|
||||
private static readonly StringName _cached_stop_operation = "stop_operation";
|
||||
private static readonly StringName _cached_apply_undo = "apply_undo";
|
||||
}
|
||||
public new void BackupRegion(Terrain3DRegion region) =>
|
||||
Call(GDExtensionMethodName.BackupRegion, [region]);
|
||||
|
||||
public new void StopOperation() =>
|
||||
Call(GDExtensionMethodName.StopOperation, []);
|
||||
|
||||
public new void ApplyUndo(Godot.Collections.Dictionary data) =>
|
||||
Call(GDExtensionMethodName.ApplyUndo, [data]);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://6igck2ddqfmt
|
||||
uid://bhdx3ry8edaq5
|
||||
|
|
|
|||
|
|
@ -1,80 +1,123 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DInstancer : GodotObject
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DInstancer";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying GodotObject), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DInstancer() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DInstancer");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DInstancer"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DInstancer Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DInstancer>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DInstancer object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DInstancer() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DInstancer"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DInstancer"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DInstancer"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DInstancer"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DInstancer Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DInstancer>(godotObject);
|
||||
}
|
||||
#region Methods
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public void ClearByMesh(int meshId) => Call(_cached_clear_by_mesh, meshId);
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DInstancer"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DInstancer"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DInstancer"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DInstancer"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DInstancer Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DInstancer wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
public void ClearByLocation(Vector2I regionLocation, int meshId) => Call(_cached_clear_by_location, regionLocation, meshId);
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DInstancer);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
public void ClearByRegion(Terrain3DRegion region, int meshId) => Call(_cached_clear_by_region, (Resource)region, meshId);
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DInstancer).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public void AddInstances(Vector3 globalPosition, Godot.Collections.Dictionary @params) => Call(_cached_add_instances, globalPosition, @params);
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DInstancer)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public void RemoveInstances(Vector3 globalPosition, Godot.Collections.Dictionary @params) => Call(_cached_remove_instances, globalPosition, @params);
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DInstancer"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DInstancer" type.</returns>
|
||||
public new static Terrain3DInstancer Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public void AddMultimesh(int meshId, MultiMesh multimesh, Transform3D transform, bool update) => Call(_cached_add_multimesh, meshId, (MultiMesh)multimesh, transform, update);
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName ClearByMesh = "clear_by_mesh";
|
||||
public new static readonly StringName ClearByLocation = "clear_by_location";
|
||||
public new static readonly StringName ClearByRegion = "clear_by_region";
|
||||
public new static readonly StringName AddInstances = "add_instances";
|
||||
public new static readonly StringName RemoveInstances = "remove_instances";
|
||||
public new static readonly StringName AddMultimesh = "add_multimesh";
|
||||
public new static readonly StringName AddTransforms = "add_transforms";
|
||||
public new static readonly StringName AppendLocation = "append_location";
|
||||
public new static readonly StringName AppendRegion = "append_region";
|
||||
public new static readonly StringName UpdateTransforms = "update_transforms";
|
||||
public new static readonly StringName GetClosestMeshId = "get_closest_mesh_id";
|
||||
public new static readonly StringName UpdateMmis = "update_mmis";
|
||||
public new static readonly StringName SwapIds = "swap_ids";
|
||||
public new static readonly StringName DumpMmis = "dump_mmis";
|
||||
}
|
||||
|
||||
public void AddTransforms(int meshId, Godot.Collections.Array<Transform3D> transforms, Color[] colors, bool update) => Call(_cached_add_transforms, meshId, transforms, colors, update);
|
||||
public new void ClearByMesh(long meshId) =>
|
||||
Call(GDExtensionMethodName.ClearByMesh, [meshId]);
|
||||
|
||||
public void AppendLocation(Vector2I regionLocation, int meshId, Godot.Collections.Array<Transform3D> transforms, Color[] colors, bool update) => Call(_cached_append_location, regionLocation, meshId, transforms, colors, update);
|
||||
public new void ClearByLocation(Vector2I regionLocation, long meshId) =>
|
||||
Call(GDExtensionMethodName.ClearByLocation, [regionLocation, meshId]);
|
||||
|
||||
public void AppendRegion(Terrain3DRegion region, int meshId, Godot.Collections.Array<Transform3D> transforms, Color[] colors, bool update) => Call(_cached_append_region, (Resource)region, meshId, transforms, colors, update);
|
||||
public new void ClearByRegion(Terrain3DRegion region, long meshId) =>
|
||||
Call(GDExtensionMethodName.ClearByRegion, [region, meshId]);
|
||||
|
||||
public void UpdateTransforms(Aabb aabb) => Call(_cached_update_transforms, aabb);
|
||||
public new void AddInstances(Vector3 globalPosition, Godot.Collections.Dictionary @params) =>
|
||||
Call(GDExtensionMethodName.AddInstances, [globalPosition, @params]);
|
||||
|
||||
public void UpdateMmis(bool rebuild) => Call(_cached_update_mmis, rebuild);
|
||||
public new void RemoveInstances(Vector3 globalPosition, Godot.Collections.Dictionary @params) =>
|
||||
Call(GDExtensionMethodName.RemoveInstances, [globalPosition, @params]);
|
||||
|
||||
public void SwapIds(int srcId, int destId) => Call(_cached_swap_ids, srcId, destId);
|
||||
public new void AddMultimesh(long meshId, MultiMesh multimesh, Transform3D transform = default, bool update = true) =>
|
||||
Call(GDExtensionMethodName.AddMultimesh, [meshId, multimesh, transform, update]);
|
||||
|
||||
public void DumpData() => Call(_cached_dump_data);
|
||||
public new void AddTransforms(long meshId, Godot.Collections.Array transforms, Color[] colors = default, bool update = true) =>
|
||||
Call(GDExtensionMethodName.AddTransforms, [meshId, transforms, colors, update]);
|
||||
|
||||
public void DumpMmis() => Call(_cached_dump_mmis);
|
||||
public new void AppendLocation(Vector2I regionLocation, long meshId, Godot.Collections.Array transforms, Color[] colors, bool update = true) =>
|
||||
Call(GDExtensionMethodName.AppendLocation, [regionLocation, meshId, transforms, colors, update]);
|
||||
|
||||
#endregion
|
||||
public new void AppendRegion(Terrain3DRegion region, long meshId, Godot.Collections.Array transforms, Color[] colors, bool update = true) =>
|
||||
Call(GDExtensionMethodName.AppendRegion, [region, meshId, transforms, colors, update]);
|
||||
|
||||
private static readonly StringName _cached_clear_by_mesh = "clear_by_mesh";
|
||||
private static readonly StringName _cached_clear_by_location = "clear_by_location";
|
||||
private static readonly StringName _cached_clear_by_region = "clear_by_region";
|
||||
private static readonly StringName _cached_add_instances = "add_instances";
|
||||
private static readonly StringName _cached_remove_instances = "remove_instances";
|
||||
private static readonly StringName _cached_add_multimesh = "add_multimesh";
|
||||
private static readonly StringName _cached_add_transforms = "add_transforms";
|
||||
private static readonly StringName _cached_append_location = "append_location";
|
||||
private static readonly StringName _cached_append_region = "append_region";
|
||||
private static readonly StringName _cached_update_transforms = "update_transforms";
|
||||
private static readonly StringName _cached_update_mmis = "update_mmis";
|
||||
private static readonly StringName _cached_swap_ids = "swap_ids";
|
||||
private static readonly StringName _cached_dump_data = "dump_data";
|
||||
private static readonly StringName _cached_dump_mmis = "dump_mmis";
|
||||
}
|
||||
public new void UpdateTransforms(Aabb aabb) =>
|
||||
Call(GDExtensionMethodName.UpdateTransforms, [aabb]);
|
||||
|
||||
public new long GetClosestMeshId(Vector3 globalPosition) =>
|
||||
Call(GDExtensionMethodName.GetClosestMeshId, [globalPosition]).As<long>();
|
||||
|
||||
public new void UpdateMmis(long meshId = -1, Vector2I regionLocation = default, bool rebuildAll = false) =>
|
||||
Call(GDExtensionMethodName.UpdateMmis, [meshId, regionLocation, rebuildAll]);
|
||||
|
||||
public new void SwapIds(long srcId, long destId) =>
|
||||
Call(GDExtensionMethodName.SwapIds, [srcId, destId]);
|
||||
|
||||
public new void DumpMmis() =>
|
||||
Call(GDExtensionMethodName.DumpMmis, []);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://tcjhk146tda8
|
||||
uid://v155pladupha
|
||||
|
|
|
|||
|
|
@ -1,402 +1,290 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DMaterial : Resource
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DMaterial";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying Resource), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DMaterial() { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DMaterial"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DMaterial Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DMaterial>(GDExtensionName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DMaterial"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DMaterial"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DMaterial"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DMaterial"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DMaterial Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DMaterial>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
|
||||
public enum WorldBackgroundEnum : long
|
||||
{
|
||||
None = 0,
|
||||
Flat = 1,
|
||||
Noise = 2,
|
||||
}
|
||||
|
||||
public enum TextureFilteringEnum : long
|
||||
{
|
||||
Linear = 0,
|
||||
Nearest = 1,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public Godot.Collections.Dictionary ShaderParameters
|
||||
{
|
||||
get => (Godot.Collections.Dictionary)Get(_cached__shader_parameters);
|
||||
set => Set(_cached__shader_parameters, Variant.From(value));
|
||||
}
|
||||
|
||||
public long /*None,Flat,Noise*/ WorldBackground
|
||||
{
|
||||
get => (long /*None,Flat,Noise*/)Get(_cached_world_background).As<Int64>();
|
||||
set => Set(_cached_world_background, Variant.From(value));
|
||||
}
|
||||
|
||||
public long /*Linear,Nearest*/ TextureFiltering
|
||||
{
|
||||
get => (long /*Linear,Nearest*/)Get(_cached_texture_filtering).As<Int64>();
|
||||
set => Set(_cached_texture_filtering, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool AutoShader
|
||||
{
|
||||
get => (bool)Get(_cached_auto_shader);
|
||||
set => Set(_cached_auto_shader, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool DualScaling
|
||||
{
|
||||
get => (bool)Get(_cached_dual_scaling);
|
||||
set => Set(_cached_dual_scaling, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShaderOverrideEnabled
|
||||
{
|
||||
get => (bool)Get(_cached_shader_override_enabled);
|
||||
set => Set(_cached_shader_override_enabled, Variant.From(value));
|
||||
}
|
||||
|
||||
public Shader ShaderOverride
|
||||
{
|
||||
get => (Shader)Get(_cached_shader_override);
|
||||
set => Set(_cached_shader_override, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowRegionGrid
|
||||
{
|
||||
get => (bool)Get(_cached_show_region_grid);
|
||||
set => Set(_cached_show_region_grid, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowInstancerGrid
|
||||
{
|
||||
get => (bool)Get(_cached_show_instancer_grid);
|
||||
set => Set(_cached_show_instancer_grid, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowVertexGrid
|
||||
{
|
||||
get => (bool)Get(_cached_show_vertex_grid);
|
||||
set => Set(_cached_show_vertex_grid, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowContours
|
||||
{
|
||||
get => (bool)Get(_cached_show_contours);
|
||||
set => Set(_cached_show_contours, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowNavigation
|
||||
{
|
||||
get => (bool)Get(_cached_show_navigation);
|
||||
set => Set(_cached_show_navigation, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowCheckered
|
||||
{
|
||||
get => (bool)Get(_cached_show_checkered);
|
||||
set => Set(_cached_show_checkered, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowGrey
|
||||
{
|
||||
get => (bool)Get(_cached_show_grey);
|
||||
set => Set(_cached_show_grey, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowHeightmap
|
||||
{
|
||||
get => (bool)Get(_cached_show_heightmap);
|
||||
set => Set(_cached_show_heightmap, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowColormap
|
||||
{
|
||||
get => (bool)Get(_cached_show_colormap);
|
||||
set => Set(_cached_show_colormap, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowRoughmap
|
||||
{
|
||||
get => (bool)Get(_cached_show_roughmap);
|
||||
set => Set(_cached_show_roughmap, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowControlTexture
|
||||
{
|
||||
get => (bool)Get(_cached_show_control_texture);
|
||||
set => Set(_cached_show_control_texture, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowControlAngle
|
||||
{
|
||||
get => (bool)Get(_cached_show_control_angle);
|
||||
set => Set(_cached_show_control_angle, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowControlScale
|
||||
{
|
||||
get => (bool)Get(_cached_show_control_scale);
|
||||
set => Set(_cached_show_control_scale, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowControlBlend
|
||||
{
|
||||
get => (bool)Get(_cached_show_control_blend);
|
||||
set => Set(_cached_show_control_blend, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowAutoshader
|
||||
{
|
||||
get => (bool)Get(_cached_show_autoshader);
|
||||
set => Set(_cached_show_autoshader, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowTextureHeight
|
||||
{
|
||||
get => (bool)Get(_cached_show_texture_height);
|
||||
set => Set(_cached_show_texture_height, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowTextureNormal
|
||||
{
|
||||
get => (bool)Get(_cached_show_texture_normal);
|
||||
set => Set(_cached_show_texture_normal, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool ShowTextureRough
|
||||
{
|
||||
get => (bool)Get(_cached_show_texture_rough);
|
||||
set => Set(_cached_show_texture_rough, Variant.From(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void SetShaderParameters(Godot.Collections.Dictionary dict) => Call(_cached__set_shader_parameters, dict);
|
||||
|
||||
public Godot.Collections.Dictionary GetShaderParameters() => Call(_cached__get_shader_parameters).As<Godot.Collections.Dictionary>();
|
||||
|
||||
public void Update() => Call(_cached_update);
|
||||
|
||||
public Rid GetMaterialRid() => Call(_cached_get_material_rid).As<Rid>();
|
||||
|
||||
public Rid GetShaderRid() => Call(_cached_get_shader_rid).As<Rid>();
|
||||
|
||||
public void SetWorldBackground(int background) => Call(_cached_set_world_background, background);
|
||||
|
||||
public int GetWorldBackground() => Call(_cached_get_world_background).As<int>();
|
||||
|
||||
public void SetTextureFiltering(int filtering) => Call(_cached_set_texture_filtering, filtering);
|
||||
|
||||
public int GetTextureFiltering() => Call(_cached_get_texture_filtering).As<int>();
|
||||
|
||||
public void SetAutoShader(bool enabled) => Call(_cached_set_auto_shader, enabled);
|
||||
|
||||
public bool GetAutoShader() => Call(_cached_get_auto_shader).As<bool>();
|
||||
|
||||
public void SetDualScaling(bool enabled) => Call(_cached_set_dual_scaling, enabled);
|
||||
|
||||
public bool GetDualScaling() => Call(_cached_get_dual_scaling).As<bool>();
|
||||
|
||||
public void EnableShaderOverride(bool enabled) => Call(_cached_enable_shader_override, enabled);
|
||||
|
||||
public bool IsShaderOverrideEnabled() => Call(_cached_is_shader_override_enabled).As<bool>();
|
||||
|
||||
public void SetShaderOverride(Shader shader) => Call(_cached_set_shader_override, (Shader)shader);
|
||||
|
||||
public Shader GetShaderOverride() => GDExtensionHelper.Bind<Shader>(Call(_cached_get_shader_override).As<GodotObject>());
|
||||
|
||||
public void SetShaderParam(StringName name, Variant? value) => Call(_cached_set_shader_param, name, value ?? new Variant());
|
||||
|
||||
public void GetShaderParam(StringName name) => Call(_cached_get_shader_param, name);
|
||||
|
||||
public void SetShowRegionGrid(bool enabled) => Call(_cached_set_show_region_grid, enabled);
|
||||
|
||||
public bool GetShowRegionGrid() => Call(_cached_get_show_region_grid).As<bool>();
|
||||
|
||||
public void SetShowInstancerGrid(bool enabled) => Call(_cached_set_show_instancer_grid, enabled);
|
||||
|
||||
public bool GetShowInstancerGrid() => Call(_cached_get_show_instancer_grid).As<bool>();
|
||||
|
||||
public void SetShowVertexGrid(bool enabled) => Call(_cached_set_show_vertex_grid, enabled);
|
||||
|
||||
public bool GetShowVertexGrid() => Call(_cached_get_show_vertex_grid).As<bool>();
|
||||
|
||||
public void SetShowContours(bool enabled) => Call(_cached_set_show_contours, enabled);
|
||||
|
||||
public bool GetShowContours() => Call(_cached_get_show_contours).As<bool>();
|
||||
|
||||
public void SetShowNavigation(bool enabled) => Call(_cached_set_show_navigation, enabled);
|
||||
|
||||
public bool GetShowNavigation() => Call(_cached_get_show_navigation).As<bool>();
|
||||
|
||||
public void SetShowCheckered(bool enabled) => Call(_cached_set_show_checkered, enabled);
|
||||
|
||||
public bool GetShowCheckered() => Call(_cached_get_show_checkered).As<bool>();
|
||||
|
||||
public void SetShowGrey(bool enabled) => Call(_cached_set_show_grey, enabled);
|
||||
|
||||
public bool GetShowGrey() => Call(_cached_get_show_grey).As<bool>();
|
||||
|
||||
public void SetShowHeightmap(bool enabled) => Call(_cached_set_show_heightmap, enabled);
|
||||
|
||||
public bool GetShowHeightmap() => Call(_cached_get_show_heightmap).As<bool>();
|
||||
|
||||
public void SetShowColormap(bool enabled) => Call(_cached_set_show_colormap, enabled);
|
||||
|
||||
public bool GetShowColormap() => Call(_cached_get_show_colormap).As<bool>();
|
||||
|
||||
public void SetShowRoughmap(bool enabled) => Call(_cached_set_show_roughmap, enabled);
|
||||
|
||||
public bool GetShowRoughmap() => Call(_cached_get_show_roughmap).As<bool>();
|
||||
|
||||
public void SetShowControlTexture(bool enabled) => Call(_cached_set_show_control_texture, enabled);
|
||||
|
||||
public bool GetShowControlTexture() => Call(_cached_get_show_control_texture).As<bool>();
|
||||
|
||||
public void SetShowControlAngle(bool enabled) => Call(_cached_set_show_control_angle, enabled);
|
||||
|
||||
public bool GetShowControlAngle() => Call(_cached_get_show_control_angle).As<bool>();
|
||||
|
||||
public void SetShowControlScale(bool enabled) => Call(_cached_set_show_control_scale, enabled);
|
||||
|
||||
public bool GetShowControlScale() => Call(_cached_get_show_control_scale).As<bool>();
|
||||
|
||||
public void SetShowControlBlend(bool enabled) => Call(_cached_set_show_control_blend, enabled);
|
||||
|
||||
public bool GetShowControlBlend() => Call(_cached_get_show_control_blend).As<bool>();
|
||||
|
||||
public void SetShowAutoshader(bool enabled) => Call(_cached_set_show_autoshader, enabled);
|
||||
|
||||
public bool GetShowAutoshader() => Call(_cached_get_show_autoshader).As<bool>();
|
||||
|
||||
public void SetShowTextureHeight(bool enabled) => Call(_cached_set_show_texture_height, enabled);
|
||||
|
||||
public bool GetShowTextureHeight() => Call(_cached_get_show_texture_height).As<bool>();
|
||||
|
||||
public void SetShowTextureNormal(bool enabled) => Call(_cached_set_show_texture_normal, enabled);
|
||||
|
||||
public bool GetShowTextureNormal() => Call(_cached_get_show_texture_normal).As<bool>();
|
||||
|
||||
public void SetShowTextureRough(bool enabled) => Call(_cached_set_show_texture_rough, enabled);
|
||||
|
||||
public bool GetShowTextureRough() => Call(_cached_get_show_texture_rough).As<bool>();
|
||||
|
||||
public int Save(string path) => Call(_cached_save, path).As<int>();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached__shader_parameters = "_shader_parameters";
|
||||
private static readonly StringName _cached_world_background = "world_background";
|
||||
private static readonly StringName _cached_texture_filtering = "texture_filtering";
|
||||
private static readonly StringName _cached_auto_shader = "auto_shader";
|
||||
private static readonly StringName _cached_dual_scaling = "dual_scaling";
|
||||
private static readonly StringName _cached_shader_override_enabled = "shader_override_enabled";
|
||||
private static readonly StringName _cached_shader_override = "shader_override";
|
||||
private static readonly StringName _cached_show_region_grid = "show_region_grid";
|
||||
private static readonly StringName _cached_show_instancer_grid = "show_instancer_grid";
|
||||
private static readonly StringName _cached_show_vertex_grid = "show_vertex_grid";
|
||||
private static readonly StringName _cached_show_contours = "show_contours";
|
||||
private static readonly StringName _cached_show_navigation = "show_navigation";
|
||||
private static readonly StringName _cached_show_checkered = "show_checkered";
|
||||
private static readonly StringName _cached_show_grey = "show_grey";
|
||||
private static readonly StringName _cached_show_heightmap = "show_heightmap";
|
||||
private static readonly StringName _cached_show_colormap = "show_colormap";
|
||||
private static readonly StringName _cached_show_roughmap = "show_roughmap";
|
||||
private static readonly StringName _cached_show_control_texture = "show_control_texture";
|
||||
private static readonly StringName _cached_show_control_angle = "show_control_angle";
|
||||
private static readonly StringName _cached_show_control_scale = "show_control_scale";
|
||||
private static readonly StringName _cached_show_control_blend = "show_control_blend";
|
||||
private static readonly StringName _cached_show_autoshader = "show_autoshader";
|
||||
private static readonly StringName _cached_show_texture_height = "show_texture_height";
|
||||
private static readonly StringName _cached_show_texture_normal = "show_texture_normal";
|
||||
private static readonly StringName _cached_show_texture_rough = "show_texture_rough";
|
||||
private static readonly StringName _cached__set_shader_parameters = "_set_shader_parameters";
|
||||
private static readonly StringName _cached__get_shader_parameters = "_get_shader_parameters";
|
||||
private static readonly StringName _cached_update = "update";
|
||||
private static readonly StringName _cached_get_material_rid = "get_material_rid";
|
||||
private static readonly StringName _cached_get_shader_rid = "get_shader_rid";
|
||||
private static readonly StringName _cached_set_world_background = "set_world_background";
|
||||
private static readonly StringName _cached_get_world_background = "get_world_background";
|
||||
private static readonly StringName _cached_set_texture_filtering = "set_texture_filtering";
|
||||
private static readonly StringName _cached_get_texture_filtering = "get_texture_filtering";
|
||||
private static readonly StringName _cached_set_auto_shader = "set_auto_shader";
|
||||
private static readonly StringName _cached_get_auto_shader = "get_auto_shader";
|
||||
private static readonly StringName _cached_set_dual_scaling = "set_dual_scaling";
|
||||
private static readonly StringName _cached_get_dual_scaling = "get_dual_scaling";
|
||||
private static readonly StringName _cached_enable_shader_override = "enable_shader_override";
|
||||
private static readonly StringName _cached_is_shader_override_enabled = "is_shader_override_enabled";
|
||||
private static readonly StringName _cached_set_shader_override = "set_shader_override";
|
||||
private static readonly StringName _cached_get_shader_override = "get_shader_override";
|
||||
private static readonly StringName _cached_set_shader_param = "set_shader_param";
|
||||
private static readonly StringName _cached_get_shader_param = "get_shader_param";
|
||||
private static readonly StringName _cached_set_show_region_grid = "set_show_region_grid";
|
||||
private static readonly StringName _cached_get_show_region_grid = "get_show_region_grid";
|
||||
private static readonly StringName _cached_set_show_instancer_grid = "set_show_instancer_grid";
|
||||
private static readonly StringName _cached_get_show_instancer_grid = "get_show_instancer_grid";
|
||||
private static readonly StringName _cached_set_show_vertex_grid = "set_show_vertex_grid";
|
||||
private static readonly StringName _cached_get_show_vertex_grid = "get_show_vertex_grid";
|
||||
private static readonly StringName _cached_set_show_contours = "set_show_contours";
|
||||
private static readonly StringName _cached_get_show_contours = "get_show_contours";
|
||||
private static readonly StringName _cached_set_show_navigation = "set_show_navigation";
|
||||
private static readonly StringName _cached_get_show_navigation = "get_show_navigation";
|
||||
private static readonly StringName _cached_set_show_checkered = "set_show_checkered";
|
||||
private static readonly StringName _cached_get_show_checkered = "get_show_checkered";
|
||||
private static readonly StringName _cached_set_show_grey = "set_show_grey";
|
||||
private static readonly StringName _cached_get_show_grey = "get_show_grey";
|
||||
private static readonly StringName _cached_set_show_heightmap = "set_show_heightmap";
|
||||
private static readonly StringName _cached_get_show_heightmap = "get_show_heightmap";
|
||||
private static readonly StringName _cached_set_show_colormap = "set_show_colormap";
|
||||
private static readonly StringName _cached_get_show_colormap = "get_show_colormap";
|
||||
private static readonly StringName _cached_set_show_roughmap = "set_show_roughmap";
|
||||
private static readonly StringName _cached_get_show_roughmap = "get_show_roughmap";
|
||||
private static readonly StringName _cached_set_show_control_texture = "set_show_control_texture";
|
||||
private static readonly StringName _cached_get_show_control_texture = "get_show_control_texture";
|
||||
private static readonly StringName _cached_set_show_control_angle = "set_show_control_angle";
|
||||
private static readonly StringName _cached_get_show_control_angle = "get_show_control_angle";
|
||||
private static readonly StringName _cached_set_show_control_scale = "set_show_control_scale";
|
||||
private static readonly StringName _cached_get_show_control_scale = "get_show_control_scale";
|
||||
private static readonly StringName _cached_set_show_control_blend = "set_show_control_blend";
|
||||
private static readonly StringName _cached_get_show_control_blend = "get_show_control_blend";
|
||||
private static readonly StringName _cached_set_show_autoshader = "set_show_autoshader";
|
||||
private static readonly StringName _cached_get_show_autoshader = "get_show_autoshader";
|
||||
private static readonly StringName _cached_set_show_texture_height = "set_show_texture_height";
|
||||
private static readonly StringName _cached_get_show_texture_height = "get_show_texture_height";
|
||||
private static readonly StringName _cached_set_show_texture_normal = "set_show_texture_normal";
|
||||
private static readonly StringName _cached_get_show_texture_normal = "get_show_texture_normal";
|
||||
private static readonly StringName _cached_set_show_texture_rough = "set_show_texture_rough";
|
||||
private static readonly StringName _cached_get_show_texture_rough = "get_show_texture_rough";
|
||||
private static readonly StringName _cached_save = "save";
|
||||
}
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DMaterial");
|
||||
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DMaterial object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DMaterial() { }
|
||||
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DMaterial"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DMaterial"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DMaterial"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DMaterial"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DMaterial Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DMaterial wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DMaterial);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DMaterial).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DMaterial)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DMaterial"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DMaterial" type.</returns>
|
||||
public new static Terrain3DMaterial Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public enum WorldBackgroundEnum
|
||||
{
|
||||
None = 0,
|
||||
Flat = 1,
|
||||
Noise = 2,
|
||||
}
|
||||
|
||||
public enum TextureFilteringEnum
|
||||
{
|
||||
Linear = 0,
|
||||
Nearest = 1,
|
||||
}
|
||||
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName ShaderParameters = "_shader_parameters";
|
||||
public new static readonly StringName WorldBackground = "world_background";
|
||||
public new static readonly StringName TextureFiltering = "texture_filtering";
|
||||
public new static readonly StringName AutoShaderEnabled = "auto_shader_enabled";
|
||||
public new static readonly StringName DualScalingEnabled = "dual_scaling_enabled";
|
||||
public new static readonly StringName ShaderOverrideEnabled = "shader_override_enabled";
|
||||
public new static readonly StringName ShaderOverride = "shader_override";
|
||||
public new static readonly StringName ShowRegionGrid = "show_region_grid";
|
||||
public new static readonly StringName ShowInstancerGrid = "show_instancer_grid";
|
||||
public new static readonly StringName ShowVertexGrid = "show_vertex_grid";
|
||||
public new static readonly StringName ShowContours = "show_contours";
|
||||
public new static readonly StringName ShowNavigation = "show_navigation";
|
||||
public new static readonly StringName ShowCheckered = "show_checkered";
|
||||
public new static readonly StringName ShowGrey = "show_grey";
|
||||
public new static readonly StringName ShowHeightmap = "show_heightmap";
|
||||
public new static readonly StringName ShowJaggedness = "show_jaggedness";
|
||||
public new static readonly StringName ShowAutoshader = "show_autoshader";
|
||||
public new static readonly StringName ShowControlTexture = "show_control_texture";
|
||||
public new static readonly StringName ShowControlBlend = "show_control_blend";
|
||||
public new static readonly StringName ShowControlAngle = "show_control_angle";
|
||||
public new static readonly StringName ShowControlScale = "show_control_scale";
|
||||
public new static readonly StringName ShowColormap = "show_colormap";
|
||||
public new static readonly StringName ShowRoughmap = "show_roughmap";
|
||||
public new static readonly StringName ShowTextureHeight = "show_texture_height";
|
||||
public new static readonly StringName ShowTextureNormal = "show_texture_normal";
|
||||
public new static readonly StringName ShowTextureRough = "show_texture_rough";
|
||||
}
|
||||
|
||||
public new Godot.Collections.Dictionary ShaderParameters
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShaderParameters).As<Godot.Collections.Dictionary>();
|
||||
set => Set(GDExtensionPropertyName.ShaderParameters, value);
|
||||
}
|
||||
|
||||
public new Terrain3DMaterial.WorldBackgroundEnum WorldBackground
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.WorldBackground).As<Terrain3DMaterial.WorldBackgroundEnum>();
|
||||
set => Set(GDExtensionPropertyName.WorldBackground, Variant.From(value));
|
||||
}
|
||||
|
||||
public new long TextureFiltering
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.TextureFiltering).As<long>();
|
||||
set => Set(GDExtensionPropertyName.TextureFiltering, value);
|
||||
}
|
||||
|
||||
public new bool AutoShaderEnabled
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.AutoShaderEnabled).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.AutoShaderEnabled, value);
|
||||
}
|
||||
|
||||
public new bool DualScalingEnabled
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.DualScalingEnabled).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.DualScalingEnabled, value);
|
||||
}
|
||||
|
||||
public new bool ShaderOverrideEnabled
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShaderOverrideEnabled).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShaderOverrideEnabled, value);
|
||||
}
|
||||
|
||||
public new Shader ShaderOverride
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShaderOverride).As<Shader>();
|
||||
set => Set(GDExtensionPropertyName.ShaderOverride, value);
|
||||
}
|
||||
|
||||
public new bool ShowRegionGrid
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowRegionGrid).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowRegionGrid, value);
|
||||
}
|
||||
|
||||
public new bool ShowInstancerGrid
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowInstancerGrid).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowInstancerGrid, value);
|
||||
}
|
||||
|
||||
public new bool ShowVertexGrid
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowVertexGrid).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowVertexGrid, value);
|
||||
}
|
||||
|
||||
public new bool ShowContours
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowContours).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowContours, value);
|
||||
}
|
||||
|
||||
public new bool ShowNavigation
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowNavigation).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowNavigation, value);
|
||||
}
|
||||
|
||||
public new bool ShowCheckered
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowCheckered).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowCheckered, value);
|
||||
}
|
||||
|
||||
public new bool ShowGrey
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowGrey).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowGrey, value);
|
||||
}
|
||||
|
||||
public new bool ShowHeightmap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowHeightmap).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowHeightmap, value);
|
||||
}
|
||||
|
||||
public new bool ShowJaggedness
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowJaggedness).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowJaggedness, value);
|
||||
}
|
||||
|
||||
public new bool ShowAutoshader
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowAutoshader).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowAutoshader, value);
|
||||
}
|
||||
|
||||
public new bool ShowControlTexture
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowControlTexture).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowControlTexture, value);
|
||||
}
|
||||
|
||||
public new bool ShowControlBlend
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowControlBlend).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowControlBlend, value);
|
||||
}
|
||||
|
||||
public new bool ShowControlAngle
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowControlAngle).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowControlAngle, value);
|
||||
}
|
||||
|
||||
public new bool ShowControlScale
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowControlScale).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowControlScale, value);
|
||||
}
|
||||
|
||||
public new bool ShowColormap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowColormap).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowColormap, value);
|
||||
}
|
||||
|
||||
public new bool ShowRoughmap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowRoughmap).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowRoughmap, value);
|
||||
}
|
||||
|
||||
public new bool ShowTextureHeight
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowTextureHeight).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowTextureHeight, value);
|
||||
}
|
||||
|
||||
public new bool ShowTextureNormal
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowTextureNormal).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowTextureNormal, value);
|
||||
}
|
||||
|
||||
public new bool ShowTextureRough
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShowTextureRough).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.ShowTextureRough, value);
|
||||
}
|
||||
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName Update = "update";
|
||||
public new static readonly StringName GetMaterialRid = "get_material_rid";
|
||||
public new static readonly StringName GetShaderRid = "get_shader_rid";
|
||||
public new static readonly StringName SetShaderParam = "set_shader_param";
|
||||
public new static readonly StringName GetShaderParam = "get_shader_param";
|
||||
public new static readonly StringName Save = "save";
|
||||
}
|
||||
|
||||
public new void Update() =>
|
||||
Call(GDExtensionMethodName.Update, []);
|
||||
|
||||
public new Rid GetMaterialRid() =>
|
||||
Call(GDExtensionMethodName.GetMaterialRid, []).As<Rid>();
|
||||
|
||||
public new Rid GetShaderRid() =>
|
||||
Call(GDExtensionMethodName.GetShaderRid, []).As<Rid>();
|
||||
|
||||
public new void SetShaderParam(StringName name, Variant value) =>
|
||||
Call(GDExtensionMethodName.SetShaderParam, [name, value]);
|
||||
|
||||
public new void GetShaderParam(StringName name) =>
|
||||
Call(GDExtensionMethodName.GetShaderParam, [name]);
|
||||
|
||||
public new Error Save(string path = "") =>
|
||||
Call(GDExtensionMethodName.Save, [path]).As<Error>();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://h5dlkgqdi5yy
|
||||
uid://cq4wvyd0gl2do
|
||||
|
|
|
|||
|
|
@ -1,552 +1,399 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DMeshAsset : Resource
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DMeshAsset";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying Resource), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DMeshAsset() { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DMeshAsset"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DMeshAsset Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DMeshAsset>(GDExtensionName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DMeshAsset"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DMeshAsset"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DMeshAsset"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DMeshAsset"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DMeshAsset Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DMeshAsset>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
|
||||
public enum GenType : long
|
||||
{
|
||||
TypeNone = 0,
|
||||
TypeTextureCard = 1,
|
||||
TypeMax = 2,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => (string)Get(_cached_name);
|
||||
set => Set(_cached_name, Variant.From(value));
|
||||
}
|
||||
|
||||
public int Id
|
||||
{
|
||||
get => (int)Get(_cached_id);
|
||||
set => Set(_cached_id, Variant.From(value));
|
||||
}
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => (bool)Get(_cached_enabled);
|
||||
set => Set(_cached_enabled, Variant.From(value));
|
||||
}
|
||||
|
||||
public PackedScene SceneFile
|
||||
{
|
||||
get => (PackedScene)Get(_cached_scene_file);
|
||||
set => Set(_cached_scene_file, Variant.From(value));
|
||||
}
|
||||
|
||||
public long /*None,TextureCard*/ GeneratedType
|
||||
{
|
||||
get => (long /*None,TextureCard*/)Get(_cached_generated_type).As<Int64>();
|
||||
set => Set(_cached_generated_type, Variant.From(value));
|
||||
}
|
||||
|
||||
public float HeightOffset
|
||||
{
|
||||
get => (float)Get(_cached_height_offset);
|
||||
set => Set(_cached_height_offset, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Density
|
||||
{
|
||||
get => (float)Get(_cached_density);
|
||||
set => Set(_cached_density, Variant.From(value));
|
||||
}
|
||||
|
||||
public long /*Off,On,Double-Sided,ShadowsOnly*/ CastShadows
|
||||
{
|
||||
get => (long /*Off,On,Double-Sided,ShadowsOnly*/)Get(_cached_cast_shadows).As<Int64>();
|
||||
set => Set(_cached_cast_shadows, Variant.From(value));
|
||||
}
|
||||
|
||||
public Material /*BaseMaterial3D,ShaderMaterial*/ MaterialOverride
|
||||
{
|
||||
get => (Material /*BaseMaterial3D,ShaderMaterial*/)Get(_cached_material_override);
|
||||
set => Set(_cached_material_override, Variant.From(value));
|
||||
}
|
||||
|
||||
public Material /*BaseMaterial3D,ShaderMaterial*/ MaterialOverlay
|
||||
{
|
||||
get => (Material /*BaseMaterial3D,ShaderMaterial*/)Get(_cached_material_overlay);
|
||||
set => Set(_cached_material_overlay, Variant.From(value));
|
||||
}
|
||||
|
||||
public int GeneratedFaces
|
||||
{
|
||||
get => (int)Get(_cached_generated_faces);
|
||||
set => Set(_cached_generated_faces, Variant.From(value));
|
||||
}
|
||||
|
||||
public Vector2 GeneratedSize
|
||||
{
|
||||
get => (Vector2)Get(_cached_generated_size);
|
||||
set => Set(_cached_generated_size, Variant.From(value));
|
||||
}
|
||||
|
||||
public int LodCount
|
||||
{
|
||||
get => (int)Get(_cached_lod_count);
|
||||
set => Set(_cached_lod_count, Variant.From(value));
|
||||
}
|
||||
|
||||
public int LastLod
|
||||
{
|
||||
get => (int)Get(_cached_last_lod);
|
||||
set => Set(_cached_last_lod, Variant.From(value));
|
||||
}
|
||||
|
||||
public int LastShadowLod
|
||||
{
|
||||
get => (int)Get(_cached_last_shadow_lod);
|
||||
set => Set(_cached_last_shadow_lod, Variant.From(value));
|
||||
}
|
||||
|
||||
public int ShadowImpostor
|
||||
{
|
||||
get => (int)Get(_cached_shadow_impostor);
|
||||
set => Set(_cached_shadow_impostor, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod0Range
|
||||
{
|
||||
get => (float)Get(_cached_lod0_range);
|
||||
set => Set(_cached_lod0_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod1Range
|
||||
{
|
||||
get => (float)Get(_cached_lod1_range);
|
||||
set => Set(_cached_lod1_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod2Range
|
||||
{
|
||||
get => (float)Get(_cached_lod2_range);
|
||||
set => Set(_cached_lod2_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod3Range
|
||||
{
|
||||
get => (float)Get(_cached_lod3_range);
|
||||
set => Set(_cached_lod3_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod4Range
|
||||
{
|
||||
get => (float)Get(_cached_lod4_range);
|
||||
set => Set(_cached_lod4_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod5Range
|
||||
{
|
||||
get => (float)Get(_cached_lod5_range);
|
||||
set => Set(_cached_lod5_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod6Range
|
||||
{
|
||||
get => (float)Get(_cached_lod6_range);
|
||||
set => Set(_cached_lod6_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod7Range
|
||||
{
|
||||
get => (float)Get(_cached_lod7_range);
|
||||
set => Set(_cached_lod7_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod8Range
|
||||
{
|
||||
get => (float)Get(_cached_lod8_range);
|
||||
set => Set(_cached_lod8_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float Lod9Range
|
||||
{
|
||||
get => (float)Get(_cached_lod9_range);
|
||||
set => Set(_cached_lod9_range, Variant.From(value));
|
||||
}
|
||||
|
||||
public float FadeMargin
|
||||
{
|
||||
get => (float)Get(_cached_fade_margin);
|
||||
set => Set(_cached_fade_margin, Variant.From(value));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Signals
|
||||
|
||||
public delegate void IdChangedHandler();
|
||||
|
||||
private IdChangedHandler _idChanged_backing;
|
||||
private Callable _idChanged_backing_callable;
|
||||
public event IdChangedHandler IdChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_idChanged_backing == null)
|
||||
{
|
||||
_idChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_idChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_id_changed, _idChanged_backing_callable);
|
||||
}
|
||||
_idChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_idChanged_backing -= value;
|
||||
|
||||
if(_idChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_id_changed, _idChanged_backing_callable);
|
||||
_idChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void FileChangedHandler();
|
||||
|
||||
private FileChangedHandler _fileChanged_backing;
|
||||
private Callable _fileChanged_backing_callable;
|
||||
public event FileChangedHandler FileChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_fileChanged_backing == null)
|
||||
{
|
||||
_fileChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_fileChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_file_changed, _fileChanged_backing_callable);
|
||||
}
|
||||
_fileChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_fileChanged_backing -= value;
|
||||
|
||||
if(_fileChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_file_changed, _fileChanged_backing_callable);
|
||||
_fileChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void SettingChangedHandler();
|
||||
|
||||
private SettingChangedHandler _settingChanged_backing;
|
||||
private Callable _settingChanged_backing_callable;
|
||||
public event SettingChangedHandler SettingChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_settingChanged_backing == null)
|
||||
{
|
||||
_settingChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_settingChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_setting_changed, _settingChanged_backing_callable);
|
||||
}
|
||||
_settingChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_settingChanged_backing -= value;
|
||||
|
||||
if(_settingChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_setting_changed, _settingChanged_backing_callable);
|
||||
_settingChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void InstancerSettingChangedHandler();
|
||||
|
||||
private InstancerSettingChangedHandler _instancerSettingChanged_backing;
|
||||
private Callable _instancerSettingChanged_backing_callable;
|
||||
public event InstancerSettingChangedHandler InstancerSettingChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_instancerSettingChanged_backing == null)
|
||||
{
|
||||
_instancerSettingChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_instancerSettingChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_instancer_setting_changed, _instancerSettingChanged_backing_callable);
|
||||
}
|
||||
_instancerSettingChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_instancerSettingChanged_backing -= value;
|
||||
|
||||
if(_instancerSettingChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_instancer_setting_changed, _instancerSettingChanged_backing_callable);
|
||||
_instancerSettingChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Clear() => Call(_cached_clear);
|
||||
|
||||
public void SetName(string name) => Call(_cached_set_name, name);
|
||||
|
||||
public string GetName() => Call(_cached_get_name).As<string>();
|
||||
|
||||
public void SetId(int id) => Call(_cached_set_id, id);
|
||||
|
||||
public int GetId() => Call(_cached_get_id).As<int>();
|
||||
|
||||
public void SetEnabled(bool enabled) => Call(_cached_set_enabled, enabled);
|
||||
|
||||
public bool IsEnabled() => Call(_cached_is_enabled).As<bool>();
|
||||
|
||||
public void SetSceneFile(PackedScene sceneFile) => Call(_cached_set_scene_file, (PackedScene)sceneFile);
|
||||
|
||||
public PackedScene GetSceneFile() => GDExtensionHelper.Bind<PackedScene>(Call(_cached_get_scene_file).As<GodotObject>());
|
||||
|
||||
public void SetGeneratedType(int type) => Call(_cached_set_generated_type, type);
|
||||
|
||||
public int GetGeneratedType() => Call(_cached_get_generated_type).As<int>();
|
||||
|
||||
public Mesh GetMesh(int lod) => GDExtensionHelper.Bind<Mesh>(Call(_cached_get_mesh, lod).As<GodotObject>());
|
||||
|
||||
public Texture2D GetThumbnail() => GDExtensionHelper.Bind<Texture2D>(Call(_cached_get_thumbnail).As<GodotObject>());
|
||||
|
||||
public void SetHeightOffset(float offset) => Call(_cached_set_height_offset, offset);
|
||||
|
||||
public float GetHeightOffset() => Call(_cached_get_height_offset).As<float>();
|
||||
|
||||
public void SetDensity(float density) => Call(_cached_set_density, density);
|
||||
|
||||
public float GetDensity() => Call(_cached_get_density).As<float>();
|
||||
|
||||
public void SetCastShadows(int mode) => Call(_cached_set_cast_shadows, mode);
|
||||
|
||||
public int GetCastShadows() => Call(_cached_get_cast_shadows).As<int>();
|
||||
|
||||
public void SetMaterialOverride(Material material) => Call(_cached_set_material_override, (Material)material);
|
||||
|
||||
public Material GetMaterialOverride() => GDExtensionHelper.Bind<Material>(Call(_cached_get_material_override).As<GodotObject>());
|
||||
|
||||
public void SetMaterialOverlay(Material material) => Call(_cached_set_material_overlay, (Material)material);
|
||||
|
||||
public Material GetMaterialOverlay() => GDExtensionHelper.Bind<Material>(Call(_cached_get_material_overlay).As<GodotObject>());
|
||||
|
||||
public void SetGeneratedFaces(int count) => Call(_cached_set_generated_faces, count);
|
||||
|
||||
public int GetGeneratedFaces() => Call(_cached_get_generated_faces).As<int>();
|
||||
|
||||
public void SetGeneratedSize(Vector2 size) => Call(_cached_set_generated_size, size);
|
||||
|
||||
public Vector2 GetGeneratedSize() => Call(_cached_get_generated_size).As<Vector2>();
|
||||
|
||||
public int GetLodCount() => Call(_cached_get_lod_count).As<int>();
|
||||
|
||||
public void SetLastLod(int lod) => Call(_cached_set_last_lod, lod);
|
||||
|
||||
public int GetLastLod() => Call(_cached_get_last_lod).As<int>();
|
||||
|
||||
public void SetLastShadowLod(int lod) => Call(_cached_set_last_shadow_lod, lod);
|
||||
|
||||
public int GetLastShadowLod() => Call(_cached_get_last_shadow_lod).As<int>();
|
||||
|
||||
public void SetShadowImpostor(int lod) => Call(_cached_set_shadow_impostor, lod);
|
||||
|
||||
public int GetShadowImpostor() => Call(_cached_get_shadow_impostor).As<int>();
|
||||
|
||||
public void SetLodRange(int lod, float distance) => Call(_cached_set_lod_range, lod, distance);
|
||||
|
||||
public float GetLodRange(int lod) => Call(_cached_get_lod_range, lod).As<float>();
|
||||
|
||||
public void SetLod0Range(float distance) => Call(_cached_set_lod0_range, distance);
|
||||
|
||||
public float GetLod0Range() => Call(_cached_get_lod0_range).As<float>();
|
||||
|
||||
public void SetLod1Range(float distance) => Call(_cached_set_lod1_range, distance);
|
||||
|
||||
public float GetLod1Range() => Call(_cached_get_lod1_range).As<float>();
|
||||
|
||||
public void SetLod2Range(float distance) => Call(_cached_set_lod2_range, distance);
|
||||
|
||||
public float GetLod2Range() => Call(_cached_get_lod2_range).As<float>();
|
||||
|
||||
public void SetLod3Range(float distance) => Call(_cached_set_lod3_range, distance);
|
||||
|
||||
public float GetLod3Range() => Call(_cached_get_lod3_range).As<float>();
|
||||
|
||||
public void SetLod4Range(float distance) => Call(_cached_set_lod4_range, distance);
|
||||
|
||||
public float GetLod4Range() => Call(_cached_get_lod4_range).As<float>();
|
||||
|
||||
public void SetLod5Range(float distance) => Call(_cached_set_lod5_range, distance);
|
||||
|
||||
public float GetLod5Range() => Call(_cached_get_lod5_range).As<float>();
|
||||
|
||||
public void SetLod6Range(float distance) => Call(_cached_set_lod6_range, distance);
|
||||
|
||||
public float GetLod6Range() => Call(_cached_get_lod6_range).As<float>();
|
||||
|
||||
public void SetLod7Range(float distance) => Call(_cached_set_lod7_range, distance);
|
||||
|
||||
public float GetLod7Range() => Call(_cached_get_lod7_range).As<float>();
|
||||
|
||||
public void SetLod8Range(float distance) => Call(_cached_set_lod8_range, distance);
|
||||
|
||||
public float GetLod8Range() => Call(_cached_get_lod8_range).As<float>();
|
||||
|
||||
public void SetLod9Range(float distance) => Call(_cached_set_lod9_range, distance);
|
||||
|
||||
public float GetLod9Range() => Call(_cached_get_lod9_range).As<float>();
|
||||
|
||||
public void SetFadeMargin(float distance) => Call(_cached_set_fade_margin, distance);
|
||||
|
||||
public float GetFadeMargin() => Call(_cached_get_fade_margin).As<float>();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_name = "name";
|
||||
private static readonly StringName _cached_id = "id";
|
||||
private static readonly StringName _cached_enabled = "enabled";
|
||||
private static readonly StringName _cached_scene_file = "scene_file";
|
||||
private static readonly StringName _cached_generated_type = "generated_type";
|
||||
private static readonly StringName _cached_height_offset = "height_offset";
|
||||
private static readonly StringName _cached_density = "density";
|
||||
private static readonly StringName _cached_cast_shadows = "cast_shadows";
|
||||
private static readonly StringName _cached_material_override = "material_override";
|
||||
private static readonly StringName _cached_material_overlay = "material_overlay";
|
||||
private static readonly StringName _cached_generated_faces = "generated_faces";
|
||||
private static readonly StringName _cached_generated_size = "generated_size";
|
||||
private static readonly StringName _cached_lod_count = "lod_count";
|
||||
private static readonly StringName _cached_last_lod = "last_lod";
|
||||
private static readonly StringName _cached_last_shadow_lod = "last_shadow_lod";
|
||||
private static readonly StringName _cached_shadow_impostor = "shadow_impostor";
|
||||
private static readonly StringName _cached_lod0_range = "lod0_range";
|
||||
private static readonly StringName _cached_lod1_range = "lod1_range";
|
||||
private static readonly StringName _cached_lod2_range = "lod2_range";
|
||||
private static readonly StringName _cached_lod3_range = "lod3_range";
|
||||
private static readonly StringName _cached_lod4_range = "lod4_range";
|
||||
private static readonly StringName _cached_lod5_range = "lod5_range";
|
||||
private static readonly StringName _cached_lod6_range = "lod6_range";
|
||||
private static readonly StringName _cached_lod7_range = "lod7_range";
|
||||
private static readonly StringName _cached_lod8_range = "lod8_range";
|
||||
private static readonly StringName _cached_lod9_range = "lod9_range";
|
||||
private static readonly StringName _cached_fade_margin = "fade_margin";
|
||||
private static readonly StringName _cached_clear = "clear";
|
||||
private static readonly StringName _cached_set_name = "set_name";
|
||||
private static readonly StringName _cached_get_name = "get_name";
|
||||
private static readonly StringName _cached_set_id = "set_id";
|
||||
private static readonly StringName _cached_get_id = "get_id";
|
||||
private static readonly StringName _cached_set_enabled = "set_enabled";
|
||||
private static readonly StringName _cached_is_enabled = "is_enabled";
|
||||
private static readonly StringName _cached_set_scene_file = "set_scene_file";
|
||||
private static readonly StringName _cached_get_scene_file = "get_scene_file";
|
||||
private static readonly StringName _cached_set_generated_type = "set_generated_type";
|
||||
private static readonly StringName _cached_get_generated_type = "get_generated_type";
|
||||
private static readonly StringName _cached_get_mesh = "get_mesh";
|
||||
private static readonly StringName _cached_get_thumbnail = "get_thumbnail";
|
||||
private static readonly StringName _cached_set_height_offset = "set_height_offset";
|
||||
private static readonly StringName _cached_get_height_offset = "get_height_offset";
|
||||
private static readonly StringName _cached_set_density = "set_density";
|
||||
private static readonly StringName _cached_get_density = "get_density";
|
||||
private static readonly StringName _cached_set_cast_shadows = "set_cast_shadows";
|
||||
private static readonly StringName _cached_get_cast_shadows = "get_cast_shadows";
|
||||
private static readonly StringName _cached_set_material_override = "set_material_override";
|
||||
private static readonly StringName _cached_get_material_override = "get_material_override";
|
||||
private static readonly StringName _cached_set_material_overlay = "set_material_overlay";
|
||||
private static readonly StringName _cached_get_material_overlay = "get_material_overlay";
|
||||
private static readonly StringName _cached_set_generated_faces = "set_generated_faces";
|
||||
private static readonly StringName _cached_get_generated_faces = "get_generated_faces";
|
||||
private static readonly StringName _cached_set_generated_size = "set_generated_size";
|
||||
private static readonly StringName _cached_get_generated_size = "get_generated_size";
|
||||
private static readonly StringName _cached_get_lod_count = "get_lod_count";
|
||||
private static readonly StringName _cached_set_last_lod = "set_last_lod";
|
||||
private static readonly StringName _cached_get_last_lod = "get_last_lod";
|
||||
private static readonly StringName _cached_set_last_shadow_lod = "set_last_shadow_lod";
|
||||
private static readonly StringName _cached_get_last_shadow_lod = "get_last_shadow_lod";
|
||||
private static readonly StringName _cached_set_shadow_impostor = "set_shadow_impostor";
|
||||
private static readonly StringName _cached_get_shadow_impostor = "get_shadow_impostor";
|
||||
private static readonly StringName _cached_set_lod_range = "set_lod_range";
|
||||
private static readonly StringName _cached_get_lod_range = "get_lod_range";
|
||||
private static readonly StringName _cached_set_lod0_range = "set_lod0_range";
|
||||
private static readonly StringName _cached_get_lod0_range = "get_lod0_range";
|
||||
private static readonly StringName _cached_set_lod1_range = "set_lod1_range";
|
||||
private static readonly StringName _cached_get_lod1_range = "get_lod1_range";
|
||||
private static readonly StringName _cached_set_lod2_range = "set_lod2_range";
|
||||
private static readonly StringName _cached_get_lod2_range = "get_lod2_range";
|
||||
private static readonly StringName _cached_set_lod3_range = "set_lod3_range";
|
||||
private static readonly StringName _cached_get_lod3_range = "get_lod3_range";
|
||||
private static readonly StringName _cached_set_lod4_range = "set_lod4_range";
|
||||
private static readonly StringName _cached_get_lod4_range = "get_lod4_range";
|
||||
private static readonly StringName _cached_set_lod5_range = "set_lod5_range";
|
||||
private static readonly StringName _cached_get_lod5_range = "get_lod5_range";
|
||||
private static readonly StringName _cached_set_lod6_range = "set_lod6_range";
|
||||
private static readonly StringName _cached_get_lod6_range = "get_lod6_range";
|
||||
private static readonly StringName _cached_set_lod7_range = "set_lod7_range";
|
||||
private static readonly StringName _cached_get_lod7_range = "get_lod7_range";
|
||||
private static readonly StringName _cached_set_lod8_range = "set_lod8_range";
|
||||
private static readonly StringName _cached_get_lod8_range = "get_lod8_range";
|
||||
private static readonly StringName _cached_set_lod9_range = "set_lod9_range";
|
||||
private static readonly StringName _cached_get_lod9_range = "get_lod9_range";
|
||||
private static readonly StringName _cached_set_fade_margin = "set_fade_margin";
|
||||
private static readonly StringName _cached_get_fade_margin = "get_fade_margin";
|
||||
private static readonly StringName _cached_id_changed = "id_changed";
|
||||
private static readonly StringName _cached_file_changed = "file_changed";
|
||||
private static readonly StringName _cached_setting_changed = "setting_changed";
|
||||
private static readonly StringName _cached_instancer_setting_changed = "instancer_setting_changed";
|
||||
}
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DMeshAsset");
|
||||
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DMeshAsset object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DMeshAsset() { }
|
||||
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DMeshAsset"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DMeshAsset"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DMeshAsset"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DMeshAsset"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DMeshAsset Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DMeshAsset wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DMeshAsset);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DMeshAsset).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DMeshAsset)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DMeshAsset"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DMeshAsset" type.</returns>
|
||||
public new static Terrain3DMeshAsset Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public enum GenType
|
||||
{
|
||||
None = 0,
|
||||
TextureCard = 1,
|
||||
Max = 2,
|
||||
}
|
||||
|
||||
public new static class GDExtensionSignalName
|
||||
{
|
||||
public new static readonly StringName IdChanged = "id_changed";
|
||||
public new static readonly StringName SettingChanged = "setting_changed";
|
||||
public new static readonly StringName InstancerSettingChanged = "instancer_setting_changed";
|
||||
public new static readonly StringName InstanceCountChanged = "instance_count_changed";
|
||||
}
|
||||
|
||||
public new delegate void IdChangedSignalHandler();
|
||||
private IdChangedSignalHandler _idChangedSignal;
|
||||
private Callable _idChangedSignalCallable;
|
||||
public event IdChangedSignalHandler IdChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_idChangedSignal is null)
|
||||
{
|
||||
_idChangedSignalCallable = Callable.From(() =>
|
||||
_idChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.IdChanged, _idChangedSignalCallable);
|
||||
}
|
||||
_idChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_idChangedSignal -= value;
|
||||
if (_idChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.IdChanged, _idChangedSignalCallable);
|
||||
_idChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void SettingChangedSignalHandler();
|
||||
private SettingChangedSignalHandler _settingChangedSignal;
|
||||
private Callable _settingChangedSignalCallable;
|
||||
public event SettingChangedSignalHandler SettingChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_settingChangedSignal is null)
|
||||
{
|
||||
_settingChangedSignalCallable = Callable.From(() =>
|
||||
_settingChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.SettingChanged, _settingChangedSignalCallable);
|
||||
}
|
||||
_settingChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_settingChangedSignal -= value;
|
||||
if (_settingChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.SettingChanged, _settingChangedSignalCallable);
|
||||
_settingChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void InstancerSettingChangedSignalHandler();
|
||||
private InstancerSettingChangedSignalHandler _instancerSettingChangedSignal;
|
||||
private Callable _instancerSettingChangedSignalCallable;
|
||||
public event InstancerSettingChangedSignalHandler InstancerSettingChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_instancerSettingChangedSignal is null)
|
||||
{
|
||||
_instancerSettingChangedSignalCallable = Callable.From(() =>
|
||||
_instancerSettingChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.InstancerSettingChanged, _instancerSettingChangedSignalCallable);
|
||||
}
|
||||
_instancerSettingChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_instancerSettingChangedSignal -= value;
|
||||
if (_instancerSettingChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.InstancerSettingChanged, _instancerSettingChangedSignalCallable);
|
||||
_instancerSettingChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new delegate void InstanceCountChangedSignalHandler();
|
||||
private InstanceCountChangedSignalHandler _instanceCountChangedSignal;
|
||||
private Callable _instanceCountChangedSignalCallable;
|
||||
public event InstanceCountChangedSignalHandler InstanceCountChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_instanceCountChangedSignal is null)
|
||||
{
|
||||
_instanceCountChangedSignalCallable = Callable.From(() =>
|
||||
_instanceCountChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.InstanceCountChanged, _instanceCountChangedSignalCallable);
|
||||
}
|
||||
_instanceCountChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_instanceCountChangedSignal -= value;
|
||||
if (_instanceCountChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.InstanceCountChanged, _instanceCountChangedSignalCallable);
|
||||
_instanceCountChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName Name = "name";
|
||||
public new static readonly StringName Id = "id";
|
||||
public new static readonly StringName Enabled = "enabled";
|
||||
public new static readonly StringName SceneFile = "scene_file";
|
||||
public new static readonly StringName HeightOffset = "height_offset";
|
||||
public new static readonly StringName Density = "density";
|
||||
public new static readonly StringName CastShadows = "cast_shadows";
|
||||
public new static readonly StringName MaterialOverride = "material_override";
|
||||
public new static readonly StringName MaterialOverlay = "material_overlay";
|
||||
public new static readonly StringName GeneratedFaces = "generated_faces";
|
||||
public new static readonly StringName GeneratedSize = "generated_size";
|
||||
public new static readonly StringName LodCount = "lod_count";
|
||||
public new static readonly StringName LastLod = "last_lod";
|
||||
public new static readonly StringName LastShadowLod = "last_shadow_lod";
|
||||
public new static readonly StringName ShadowImpostor = "shadow_impostor";
|
||||
public new static readonly StringName Lod0Range = "lod0_range";
|
||||
public new static readonly StringName Lod1Range = "lod1_range";
|
||||
public new static readonly StringName Lod2Range = "lod2_range";
|
||||
public new static readonly StringName Lod3Range = "lod3_range";
|
||||
public new static readonly StringName Lod4Range = "lod4_range";
|
||||
public new static readonly StringName Lod5Range = "lod5_range";
|
||||
public new static readonly StringName Lod6Range = "lod6_range";
|
||||
public new static readonly StringName Lod7Range = "lod7_range";
|
||||
public new static readonly StringName Lod8Range = "lod8_range";
|
||||
public new static readonly StringName Lod9Range = "lod9_range";
|
||||
public new static readonly StringName FadeMargin = "fade_margin";
|
||||
}
|
||||
|
||||
public new string Name
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Name).As<string>();
|
||||
set => Set(GDExtensionPropertyName.Name, value);
|
||||
}
|
||||
|
||||
public new long Id
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Id).As<long>();
|
||||
set => Set(GDExtensionPropertyName.Id, value);
|
||||
}
|
||||
|
||||
public new bool Enabled
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Enabled).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.Enabled, value);
|
||||
}
|
||||
|
||||
public new PackedScene SceneFile
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.SceneFile).As<PackedScene>();
|
||||
set => Set(GDExtensionPropertyName.SceneFile, value);
|
||||
}
|
||||
|
||||
public new double HeightOffset
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.HeightOffset).As<double>();
|
||||
set => Set(GDExtensionPropertyName.HeightOffset, value);
|
||||
}
|
||||
|
||||
public new double Density
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Density).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Density, value);
|
||||
}
|
||||
|
||||
public new Variant CastShadows
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.CastShadows).As<Variant>();
|
||||
set => Set(GDExtensionPropertyName.CastShadows, value);
|
||||
}
|
||||
|
||||
public new Material MaterialOverride
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.MaterialOverride).As<Material>();
|
||||
set => Set(GDExtensionPropertyName.MaterialOverride, value);
|
||||
}
|
||||
|
||||
public new Material MaterialOverlay
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.MaterialOverlay).As<Material>();
|
||||
set => Set(GDExtensionPropertyName.MaterialOverlay, value);
|
||||
}
|
||||
|
||||
public new long GeneratedFaces
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.GeneratedFaces).As<long>();
|
||||
set => Set(GDExtensionPropertyName.GeneratedFaces, value);
|
||||
}
|
||||
|
||||
public new Vector2 GeneratedSize
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.GeneratedSize).As<Vector2>();
|
||||
set => Set(GDExtensionPropertyName.GeneratedSize, value);
|
||||
}
|
||||
|
||||
public new long LodCount
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.LodCount).As<long>();
|
||||
}
|
||||
|
||||
public new long LastLod
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.LastLod).As<long>();
|
||||
set => Set(GDExtensionPropertyName.LastLod, value);
|
||||
}
|
||||
|
||||
public new long LastShadowLod
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.LastShadowLod).As<long>();
|
||||
set => Set(GDExtensionPropertyName.LastShadowLod, value);
|
||||
}
|
||||
|
||||
public new long ShadowImpostor
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ShadowImpostor).As<long>();
|
||||
set => Set(GDExtensionPropertyName.ShadowImpostor, value);
|
||||
}
|
||||
|
||||
public new double Lod0Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod0Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod0Range, value);
|
||||
}
|
||||
|
||||
public new double Lod1Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod1Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod1Range, value);
|
||||
}
|
||||
|
||||
public new double Lod2Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod2Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod2Range, value);
|
||||
}
|
||||
|
||||
public new double Lod3Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod3Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod3Range, value);
|
||||
}
|
||||
|
||||
public new double Lod4Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod4Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod4Range, value);
|
||||
}
|
||||
|
||||
public new double Lod5Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod5Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod5Range, value);
|
||||
}
|
||||
|
||||
public new double Lod6Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod6Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod6Range, value);
|
||||
}
|
||||
|
||||
public new double Lod7Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod7Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod7Range, value);
|
||||
}
|
||||
|
||||
public new double Lod8Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod8Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod8Range, value);
|
||||
}
|
||||
|
||||
public new double Lod9Range
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Lod9Range).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Lod9Range, value);
|
||||
}
|
||||
|
||||
public new double FadeMargin
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.FadeMargin).As<double>();
|
||||
set => Set(GDExtensionPropertyName.FadeMargin, value);
|
||||
}
|
||||
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName Clear = "clear";
|
||||
public new static readonly StringName SetHighlighted = "set_highlighted";
|
||||
public new static readonly StringName IsHighlighted = "is_highlighted";
|
||||
public new static readonly StringName GetHighlightColor = "get_highlight_color";
|
||||
public new static readonly StringName GetThumbnail = "get_thumbnail";
|
||||
public new static readonly StringName GetMesh = "get_mesh";
|
||||
public new static readonly StringName SetLodRange = "set_lod_range";
|
||||
public new static readonly StringName GetLodRange = "get_lod_range";
|
||||
public new static readonly StringName GetInstanceCount = "get_instance_count";
|
||||
}
|
||||
|
||||
public new void Clear() =>
|
||||
Call(GDExtensionMethodName.Clear, []);
|
||||
|
||||
public new void SetHighlighted(bool enabled) =>
|
||||
Call(GDExtensionMethodName.SetHighlighted, [enabled]);
|
||||
|
||||
public new bool IsHighlighted() =>
|
||||
Call(GDExtensionMethodName.IsHighlighted, []).As<bool>();
|
||||
|
||||
public new Color GetHighlightColor() =>
|
||||
Call(GDExtensionMethodName.GetHighlightColor, []).As<Color>();
|
||||
|
||||
public new Texture2D GetThumbnail() =>
|
||||
Call(GDExtensionMethodName.GetThumbnail, []).As<Texture2D>();
|
||||
|
||||
public new Mesh GetMesh(long lod = 0) =>
|
||||
Call(GDExtensionMethodName.GetMesh, [lod]).As<Mesh>();
|
||||
|
||||
public new void SetLodRange(long lod, double distance) =>
|
||||
Call(GDExtensionMethodName.SetLodRange, [lod, distance]);
|
||||
|
||||
public new double GetLodRange(long lod) =>
|
||||
Call(GDExtensionMethodName.GetLodRange, [lod]).As<double>();
|
||||
|
||||
public new long GetInstanceCount() =>
|
||||
Call(GDExtensionMethodName.GetInstanceCount, []).As<long>();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://pqa3qpe645u
|
||||
uid://c1mg74hkhl5m2
|
||||
|
|
|
|||
|
|
@ -1,252 +1,223 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DRegion : Resource
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DRegion";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying Resource), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DRegion() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DRegion");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DRegion"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DRegion Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DRegion>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DRegion object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DRegion() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DRegion"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DRegion"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DRegion"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DRegion"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DRegion Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DRegion>(godotObject);
|
||||
}
|
||||
#region Enums
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public enum MapType : long
|
||||
{
|
||||
TypeHeight = 0,
|
||||
TypeControl = 1,
|
||||
TypeColor = 2,
|
||||
TypeMax = 3,
|
||||
}
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DRegion"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DRegion"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DRegion"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DRegion"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DRegion Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DRegion wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
#endregion
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DRegion);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
#region Properties
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DRegion).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public float Version
|
||||
{
|
||||
get => (float)Get(_cached_version);
|
||||
set => Set(_cached_version, Variant.From(value));
|
||||
}
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DRegion)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public int RegionSize
|
||||
{
|
||||
get => (int)Get(_cached_region_size);
|
||||
set => Set(_cached_region_size, Variant.From(value));
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DRegion"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DRegion" type.</returns>
|
||||
public new static Terrain3DRegion Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public float VertexSpacing
|
||||
{
|
||||
get => (float)Get(_cached_vertex_spacing);
|
||||
set => Set(_cached_vertex_spacing, Variant.From(value));
|
||||
}
|
||||
public enum MapType
|
||||
{
|
||||
Height = 0,
|
||||
Control = 1,
|
||||
Color = 2,
|
||||
Max = 3,
|
||||
}
|
||||
|
||||
public Vector2 HeightRange
|
||||
{
|
||||
get => (Vector2)Get(_cached_height_range);
|
||||
set => Set(_cached_height_range, Variant.From(value));
|
||||
}
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName Version = "version";
|
||||
public new static readonly StringName RegionSize = "region_size";
|
||||
public new static readonly StringName VertexSpacing = "vertex_spacing";
|
||||
public new static readonly StringName HeightRange = "height_range";
|
||||
public new static readonly StringName HeightMap = "height_map";
|
||||
public new static readonly StringName ControlMap = "control_map";
|
||||
public new static readonly StringName ColorMap = "color_map";
|
||||
public new static readonly StringName Instances = "instances";
|
||||
public new static readonly StringName Edited = "edited";
|
||||
public new static readonly StringName Deleted = "deleted";
|
||||
public new static readonly StringName Modified = "modified";
|
||||
public new static readonly StringName Location = "location";
|
||||
}
|
||||
|
||||
public Image HeightMap
|
||||
{
|
||||
get => (Image)Get(_cached_height_map);
|
||||
set => Set(_cached_height_map, Variant.From(value));
|
||||
}
|
||||
public new double Version
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Version).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Version, value);
|
||||
}
|
||||
|
||||
public Image ControlMap
|
||||
{
|
||||
get => (Image)Get(_cached_control_map);
|
||||
set => Set(_cached_control_map, Variant.From(value));
|
||||
}
|
||||
public new long RegionSize
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.RegionSize).As<long>();
|
||||
set => Set(GDExtensionPropertyName.RegionSize, value);
|
||||
}
|
||||
|
||||
public Image ColorMap
|
||||
{
|
||||
get => (Image)Get(_cached_color_map);
|
||||
set => Set(_cached_color_map, Variant.From(value));
|
||||
}
|
||||
public new double VertexSpacing
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.VertexSpacing).As<double>();
|
||||
set => Set(GDExtensionPropertyName.VertexSpacing, value);
|
||||
}
|
||||
|
||||
public Godot.Collections.Dictionary Instances
|
||||
{
|
||||
get => (Godot.Collections.Dictionary)Get(_cached_instances);
|
||||
set => Set(_cached_instances, Variant.From(value));
|
||||
}
|
||||
public new Vector2 HeightRange
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.HeightRange).As<Vector2>();
|
||||
set => Set(GDExtensionPropertyName.HeightRange, value);
|
||||
}
|
||||
|
||||
public bool Edited
|
||||
{
|
||||
get => (bool)Get(_cached_edited);
|
||||
set => Set(_cached_edited, Variant.From(value));
|
||||
}
|
||||
public new Image HeightMap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.HeightMap).As<Image>();
|
||||
set => Set(GDExtensionPropertyName.HeightMap, value);
|
||||
}
|
||||
|
||||
public bool Deleted
|
||||
{
|
||||
get => (bool)Get(_cached_deleted);
|
||||
set => Set(_cached_deleted, Variant.From(value));
|
||||
}
|
||||
public new Image ControlMap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ControlMap).As<Image>();
|
||||
set => Set(GDExtensionPropertyName.ControlMap, value);
|
||||
}
|
||||
|
||||
public bool Modified
|
||||
{
|
||||
get => (bool)Get(_cached_modified);
|
||||
set => Set(_cached_modified, Variant.From(value));
|
||||
}
|
||||
public new Image ColorMap
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.ColorMap).As<Image>();
|
||||
set => Set(GDExtensionPropertyName.ColorMap, value);
|
||||
}
|
||||
|
||||
public Vector2I Location
|
||||
{
|
||||
get => (Vector2I)Get(_cached_location);
|
||||
set => Set(_cached_location, Variant.From(value));
|
||||
}
|
||||
public new Godot.Collections.Dictionary Instances
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Instances).As<Godot.Collections.Dictionary>();
|
||||
set => Set(GDExtensionPropertyName.Instances, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public new bool Edited
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Edited).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.Edited, value);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
public new bool Deleted
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Deleted).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.Deleted, value);
|
||||
}
|
||||
|
||||
public void SetVersion(float version) => Call(_cached_set_version, version);
|
||||
public new bool Modified
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Modified).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.Modified, value);
|
||||
}
|
||||
|
||||
public float GetVersion() => Call(_cached_get_version).As<float>();
|
||||
public new Vector2I Location
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Location).As<Vector2I>();
|
||||
set => Set(GDExtensionPropertyName.Location, value);
|
||||
}
|
||||
|
||||
public void SetRegionSize(int regionSize) => Call(_cached_set_region_size, regionSize);
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName SetMap = "set_map";
|
||||
public new static readonly StringName GetMap = "get_map";
|
||||
public new static readonly StringName SetMaps = "set_maps";
|
||||
public new static readonly StringName GetMaps = "get_maps";
|
||||
public new static readonly StringName SanitizeMaps = "sanitize_maps";
|
||||
public new static readonly StringName SanitizeMap = "sanitize_map";
|
||||
public new static readonly StringName ValidateMapSize = "validate_map_size";
|
||||
public new static readonly StringName UpdateHeight = "update_height";
|
||||
public new static readonly StringName UpdateHeights = "update_heights";
|
||||
public new static readonly StringName CalcHeightRange = "calc_height_range";
|
||||
public new static readonly StringName Save = "save";
|
||||
public new static readonly StringName SetData = "set_data";
|
||||
public new static readonly StringName GetData = "get_data";
|
||||
public new static readonly StringName Duplicate = "duplicate";
|
||||
public new static readonly StringName Dump = "dump";
|
||||
}
|
||||
|
||||
public int GetRegionSize() => Call(_cached_get_region_size).As<int>();
|
||||
public new void SetMap(Terrain3DRegion.MapType mapType, Image map) =>
|
||||
Call(GDExtensionMethodName.SetMap, [Variant.From(mapType), map]);
|
||||
|
||||
public void SetVertexSpacing(float vertexSpacing) => Call(_cached_set_vertex_spacing, vertexSpacing);
|
||||
public new Image GetMap(Terrain3DRegion.MapType mapType) =>
|
||||
Call(GDExtensionMethodName.GetMap, [Variant.From(mapType)]).As<Image>();
|
||||
|
||||
public float GetVertexSpacing() => Call(_cached_get_vertex_spacing).As<float>();
|
||||
public new void SetMaps(Godot.Collections.Array maps) =>
|
||||
Call(GDExtensionMethodName.SetMaps, [maps]);
|
||||
|
||||
public void SetMap(int mapType, Image map) => Call(_cached_set_map, mapType, (Image)map);
|
||||
public new Godot.Collections.Array GetMaps() =>
|
||||
Call(GDExtensionMethodName.GetMaps, []).As<Godot.Collections.Array>();
|
||||
|
||||
public Image GetMap(int mapType) => GDExtensionHelper.Bind<Image>(Call(_cached_get_map, mapType).As<GodotObject>());
|
||||
public new void SanitizeMaps() =>
|
||||
Call(GDExtensionMethodName.SanitizeMaps, []);
|
||||
|
||||
public void SetMaps(Godot.Collections.Array<Image> maps) => Call(_cached_set_maps, maps);
|
||||
public new Image SanitizeMap(Terrain3DRegion.MapType mapType, Image map) =>
|
||||
Call(GDExtensionMethodName.SanitizeMap, [Variant.From(mapType), map]).As<Image>();
|
||||
|
||||
public Godot.Collections.Array<Image> GetMaps() => GDExtensionHelper.Cast<Image>(Call(_cached_get_maps).As<Godot.Collections.Array<Godot.GodotObject>>());
|
||||
public new bool ValidateMapSize(Image map) =>
|
||||
Call(GDExtensionMethodName.ValidateMapSize, [map]).As<bool>();
|
||||
|
||||
public void SetHeightMap(Image map) => Call(_cached_set_height_map, (Image)map);
|
||||
public new void UpdateHeight(double height) =>
|
||||
Call(GDExtensionMethodName.UpdateHeight, [height]);
|
||||
|
||||
public Image GetHeightMap() => GDExtensionHelper.Bind<Image>(Call(_cached_get_height_map).As<GodotObject>());
|
||||
public new void UpdateHeights(Vector2 lowHigh) =>
|
||||
Call(GDExtensionMethodName.UpdateHeights, [lowHigh]);
|
||||
|
||||
public void SetControlMap(Image map) => Call(_cached_set_control_map, (Image)map);
|
||||
public new void CalcHeightRange() =>
|
||||
Call(GDExtensionMethodName.CalcHeightRange, []);
|
||||
|
||||
public Image GetControlMap() => GDExtensionHelper.Bind<Image>(Call(_cached_get_control_map).As<GodotObject>());
|
||||
public new Error Save(string path = "", bool save16Bit = false) =>
|
||||
Call(GDExtensionMethodName.Save, [path, save16Bit]).As<Error>();
|
||||
|
||||
public void SetColorMap(Image map) => Call(_cached_set_color_map, (Image)map);
|
||||
public new void SetData(Godot.Collections.Dictionary data) =>
|
||||
Call(GDExtensionMethodName.SetData, [data]);
|
||||
|
||||
public Image GetColorMap() => GDExtensionHelper.Bind<Image>(Call(_cached_get_color_map).As<GodotObject>());
|
||||
public new Godot.Collections.Dictionary GetData() =>
|
||||
Call(GDExtensionMethodName.GetData, []).As<Godot.Collections.Dictionary>();
|
||||
|
||||
public void SanitizeMaps() => Call(_cached_sanitize_maps);
|
||||
public new Terrain3DRegion Duplicate(bool deep = false) =>
|
||||
Terrain3DRegion.Bind(Call(GDExtensionMethodName.Duplicate, [deep]).As<Resource>());
|
||||
|
||||
public Image SanitizeMap(int mapType, Image map) => GDExtensionHelper.Bind<Image>(Call(_cached_sanitize_map, mapType, (Image)map).As<GodotObject>());
|
||||
public new void Dump(bool verbose = false) =>
|
||||
Call(GDExtensionMethodName.Dump, [verbose]);
|
||||
|
||||
public bool ValidateMapSize(Image map) => Call(_cached_validate_map_size, (Image)map).As<bool>();
|
||||
|
||||
public void SetHeightRange(Vector2 range) => Call(_cached_set_height_range, range);
|
||||
|
||||
public Vector2 GetHeightRange() => Call(_cached_get_height_range).As<Vector2>();
|
||||
|
||||
public void UpdateHeight(float height) => Call(_cached_update_height, height);
|
||||
|
||||
public void UpdateHeights(Vector2 lowHigh) => Call(_cached_update_heights, lowHigh);
|
||||
|
||||
public void CalcHeightRange() => Call(_cached_calc_height_range);
|
||||
|
||||
public void SetInstances(Godot.Collections.Dictionary instances) => Call(_cached_set_instances, instances);
|
||||
|
||||
public Godot.Collections.Dictionary GetInstances() => Call(_cached_get_instances).As<Godot.Collections.Dictionary>();
|
||||
|
||||
public int Save(string path, bool _16Bit) => Call(_cached_save, path, _16Bit).As<int>();
|
||||
|
||||
public void SetDeleted(bool deleted) => Call(_cached_set_deleted, deleted);
|
||||
|
||||
public bool IsDeleted() => Call(_cached_is_deleted).As<bool>();
|
||||
|
||||
public void SetEdited(bool edited) => Call(_cached_set_edited, edited);
|
||||
|
||||
public bool IsEdited() => Call(_cached_is_edited).As<bool>();
|
||||
|
||||
public void SetModified(bool modified) => Call(_cached_set_modified, modified);
|
||||
|
||||
public bool IsModified() => Call(_cached_is_modified).As<bool>();
|
||||
|
||||
public void SetLocation(Vector2I location) => Call(_cached_set_location, location);
|
||||
|
||||
public Vector2I GetLocation() => Call(_cached_get_location).As<Vector2I>();
|
||||
|
||||
public void SetData(Godot.Collections.Dictionary data) => Call(_cached_set_data, data);
|
||||
|
||||
public Godot.Collections.Dictionary GetData() => Call(_cached_get_data).As<Godot.Collections.Dictionary>();
|
||||
|
||||
public Terrain3DRegion Duplicate(bool deep) => GDExtensionHelper.Bind<Terrain3DRegion>(Call(_cached_duplicate, deep).As<GodotObject>());
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_version = "version";
|
||||
private static readonly StringName _cached_region_size = "region_size";
|
||||
private static readonly StringName _cached_vertex_spacing = "vertex_spacing";
|
||||
private static readonly StringName _cached_height_range = "height_range";
|
||||
private static readonly StringName _cached_height_map = "height_map";
|
||||
private static readonly StringName _cached_control_map = "control_map";
|
||||
private static readonly StringName _cached_color_map = "color_map";
|
||||
private static readonly StringName _cached_instances = "instances";
|
||||
private static readonly StringName _cached_edited = "edited";
|
||||
private static readonly StringName _cached_deleted = "deleted";
|
||||
private static readonly StringName _cached_modified = "modified";
|
||||
private static readonly StringName _cached_location = "location";
|
||||
private static readonly StringName _cached_set_version = "set_version";
|
||||
private static readonly StringName _cached_get_version = "get_version";
|
||||
private static readonly StringName _cached_set_region_size = "set_region_size";
|
||||
private static readonly StringName _cached_get_region_size = "get_region_size";
|
||||
private static readonly StringName _cached_set_vertex_spacing = "set_vertex_spacing";
|
||||
private static readonly StringName _cached_get_vertex_spacing = "get_vertex_spacing";
|
||||
private static readonly StringName _cached_set_map = "set_map";
|
||||
private static readonly StringName _cached_get_map = "get_map";
|
||||
private static readonly StringName _cached_set_maps = "set_maps";
|
||||
private static readonly StringName _cached_get_maps = "get_maps";
|
||||
private static readonly StringName _cached_set_height_map = "set_height_map";
|
||||
private static readonly StringName _cached_get_height_map = "get_height_map";
|
||||
private static readonly StringName _cached_set_control_map = "set_control_map";
|
||||
private static readonly StringName _cached_get_control_map = "get_control_map";
|
||||
private static readonly StringName _cached_set_color_map = "set_color_map";
|
||||
private static readonly StringName _cached_get_color_map = "get_color_map";
|
||||
private static readonly StringName _cached_sanitize_maps = "sanitize_maps";
|
||||
private static readonly StringName _cached_sanitize_map = "sanitize_map";
|
||||
private static readonly StringName _cached_validate_map_size = "validate_map_size";
|
||||
private static readonly StringName _cached_set_height_range = "set_height_range";
|
||||
private static readonly StringName _cached_get_height_range = "get_height_range";
|
||||
private static readonly StringName _cached_update_height = "update_height";
|
||||
private static readonly StringName _cached_update_heights = "update_heights";
|
||||
private static readonly StringName _cached_calc_height_range = "calc_height_range";
|
||||
private static readonly StringName _cached_set_instances = "set_instances";
|
||||
private static readonly StringName _cached_get_instances = "get_instances";
|
||||
private static readonly StringName _cached_save = "save";
|
||||
private static readonly StringName _cached_set_deleted = "set_deleted";
|
||||
private static readonly StringName _cached_is_deleted = "is_deleted";
|
||||
private static readonly StringName _cached_set_edited = "set_edited";
|
||||
private static readonly StringName _cached_is_edited = "is_edited";
|
||||
private static readonly StringName _cached_set_modified = "set_modified";
|
||||
private static readonly StringName _cached_is_modified = "is_modified";
|
||||
private static readonly StringName _cached_set_location = "set_location";
|
||||
private static readonly StringName _cached_get_location = "get_location";
|
||||
private static readonly StringName _cached_set_data = "set_data";
|
||||
private static readonly StringName _cached_get_data = "get_data";
|
||||
private static readonly StringName _cached_duplicate = "duplicate";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://dvs5f0nv1q5dl
|
||||
uid://bcby10sji7q8i
|
||||
|
|
|
|||
|
|
@ -1,291 +1,254 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DTextureAsset : Resource
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DTextureAsset";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying Resource), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DTextureAsset() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DTextureAsset");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DTextureAsset"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DTextureAsset Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DTextureAsset>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DTextureAsset object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DTextureAsset() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DTextureAsset"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DTextureAsset"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DTextureAsset"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DTextureAsset"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DTextureAsset Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DTextureAsset>(godotObject);
|
||||
}
|
||||
#region Properties
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => (string)Get(_cached_name);
|
||||
set => Set(_cached_name, Variant.From(value));
|
||||
}
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DTextureAsset"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DTextureAsset"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DTextureAsset"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DTextureAsset"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DTextureAsset Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DTextureAsset wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
public int Id
|
||||
{
|
||||
get => (int)Get(_cached_id);
|
||||
set => Set(_cached_id, Variant.From(value));
|
||||
}
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DTextureAsset);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
public Color AlbedoColor
|
||||
{
|
||||
get => (Color)Get(_cached_albedo_color);
|
||||
set => Set(_cached_albedo_color, Variant.From(value));
|
||||
}
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DTextureAsset).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public Texture2D /*ImageTexture,CompressedTexture2D*/ AlbedoTexture
|
||||
{
|
||||
get => (Texture2D /*ImageTexture,CompressedTexture2D*/)Get(_cached_albedo_texture);
|
||||
set => Set(_cached_albedo_texture, Variant.From(value));
|
||||
}
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DTextureAsset)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public Texture2D /*ImageTexture,CompressedTexture2D*/ NormalTexture
|
||||
{
|
||||
get => (Texture2D /*ImageTexture,CompressedTexture2D*/)Get(_cached_normal_texture);
|
||||
set => Set(_cached_normal_texture, Variant.From(value));
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DTextureAsset"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DTextureAsset" type.</returns>
|
||||
public new static Terrain3DTextureAsset Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public float NormalDepth
|
||||
{
|
||||
get => (float)Get(_cached_normal_depth);
|
||||
set => Set(_cached_normal_depth, Variant.From(value));
|
||||
}
|
||||
public new static class GDExtensionSignalName
|
||||
{
|
||||
public new static readonly StringName IdChanged = "id_changed";
|
||||
public new static readonly StringName FileChanged = "file_changed";
|
||||
public new static readonly StringName SettingChanged = "setting_changed";
|
||||
}
|
||||
|
||||
public float AoStrength
|
||||
{
|
||||
get => (float)Get(_cached_ao_strength);
|
||||
set => Set(_cached_ao_strength, Variant.From(value));
|
||||
}
|
||||
public new delegate void IdChangedSignalHandler();
|
||||
private IdChangedSignalHandler _idChangedSignal;
|
||||
private Callable _idChangedSignalCallable;
|
||||
public event IdChangedSignalHandler IdChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_idChangedSignal is null)
|
||||
{
|
||||
_idChangedSignalCallable = Callable.From(() =>
|
||||
_idChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.IdChanged, _idChangedSignalCallable);
|
||||
}
|
||||
_idChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_idChangedSignal -= value;
|
||||
if (_idChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.IdChanged, _idChangedSignalCallable);
|
||||
_idChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public float Roughness
|
||||
{
|
||||
get => (float)Get(_cached_roughness);
|
||||
set => Set(_cached_roughness, Variant.From(value));
|
||||
}
|
||||
public new delegate void FileChangedSignalHandler();
|
||||
private FileChangedSignalHandler _fileChangedSignal;
|
||||
private Callable _fileChangedSignalCallable;
|
||||
public event FileChangedSignalHandler FileChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_fileChangedSignal is null)
|
||||
{
|
||||
_fileChangedSignalCallable = Callable.From(() =>
|
||||
_fileChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.FileChanged, _fileChangedSignalCallable);
|
||||
}
|
||||
_fileChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_fileChangedSignal -= value;
|
||||
if (_fileChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.FileChanged, _fileChangedSignalCallable);
|
||||
_fileChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public float UvScale
|
||||
{
|
||||
get => (float)Get(_cached_uv_scale);
|
||||
set => Set(_cached_uv_scale, Variant.From(value));
|
||||
}
|
||||
public new delegate void SettingChangedSignalHandler();
|
||||
private SettingChangedSignalHandler _settingChangedSignal;
|
||||
private Callable _settingChangedSignalCallable;
|
||||
public event SettingChangedSignalHandler SettingChangedSignal
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_settingChangedSignal is null)
|
||||
{
|
||||
_settingChangedSignalCallable = Callable.From(() =>
|
||||
_settingChangedSignal?.Invoke());
|
||||
Connect(GDExtensionSignalName.SettingChanged, _settingChangedSignalCallable);
|
||||
}
|
||||
_settingChangedSignal += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_settingChangedSignal -= value;
|
||||
if (_settingChangedSignal is not null) return;
|
||||
Disconnect(GDExtensionSignalName.SettingChanged, _settingChangedSignalCallable);
|
||||
_settingChangedSignalCallable = default;
|
||||
}
|
||||
}
|
||||
|
||||
public float DetilingRotation
|
||||
{
|
||||
get => (float)Get(_cached_detiling_rotation);
|
||||
set => Set(_cached_detiling_rotation, Variant.From(value));
|
||||
}
|
||||
public new static class GDExtensionPropertyName
|
||||
{
|
||||
public new static readonly StringName Name = "name";
|
||||
public new static readonly StringName Id = "id";
|
||||
public new static readonly StringName AlbedoColor = "albedo_color";
|
||||
public new static readonly StringName AlbedoTexture = "albedo_texture";
|
||||
public new static readonly StringName NormalTexture = "normal_texture";
|
||||
public new static readonly StringName NormalDepth = "normal_depth";
|
||||
public new static readonly StringName AoStrength = "ao_strength";
|
||||
public new static readonly StringName Roughness = "roughness";
|
||||
public new static readonly StringName UvScale = "uv_scale";
|
||||
public new static readonly StringName VerticalProjection = "vertical_projection";
|
||||
public new static readonly StringName DetilingRotation = "detiling_rotation";
|
||||
public new static readonly StringName DetilingShift = "detiling_shift";
|
||||
}
|
||||
|
||||
public float DetilingShift
|
||||
{
|
||||
get => (float)Get(_cached_detiling_shift);
|
||||
set => Set(_cached_detiling_shift, Variant.From(value));
|
||||
}
|
||||
public new string Name
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Name).As<string>();
|
||||
set => Set(GDExtensionPropertyName.Name, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public new long Id
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Id).As<long>();
|
||||
set => Set(GDExtensionPropertyName.Id, value);
|
||||
}
|
||||
|
||||
#region Signals
|
||||
public new Color AlbedoColor
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.AlbedoColor).As<Color>();
|
||||
set => Set(GDExtensionPropertyName.AlbedoColor, value);
|
||||
}
|
||||
|
||||
public delegate void IdChangedHandler();
|
||||
public new Texture2D AlbedoTexture
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.AlbedoTexture).As<Texture2D>();
|
||||
set => Set(GDExtensionPropertyName.AlbedoTexture, value);
|
||||
}
|
||||
|
||||
private IdChangedHandler _idChanged_backing;
|
||||
private Callable _idChanged_backing_callable;
|
||||
public event IdChangedHandler IdChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_idChanged_backing == null)
|
||||
{
|
||||
_idChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_idChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_id_changed, _idChanged_backing_callable);
|
||||
}
|
||||
_idChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_idChanged_backing -= value;
|
||||
|
||||
if(_idChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_id_changed, _idChanged_backing_callable);
|
||||
_idChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
public new Texture2D NormalTexture
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.NormalTexture).As<Texture2D>();
|
||||
set => Set(GDExtensionPropertyName.NormalTexture, value);
|
||||
}
|
||||
|
||||
public delegate void FileChangedHandler();
|
||||
public new double NormalDepth
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.NormalDepth).As<double>();
|
||||
set => Set(GDExtensionPropertyName.NormalDepth, value);
|
||||
}
|
||||
|
||||
private FileChangedHandler _fileChanged_backing;
|
||||
private Callable _fileChanged_backing_callable;
|
||||
public event FileChangedHandler FileChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_fileChanged_backing == null)
|
||||
{
|
||||
_fileChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_fileChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_file_changed, _fileChanged_backing_callable);
|
||||
}
|
||||
_fileChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_fileChanged_backing -= value;
|
||||
|
||||
if(_fileChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_file_changed, _fileChanged_backing_callable);
|
||||
_fileChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
public new double AoStrength
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.AoStrength).As<double>();
|
||||
set => Set(GDExtensionPropertyName.AoStrength, value);
|
||||
}
|
||||
|
||||
public delegate void SettingChangedHandler();
|
||||
public new double Roughness
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.Roughness).As<double>();
|
||||
set => Set(GDExtensionPropertyName.Roughness, value);
|
||||
}
|
||||
|
||||
private SettingChangedHandler _settingChanged_backing;
|
||||
private Callable _settingChanged_backing_callable;
|
||||
public event SettingChangedHandler SettingChanged
|
||||
{
|
||||
add
|
||||
{
|
||||
if(_settingChanged_backing == null)
|
||||
{
|
||||
_settingChanged_backing_callable = Callable.From(
|
||||
() =>
|
||||
{
|
||||
_settingChanged_backing?.Invoke();
|
||||
}
|
||||
);
|
||||
Connect(_cached_setting_changed, _settingChanged_backing_callable);
|
||||
}
|
||||
_settingChanged_backing += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_settingChanged_backing -= value;
|
||||
|
||||
if(_settingChanged_backing == null)
|
||||
{
|
||||
Disconnect(_cached_setting_changed, _settingChanged_backing_callable);
|
||||
_settingChanged_backing_callable = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
public new double UvScale
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.UvScale).As<double>();
|
||||
set => Set(GDExtensionPropertyName.UvScale, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
public new bool VerticalProjection
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.VerticalProjection).As<bool>();
|
||||
set => Set(GDExtensionPropertyName.VerticalProjection, value);
|
||||
}
|
||||
|
||||
#region Methods
|
||||
public new double DetilingRotation
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.DetilingRotation).As<double>();
|
||||
set => Set(GDExtensionPropertyName.DetilingRotation, value);
|
||||
}
|
||||
|
||||
public void Clear() => Call(_cached_clear);
|
||||
public new double DetilingShift
|
||||
{
|
||||
get => Get(GDExtensionPropertyName.DetilingShift).As<double>();
|
||||
set => Set(GDExtensionPropertyName.DetilingShift, value);
|
||||
}
|
||||
|
||||
public void SetName(string name) => Call(_cached_set_name, name);
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName Clear = "clear";
|
||||
public new static readonly StringName SetHighlighted = "set_highlighted";
|
||||
public new static readonly StringName IsHighlighted = "is_highlighted";
|
||||
public new static readonly StringName GetHighlightColor = "get_highlight_color";
|
||||
public new static readonly StringName GetThumbnail = "get_thumbnail";
|
||||
}
|
||||
|
||||
public string GetName() => Call(_cached_get_name).As<string>();
|
||||
public new void Clear() =>
|
||||
Call(GDExtensionMethodName.Clear, []);
|
||||
|
||||
public void SetId(int id) => Call(_cached_set_id, id);
|
||||
public new void SetHighlighted(bool enabled) =>
|
||||
Call(GDExtensionMethodName.SetHighlighted, [enabled]);
|
||||
|
||||
public int GetId() => Call(_cached_get_id).As<int>();
|
||||
public new bool IsHighlighted() =>
|
||||
Call(GDExtensionMethodName.IsHighlighted, []).As<bool>();
|
||||
|
||||
public void SetAlbedoColor(Color color) => Call(_cached_set_albedo_color, color);
|
||||
public new Color GetHighlightColor() =>
|
||||
Call(GDExtensionMethodName.GetHighlightColor, []).As<Color>();
|
||||
|
||||
public Color GetAlbedoColor() => Call(_cached_get_albedo_color).As<Color>();
|
||||
public new Texture2D GetThumbnail() =>
|
||||
Call(GDExtensionMethodName.GetThumbnail, []).As<Texture2D>();
|
||||
|
||||
public void SetAlbedoTexture(Texture2D texture) => Call(_cached_set_albedo_texture, (Texture2D)texture);
|
||||
|
||||
public Texture2D GetAlbedoTexture() => GDExtensionHelper.Bind<Texture2D>(Call(_cached_get_albedo_texture).As<GodotObject>());
|
||||
|
||||
public void SetNormalTexture(Texture2D texture) => Call(_cached_set_normal_texture, (Texture2D)texture);
|
||||
|
||||
public Texture2D GetNormalTexture() => GDExtensionHelper.Bind<Texture2D>(Call(_cached_get_normal_texture).As<GodotObject>());
|
||||
|
||||
public void SetNormalDepth(float normalDepth) => Call(_cached_set_normal_depth, normalDepth);
|
||||
|
||||
public float GetNormalDepth() => Call(_cached_get_normal_depth).As<float>();
|
||||
|
||||
public void SetAoStrength(float aoStrength) => Call(_cached_set_ao_strength, aoStrength);
|
||||
|
||||
public float GetAoStrength() => Call(_cached_get_ao_strength).As<float>();
|
||||
|
||||
public void SetRoughness(float roughness) => Call(_cached_set_roughness, roughness);
|
||||
|
||||
public float GetRoughness() => Call(_cached_get_roughness).As<float>();
|
||||
|
||||
public void SetUvScale(float scale) => Call(_cached_set_uv_scale, scale);
|
||||
|
||||
public float GetUvScale() => Call(_cached_get_uv_scale).As<float>();
|
||||
|
||||
public void SetDetilingRotation(float detilingRotation) => Call(_cached_set_detiling_rotation, detilingRotation);
|
||||
|
||||
public float GetDetilingRotation() => Call(_cached_get_detiling_rotation).As<float>();
|
||||
|
||||
public void SetDetilingShift(float detilingShift) => Call(_cached_set_detiling_shift, detilingShift);
|
||||
|
||||
public float GetDetilingShift() => Call(_cached_get_detiling_shift).As<float>();
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly StringName _cached_name = "name";
|
||||
private static readonly StringName _cached_id = "id";
|
||||
private static readonly StringName _cached_albedo_color = "albedo_color";
|
||||
private static readonly StringName _cached_albedo_texture = "albedo_texture";
|
||||
private static readonly StringName _cached_normal_texture = "normal_texture";
|
||||
private static readonly StringName _cached_normal_depth = "normal_depth";
|
||||
private static readonly StringName _cached_ao_strength = "ao_strength";
|
||||
private static readonly StringName _cached_roughness = "roughness";
|
||||
private static readonly StringName _cached_uv_scale = "uv_scale";
|
||||
private static readonly StringName _cached_detiling_rotation = "detiling_rotation";
|
||||
private static readonly StringName _cached_detiling_shift = "detiling_shift";
|
||||
private static readonly StringName _cached_clear = "clear";
|
||||
private static readonly StringName _cached_set_name = "set_name";
|
||||
private static readonly StringName _cached_get_name = "get_name";
|
||||
private static readonly StringName _cached_set_id = "set_id";
|
||||
private static readonly StringName _cached_get_id = "get_id";
|
||||
private static readonly StringName _cached_set_albedo_color = "set_albedo_color";
|
||||
private static readonly StringName _cached_get_albedo_color = "get_albedo_color";
|
||||
private static readonly StringName _cached_set_albedo_texture = "set_albedo_texture";
|
||||
private static readonly StringName _cached_get_albedo_texture = "get_albedo_texture";
|
||||
private static readonly StringName _cached_set_normal_texture = "set_normal_texture";
|
||||
private static readonly StringName _cached_get_normal_texture = "get_normal_texture";
|
||||
private static readonly StringName _cached_set_normal_depth = "set_normal_depth";
|
||||
private static readonly StringName _cached_get_normal_depth = "get_normal_depth";
|
||||
private static readonly StringName _cached_set_ao_strength = "set_ao_strength";
|
||||
private static readonly StringName _cached_get_ao_strength = "get_ao_strength";
|
||||
private static readonly StringName _cached_set_roughness = "set_roughness";
|
||||
private static readonly StringName _cached_get_roughness = "get_roughness";
|
||||
private static readonly StringName _cached_set_uv_scale = "set_uv_scale";
|
||||
private static readonly StringName _cached_get_uv_scale = "get_uv_scale";
|
||||
private static readonly StringName _cached_set_detiling_rotation = "set_detiling_rotation";
|
||||
private static readonly StringName _cached_get_detiling_rotation = "get_detiling_rotation";
|
||||
private static readonly StringName _cached_set_detiling_shift = "set_detiling_shift";
|
||||
private static readonly StringName _cached_get_detiling_shift = "get_detiling_shift";
|
||||
private static readonly StringName _cached_id_changed = "id_changed";
|
||||
private static readonly StringName _cached_file_changed = "file_changed";
|
||||
private static readonly StringName _cached_setting_changed = "setting_changed";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://onf50a4k5wx7
|
||||
uid://bbee5m52swmhh
|
||||
|
|
|
|||
|
|
@ -1,119 +1,175 @@
|
|||
#pragma warning disable CS0109
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace TokisanGames;
|
||||
|
||||
public partial class Terrain3DUtil : GodotObject
|
||||
{
|
||||
public static readonly StringName GDExtensionName = "Terrain3DUtil";
|
||||
|
||||
[Obsolete("Wrapper classes cannot be constructed with Ctor (it only instantiate the underlying GodotObject), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DUtil() { }
|
||||
private new static readonly StringName NativeName = new StringName("Terrain3DUtil");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DUtil"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static Terrain3DUtil Instantiate()
|
||||
{
|
||||
return GDExtensionHelper.Instantiate<Terrain3DUtil>(GDExtensionName);
|
||||
}
|
||||
[Obsolete("Wrapper types cannot be constructed with constructors (it only instantiate the underlying Terrain3DUtil object), please use the Instantiate() method instead.")]
|
||||
protected Terrain3DUtil() { }
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DUtil"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DUtil"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DUtil"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DUtil"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static Terrain3DUtil Bind(GodotObject godotObject)
|
||||
{
|
||||
return GDExtensionHelper.Bind<Terrain3DUtil>(godotObject);
|
||||
}
|
||||
#region Methods
|
||||
private static CSharpScript _wrapperScriptAsset;
|
||||
|
||||
public static float AsFloat(int value) => GDExtensionHelper.Call(GDExtensionName, _cached_as_float, value).As<float>();
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <see cref="Terrain3DUtil"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <see cref="Terrain3DUtil"/> wrapper type,
|
||||
/// a new instance of the <see cref="Terrain3DUtil"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <see cref="Terrain3DUtil"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public new static Terrain3DUtil Bind(GodotObject godotObject)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!IsInstanceValid(godotObject))
|
||||
throw new InvalidOperationException("The supplied GodotObject instance is not valid.");
|
||||
#endif
|
||||
if (godotObject is Terrain3DUtil wrapperScriptInstance)
|
||||
return wrapperScriptInstance;
|
||||
|
||||
public static int AsUint(float value) => GDExtensionHelper.Call(GDExtensionName, _cached_as_uint, value).As<int>();
|
||||
#if DEBUG
|
||||
var expectedType = typeof(Terrain3DUtil);
|
||||
var currentObjectClassName = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(expectedType.Name, currentObjectClassName))
|
||||
throw new InvalidOperationException($"The supplied GodotObject ({currentObjectClassName}) is not the {expectedType.Name} type.");
|
||||
#endif
|
||||
|
||||
public static int GetBase(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_get_base, pixel).As<int>();
|
||||
if (_wrapperScriptAsset is null)
|
||||
{
|
||||
var scriptPathAttribute = typeof(Terrain3DUtil).GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
if (scriptPathAttribute is null) throw new UnreachableException();
|
||||
_wrapperScriptAsset = ResourceLoader.Load<CSharpScript>(scriptPathAttribute.Path);
|
||||
}
|
||||
|
||||
public static int EncBase(int @base) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_base, @base).As<int>();
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(_wrapperScriptAsset);
|
||||
return (Terrain3DUtil)InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
public static int GetOverlay(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_get_overlay, pixel).As<int>();
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <see cref="Terrain3DUtil"/> type, and attaches a wrapper script instance to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension "Terrain3DUtil" type.</returns>
|
||||
public new static Terrain3DUtil Instantiate() => Bind(ClassDB.Instantiate(NativeName).As<GodotObject>());
|
||||
|
||||
public static int EncOverlay(int overlay) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_overlay, overlay).As<int>();
|
||||
public new static class GDExtensionMethodName
|
||||
{
|
||||
public new static readonly StringName AsFloat = "as_float";
|
||||
public new static readonly StringName AsUint = "as_uint";
|
||||
public new static readonly StringName GetBase = "get_base";
|
||||
public new static readonly StringName EncBase = "enc_base";
|
||||
public new static readonly StringName GetOverlay = "get_overlay";
|
||||
public new static readonly StringName EncOverlay = "enc_overlay";
|
||||
public new static readonly StringName GetBlend = "get_blend";
|
||||
public new static readonly StringName EncBlend = "enc_blend";
|
||||
public new static readonly StringName GetUvRotation = "get_uv_rotation";
|
||||
public new static readonly StringName EncUvRotation = "enc_uv_rotation";
|
||||
public new static readonly StringName GetUvScale = "get_uv_scale";
|
||||
public new static readonly StringName EncUvScale = "enc_uv_scale";
|
||||
public new static readonly StringName IsHole = "is_hole";
|
||||
public new static readonly StringName EncHole = "enc_hole";
|
||||
public new static readonly StringName IsNav = "is_nav";
|
||||
public new static readonly StringName EncNav = "enc_nav";
|
||||
public new static readonly StringName IsAuto = "is_auto";
|
||||
public new static readonly StringName EncAuto = "enc_auto";
|
||||
public new static readonly StringName FilenameToLocation = "filename_to_location";
|
||||
public new static readonly StringName LocationToFilename = "location_to_filename";
|
||||
public new static readonly StringName BlackToAlpha = "black_to_alpha";
|
||||
public new static readonly StringName GetMinMax = "get_min_max";
|
||||
public new static readonly StringName GetThumbnail = "get_thumbnail";
|
||||
public new static readonly StringName GetFilledImage = "get_filled_image";
|
||||
public new static readonly StringName LoadImage = "load_image";
|
||||
public new static readonly StringName PackImage = "pack_image";
|
||||
public new static readonly StringName LuminanceToHeight = "luminance_to_height";
|
||||
}
|
||||
|
||||
public static int GetBlend(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_get_blend, pixel).As<int>();
|
||||
public new static double AsFloat(long value) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.AsFloat, [value]).As<double>();
|
||||
|
||||
public static int EncBlend(int blend) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_blend, blend).As<int>();
|
||||
public new static long AsUint(double value) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.AsUint, [value]).As<long>();
|
||||
|
||||
public static int GetUvRotation(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_get_uv_rotation, pixel).As<int>();
|
||||
public new static long GetBase(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetBase, [pixel]).As<long>();
|
||||
|
||||
public static int EncUvRotation(int rotation) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_uv_rotation, rotation).As<int>();
|
||||
public new static long EncBase(long @base) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncBase, [@base]).As<long>();
|
||||
|
||||
public static int GetUvScale(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_get_uv_scale, pixel).As<int>();
|
||||
public new static long GetOverlay(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetOverlay, [pixel]).As<long>();
|
||||
|
||||
public static int EncUvScale(int scale) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_uv_scale, scale).As<int>();
|
||||
public new static long EncOverlay(long overlay) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncOverlay, [overlay]).As<long>();
|
||||
|
||||
public static bool IsHole(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_is_hole, pixel).As<bool>();
|
||||
public new static long GetBlend(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetBlend, [pixel]).As<long>();
|
||||
|
||||
public static int EncHole(bool pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_hole, pixel).As<int>();
|
||||
public new static long EncBlend(long blend) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncBlend, [blend]).As<long>();
|
||||
|
||||
public static bool IsNav(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_is_nav, pixel).As<bool>();
|
||||
public new static long GetUvRotation(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetUvRotation, [pixel]).As<long>();
|
||||
|
||||
public static int EncNav(bool pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_nav, pixel).As<int>();
|
||||
public new static long EncUvRotation(long rotation) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncUvRotation, [rotation]).As<long>();
|
||||
|
||||
public static bool IsAuto(int pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_is_auto, pixel).As<bool>();
|
||||
public new static long GetUvScale(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetUvScale, [pixel]).As<long>();
|
||||
|
||||
public static int EncAuto(bool pixel) => GDExtensionHelper.Call(GDExtensionName, _cached_enc_auto, pixel).As<int>();
|
||||
public new static long EncUvScale(long scale) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncUvScale, [scale]).As<long>();
|
||||
|
||||
public static Vector2I FilenameToLocation(string filename) => GDExtensionHelper.Call(GDExtensionName, _cached_filename_to_location, filename).As<Vector2I>();
|
||||
public new static bool IsHole(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.IsHole, [pixel]).As<bool>();
|
||||
|
||||
public static string LocationToFilename(Vector2I regionLocation) => GDExtensionHelper.Call(GDExtensionName, _cached_location_to_filename, regionLocation).As<string>();
|
||||
public new static long EncHole(bool pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncHole, [pixel]).As<long>();
|
||||
|
||||
public static Image BlackToAlpha(Image image) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_black_to_alpha, (Image)image).As<GodotObject>());
|
||||
public new static bool IsNav(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.IsNav, [pixel]).As<bool>();
|
||||
|
||||
public static Vector2 GetMinMax(Image image) => GDExtensionHelper.Call(GDExtensionName, _cached_get_min_max, (Image)image).As<Vector2>();
|
||||
public new static long EncNav(bool pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncNav, [pixel]).As<long>();
|
||||
|
||||
public static Image GetThumbnail(Image image, Vector2I size) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_get_thumbnail, (Image)image, size).As<GodotObject>());
|
||||
public new static bool IsAuto(long pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.IsAuto, [pixel]).As<bool>();
|
||||
|
||||
public static Image GetFilledImage(Vector2I size, Color color, bool createMipmaps, int format) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_get_filled_image, size, color, createMipmaps, format).As<GodotObject>());
|
||||
public new static long EncAuto(bool pixel) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.EncAuto, [pixel]).As<long>();
|
||||
|
||||
public static Image LoadImage(string fileName, int cacheMode, Vector2 r16HeightRange, Vector2I r16Size) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_load_image, fileName, cacheMode, r16HeightRange, r16Size).As<GodotObject>());
|
||||
public new static Vector2I FilenameToLocation(string filename) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.FilenameToLocation, [filename]).As<Vector2I>();
|
||||
|
||||
public static Image PackImage(Image srcRgb, Image srcA, bool invertGreen, bool invertAlpha, int alphaChannel) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_pack_image, (Image)srcRgb, (Image)srcA, invertGreen, invertAlpha, alphaChannel).As<GodotObject>());
|
||||
public new static string LocationToFilename(Vector2I regionLocation) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.LocationToFilename, [regionLocation]).As<string>();
|
||||
|
||||
public static Image LuminanceToHeight(Image srcRgb) => GDExtensionHelper.Bind<Image>(GDExtensionHelper.Call(GDExtensionName, _cached_luminance_to_height, (Image)srcRgb).As<GodotObject>());
|
||||
public new static Image BlackToAlpha(Image image) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.BlackToAlpha, [image]).As<Image>();
|
||||
|
||||
#endregion
|
||||
public new static Vector2 GetMinMax(Image image) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetMinMax, [image]).As<Vector2>();
|
||||
|
||||
private static readonly StringName _cached_as_float = "as_float";
|
||||
private static readonly StringName _cached_as_uint = "as_uint";
|
||||
private static readonly StringName _cached_get_base = "get_base";
|
||||
private static readonly StringName _cached_enc_base = "enc_base";
|
||||
private static readonly StringName _cached_get_overlay = "get_overlay";
|
||||
private static readonly StringName _cached_enc_overlay = "enc_overlay";
|
||||
private static readonly StringName _cached_get_blend = "get_blend";
|
||||
private static readonly StringName _cached_enc_blend = "enc_blend";
|
||||
private static readonly StringName _cached_get_uv_rotation = "get_uv_rotation";
|
||||
private static readonly StringName _cached_enc_uv_rotation = "enc_uv_rotation";
|
||||
private static readonly StringName _cached_get_uv_scale = "get_uv_scale";
|
||||
private static readonly StringName _cached_enc_uv_scale = "enc_uv_scale";
|
||||
private static readonly StringName _cached_is_hole = "is_hole";
|
||||
private static readonly StringName _cached_enc_hole = "enc_hole";
|
||||
private static readonly StringName _cached_is_nav = "is_nav";
|
||||
private static readonly StringName _cached_enc_nav = "enc_nav";
|
||||
private static readonly StringName _cached_is_auto = "is_auto";
|
||||
private static readonly StringName _cached_enc_auto = "enc_auto";
|
||||
private static readonly StringName _cached_filename_to_location = "filename_to_location";
|
||||
private static readonly StringName _cached_location_to_filename = "location_to_filename";
|
||||
private static readonly StringName _cached_black_to_alpha = "black_to_alpha";
|
||||
private static readonly StringName _cached_get_min_max = "get_min_max";
|
||||
private static readonly StringName _cached_get_thumbnail = "get_thumbnail";
|
||||
private static readonly StringName _cached_get_filled_image = "get_filled_image";
|
||||
private static readonly StringName _cached_load_image = "load_image";
|
||||
private static readonly StringName _cached_pack_image = "pack_image";
|
||||
private static readonly StringName _cached_luminance_to_height = "luminance_to_height";
|
||||
}
|
||||
public new static Image GetThumbnail(Image image, Vector2I size = default) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetThumbnail, [image, size]).As<Image>();
|
||||
|
||||
public new static Image GetFilledImage(Vector2I size, Color color, bool createMipmaps, Image.Format format) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.GetFilledImage, [size, color, createMipmaps, Variant.From(format)]).As<Image>();
|
||||
|
||||
public new static Image LoadImage(string fileName, long cacheMode = 0, Vector2 r16HeightRange = default, Vector2I r16Size = default) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.LoadImage, [fileName, cacheMode, r16HeightRange, r16Size]).As<Image>();
|
||||
|
||||
public new static Image PackImage(Image srcRgb, Image srcA, bool invertGreen = false, bool invertAlpha = false, bool normalizeAlpha = false, long alphaChannel = 0) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.PackImage, [srcRgb, srcA, invertGreen, invertAlpha, normalizeAlpha, alphaChannel]).As<Image>();
|
||||
|
||||
public new static Image LuminanceToHeight(Image srcRgb) =>
|
||||
ClassDB.ClassCallStatic(NativeName, GDExtensionMethodName.LuminanceToHeight, [srcRgb]).As<Image>();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
uid://d4iali0vlx1m2
|
||||
uid://b5712pl5vpmet
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Concurrent;
|
||||
using Godot;
|
||||
|
||||
public static class GDExtensionHelper
|
||||
{
|
||||
private static readonly ConcurrentDictionary<string, GodotObject> _instances = [];
|
||||
private static readonly ConcurrentDictionary<Type,Variant> _scripts = [];
|
||||
/// <summary>
|
||||
/// Calls a static method within the given type.
|
||||
/// </summary>
|
||||
/// <param name="className">The type name.</param>
|
||||
/// <param name="method">The method name.</param>
|
||||
/// <param name="arguments">The arguments.</param>
|
||||
/// <returns>The return value of the method.</returns>
|
||||
public static Variant Call(StringName className, StringName method, params Variant[] arguments)
|
||||
{
|
||||
return _instances.GetOrAdd(className,InstantiateStaticFactory).Call(method, arguments);
|
||||
}
|
||||
|
||||
private static GodotObject InstantiateStaticFactory(string className) => ClassDB.Instantiate(className).As<GodotObject>();
|
||||
|
||||
/// <summary>
|
||||
/// Try to cast the script on the supplied <paramref name="godotObject"/> to the <typeparamref name="T"/> wrapper type,
|
||||
/// if no script has attached to the type, or the script attached to the type does not inherit the <typeparamref name="T"/> wrapper type,
|
||||
/// a new instance of the <typeparamref name="T"/> wrapper script will get attaches to the <paramref name="godotObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>The developer should only supply the <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</remarks>
|
||||
/// <param name="godotObject">The <paramref name="godotObject"/> that represents the correct underlying GDExtension type.</param>
|
||||
/// <returns>The existing or a new instance of the <typeparamref name="T"/> wrapper script attached to the supplied <paramref name="godotObject"/>.</returns>
|
||||
public static T Bind<T>(GodotObject godotObject) where T : GodotObject
|
||||
{
|
||||
#if DEBUG
|
||||
if (!GodotObject.IsInstanceValid(godotObject)) throw new ArgumentException(nameof(godotObject),"The supplied GodotObject is not valid.");
|
||||
#endif
|
||||
if (godotObject is T wrapperScript) return wrapperScript;
|
||||
var type = typeof(T);
|
||||
#if DEBUG
|
||||
var className = godotObject.GetClass();
|
||||
if (!ClassDB.IsParentClass(type.Name, className)) throw new ArgumentException(nameof(godotObject),$"The supplied GodotObject {className} is not a {type.Name}.");
|
||||
#endif
|
||||
var script =_scripts.GetOrAdd(type,GetScriptFactory);
|
||||
var instanceId = godotObject.GetInstanceId();
|
||||
godotObject.SetScript(script);
|
||||
return (T)GodotObject.InstanceFromId(instanceId);
|
||||
}
|
||||
|
||||
private static Variant GetScriptFactory(Type type)
|
||||
{
|
||||
var scriptPath = type.GetCustomAttributes<ScriptPathAttribute>().FirstOrDefault();
|
||||
return scriptPath is null ? null : ResourceLoader.Load(scriptPath.Path);
|
||||
}
|
||||
|
||||
public static Godot.Collections.Array<T> Cast<[MustBeVariant]T>(Godot.Collections.Array<GodotObject> godotObjects) where T : GodotObject
|
||||
{
|
||||
return new Godot.Collections.Array<T>(godotObjects.Select(Bind<T>));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the GDExtension <typeparam name="T"/> type, and attaches the wrapper script to it.
|
||||
/// </summary>
|
||||
/// <returns>The wrapper instance linked to the underlying GDExtension type.</returns>
|
||||
public static T Instantiate<T>(StringName className) where T : GodotObject
|
||||
{
|
||||
return Bind<T>(ClassDB.Instantiate(className).As<GodotObject>());
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://bh37eeupa2m4q
|
||||
Loading…
Reference in New Issue