Feature : Handle the hint and hint string for the BindProperty attribute#37
Feature : Handle the hint and hint string for the BindProperty attribute#37spimort wants to merge 2 commits into
Conversation
|
@spimort |
|
@GeorgeS2019 Just run the This example adds a new node called [GodotClass]
public partial class MyCustomNode : Node
{
[BindProperty(Hint = PropertyHint.Dir)]
public string DataPath { get; set; }
[BindProperty(Hint = PropertyHint.Range, HintString = "0,100")]
public int IntValueWithMinMax { get; set; }
[BindProperty(Hint = PropertyHint.Link)]
public Vector3 Vec3WithLinkedValues { get; set; }
}These properties are then available in the editor : I hope this helps! |
|
@spimort Thx..Now I know the build is possible Take a look the above link if you are interested how to combine Godot-Dotnet and LibGodot A working outdated 2024 version |
|
This definitely helped a lot, but personally, I wish the property hint & string usage could be a little bit more So you do I'm fully aware that the GodotEngine internally uses these magical numbers, but from an API design perspective, I think it's better not to let the user do this all the time. See how GDScript has done this. And we can leave the |
|
@Delsin-Yu That's a good idea, I think it would improve the quality of life of the api! I can make the changes, but I just want to make sure that maintainers are on board with this change to ensure I'm aligning with the project's direction. |
|
@GeorgeS2019 make sure to include the flag Then, you can use the flag |
To produce the NuGet packages use the --pack argument. I also just restore Godot.sln and build .. src/Godot.Bindings/Godot.Bindings.csproj. Fail to build ###However I am able to fork and use GitHub action based on latest CI instead of nightly workflow to generate the GodotBindingGenerator.exe. Do you need/use this step?? I presume you use something like this |
Thanks .I am able to run in Windows |


This feature adds the option to specify the
HintandHintStringon theBindPropertyAttribute.This is useful to handle Godot special property bindings like Files, Directory, Layers3DPhysics, etc.
As of now it seems like it was possible to do it using a "Hand made"
BindMethodsusing theClassRegistrationContext.I did not see a way to do it right now with source generator using the attribute, unless I missed something and there is other ways to do it.
This code was inspired by the
NameOverridefrom theCollectCorefunction.Unit tests has been done to ensure the result of the code generation.
I hope this can be useful 🙂