-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Optimize SceneTreeEditor filtering #61371
Conversation
1433993
to
a77572e
Compare
a77572e
to
b923cc8
Compare
Thanks! |
} | ||
|
||
if (!keep) { | ||
keep = filter.is_subsequence_ofn(p_parent->get_text(0)); |
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.
@KoBeWi I have a question regard this PR's effect on my #58377. After this PR being merged, the p_parent->get_class() will no longer return the type of node, ( it will return something like "Node3D" before this PR).
I'm actually new to godot's development, do I used a wrong function? Is there any new way to implement #58377 ?
Thank you!
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.
Doesn't seem like p_parent
was ever anything else than TreeItem. Not sure how to get node from a tree item, maybe it's stored in some metadata.
Do you have the old code from your PR somewhere?
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.
You can get the node pointer by using get_node(p_parent->get_metadata(0))
and then use get_class()
on that node.
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.
It works, thank you very much!
} | ||
item->set_as_cursor(0); | ||
} | ||
|
||
bool keep = (filter.is_subsequence_ofn(String(p_node->get_name()))); |
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.
This PR integrates #60061 into SceneTreeEditor. When you filter, it will no longer rebuild the whole tree, but instead hide nodes that don't match the filter.
According to my crappy benchmark, before this change my test scene would filter in 7000μs to 11000μs depending on filter text, now it takes around 550μs, so it's ~20x faster.
Please test if there aren't any bugs (I found one, but it's in Tree: #61372).