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

feat: [Traits] Implements a GDScript Trait system #11

Merged

Conversation

decryptedchaos
Copy link
Contributor

@decryptedchaos decryptedchaos commented Feb 18, 2025

Based on the following PR Authored by @SeremTitus

The Redot team have added some improvements and bug fixes:

  • Credit to @Ward727a

  • [FIX] Traits have proper template on creation

  • [BUG] Trait creation was not checking if a trait of the same name already existed.

  • [BUG] Gutter marker for base class functions ( _ready & _process) for Traits

@decryptedchaos decryptedchaos marked this pull request as ready for review February 19, 2025 00:08
@Ward727a
Copy link

I just found a new bug with the gutter icons, from what I can see if the trait (.gdt) has a function on the same line than a virtual function inside the script (.gd) where the trait is used, the function from the script is "replaced" by the function in the trait (.gdt) file.

I'm already working on a fix :)

What we have right now
redot windows editor dev x86_64_JI94b4rFHU

What we should have
redot windows editor dev x86_64_7xvydn8994

Credit @Ward727a
 
- Fixed a bug when 2 functions (one from trait, and one from other scipt) was one the same line: The gutter icon for virtual function wasn't shown.

- Did a little optimization on the "get_function_names_recursively" function (using Vector and not HashMap) this allow us to gain ~10% in time when running (HashMap average ~= 9.8µs / Vector average ~= 8.8µs).
@decryptedchaos decryptedchaos merged commit 907e84a into Redot-Experimental:master Feb 28, 2025
19 checks passed
@decryptedchaos decryptedchaos deleted the feature/traits-fix branch March 2, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants