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

Allow to get list of non object methods #49053

Closed
wants to merge 1 commit into from

Conversation

qarmin
Copy link
Contributor

@qarmin qarmin commented May 25, 2021

1/3 of godotengine/godot-proposals#2344

This allow to get list of e.g. String methods by using:

ClassDB.get_variant_method_list(TYPE_STRING)

_ClassDB::get_variant_method_list is almost 1:1 copy of _ClassDB::get_method_list
also
Variant::get_method_list_by_type is just extracted code from Variant::get_method_list to be able not duplicate same code.

get_non_object_methods_list isn't the best name, so it should be renamed to something better

@YuriSizov
Copy link
Contributor

get_non_object_methods_list isn't the best name, so it should be renamed to something better

Yeah... get_variant_method_list?

@@ -2188,7 +2188,27 @@ bool _ClassDB::is_class_enabled(StringName p_class) const {
return ClassDB::is_class_enabled(p_class);
}

Array _ClassDB::get_non_object_methods_list(Variant::Type p_type) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had issues with using Variant::Type in a method signatures while generating C# mono glue and while generating/validating RST documentation (see commit in VariantResource class in Goost). Not sure if that's still an issue in master, though.

If that's still an issue, the workaround is to use int over Variant::Type.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this cannot cause any issues because C# does not deal with Variant directly, and is a special case.

core/core_bind.cpp Outdated Show resolved Hide resolved
@YuriSizov YuriSizov added this to the 4.0 milestone Jul 18, 2021
@qarmin qarmin force-pushed the get_non_object_functions branch 2 times, most recently from 5dba10f to 05f5030 Compare August 20, 2021 15:01
@qarmin qarmin force-pushed the get_non_object_functions branch 2 times, most recently from c76f1b6 to 46f72fa Compare August 24, 2021 13:51
@qarmin qarmin force-pushed the get_non_object_functions branch 2 times, most recently from 4b8d672 to 257484c Compare October 1, 2021 05:37
core/variant/variant.h Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

We discussed this in a PR meeting and @reduz suggests that this should not go in ClassDB because it's not part of its scope. This could maybe be implemented in @GlobalScope i.e. in a core/variant/ file directly (variant_internal.h? not sure).

@akien-mga akien-mga requested a review from vnen January 6, 2022 15:10
@reduz
Copy link
Member

reduz commented Feb 6, 2022

I think we should create a singleton class in core_bind to expose Variant reflection to scripting, but I am not exactly sure what it should be called. Maybe TypeDB ?

@qarmin qarmin marked this pull request as draft September 17, 2022 06:22
@akien-mga akien-mga removed this from the 4.0 milestone Jan 19, 2023
@akien-mga akien-mga added this to the 4.x milestone Jan 19, 2023
@qarmin qarmin removed this from the 4.x milestone May 13, 2023
@qarmin qarmin closed this May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants