Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing C# examples for PropertyTweener class #9924

Open
hawkerm opened this issue Sep 8, 2024 · 3 comments
Open

Missing C# examples for PropertyTweener class #9924

hawkerm opened this issue Sep 8, 2024 · 3 comments
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement good first issue topic:dotnet

Comments

@hawkerm
Copy link

hawkerm commented Sep 8, 2024

Your Godot version: 4.3

Issue description:
Was looking for more guidance on how to use SetCustomInterpolator in C# as a direct lambda expression can't be used directly inline (.SetCustomInterpolator(t => Math.Pow(t, 0.75f))).

Took a bit to get to .SetCustomInterpolator(Callable.From<float, float>(t => Mathf.Pow(t, 0.75f)))

Would be nice for the page to have the boxes which switch between gdscript and C# like other examples. Thanks!

URL to the documentation page (if already existing): https://docs.godotengine.org/en/stable/classes/class_propertytweener.html#class-propertytweener-method-set-custom-interpolator

@skyace65 skyace65 added topic:dotnet area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository labels Sep 8, 2024
@Bossdell113
Copy link

I saw that this was labeled as a good first issue and I was wondering if I could claim this issue for a school project I am doing. If I am understanding this correctly the SetCustomInterpolator does not have the C# version in there unlike other methods that have both C# and gdscript. If this is something I can take my time on then I can totally start working on this, I'd need to do some more research on C# and gdscript though so I won't be able to get this done super quickly, but I think I can manage if given maybe 4 or 5 weeks give or take. Again, it depends on how much time I'd have for this.

@raulsntos
Copy link
Member

@Bossdell113 Yes, you can open a pull request to fix this issue, contributions are always welcome 🙂. As a new contributor, make sure to read CONTRIBUTING.md and the contributing documentation if you haven't already.

The issue is C# examples are missing from the documentation in PropertyTweener.xml. To add C# examples use the [codeblocks] syntax, here's an example from @GlobalScope.hash:

<method name="hash">
	<return type="int" />
	<param index="0" name="variable" type="Variant" />
	<description>
		Returns the integer hash of the passed [param variable].
		[codeblocks]
		[gdscript]
		print(hash("a")) # Prints 177670
		[/gdscript]
		[csharp]
		GD.Print(GD.Hash("a")); // Prints 177670
		[/csharp]
		[/codeblocks]
	</description>
</method>

Feel free to reach out in the development chat if you need help.

@Bossdell113
Copy link

Thanks for the info. I'll use the development chat if I have any questions about the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:class reference Issues and PRs about the class reference, which should be addressed on the Godot engine repository enhancement good first issue topic:dotnet
Projects
None yet
Development

No branches or pull requests

4 participants