-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
TreeItem call_recursive method nonexistent #41493
Comments
Make sure you call the right (existing) method in extends Node2D
func _ready():
var item = $Tree.create_item()
item.call_recursive("set_collapsed", true) But yeah the error message is misleading, the error should report the method name specified via the argument, and not the caller. You can reproduce this issue with something like: |
Thanks, that works and I now know the methods must exist in TreeItem. I was calling a custom function. The docs imply that any method can be called, so a doc edit would clear that up. |
Do you mean that you extend If that's the case, then perhaps it can be made so that script methods could also be called using this method in the engine. |
I had extended Tree via script and called that method - I didn't try extending TreeItem - is that intended to work? |
@Koyper sorry, I wrongly assumed So I think there's no way to add new methods for tree items specifically, you could only use things like |
Thanks so much for your detailed replies. I have the tree hierarchy mirrored in data, and have recursive functions to manage the hierarchy (a less-trivial task than one would initially assume), so I worked around it, though there are cases where having it scriptable would be helpful. I'll be able to use the existing functions with the call_recursive in any case, now that I know the limitations. |
I'll make a PR then, to fix the error message. |
Godot version:
3.2.2
OS/device including version:
Mac OS 10.14.5
Issue description:
returns error message:
"Invalid call. Nonexistent function 'call_recursive' in base TreeItem
call_recursive is listed in TreeItem methods in the docs
Steps to reproduce:
Call the method on any TreeItem instance.
Minimal reproduction project:
The text was updated successfully, but these errors were encountered: