-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Expose ClassDB.class_get_api_type()
method
#90703
Conversation
ClassDB.get_api_type()
CI Tests Godot Cpp test fails cause. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I think this change makes sense, and the code looks good.
However, this will need to be squashed into a single commit, per Godot's pull request workflow. See the docs for a way to do that using git rebase
: https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html#the-interactive-rebase
I'll take a look at fixing the godot-cpp issue.
I just posted PR godotengine/godot-cpp#1445 which will fix godot-cpp with these changes |
9e88b5c
to
ac8ecfe
Compare
81e5f13
to
0a093d9
Compare
ClassDB.get_api_type()
ClassDB::get_api_type()
ClassDB::get_property_getter()
ClassDB::get_property_setter()
ClassDB::get_api_type()
ClassDB::get_property_getter()
ClassDB::get_property_setter()
ClassDB::get_api_type()
ClassDB::get_property_getter()
ClassDB::get_property_setter()
method
218d286
to
57a6b03
Compare
Thanks @dsnopek @AThousandShips ! |
57a6b03
to
a823d50
Compare
a823d50
to
048d9d3
Compare
The void ClassDB::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
const String pf = p_function;
- bool first_argument_is_class = false;
- if (p_idx == 0) {
- first_argument_is_class = (pf == "get_inheriters_from_class" || pf == "get_parent_class" ||
- pf == "class_exists" || pf == "can_instantiate" || pf == "instantiate" ||
- pf == "class_has_signal" || pf == "class_get_signal" || pf == "class_get_signal_list" ||
- pf == "class_get_property_list" || pf == "class_get_property" || pf == "class_set_property" ||
- pf == "class_has_method" || pf == "class_get_method_list" ||
- pf == "class_get_integer_constant_list" || pf == "class_has_integer_constant" || pf == "class_get_integer_constant" ||
- pf == "class_has_enum" || pf == "class_get_enum_list" || pf == "class_get_enum_constants" || pf == "class_get_integer_constant_enum" ||
- pf == "is_class_enabled" || pf == "is_class_enum_bitfield" || pf == "class_get_api_type" ||
- pf == "class_get_property_getter" || pf == "class_get_property_setter");
- }
+ bool first_argument_is_class = p_idx == 0 && has_first_argument_class_methods(pf);
if (first_argument_is_class || pf == "is_parent_class") {
for (const String &E : get_class_list()) {
r_options->push_back(E.quote());
}
}
Object::get_argument_options(p_function, p_idx, r_options);
}
+ HashSet<String> first_argument_class_methods;
+ bool has_first_argument_class_methods(const String p_function) const {
+ if (!first_argument_class_methods.is_empty()) {
+ return first_argument_class_methods.has(p_function);
+ }
+ auto class_methods = {
+ "get_inheriters_from_class",
+ "get_parent_class",
+ "class_exists",
+ "is_parent_class",
+ "can_instantiate",
+ "instantiate",
+ "class_has_signal",
+ "class_get_signal",
+ "class_get_signal_list",
+ "class_get_property_list",
+ "class_get_property",
+ "class_set_property",
+ "class_has_method",
+ "class_get_method_list",
+ "class_get_integer_constant_list",
+ "class_has_integer_constant",
+ "class_get_integer_constant",
+ "class_has_enum",
+ "class_get_enum_list",
+ "class_get_enum_constants",
+ "class_get_integer_constant_enum",
+ "is_class_enabled",
+ "is_class_enum_bitfield",
+ "class_get_api_type",
+ "class_get_property_getter",
+ "class_get_property_setter"
+ };
+ bool result = false;
+ for (const String &E : class_methods) {
+ first_argument_class_methods.insert(E);
+ if (E == p_function) {
+ result = true;
+ }
+ }
+ return result;
+}
|
e2dafe1
to
c48676e
Compare
I would just leave this as it is for now. Overall, this PR is looking good to me! CI is complaining about an extra line in the docs XML:
However, aside from that, the main thing blocking this is that we need to get godot-cpp PR godotengine/godot-cpp#1445 merged and cherry-picked so that the rest of the tests can pass here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are now passing - yay!
This looks good to me, however, it would probably be good to update the PR title and commit message with the right method names.
ClassDB::get_api_type()
ClassDB::get_property_getter()
ClassDB::get_property_setter()
methodClassDB::class_get_api_type()
ClassDB::class_get_property_getter()
ClassDB::class_get_property_setter()
method
76ce74c
to
d8fbe47
Compare
Any chance we can have this in |
We're in feature freeze so I don't expect so, but we'll see what the production team says, I suspect 4.4 |
ClassDB::class_get_api_type()
ClassDB::class_get_property_getter()
ClassDB::class_get_property_setter()
methodClassDB
class_get_api_type()
class_get_property_getter()
class_get_property_setter()
methods
I'm not sure about |
I think the |
d8fbe47
to
85a56bc
Compare
I think yes, since the other two methods are already exposed. |
ClassDB
class_get_api_type()
class_get_property_getter()
class_get_property_setter()
methodsClassDB.class_get_api_type()
method
bf1a9ba
to
4eb805b
Compare
e234d35
to
c45d602
Compare
I've removed that part and just kept the class_get_api_type part. Can you see if it's working? @dalexeev @akien-mga |
c45d602
to
949d24b
Compare
Thanks! |
Thanks! |
Expose
ClassDB::class_get_api_type()
for editor-plugins and other languages wrapper generator.ClassDB.get_api_type()
for better GDExtension interoperability with non-GDScript languages godot-proposals#9526