Compare commits
4 Commits
1e73b6d653
...
2ca4a61ede
Author | SHA1 | Date |
---|---|---|
monxa | 2ca4a61ede | |
Alexander Montag | 380f80c2b3 | |
Serhii Snitsaruk | 60a767032e | |
Serhii Snitsaruk | 60142b191d |
|
@ -241,8 +241,8 @@ void TreeSearch::_draw_highlight_item(TreeItem *p_tree_item, Rect2 p_rect, Calla
|
||||||
Rect2 draw_rect = p_rect;
|
Rect2 draw_rect = p_rect;
|
||||||
|
|
||||||
Vector2 rect_offset = Vector2(substring_before_size.x, 0);
|
Vector2 rect_offset = Vector2(substring_before_size.x, 0);
|
||||||
rect_offset.x += p_tree_item->get_icon_max_width(0) * EDSCALE;
|
rect_offset.x += p_tree_item->get_icon_max_width(0);
|
||||||
rect_offset.x += (h_sep + 4.) * EDSCALE; // TODO: Find better way to determine texts x-offset
|
rect_offset.x += (h_sep + 4. * EDSCALE); // TODO: Find better way to determine texts x-offset
|
||||||
rect_offset.y = (p_rect.size.y - substring_match_size.y) / 2; // center box vertically
|
rect_offset.y = (p_rect.size.y - substring_match_size.y) / 2; // center box vertically
|
||||||
|
|
||||||
draw_rect.position += rect_offset - PADDING / 2;
|
draw_rect.position += rect_offset - PADDING / 2;
|
||||||
|
@ -252,7 +252,7 @@ void TreeSearch::_draw_highlight_item(TreeItem *p_tree_item, Rect2 p_rect, Calla
|
||||||
stylebox->draw(p_tree_item->get_tree()->get_canvas_item(), draw_rect);
|
stylebox->draw(p_tree_item->get_tree()->get_canvas_item(), draw_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second part: draw number (TODO: maybe use columns)
|
// second part: draw number
|
||||||
int num_mat = number_matches.has(p_tree_item) ? number_matches.get(p_tree_item) : 0;
|
int num_mat = number_matches.has(p_tree_item) ? number_matches.get(p_tree_item) : 0;
|
||||||
if (num_mat > 0) {
|
if (num_mat > 0) {
|
||||||
float h_sep = p_tree_item->get_tree()->get_theme_constant("h_separation");
|
float h_sep = p_tree_item->get_tree()->get_theme_constant("h_separation");
|
||||||
|
|
|
@ -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