-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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()
class_get_property_getter()
class_get_property_setter()
methods
#90703
base: master
Are you sure you want to change the base?
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
Lines 1565 to 1586 in 048d9d3
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. |
c48676e
to
ff46842
Compare
You're right. I was just leaving a comment to ask for opinions, and I didn't intend to modify that section of the code. It's not within the scope of this PR.
I'll fix that section of the code right away. It was my oversight, I didn't notice the extra line breaks.
I can only wait for your PR to be merged to pass the tests smoothly. Thanks for taking the time to look at this PR over the past few days. I thought not many people would have the free time to review it. Also, thanks for your hard work, @AThousandShips @dsnopek . |
ff46842
to
8562300
Compare
Once PR godotengine/godot-cpp#1465 is merged (which cherry-picks the necessary changes to |
Thanks! |
ec47e8a
to
76ce74c
Compare
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
… ClassDB::class_get_property_getter 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
Expose
ClassDB::class_get_api_type()
ClassDB::class_get_property_getter()
ClassDB::class_get_property_setter()
for editor-plugins and other languages wrapper generator.godotengine/godot-proposals#9526