mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Allow method binds to take Object subclasses as arguments
This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object. This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary. A few small changes also had to be made to other files, due to the changes cascading down all the includes.
This commit is contained in:
parent
2f4d76f068
commit
051ef479c9
15 changed files with 64 additions and 78 deletions
|
@ -362,7 +362,7 @@ void RenameDialog::_post_popup() {
|
|||
Array selected_node_list = editor_selection->get_selected_nodes();
|
||||
ERR_FAIL_COND(selected_node_list.size() == 0);
|
||||
|
||||
preview_node = selected_node_list[0];
|
||||
preview_node = Object::cast_to<Node>(selected_node_list[0]);
|
||||
|
||||
_update_preview();
|
||||
_update_substitute();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue