Compare commits
4 Commits
2a7c329745
...
8ac2219d32
Author | SHA1 | Date |
---|---|---|
monxa | 8ac2219d32 | |
Alexander Montag | 20be87904a | |
Serhii Snitsaruk | 60a767032e | |
Serhii Snitsaruk | 60142b191d |
|
@ -383,6 +383,12 @@ void TreeSearch::_select_next_match() {
|
||||||
_select_first_match();
|
_select_first_match();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TreeSearch::_on_search_panel_visibility_changed() {
|
||||||
|
if (tree_reference && !search_panel->is_visible()) {
|
||||||
|
tree_reference->grab_focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool TreeSearch::_vector_has_bsearch(Vector<T *> &p_vec, T *element) const {
|
inline bool TreeSearch::_vector_has_bsearch(Vector<T *> &p_vec, T *element) const {
|
||||||
int idx = p_vec.bsearch(element, true);
|
int idx = p_vec.bsearch(element, true);
|
||||||
|
@ -439,6 +445,7 @@ void TreeSearch::update_search(Tree *p_tree) {
|
||||||
TreeSearch::TreeSearch(TreeSearchPanel *p_search_panel) {
|
TreeSearch::TreeSearch(TreeSearchPanel *p_search_panel) {
|
||||||
search_panel = p_search_panel;
|
search_panel = p_search_panel;
|
||||||
search_panel->connect("text_submitted", callable_mp(this, &TreeSearch::_select_next_match));
|
search_panel->connect("text_submitted", callable_mp(this, &TreeSearch::_select_next_match));
|
||||||
|
search_panel->connect("visibility_changed", callable_mp(this, &TreeSearch::_on_search_panel_visibility_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* !TreeSearch */
|
/* !TreeSearch */
|
||||||
|
|
|
@ -90,6 +90,8 @@ private:
|
||||||
void _select_first_match();
|
void _select_first_match();
|
||||||
void _select_next_match();
|
void _select_next_match();
|
||||||
|
|
||||||
|
void _on_search_panel_visibility_changed();
|
||||||
|
|
||||||
// TODO: make p_vec ref `const` once Vector::bsearch is const. See: https://github.com/godotengine/godot/pull/90341
|
// TODO: make p_vec ref `const` once Vector::bsearch is const. See: https://github.com/godotengine/godot/pull/90341
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool _vector_has_bsearch(Vector<T *> &p_vec, T *element) const;
|
bool _vector_has_bsearch(Vector<T *> &p_vec, T *element) const;
|
||||||
|
|
|
@ -263,6 +263,21 @@ void LimboHSM::_validate_property(PropertyInfo &p_property) const {
|
||||||
void LimboHSM::_notification(int p_what) {
|
void LimboHSM::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_POST_ENTER_TREE: {
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
|
if (was_active && is_root()) {
|
||||||
|
// Re-activate the root HSM if it was previously active.
|
||||||
|
// Typically, this happens when the node is re-entered scene repeatedly (e.g., re-parenting, pooling).
|
||||||
|
set_active(true);
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
|
if (is_root()) {
|
||||||
|
// Remember active status for re-parenting and exit state machine
|
||||||
|
// to release resources and signal connections if active.
|
||||||
|
was_active = active;
|
||||||
|
if (is_active()) {
|
||||||
|
_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_PROCESS: {
|
case NOTIFICATION_PROCESS: {
|
||||||
_update(get_process_delta_time());
|
_update(get_process_delta_time());
|
||||||
|
|
|
@ -55,6 +55,7 @@ private:
|
||||||
LimboState *previous_active;
|
LimboState *previous_active;
|
||||||
LimboState *next_active;
|
LimboState *next_active;
|
||||||
bool updating = false;
|
bool updating = false;
|
||||||
|
bool was_active = false;
|
||||||
|
|
||||||
HashMap<TransitionKey, Transition, TransitionKeyHasher> transitions;
|
HashMap<TransitionKey, Transition, TransitionKeyHasher> transitions;
|
||||||
|
|
||||||
|
|
|
@ -190,11 +190,6 @@ void LimboState::_notification(int p_what) {
|
||||||
_update_blackboard_plan();
|
_update_blackboard_plan();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_PREDELETE: {
|
|
||||||
if (is_active()) {
|
|
||||||
_exit();
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue