mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-05 02:10:14 +03:00
Allow method binds to take Object subclasses as arguments
As done in upstream Godot via GH-57205. Add a test that ensures it works also for "gdextended" objects.
This commit is contained in:
@@ -122,6 +122,7 @@ void Example::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("test_tarray_arg", "array"), &Example::test_tarray_arg);
|
||||
ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray);
|
||||
ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary);
|
||||
ClassDB::bind_method(D_METHOD("test_node_argument"), &Example::test_node_argument);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("def_args", "a", "b"), &Example::def_args, DEFVAL(100), DEFVAL(200));
|
||||
|
||||
@@ -212,6 +213,11 @@ ExampleRef *Example::return_extended_ref() const {
|
||||
return memnew(ExampleRef());
|
||||
}
|
||||
|
||||
Example *Example::test_node_argument(Example *p_node) const {
|
||||
UtilityFunctions::print(" Test node argument called with ", p_node ? String::num(p_node->get_instance_id()) : "null");
|
||||
return p_node;
|
||||
}
|
||||
|
||||
Ref<ExampleRef> Example::extended_ref_checks(Ref<ExampleRef> p_ref) const {
|
||||
// This is therefor the prefered way of instancing and returning a refcounted object:
|
||||
Ref<ExampleRef> ref;
|
||||
|
||||
Reference in New Issue
Block a user