Debugger: Use warning icon for alerts

This commit is contained in:
Serhii Snitsaruk 2023-04-15 10:53:57 +02:00
parent 4e0305de51
commit 29d994f3a0
4 changed files with 15 additions and 12 deletions

View File

@ -38,7 +38,9 @@ void BTState::_update(double p_delta) {
void BTState::_notification(int p_notification) { void BTState::_notification(int p_notification) {
switch (p_notification) { switch (p_notification) {
case NOTIFICATION_EXIT_TREE: { case NOTIFICATION_EXIT_TREE: {
LimboDebugger::get_singleton()->unregister_bt_instance(tree_instance, get_path()); if (tree_instance.is_valid()) {
LimboDebugger::get_singleton()->unregister_bt_instance(tree_instance, get_path());
}
} break; } break;
} }
} }

View File

@ -57,23 +57,23 @@ Error LimboDebugger::parse_message(void *p_user, const String &p_msg, const Arra
return OK; return OK;
} }
void LimboDebugger::register_bt_instance(Ref<BTTask> p_instance, NodePath p_path) { void LimboDebugger::register_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path) {
ERR_FAIL_COND(active_trees.has(p_path)); ERR_FAIL_COND(active_trees.has(p_player_path));
active_trees.insert(p_path, p_instance); active_trees.insert(p_player_path, p_instance);
if (session_active) { if (session_active) {
_send_active_bt_players(); _send_active_bt_players();
} }
} }
void LimboDebugger::unregister_bt_instance(Ref<BTTask> p_instance, NodePath p_path) { void LimboDebugger::unregister_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path) {
ERR_FAIL_COND(p_path.is_empty()); ERR_FAIL_COND(p_player_path.is_empty());
ERR_FAIL_COND(!active_trees.has(p_path)); ERR_FAIL_COND(!active_trees.has(p_player_path));
if (tracked_tree == p_path) { if (tracked_tree == p_player_path) {
_untrack_tree(); _untrack_tree();
} }
active_trees.erase(p_path); active_trees.erase(p_player_path);
if (session_active) { if (session_active) {
_send_active_bt_players(); _send_active_bt_players();

View File

@ -39,9 +39,9 @@ private:
public: public:
static Error parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured); static Error parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured);
void register_bt_instance(Ref<BTTask> p_instance, NodePath p_path); void register_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path);
void unregister_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path);
void unregister_bt_instance(Ref<BTTask> p_instance, NodePath p_path);
#endif // DEBUG_ENABLED #endif // DEBUG_ENABLED
}; };
#endif // LIMBO_DEBUGGER #endif // LIMBO_DEBUGGER

View File

@ -62,7 +62,8 @@ void LimboDebuggerTab::update_behavior_tree(const BehaviorTreeData &p_data) {
void LimboDebuggerTab::_show_alert(const String &p_message) { void LimboDebuggerTab::_show_alert(const String &p_message) {
alert_message->set_text(p_message); alert_message->set_text(p_message);
alert_icon->set_texture(get_theme_icon(SNAME("NodeInfo"), SNAME("EditorIcons"))); // alert_icon->set_texture(get_theme_icon(SNAME("NodeInfo"), SNAME("EditorIcons")));
alert_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
alert_box->set_visible(!p_message.is_empty()); alert_box->set_visible(!p_message.is_empty());
} }